/* ============================================================
   Witness — Staff Dashboard (Low-fi Wireframe)
   Grayscale, boxy, monospace labels.
============================================================ */

:root {
  --ink: #1a1a1a;
  --ink-2: #444;
  --ink-3: #6b6b6b;
  --ink-4: #999;
  --line: #d4d4d4;
  --line-2: #e8e8e8;
  --bg: #f5f5f4;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --hatch: repeating-linear-gradient(
    45deg,
    #e5e5e5 0 6px,
    transparent 6px 12px
  );

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r: 2px;
  --gap: 16px;
}

[data-theme="dark"] {
  --ink: #f2f2f0;
  --ink-2: #c8c8c4;
  --ink-3: #8b8b87;
  --ink-4: #5e5e5a;
  --line: #2e2e2c;
  --line-2: #242422;
  --bg: #0e0e0d;
  --surface: #161615;
  --surface-2: #1c1c1b;
  --hatch: repeating-linear-gradient(
    45deg,
    #242422 0 6px,
    transparent 6px 12px
  );
}

[data-theme="dark"] .error {
  background: #3a2424;
  border-color: #6b3a3a;
  color: #f2d6d6;
}
[data-theme="dark"] button:hover { background: var(--ink); color: var(--bg); }
[data-theme="dark"] button.primary { background: var(--ink); color: var(--bg); }
[data-theme="dark"] button.primary:hover { background: var(--ink-2); border-color: var(--ink-2); color: var(--bg); }
[data-theme="dark"] .topbar nav button.active { background: var(--surface-2); color: var(--ink); }
[data-theme="dark"] .sidebar li.active { background: var(--ink); color: var(--bg); }
[data-theme="dark"] .sidebar li.active .count { color: var(--bg); }
[data-theme="dark"] .viewtoggle button.active { background: var(--ink); color: var(--bg); }
[data-theme="dark"] .viewtoggle button.active:hover { background: var(--ink); color: var(--bg); }
[data-theme="dark"] .checkbox.checked { color: var(--bg); }
[data-theme="dark"] .tag.solid { color: var(--bg); }
[data-theme="dark"] .switch::after { background: var(--bg); }
[data-theme="dark"] .switch.on::after { background: var(--surface); }
[data-theme="dark"] .toast { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.6); }
[data-theme="dark"] .video-viewer { background: #000; }
[data-theme="dark"] .pdf-page .lh.title { background: var(--ink-2); }
[data-theme="dark"] .progress-bar { background: var(--line-2); }
[data-theme="dark"] .progress-bar > span { background: var(--ink); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: var(--r);
}
button:hover { background: var(--ink); color: var(--surface); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--ink); color: var(--surface); }
button.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
button.ghost { border-color: var(--line); }
button.ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-3); }
button.icon {
  width: 32px; height: 32px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
  border-radius: var(--r);
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ink);
}

label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  display: block;
  margin-bottom: 6px;
}

.mono { font-family: var(--font-mono); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: var(--r);
  background: var(--surface);
  white-space: nowrap;
}
.tag.solid { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tag.dot::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--ink);
  border-radius: 50%;
}

.hatch {
  background: var(--hatch);
  border: 1px dashed var(--ink-4);
}

.divider { height: 1px; background: var(--line); }

/* APP SHELL ----------------------------------------------- */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar .brand .mark {
  width: 22px; height: 22px;
  border: 1.5px solid var(--ink);
  display: inline-grid; place-items: center;
  font-weight: 700;
  font-size: 11px;
}
.topbar nav {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}
.topbar nav button {
  border: none;
  background: transparent;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  border-radius: var(--r);
}
.topbar nav button.active { color: var(--ink); background: var(--bg); }
.topbar nav button:hover { color: var(--ink); background: var(--bg); }

.topbar .spacer { flex: 1; }

