/* BerheLaw Admin Portal styles.
   Restrained navy + gold law-firm cockpit. Server-rendered, responsive. */

:root {
  --navy-900: #0c1830;
  --navy-800: #122142;
  --navy-700: #1b2e54;
  --ink: #1d2535;
  --ink-soft: #4a5468;
  --ink-faint: #8a93a6;
  --paper: #f4f6fa;
  --card: #ffffff;
  --line: #e3e8f0;
  --line-soft: #eef1f7;
  --gold: #c19a4b;
  --gold-soft: #f3ead6;
  --gold-deep: #9c7a32;
  --green: #2f7d52;
  --green-soft: #e3f2e9;
  --red: #b3401f;
  --red-soft: #fbe6df;
  --amber: #9a6b12;
  --amber-soft: #fbeed0;
  --blue: #2a5d9c;
  --blue-soft: #e2ecf8;
  --slate-soft: #e9edf3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 28, 56, 0.06), 0 8px 24px rgba(16, 28, 56, 0.06);
  --shadow-sm: 0 1px 2px rgba(16, 28, 56, 0.08);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 600; color: var(--ink); }
h1 { font-size: 1.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }

/* ---------------------------------------------------------------- Layout */

.layout {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--navy-900);
  color: #cdd6e6;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 20px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: var(--navy-900);
  font-weight: 700;
  font-family: var(--serif);
  display: grid;
  place-items: center;
  font-size: 1rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 600; color: #fff; font-size: 1.05rem; letter-spacing: 0.01em; }
.brand-sub { font-size: 0.72rem; color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.nav-link {
  color: #b8c2d6;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.nav-link:hover { background: var(--navy-800); color: #fff; text-decoration: none; }
.nav-link.is-active {
  background: var(--navy-700);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--gold);
}

.sidebar-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.who { display: flex; flex-direction: column; margin-bottom: 12px; padding: 0 4px; }
.who-name { color: #fff; font-weight: 600; font-size: 0.9rem; }
.who-email { color: var(--ink-faint); font-size: 0.78rem; word-break: break-all; }

.btn-logout {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  color: #cdd6e6;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
}
.btn-logout:hover { background: var(--navy-800); color: #fff; }

/* ---------------------------------------------------------------- Content */

.content { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.searchbar { display: flex; gap: 8px; flex: 1; max-width: 520px; }
.searchbar input {
  flex: 1;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--paper);
}
.searchbar input:focus { outline: none; border-color: var(--gold); background: #fff; }
.searchbar button {
  padding: 9px 16px;
  border: none;
  background: var(--navy-800);
  color: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
}
.searchbar button:hover { background: var(--navy-700); }

.topbar-meta { color: var(--ink-soft); font-size: 0.85rem; white-space: nowrap; }

.page { padding: 28px; flex: 1; max-width: 1200px; width: 100%; }

.legal-banner {
  padding: 16px 28px;
  font-size: 0.74rem;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  background: var(--card);
  line-height: 1.6;
}

/* ---------------------------------------------------------------- Page head */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-sub { margin: 6px 0 0; color: var(--ink-soft); font-size: 0.92rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.banner {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin: 0 0 18px;
  font-size: 0.88rem;
  border: 1px solid var(--line);
}
.banner-ok { background: var(--green-soft); color: var(--green); border-color: #bfdcc9; }
.banner-error { background: var(--red-soft); color: var(--red); border-color: #efc2b6; }

.hq {
  border: 1px solid rgba(193, 154, 75, 0.34);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,253,0.96));
  box-shadow: var(--shadow-sm);
}
.hq-head { padding-top: 0; }
.hq-fresh { color: var(--ink-faint); font-size: 0.82rem; }
.hq .kpi-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-alert { color: var(--red); }

.command-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: -4px 0 20px;
}
.command-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 15px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.command-card:hover { text-decoration: none; border-color: var(--gold); box-shadow: var(--shadow); }
.command-card strong { color: var(--ink); font-size: 0.94rem; }
.command-card small { color: var(--ink-soft); line-height: 1.45; }
.command-label { color: var(--gold-deep); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

.ops-strip {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 20px;
  margin-bottom: 22px;
}
.ops-card { margin-bottom: 0; }
.mini-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.mini-kpis span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}
.mini-kpis strong { font-size: 1.35rem; font-family: var(--serif); color: var(--navy-900); line-height: 1; }
.mini-kpis small { color: var(--ink-soft); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; }
.compact-list .list-row { padding: 8px 0; }

.breadcrumb { font-size: 0.82rem; color: var(--ink-faint); margin-bottom: 12px; }
.breadcrumb a { color: var(--ink-soft); }

/* ---------------------------------------------------------------- KPIs */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s, box-shadow 0.12s;
}
.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--gold); }
.kpi-num { font-size: 2rem; font-weight: 700; color: var(--navy-900); font-family: var(--serif); line-height: 1; }
.kpi-label { font-size: 0.82rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------------------------------------------------------------- Panels */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
  align-items: start;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 20px 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  min-width: 0;
}
.grid-2 .panel { margin-bottom: 0; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 14px;
}
.panel-head a { font-size: 0.82rem; }

/* ---------------------------------------------------------------- Lists */

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.list-row:last-child { border-bottom: none; }
.list-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.list-main:hover { text-decoration: none; }
.list-main:hover .list-title { color: var(--gold-deep); }
.list-title {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.92rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}
.list-meta { font-size: 0.8rem; color: var(--ink-faint); }

/* ---------------------------------------------------------------- Tables */

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
}
.table thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--slate-soft);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
}
.table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { cursor: pointer; transition: background 0.1s; }
.table tbody tr:hover { background: var(--gold-soft); }
.cell-strong { font-weight: 600; color: var(--ink); }
.cell-muted { color: var(--ink-faint); }

