/* Doc Tracker — layout: left sidebar on desktop, top search + bottom tab bar on phones.
   Patterns borrowed from asset / records tools (Sortly, Snipe-IT, FileTrail): photo-first item rows,
   "who has it" on every row, current custodian first on the item page, chain-of-custody timeline. */
:root {
  --brand: #1f4e5f;
  --brand-2: #2c6b80;
  --brand-ink: #fff;
  --bg: #f4f5f7;
  --surface: #fff;
  --surface-2: #f9fafb;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --chip: #f1f2f4;
  --orange: #b45309;
  --orange-bg: #fef3c7;
  --red: #b42318;
  --red-bg: #fee4e2;
  --green: #067647;
  --green-bg: #dcfae6;
  --blue: #175cd3;
  --blue-bg: #e0eaff;
  --violet: #6941c6;
  --violet-bg: #f0ebff;
  --gray-bg: #f2f4f7;
  --link: #1f4e5f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --side-w: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #2c6b80; --brand-2: #3a8aa3; --bg: #0f1115; --surface: #171a20; --surface-2: #1d2027; --ink: #eceef1; --ink-2: #c9ccd2;
    --muted: #9aa0aa; --line: #2a2e36; --chip: #22262e; --orange: #fbbf5a; --orange-bg: #3a2a10; --red: #ff8a80; --red-bg: #3d1c1a;
    --green: #6ee7a8; --green-bg: #12301f; --blue: #8fb3ff; --blue-bg: #17264a; --violet: #c4b1ff; --violet-bg: #2a2147;
    --gray-bg: #22262e; --link: #8cc8dc; --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #2c6b80; --brand-2: #3a8aa3; --bg: #0f1115; --surface: #171a20; --surface-2: #1d2027; --ink: #eceef1; --ink-2: #c9ccd2;
  --muted: #9aa0aa; --line: #2a2e36; --chip: #22262e; --orange: #fbbf5a; --orange-bg: #3a2a10; --red: #ff8a80; --red-bg: #3d1c1a;
  --green: #6ee7a8; --green-bg: #12301f; --blue: #8fb3ff; --blue-bg: #17264a; --violet: #c4b1ff; --violet-bg: #2a2147;
  --gray-bg: #22262e; --link: #8cc8dc; --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--link); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: .1em 0 .5em; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: .1em 0 .6em; }
h3 { font-size: .8rem; margin: 1.2em 0 .5em; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pre { white-space: pre-wrap; }
.big-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 600; letter-spacing: -.01em; }
a.big-code { text-decoration: none; }

/* ---------- app shell ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--surface); border-right: 1px solid var(--line);
        display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; z-index: 30; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; text-decoration: none; font-size: 1.02rem; padding: 2px 6px 6px; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; font-size: .78rem; font-weight: 800; letter-spacing: .02em; }
.side-search input { min-height: 36px; background: var(--surface-2); font-size: .9rem; }
.side-cta { width: 100%; }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: .93rem; }
.side-nav a i { font-style: normal; width: 18px; text-align: center; color: var(--muted); }
.side-nav a:hover { background: var(--chip); }
.side-nav a.on { background: var(--chip); color: var(--ink); font-weight: 600; }
.side-nav a.on i { color: var(--brand-2); }
.side-label { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 14px 10px 4px; }
.count { margin-left: auto; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--chip); }
.count.bad { background: var(--red); color: #fff; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 6px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.side-foot form { margin: 0; }
.side-foot .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.app .page { margin-left: var(--side-w); min-height: 100vh; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 28px 40px; }
.mtop, .tabbar, .scrim { display: none; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }

@media (max-width: 900px) {
  .app .page { margin-left: 0; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .wrap { padding: 14px 16px 24px; }
  .side { transform: translateX(-100%); transition: transform .2s ease; width: 280px; visibility: hidden; }
  body.nav-open .side { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .mtop { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; padding: 8px 12px;
          background: var(--surface); border-bottom: 1px solid var(--line); }
  .mtop .brand { padding: 0; }
  .mtop-search { flex: 1; }
  .mtop-search input { min-height: 38px; background: var(--surface-2); border-radius: 99px; padding: 6px 14px; }
  .mtop-help { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-weight: 700; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; inset: auto 0 0 0; z-index: 20;
            background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 4px; font: inherit;
            font-size: .7rem; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; }
  .tabbar i { font-style: normal; font-size: 1.25rem; line-height: 1.2; }
  .tabbar .on { color: var(--brand-2); font-weight: 600; }
  .tabbar .dot { position: absolute; top: 4px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
  .tabbar .tab-cta i { display: grid; place-items: center; width: 50px; height: 50px; margin-top: -18px; border-radius: 50%; background: var(--brand);
            color: #fff; font-size: 1.6rem; box-shadow: 0 4px 12px rgba(31,78,95,.35); }
}

/* ---------- basics ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card > h2:first-child { margin-top: 0; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; flex: 1; }
.login { width: 100%; max-width: 380px; text-align: center; }
.login.wide { max-width: 520px; text-align: left; }
.login h1 { color: var(--link); margin-bottom: 0; }
.plain { list-style: none; padding: 0; }
.plain li { padding: 4px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--brand); color: #fff; border: 1px solid var(--brand);
       border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600; font-size: .93rem; text-decoration: none; cursor: pointer; min-height: 38px; white-space: nowrap; }
.btn:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover { background: var(--chip); }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: .84rem; }
.btn.big { width: 100%; min-height: 48px; font-size: 1.02rem; margin-top: 8px; }
.btn[disabled] { opacity: .6; cursor: progress; }
button.link { background: none; border: 0; font: inherit; color: var(--link); cursor: pointer; padding: 0; }

.flash { display: block; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; background: var(--green-bg); color: var(--green); text-decoration: none; }
.flash.error { background: var(--red-bg); color: var(--red); }
.flash.warn { background: var(--orange-bg); color: var(--orange); }
.flash.info { background: var(--blue-bg); color: var(--blue); }

.head-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.head-row h1 { margin: 0; flex: 1 1 auto; min-width: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lead { color: var(--muted); margin: -6px 0 18px; }

input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand-2) 40%, transparent); border-color: var(--brand-2); }
textarea { min-height: 80px; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; margin: 0 0 12px; }
.filters > select, .filters > input { width: auto; min-width: 180px; flex: 1 1 180px; }
.filters details { flex: 1 1 100%; order: 5; }
.filters summary { cursor: pointer; color: var(--muted); padding: 4px 0; font-size: .9rem; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 8px; }
.filter-grid label, .inline { font-size: .85rem; color: var(--muted); }
.inline { display: inline-flex; gap: 6px; align-items: center; min-height: 40px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { background: var(--surface); color: var(--ink-2); text-decoration: none; padding: 5px 12px; border-radius: 999px; font-size: .86rem; border: 1px solid var(--line); }
.chip b { margin-left: 4px; }
.chip.on { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.summary-line { margin: 4px 0 10px; font-size: .88rem; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--gray-bg); color: var(--ink-2); white-space: nowrap; }
.badge.big { font-size: .88rem; padding: 4px 12px; }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.warn { background: var(--orange-bg); color: var(--orange); }
.badge.bad { background: var(--red-bg); color: var(--red); }
.badge.info { background: var(--blue-bg); color: var(--blue); }
.badge.out { background: var(--violet-bg); color: var(--violet); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; }

.cat { display: inline-grid; place-items: center; min-width: 22px; height: 22px; font-weight: 700; font-size: .74rem; padding: 0 6px; border-radius: 6px; background: var(--chip); color: var(--ink-2); }
.cat.A { background: var(--blue-bg); color: var(--blue); }
.cat.C { background: var(--orange-bg); color: var(--orange); }
.cat.E { background: var(--green-bg); color: var(--green); }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-scroll { border: 0; box-shadow: none; border-radius: 0; }
table.grid { border-collapse: collapse; width: 100%; font-size: .88rem; }
.grid th, .grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid th { white-space: nowrap; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td.detail { min-width: 200px; }
.grid thead th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; }
.grid tfoot td, .grid tfoot th { font-weight: 600; background: var(--surface-2); }
.grid tr.inactive { opacity: .55; }
.grid tr.denied td { color: var(--red); }
.grid tr.overdue td:first-child { box-shadow: inset 3px 0 var(--red); }
.grid tr.due-soon td:first-child { box-shadow: inset 3px 0 var(--orange); }
.grid .actions { display: flex; gap: 6px; white-space: nowrap; }
.grid .actions form { margin: 0; }
td.actions form { display: inline; }

/* ---------- home ---------- */
.hello { margin-bottom: 18px; }
.hello h1 { margin-bottom: 2px; }
@media (max-width: 700px) {
  .hello > div:first-child { flex-basis: 100%; }
  .hello .head-actions { width: 100%; }
  .hello .head-actions .btn { flex: 1; }
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.stat .k { font-size: .8rem; color: var(--muted); }
.stat .v { font-size: 1.7rem; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.stat.bad .v { color: var(--red); }
.stat.warn .v { color: var(--orange); }
.stat.zero .v { color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover, .stat:hover { border-color: var(--brand-2); }
.tile .name { font-weight: 600; }
.tile .n { font-size: 1.5rem; font-weight: 700; }
.meter { height: 6px; background: var(--chip); border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.meter i { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li { border-top: 1px solid var(--line); }
.tasks li:first-child { border-top: 0; }
.tasks a.task { display: flex; gap: 12px; align-items: center; padding: 10px 2px; text-decoration: none; color: var(--ink); }
.tasks a.task:hover { background: var(--surface-2); }
.task .ico { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--chip); font-size: 1rem; }
.task .ico.bad { background: var(--red-bg); color: var(--red); }
.task .ico.warn { background: var(--orange-bg); color: var(--orange); }
.task .ico.info { background: var(--blue-bg); color: var(--blue); }
.task .body { flex: 1; min-width: 0; }
.task .t1 { font-weight: 600; }
.task .t2 { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .go { color: var(--muted); }
.allclear { display: flex; gap: 10px; align-items: center; color: var(--green); }

/* ---------- item rows (list) ---------- */
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--ink); }
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row.inactive { opacity: .55; }
.row .pick { flex: none; }
.thumb { flex: none; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: var(--chip); display: grid; place-items: center; color: var(--muted); font-size: .7rem; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row .main { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .82rem; color: var(--muted); align-items: center; }
.row .where { flex: 0 0 240px; min-width: 0; font-size: .86rem; }
.row .where .lbl { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.row .where .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .flags { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bulkbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 10px 0; flex-wrap: wrap; }
@media (max-width: 700px) {
  .row { align-items: flex-start; flex-wrap: wrap; padding: 10px 12px; }
  .row .where { flex: 1 1 100%; order: 3; padding-left: 92px; margin-top: -4px; }
  .row .flags { flex-direction: row; order: 4; padding-left: 92px; }
  .row .title { white-space: normal; }
}

/* ---------- item page ---------- */
.hero { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 16px; }
.hero .photo { flex: none; width: 120px; height: 120px; border-radius: 14px; overflow: hidden; background: var(--chip); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); font-size: .8rem; }
.hero .photo img { width: 100%; height: 100%; object-fit: cover; }
.hero .info { flex: 1; min-width: 0; }
.hero .code { color: var(--muted); font-size: .9rem; }
.hero h1 { margin: 2px 0 8px; }
.hero .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.hero .primary { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.custody { border-left: 4px solid var(--brand-2); }
.custody .now { display: flex; gap: 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.custody .now:first-of-type { border-top: 0; }
.custody .av { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--chip); font-size: 1.05rem; }
.custody .av.contact { background: var(--violet-bg); color: var(--violet); }
.custody .av.place { background: var(--green-bg); color: var(--green); }
.custody .av.staff { background: var(--blue-bg); color: var(--blue); }
.custody .who { font-weight: 600; font-size: 1.02rem; }
.custody .qty { margin-left: auto; font-size: .88rem; color: var(--ink-2); white-space: nowrap; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 7px 12px; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 28px; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .pt { position: absolute; left: 2px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand-2); }
.timeline .pt.in { border-color: var(--green); }
.timeline .pt.out { border-color: var(--violet); }
.timeline .pt.bad { border-color: var(--red); }
.timeline .when { color: var(--muted); font-size: .8rem; }
.timeline .what { color: var(--ink); }
.timeline .why { color: var(--muted); }
.files { display: flex; flex-wrap: wrap; gap: 10px; }
.files a.f { display: block; width: 120px; text-decoration: none; color: var(--ink); font-size: .8rem; }
.files a.f img, .files a.f .pdf { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 700; background: var(--chip); }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 16px; }
.actions-grid details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.actions-grid summary { font-weight: 600; cursor: pointer; }
.actions-grid form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.inline-nums { display: flex; gap: 8px; }
.inline-nums label { flex: 1; display: flex; flex-direction: column; font-size: .85rem; }
.history { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.history li { padding: 6px 0; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .detail-grid, .row2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 100px minmax(0, 1fr); }
  .hero { gap: 12px; }
  .hero .photo { width: 84px; height: 84px; }
  .hero h1 { font-size: 1.25rem; }
  .hero .primary .btn { flex: 1 1 auto; }
  .filters > select, .filters > input { min-width: 0; flex-basis: 100%; }
  .card { padding: 14px; }
  .grid td.detail { min-width: 160px; }
}

/* ---------- forms ---------- */
.form { max-width: 720px; }
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.field label { font-weight: 600; font-size: .9rem; }
.field.req > label::after { content: " *"; color: var(--red); }
.field .err { color: var(--red); }
.field .help, .field small { color: var(--muted); font-size: .82rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.previews { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.previews img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- help ---------- */
.help { max-width: 820px; }
.help h2 { margin-top: 1.6em; padding-top: 1em; border-top: 1px solid var(--line); }
.help h2:first-of-type { border-top: 0; padding-top: 0; }
.help li { margin: 5px 0; }
.help .tip { background: var(--blue-bg); color: var(--ink); border-radius: 10px; padding: 10px 14px; font-size: .92rem; }
.help .toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.help table.grid { margin: 8px 0; }
.help table.grid td, .help table.grid th { white-space: normal; }

/* ---------- audit log ---------- */
.act { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; padding: 1px 6px; border-radius: 6px; background: var(--chip); white-space: nowrap; }
.act.denied, .act.login_failed, .act.login_denied { background: var(--red-bg); color: var(--red); }
.act.view_as_start, .act.view_as_stop { background: #fdf0c4; color: #6b4e00; }

/* "View as" (Jensen only): impossible to miss, so nobody forgets they are looking through someone else's eyes */
.view-as-bar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: #f5c542; color: #2b2100; font-size: 14px; }
.view-as-bar form { margin: 0; }
.view-as-bar .btn { background: #2b2100; border-color: #2b2100; }
@media (max-width: 900px) { .view-as-bar { top: 55px; } }

/* lightbox (tracker.js) */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 50; display: none; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: 6px; }
.lightbox .cap { color: #fff; margin-top: 10px; }
.lightbox button { position: absolute; background: rgba(255,255,255,.15); color: #fff; border: 0; font-size: 1.6rem; width: 46px; height: 46px; border-radius: 50%; cursor: pointer; }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 12px; top: 50%; }
.lb-next { right: 12px; top: 50%; }