.topbar .right { display: flex; align-items: center; gap: 8px; }
.avatar-chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  padding: 4px 10px 4px 4px;
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.avatar-chip:hover { border-color: var(--ink); }
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--hatch);
  border: 1px solid var(--line);
  display: inline-grid; place-items: center;
  font-size: 10px;
  color: var(--ink-3);
}
.avatar.lg { width: 88px; height: 88px; font-size: 16px; }

.bell {
  position: relative;
}
.bell .dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; background: var(--ink);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* PAGE LAYOUT --------------------------------------------- */

.page {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}
.page.no-sidebar { grid-template-columns: 1fr; }

.sidebar {
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  background: var(--surface);
}
.sidebar h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin: 0 0 8px;
}
.sidebar ul { list-style: none; padding: 0; margin: 0 0 22px; }
.sidebar li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 13px;
}
.sidebar li:hover { background: var(--bg); }
.sidebar li.active { background: var(--ink); color: var(--surface); }
.sidebar li.active .count { color: var(--surface); opacity: 0.7; }
.sidebar li .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

.main {
  padding: 24px 32px 64px;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.page-header h1 {
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.page-header .sub {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

/* CARDS / GRID -------------------------------------------- */

.grid {
  display: grid;
  gap: var(--gap);
}
.grid.compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.cozy    { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.roomy   { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid.list    { grid-template-columns: 1fr; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s;
  overflow: hidden;
}
.card:hover {
  border-color: var(--ink);
}
.card.read { opacity: 0.7; }
.card.read .card-body { background: var(--surface-2); }

.card .thumb {
  aspect-ratio: 16 / 9;
  background: var(--hatch);
  border-bottom: 1px solid var(--line);
  position: relative;
  display: grid; place-items: center;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.card .thumb .typebadge {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 2px 6px;
  font-size: 10px;
  border-radius: var(--r);
}
.card .thumb .corner-status {
  position: absolute;
  top: 8px; right: 8px;
}

.card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.card-body h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-wrap: pretty;
}
.card-body .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.card-body .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.card-body .desc {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* List variant of card */
.card.row {
  flex-direction: row;
  align-items: stretch;
}
.card.row .thumb {
  aspect-ratio: auto;
  width: 120px;
  border-bottom: none;
  border-right: 1px solid var(--line);
  flex-shrink: 0;
}
.card.row .card-body { flex-direction: row; align-items: center; gap: 16px; }
.card.row .card-body .left { flex: 1; min-width: 0; }
.card.row .card-body .left h3 { margin-bottom: 4px; }
.card.row .card-body .meta { margin-top: 0; padding-top: 0; }

/* BANNER -------------------------------------------------- */

.banner {
  border: 1px solid var(--ink);
  background: var(--surface);
  padding: 14px 16px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.banner .icon-box {
  width: 36px; height: 36px;
  border: 1px solid var(--ink);
  display: grid; place-items: center;
  border-radius: var(--r);
  flex-shrink: 0;
}
.banner .text { flex: 1; }
.banner .text strong { font-weight: 600; }
.banner .text .sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* TOOLBAR (search/filters) -------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.search {
  flex: 1;
  min-width: 220px;
  position: relative;
}
.search input { padding-left: 32px; }
.search svg {
  position: absolute;
  left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3);
}
.toolbar select { width: auto; min-width: 140px; }
.viewtoggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.viewtoggle button {
  border: none;
  border-radius: 0;
  padding: 6px 10px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.viewtoggle button:last-child { border-right: none; }
.viewtoggle button.active { background: var(--ink); color: var(--surface); }
.viewtoggle button:hover { background: var(--bg); color: var(--ink); }
.viewtoggle button.active:hover { background: var(--ink); color: var(--surface); }

/* PROGRESS ------------------------------------------------ */

.progress-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.progress-card .text { flex: 1; }
.progress-card .text .head {
  font-weight: 600;
  margin-bottom: 4px;
}
.progress-card .text .sub {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.progress-bar {
  width: 200px;
  height: 8px;
  background: var(--line-2);
  border-radius: var(--r);
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--ink);
  transition: width 0.3s;
}
.pct {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  min-width: 42px;
  text-align: right;
}

/* SECTION HEADERS ----------------------------------------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 28px 0 12px;
}
.section-head h2 {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin: 0;
  font-weight: 600;
}
.section-head .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
}

/* LOGIN --------------------------------------------------- */

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
}
.login-side {
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-side .brand-large {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.login-side .brand-large .mark {
  width: 36px; height: 36px;
  border: 2px solid var(--ink);
  display: grid; place-items: center;
  font-weight: 700;
}
.login-side .quote {
  font-size: 28px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  max-width: 420px;
  text-wrap: pretty;
}
.login-side .footer {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.login-form-wrap {
  display: grid;
  place-items: center;
  padding: 40px;
}
.login-form {
  width: 100%;
  max-width: 360px;
}
.login-form h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.login-form p.sub {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin: 0 0 28px;
}
.field { margin-bottom: 16px; }
.field .row {
  display: flex; justify-content: space-between; align-items: baseline;
}
.field .row .link {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-decoration: underline;
  cursor: pointer;
  background: none; border: none; padding: 0;
}
.field .row .link:hover { color: var(--ink); background: none; }
.error {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  background: #f0e6e6;
  border: 1px solid #c69a9a;
  padding: 6px 10px;
  border-radius: var(--r);
  margin-bottom: 12px;
}
.login-form button.primary { width: 100%; padding: 11px; }

/* DETAIL PAGE --------------------------------------------- */

.detail-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 32px 64px;
}
.crumb {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.crumb button {
  background: none; border: none; padding: 0;
  color: var(--ink-3);
  font-family: inherit; font-size: inherit;
  text-transform: inherit; letter-spacing: inherit;
  text-decoration: underline; cursor: pointer;
}
.crumb button:hover { color: var(--ink); background: none; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}
.detail-main {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  min-height: 480px;
  display: flex;
  flex-direction: column;
}
.detail-main .head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.detail-main h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.detail-main .head .meta {
  display: flex; gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.detail-main .body { padding: 24px; flex: 1; }

.pdf-viewer {
  background: var(--bg);
  border: 1px dashed var(--line);
  height: 520px;
  display: grid;
  place-items: center;
  position: relative;
}
.pdf-page {
  width: 78%;
  height: 86%;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 32px;
  display: flex; flex-direction: column; gap: 10px;
  font-size: 11px;
  color: var(--ink-3);
}
.pdf-page .lh {
  height: 8px;
  background: var(--line-2);
  border-radius: 1px;
}
.pdf-page .lh.short { width: 60%; }
.pdf-page .lh.med   { width: 85%; }
.pdf-page .lh.title { width: 50%; height: 14px; background: var(--ink-2); margin-bottom: 14px; }

.video-viewer {
  background: var(--ink);
  height: 480px;
  display: grid; place-items: center;
  position: relative;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.video-viewer .play {
  width: 64px; height: 64px;
  border: 2px solid #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
}
.video-viewer .scrub {
  position: absolute;
  bottom: 16px; left: 16px; right: 16px;
  height: 4px;
  background: #444;
  border-radius: 2px;
}
.video-viewer .scrub > span {
  display: block; height: 100%; width: 35%;
  background: #fff;
}

.detail-side {
  display: flex; flex-direction: column; gap: 16px;
}
.side-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
}
.side-card h4 {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
}
.side-card .row {
  display: flex; justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--line-2);
}
.side-card .row:last-child { border-bottom: none; }
.side-card .row .k {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.side-card .actions { display: flex; flex-direction: column; gap: 8px; }
.side-card .actions button { width: 100%; }

/* FORM ASSET --------------------------------------------- */

.form-block { display: flex; flex-direction: column; gap: 18px; }
.form-block .question {
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 14px 16px;
  background: var(--surface-2);
}
.form-block .question .qtext { margin-bottom: 10px; font-weight: 500; }
.form-block .question .qsub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.choice {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  margin-bottom: 6px;
}
.choice:hover { border-color: var(--ink-3); }
.choice.selected { border-color: var(--ink); background: var(--bg); }
.choice .radio {
  width: 14px; height: 14px;
  border: 1px solid var(--ink-3);
  border-radius: 50%;
  flex-shrink: 0;
  display: grid; place-items: center;
}
.choice.selected .radio::after {
  content: "";
  width: 6px; height: 6px;
  background: var(--ink);
  border-radius: 50%;
}
.checkbox {
  width: 14px; height: 14px;
  border: 1px solid var(--ink-3);
  border-radius: 1px;
  flex-shrink: 0;
  display: grid; place-items: center;
}
.checkbox.checked { background: var(--ink); border-color: var(--ink); color: white; font-size: 10px; }

/* PROFILE -------------------------------------------------- */

.profile-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  margin-top: 8px;
}
.profile-side {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  text-align: center;
  position: sticky;
  top: 80px;
}
.profile-side .name { font-weight: 600; margin: 12px 0 4px; }
.profile-side .role {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.profile-side .upload {
  width: 100%;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 7px;
}
.profile-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.profile-tabs button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.profile-tabs button.active {
  border-bottom-color: var(--ink);
  color: var(--ink);
  background: none;
}
.profile-tabs button:hover { color: var(--ink); background: none; }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}
.field-grid.full > .field { grid-column: 1 / -1; }
.fg-full { grid-column: 1 / -1; }

.subhead {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-2);
}

/* SWITCH --------------------------------------------------- */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line-2);
}
.switch-row:last-child { border-bottom: none; }
.switch-row .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}
.switch {
  width: 36px; height: 20px;
  background: var(--line);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.switch.on { background: var(--ink); }
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--surface);
  border-radius: 50%;
  transition: transform 0.2s;
}
.switch.on::after { transform: translateX(16px); }

/* EMPTY / LOADING ----------------------------------------- */

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--r);
  padding: 64px 24px;
  text-align: center;
  background: var(--surface);
}
.empty .glyph {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border: 1px dashed var(--ink-4);
  display: grid; place-items: center;
}
.empty h3 { margin: 0 0 4px; font-weight: 600; font-size: 16px; }
.empty p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

@keyframes shimmer {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}
.skeleton {
  background: var(--line-2);
  border-radius: var(--r);
  animation: shimmer 1.4s ease-in-out infinite;
}
.sk-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.sk-card .thumb { background: var(--line-2); aspect-ratio: 16/9; animation: shimmer 1.4s ease-in-out infinite; }
.sk-card .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }

/* TOAST --------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 16px;
  border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 100;
  display: flex; align-items: center; gap: 8px;
}

/* DROPDOWN ------------------------------------------------ */

.dropdown {
  position: relative;
}
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  min-width: 200px;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  padding: 4px;
}
.menu .item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--r);
}
.menu .item:hover { background: var(--bg); }
.menu .sep { height: 1px; background: var(--line); margin: 4px 0; }