.count-pill {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  padding: 2px 8px;
  background: var(--slate-soft);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- Filters */

.filter-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 0.82rem;
  text-transform: capitalize;
}
.chip:hover { text-decoration: none; border-color: var(--gold); color: var(--gold-deep); }
.chip.is-active { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }

/* ---------------------------------------------------------------- Tags */

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--slate-soft);
  color: var(--ink-soft);
}

/* status */
.tag-status-new { background: var(--blue-soft); color: var(--blue); }
.tag-status-contacted { background: var(--gold-soft); color: var(--gold-deep); }
.tag-status-qualified { background: var(--gold-soft); color: var(--gold-deep); }
.tag-status-converted { background: var(--green-soft); color: var(--green); }
.tag-status-declined { background: var(--slate-soft); color: var(--ink-faint); }
.tag-status-intake { background: var(--blue-soft); color: var(--blue); }
.tag-status-active { background: var(--green-soft); color: var(--green); }
.tag-status-pending { background: var(--amber-soft); color: var(--amber); }
.tag-status-closed { background: var(--slate-soft); color: var(--ink-faint); }

/* urgency + priority */
.tag-urgency-low, .tag-priority-low { background: var(--slate-soft); color: var(--ink-faint); }
.tag-urgency-normal, .tag-priority-normal { background: var(--blue-soft); color: var(--blue); }
.tag-urgency-high, .tag-priority-high { background: var(--amber-soft); color: var(--amber); }
.tag-priority-urgent { background: var(--red-soft); color: var(--red); }

/* ---------------------------------------------------------------- Due dates */

.due { font-size: 0.84rem; color: var(--ink-soft); white-space: nowrap; text-align: right; }
.due-soon { color: var(--amber); font-weight: 600; }
.due-late { color: var(--red); font-weight: 600; }

/* ---------------------------------------------------------------- Activity */

.activity { list-style: none; margin: 0; padding: 0; }
.activity li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.activity li:last-child { border-bottom: none; }
.act-time { color: var(--ink-faint); font-size: 0.78rem; min-width: 132px; font-variant-numeric: tabular-nums; }
.act-actor { font-weight: 600; color: var(--ink); }
.act-action { color: var(--blue); text-transform: capitalize; }
.act-detail { color: var(--ink-soft); }

/* ---------------------------------------------------------------- Definition lists */

.defs { margin: 0; display: flex; flex-direction: column; }
.defs > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.defs > div:last-child { border-bottom: none; }
.defs dt { color: var(--ink-faint); font-size: 0.84rem; margin: 0; }
.defs dd { margin: 0; color: var(--ink); font-size: 0.9rem; word-break: break-word; }
.defs-wide > div { grid-template-columns: 150px minmax(0, 1fr); }
.defs code { font-size: 0.78rem; color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.gate-block { background: #fffaf0; border-radius: var(--radius-sm); padding: 12px; }
.gate-block p + p { margin-top: 8px; }

.message-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.message-block h3 { color: var(--ink-soft); margin-bottom: 6px; }
.message-block p { margin: 0; color: var(--ink); line-height: 1.6; }

/* ---------------------------------------------------------------- Forms */

.stack-form, .note-form, .login-form { display: flex; flex-direction: column; gap: 12px; }

label > span { display: block; font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 5px; font-weight: 500; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="date"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
textarea { resize: vertical; }

.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  text-align: center;
}
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--navy-800); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--gold); color: var(--gold-deep); text-decoration: none; }

.hint { font-size: 0.82rem; color: var(--ink-faint); margin: 0 0 10px; line-height: 1.5; }

.convert-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.convert-block h3 { margin-bottom: 6px; }

/* ---------------------------------------------------------------- Notes */

.note-form { margin-bottom: 16px; }
.note-form textarea { min-height: 56px; }
.note-form .btn-primary { align-self: flex-start; }

