:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f6f7;
  color: #182028;
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
[hidden] { display: none !important; }
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef1f2;
}
.login-form {
  width: min(380px, 100%);
  padding: 32px;
  border: 1px solid #d0d6d9;
  border-top: 4px solid #13795b;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(20, 30, 36, .12);
}
.login-brand { margin-bottom: 24px; color: #13795b; font-size: 16px; font-weight: 700; }
.login-form h1 { font-size: 22px; margin-bottom: 6px; }
.login-form > p { margin-bottom: 24px; }
.login-form button { width: 100%; margin-top: 4px; }
.login-error { min-height: 20px; margin: -4px 0 6px !important; color: #a33131 !important; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button {
  border: 1px solid #136b55;
  border-radius: 4px;
  padding: 8px 12px;
  background: #13795b;
  color: #fff;
  cursor: pointer;
}
button:hover { background: #0f684e; }
button:disabled { cursor: not-allowed; opacity: .55; }
button.secondary { background: #fff; color: #26313a; border-color: #b9c0c5; }
button.danger { background: #fff; color: #a33131; border-color: #d5a3a3; }
.topbar {
  min-height: 58px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #fff;
  background: #17232b;
  border-bottom: 3px solid #e4b643;
}
.topbar strong { font-size: 17px; margin-right: 12px; }
.topbar span { color: #c8d0d5; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions .status { color: #f0c85f; margin-right: 6px; }
.tabs {
  padding: 0 24px;
  display: flex;
  gap: 24px;
  background: #fff;
  border-bottom: 1px solid #d9dde0;
}
.tab {
  padding: 14px 2px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #53616b;
}
.tab:hover { background: transparent; color: #182028; }
.tab.active { border-bottom-color: #13795b; color: #182028; font-weight: 650; }
main { max-width: 1440px; margin: 0 auto; padding: 24px; }
.panel { display: none; }
.panel.active { display: block; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid #d9dde0;
  border-radius: 6px;
  background: #fff;
}
.metrics div { padding: 15px 18px; border-right: 1px solid #e3e6e8; min-width: 0; }
.metrics div:last-child { border-right: 0; }
.metrics span { display: block; color: #65737c; font-size: 12px; margin-bottom: 5px; }
.metrics strong { display: block; font-size: 21px; overflow: hidden; text-overflow: ellipsis; }
.section-heading {
  margin-top: 24px;
  margin-bottom: 10px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}
h1, h2, p { margin-top: 0; }
h1 { font-size: 18px; margin-bottom: 4px; }
h2 { font-size: 17px; }
p { color: #64717a; margin-bottom: 0; }
select, input, textarea {
  width: 100%;
  border: 1px solid #bfc6cb;
  border-radius: 4px;
  padding: 8px 9px;
  background: #fff;
  color: #182028;
}
select { width: auto; min-width: 140px; }
input:focus, textarea:focus, select:focus { outline: 2px solid #8fc9b8; outline-offset: 1px; }
textarea { resize: vertical; min-height: 180px; line-height: 1.45; }
label { display: block; margin-bottom: 14px; color: #34414a; }
label input, label textarea { margin-top: 5px; }
.table-wrap { overflow-x: auto; border: 1px solid #d9dde0; border-radius: 6px; background: #fff; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #e5e8ea; vertical-align: top; overflow-wrap: anywhere; }
th { color: #5b6871; font-size: 12px; background: #f6f7f8; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: 3px; color: #75818a; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions button { padding: 5px 8px; font-size: 12px; }
.badge { display: inline-block; padding: 3px 7px; border-radius: 3px; font-size: 12px; background: #e9edf0; color: #45525b; }
.badge.pending { background: #fff0c7; color: #7d5a00; }
.badge.approved, .badge.indexed { background: #dcefe8; color: #126044; }
.badge.rejected, .badge.revoked, .badge.error { background: #f6dddd; color: #922e2e; }
.badge.suspended { background: #e6e3f4; color: #55478a; }
.empty { padding: 26px; text-align: center; color: #7a858d; }
.split { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(460px, 1.2fr); gap: 28px; }
.editor { padding-right: 28px; border-right: 1px solid #d9dde0; }
.document-list { border-top: 1px solid #d9dde0; }
.document-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 13px 0; border-bottom: 1px solid #d9dde0; }
.document-row strong, .document-row small { display: block; overflow-wrap: anywhere; }
.document-row small { margin-top: 4px; color: #6d7982; }
dialog { width: min(520px, calc(100% - 32px)); border: 1px solid #aeb6bc; border-radius: 6px; padding: 22px; box-shadow: 0 18px 48px rgba(20, 30, 36, .22); }
dialog::backdrop { background: rgba(16, 23, 28, .45); }
fieldset { border: 1px solid #d3d8db; border-radius: 4px; margin: 0 0 18px; padding: 12px; }
fieldset label { display: inline-flex; align-items: center; gap: 7px; margin: 4px 16px 4px 0; }
fieldset input { width: auto; margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
#toast { position: fixed; right: 20px; bottom: 20px; max-width: 420px; padding: 11px 14px; border-radius: 4px; background: #17232b; color: #fff; opacity: 0; pointer-events: none; transition: opacity .16s; }
#toast.show { opacity: 1; }
@media (max-width: 800px) {
  .topbar { align-items: flex-start; padding: 10px 14px; }
  .topbar > div:first-child span { display: block; margin-top: 3px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .tabs { padding: 0 14px; gap: 16px; overflow-x: auto; }
  main { padding: 16px 14px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics div:nth-child(2) { border-right: 0; }
  .metrics div:nth-child(-n+2) { border-bottom: 1px solid #e3e6e8; }
  .split { grid-template-columns: 1fr; }
  .editor { border-right: 0; border-bottom: 1px solid #d9dde0; padding: 0 0 22px; }
  table { min-width: 760px; }
}