/* NOTIFICATIONS PANEL ------------------------------------- */

.notif-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 8px 28px rgba(0,0,0,0.08);
  z-index: 30;
}
.notif-panel header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-panel header h4 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
}
.notif-panel .item {
  padding: 12px 16px;
  border-bottom: 1px dashed var(--line-2);
  font-size: 13px;
  cursor: pointer;
}
.notif-panel .item:hover { background: var(--surface-2); }
.notif-panel .item:last-child { border-bottom: none; }
.notif-panel .item .when {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-top: 4px;
}

/* BUTTONS LIST -------------------------------------------- */

.cta-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* MODAL --------------------------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,20,20,0.4);
  display: grid; place-items: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  width: 100%;
  max-width: 440px;
  padding: 24px;
}
.modal h2 {
  margin: 0 0 4px;
  font-size: 18px;
}
.modal .sub {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 18px;
}
.modal .actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 18px;
}

/* KBD ------------------------------------------------------ */
kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink-3);
}

/* UTILITY ------------------------------------------------- */
.flex { display: flex; }
.flex.col { flex-direction: column; }
.flex.between { justify-content: space-between; }
.flex.center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.muted {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.center-text { text-align: center; }
.spread { display: flex; align-items: center; justify-content: space-between; }

/* RESPONSIVE ----------------------------------------------- */

@media (max-width: 900px) {
  /* Login + reset screens: collapse two-pane to single column */
  .login-shell {
    grid-template-columns: 1fr;
    min-height: 100vh;
  }
  .login-side {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 16px 20px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .login-side > div:nth-child(2),
  .login-side .footer { display: none; }
  .login-form-wrap { padding: 32px 20px 48px; }

  /* Topbar: drop secondary nav, drop avatar name */
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar nav { display: none; }
  .avatar-chip > span:last-child { display: none; }

  /* Dashboard: sidebar becomes horizontal chip-scroller above main */
  .page { grid-template-columns: 1fr; }
  .sidebar {
    display: flex;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 16px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    gap: 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar h4 { display: none; }
  .sidebar ul {
    display: flex;
    flex-direction: row;
    margin: 0;
    padding: 0;
    gap: 6px;
    flex-shrink: 0;
  }
  .sidebar ul:nth-of-type(3) { display: none; }
  .sidebar li {
    flex-shrink: 0;
    white-space: nowrap;
    border: 1px solid var(--line);
    padding: 5px 10px;
    border-radius: var(--r);
    font-size: 12px;
    gap: 6px;
  }
  .sidebar li.active {
    background: var(--ink);
    color: var(--surface);
    border-color: var(--ink);
  }
  .sidebar li.active .count { color: var(--surface); opacity: 0.85; }
  .sidebar li .count { font-size: 10px; }
  .main { padding: 20px 16px 48px; }

  /* Detail breadcrumb wraps on narrow screens */
  .crumb { flex-wrap: wrap; gap: 6px; }

  /* Card thumbs shorter on mobile */
  .card .thumb { aspect-ratio: 21 / 9; }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-header h1 { font-size: 22px; }
  .progress-card { flex-wrap: wrap; }
  .progress-bar { flex: 1; min-width: 120px; }
  .banner { flex-wrap: wrap; }
  .banner .text { flex: 1 1 200px; }
  .toolbar select { flex: 1; min-width: 0; }

  /* List-view cards: stack body content under thumb */
  .card.row .card-body {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
  }
  .card.row .card-body .left { width: 100%; }
  .card.row .thumb { width: 72px; }

  /* Detail: stack main + side */
  .detail-shell { padding: 20px 16px 48px; }
  .detail-grid { grid-template-columns: 1fr; gap: 16px; }
  .detail-main h1 { font-size: 18px; }
  .detail-main .head { padding: 16px; }
  .detail-main .body { padding: 16px; }
  .pdf-viewer { height: 380px; }
  .pdf-page { padding: 20px; }
  .video-viewer { height: 240px; }

  /* Profile: stack, drop sticky, shrink avatar */
  .profile-grid { grid-template-columns: 1fr; gap: 16px; }
  .profile-side { position: static; padding: 16px; }
  .profile-side .avatar.lg { width: 64px; height: 64px; font-size: 14px; }
  .profile-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .profile-tabs::-webkit-scrollbar { display: none; }
  .profile-tabs button { white-space: nowrap; flex-shrink: 0; }
  .field-grid { grid-template-columns: 1fr; }

  /* Notification panel: anchor to viewport so it can't overflow */
  .notif-panel {
    position: fixed;
    top: 64px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .topbar .brand > span:last-child { display: none; }
  .toolbar .viewtoggle { display: none; }
  .field-grid { gap: 12px; }
}