.notes { list-style: none; margin: 0; padding: 0; }
.notes li { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.notes li:last-child { border-bottom: none; }
.note-body { color: var(--ink); line-height: 1.55; }
.note-meta { font-size: 0.78rem; color: var(--ink-faint); margin-top: 4px; }

.empty { color: var(--ink-faint); font-size: 0.88rem; padding: 14px 0; font-style: italic; }

.resource-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.resource-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  min-width: 0;
}
.resource-list li:last-child { border-bottom: none; }
.resource-list a { display: flex; flex-direction: column; min-width: 0; color: var(--ink); }
.resource-list a:hover { text-decoration: none; color: var(--gold-deep); }
.resource-list span { color: var(--ink); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resource-list small { color: var(--ink-faint); font-size: 0.74rem; overflow-wrap: anywhere; }
.resource-list strong { color: var(--navy-800); font-family: var(--serif); font-size: 1rem; }
.compact-panel { padding-bottom: 12px; }

.source-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.source-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  min-width: 0;
}
.source-item:hover { text-decoration: none; border-color: var(--gold); background: #fff; }
.source-item strong { color: var(--ink); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-item span { color: var(--blue); font-size: 0.78rem; }
.source-item code { color: var(--ink-faint); font-size: 0.72rem; overflow-wrap: anywhere; white-space: normal; }

.file-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.file-list-panel, .file-editor-panel { margin-bottom: 0; }
.file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 72vh;
  overflow: auto;
  padding-right: 4px;
}
.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 10px 11px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  color: var(--ink);
}
.file-row:hover, .file-row.is-active { text-decoration: none; border-color: var(--gold); background: #fff; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-folder, .file-meta, .file-path-hint { color: var(--ink-faint); font-size: 0.76rem; overflow-wrap: anywhere; }
.file-edit-form { display: flex; flex-direction: column; gap: 12px; }
.code-editor {
  min-height: 58vh;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.5;
  white-space: pre;
  overflow: auto;
}
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.file-defs { margin-top: 16px; }
.empty-state { padding: 40px 10px; color: var(--ink-soft); }
.empty-state h2 { margin-bottom: 8px; }

/* ---------------------------------------------------------------- Tasks */

.tasks { list-style: none; margin: 0; padding: 0; }
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.task-row:last-child { border-bottom: none; }
.task-check { background: none; border: none; cursor: pointer; padding: 0; font-size: 1.15rem; line-height: 1; color: var(--ink-faint); }
.task-check:hover { color: var(--gold-deep); }
.task-check.is-done { color: var(--green); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 0.9rem; color: var(--ink); }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--ink-faint); }
.task-due { font-size: 0.8rem; color: var(--ink-soft); white-space: nowrap; }

.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.inline-form label { flex: 1; min-width: 160px; }
.inline-form .btn-primary { flex-shrink: 0; }

/* ---------------------------------------------------------------- Documents */

.docs { list-style: none; margin: 0; padding: 0; }
.docs li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.docs li:last-child { border-bottom: none; }
.doc-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  color: var(--gold-deep);
  display: grid; place-items: center;
  font-size: 0.7rem; font-weight: 700;
  flex-shrink: 0;
}
.doc-main { flex: 1; min-width: 0; }
.doc-name { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.doc-meta { font-size: 0.79rem; color: var(--ink-faint); }

/* ---------------------------------------------------------------- Search */

.search-group { margin-bottom: 22px; }
.search-group-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 600;
}
.search-count { color: var(--ink-faint); font-weight: 500; }

/* ---------------------------------------------------------------- Login */

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 50% -20%, rgba(193,154,75,0.14), transparent),
    var(--navy-900);
  padding: 24px;
}
.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand .brand-name { color: var(--ink); font-size: 1.1rem; font-weight: 700; }
.login-brand .brand-sub { color: var(--gold-deep); }
.login-title { font-size: 1.25rem; margin-bottom: 20px; }
.login-legal { font-size: 0.74rem; color: var(--ink-faint); line-height: 1.6; margin: 22px 0 0; }
.login-form .btn-primary { margin-top: 4px; padding: 11px; }

.alert {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid #f0c5b6;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  margin-bottom: 18px;
}

/* ---------------------------------------------------------------- Responsive */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    padding: 14px 18px;
  }
  .brand { padding: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; flex: 1; }
  .nav-link { padding: 7px 11px; }
  .nav-link.is-active { box-shadow: inset 0 -3px 0 var(--gold); }
  .sidebar-foot { margin-top: 0; padding-top: 0; border-top: none; display: flex; align-items: center; gap: 12px; }
  .who { margin-bottom: 0; }
  .btn-logout { width: auto; }
  .kpi-row, .hq .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .command-strip, .source-map, .ops-strip, .file-layout { grid-template-columns: 1fr; }
  .file-list { max-height: 340px; }
}

@media (max-width: 620px) {
  .page, .topbar, .legal-banner { padding-left: 16px; padding-right: 16px; }
  .topbar { flex-wrap: wrap; }
  .topbar-meta { display: none; }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi-num { font-size: 1.6rem; }
  .list-row { align-items: flex-start; flex-wrap: wrap; }
  .list-main { flex-basis: 100%; }
  .due { text-align: left; white-space: normal; }
  .resource-list span { white-space: normal; }
  .source-item strong { white-space: normal; }
  .table { font-size: 0.84rem; }
  .table thead th, .table tbody td { padding: 10px 12px; }
  .act-time { min-width: 100%; }
}
