/* Officer dashboard. Builds on css/styles.css (same palette, fonts and tokens).
   Idea: every form is a labelled filing folder on the officers' desk. */

body.admin { background: var(--paper); }
.ad-wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding-inline: var(--gutter); }

/* ---------- top bar ---------- */
.ad-top { position: sticky; top: 0; z-index: 50; background: var(--navy-800); color: var(--white); border-bottom: 3px solid var(--gold-600); box-shadow: 0 4px 18px rgba(3,21,48,.25); }
.ad-top-in { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding-block: 8px; min-height: 64px; }
.ad-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--white); min-width: 0; }
.ad-brand img { width: 52px; height: 52px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.ad-brand strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.05rem; line-height: 1.1; }
.ad-brand em { display: block; font-style: normal; color: var(--gold); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; margin-top: 2px; }
.ad-modes { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; background: rgba(255,255,255,.08); border: 1px solid rgba(249,201,55,.4); border-radius: 999px; padding: 3px; }
.ad-modes button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 6px 14px; border-radius: 999px; border: 0; background: transparent; color: #d6e0f5; font: 700 .95rem var(--font-body); cursor: pointer; }
.ad-modes button svg { width: 16px; height: 16px; }
.ad-modes button b { background: rgba(255,255,255,.14); border-radius: 999px; padding: 1px 9px; font-size: .82rem; }
.ad-modes button[aria-pressed="true"] { background: var(--gold); color: var(--navy-900); }
.ad-modes button[aria-pressed="true"] b { background: rgba(3,21,48,.15); }
.ad-actions { display: flex; gap: 8px; grid-row: 1; grid-column: 2; }
.ad-icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid rgba(249,201,55,.55); background: transparent; color: var(--gold); display: inline-grid; place-items: center; cursor: pointer; }
.ad-icon-btn:hover { background: rgba(249,201,55,.14); }
.ad-icon-btn--danger { border-color: var(--err); color: var(--err); width: 38px; height: 38px; border-radius: 10px; background: #fff; }
.ad-icon-btn--danger:hover { background: var(--err-bg); }
@media (min-width: 820px) {


}

/* ---------- banners ---------- */
.ad-bar { padding: 9px 0; font-size: .92rem; border-bottom: 1px solid var(--line); }
.ad-bar .ad-wrap { display: flex; gap: 10px; align-items: center; }
.ad-bar svg { width: 20px; height: 20px; flex: none; }
.ad-bar p { margin: 0; }
.ad-bar--test { background: var(--sky-soft); color: var(--navy-800); }
.ad-bar--lock { background: var(--warn-bg); color: #4a3200; }
.ad-bar--live { background: var(--err-bg); color: #5b0b0d; }

/* ---------- layout bits ---------- */
.ad-main { padding-block: 24px 60px; min-height: 60vh; display: grid; gap: 26px; align-content: start; }
.ad-main h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); margin: 0; }
.ad-main h2 { font-size: 1.35rem; margin: 0; }
.ad-h-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 14px; }
.ad-h-row p { margin: 0; }
.ad-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(14px, 3vw, 22px); box-shadow: var(--shadow-sm); }
.ad-card-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin-bottom: 12px; }
.ad-legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: .88rem; }
.ad-legend i { display: inline-block; width: 13px; height: 13px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.ad-loading { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 60px 0; color: var(--ink-soft); }
.ad-spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--gold-600); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.ad-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 2px solid var(--navy-800); background: var(--white); color: var(--navy-800); font: 700 .95rem var(--font-body); cursor: pointer; text-decoration: none; transition: background .15s, transform .15s; }
.ad-btn svg { width: 18px; height: 18px; }
.ad-btn:hover { background: var(--navy-800); color: var(--gold); }
.ad-btn[disabled] { opacity: .45; cursor: not-allowed; background: var(--white); color: var(--navy-800); }
.ad-btn--gold { background: var(--gold); border-color: var(--gold-600); color: var(--navy-900); box-shadow: 0 3px 0 var(--gold-600); }
.ad-btn--gold:hover { background: #ffd95e; color: var(--navy-900); transform: translateY(-1px); }
.ad-btn--ghost { border-color: var(--line); color: var(--ink-soft); }
.ad-btn--danger { border-color: var(--err); color: var(--err); }
.ad-btn--danger:hover { background: var(--err); color: #fff; }
.ad-btn--sm { min-height: 36px; padding: 4px 14px; font-size: .85rem; }
.ad-tools { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* ---------- KPIs ---------- */
.ad-kpis { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 820px) { .ad-kpis { grid-template-columns: repeat(4, 1fr); } }
.ad-kpi { background: var(--white); border: 1px solid var(--line); border-top: 5px solid var(--navy-800); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.ad-kpi:nth-child(2) { border-top-color: var(--gold-600); }
.ad-kpi:nth-child(3) { border-top-color: var(--sky); }
.ad-kpi:nth-child(4) { border-top-color: var(--royal-600); }
.ad-num { font-family: var(--font-display); font-size: 2.6rem; line-height: 1; color: var(--navy-800); }
.ad-lbl { margin-top: 6px; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }

/* ---------- chart ---------- */
.ad-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.ad-chart text { font-family: var(--font-body); font-size: 11.5px; fill: var(--ink-soft); }
.ad-chart text.val { fill: var(--navy-800); font-weight: 700; font-size: 11px; }

/* ---------- filing-folder tiles ---------- */
.ad-tiles { display: grid; gap: 28px 18px; padding-top: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.ad-tile { position: relative; display: grid; gap: 4px; padding: 30px 18px 14px; text-decoration: none; color: var(--ink); background: linear-gradient(180deg, #fffbe9, #fff 40%); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s; }
.ad-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--gold-600); color: var(--ink); }
.ad-tab { position: absolute; top: -14px; left: 14px; background: var(--navy-800); color: var(--gold); font-size: .7rem; letter-spacing: .14em; font-weight: 700; padding: 5px 12px 4px; border-radius: 9px 9px 0 0; }
.ad-tile.is-live { border-color: var(--gold-600); border-width: 2px; }
.ad-tile.is-live .ad-tab { background: var(--gold); color: var(--navy-900); }
.ad-tile strong { font-family: var(--font-display); font-weight: 400; font-size: 1.12rem; line-height: 1.2; color: var(--navy-800); padding-right: 40px; }
.ad-tile-ic { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 10px; background: var(--navy-800); color: var(--gold); display: grid; place-items: center; }
.ad-tile-ic svg { width: 20px; height: 20px; }
.ad-tile-ic.big { position: static; width: 56px; height: 56px; border-radius: 16px; box-shadow: inset 0 0 0 2px rgba(249,201,55,.4); flex: none; }
.ad-tile-ic.big svg { width: 30px; height: 30px; }
.ad-tile-num { font-family: var(--font-display); font-size: 2.6rem; line-height: 1.05; color: var(--navy-800); margin-top: 4px; }
.ad-tile-meta { font-size: .85rem; color: var(--ink-soft); }
.ad-segs { display: flex; height: 7px; border-radius: 99px; overflow: hidden; background: var(--line); margin-top: 8px; gap: 2px; }
.seg { display: block; height: 100%; }
.seg-Received { background: var(--gold-600); } .seg-InReview { background: var(--sky); } .seg-Approved, .seg-Resolved { background: var(--ok); } .seg-Rejected { background: var(--err); } .seg-none { background: transparent; }
.ad-open { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-weight: 700; font-size: .88rem; color: var(--royal); }
.ad-open svg { width: 16px; height: 16px; transition: transform .15s; }
.ad-tile:hover .ad-open svg { transform: translateX(4px); }

/* ---------- activity ---------- */
.ad-act { list-style: none; margin: 0; padding: 0; display: grid; }
.ad-act a { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 11px 4px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.ad-act li:first-child a { border-top: 0; }
.ad-act a:hover { background: var(--cream); }
.ad-act-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--cream); color: var(--navy-800); display: grid; place-items: center; }
.ad-act-ic svg { width: 18px; height: 18px; }
.ad-act-t strong { display: block; font-size: .95rem; }
.ad-act-t small { color: var(--ink-soft); }
.ad-act-w { color: var(--ink-soft); font-size: .85rem; white-space: nowrap; }
.ad-empty-li { padding: 14px 4px; color: var(--ink-soft); }
@media (max-width: 560px) { .ad-act a { grid-template-columns: auto 1fr auto; } .ad-act-w { display: none; } }

/* ---------- pills / tags ---------- */
.ad-pill { display: inline-block; padding: 3px 12px; border-radius: 999px; font-weight: 700; font-size: .8rem; white-space: nowrap; }
.ad-pill--warn { background: var(--warn-bg); color: #6b4700; } .ad-pill--info { background: var(--sky-soft); color: var(--navy-800); } .ad-pill--ok { background: var(--ok-bg); color: var(--ok); } .ad-pill--bad { background: var(--err-bg); color: var(--err); }
.ad-tag { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--sky-soft); color: var(--navy-700); border-radius: 6px; padding: 1px 6px; vertical-align: 2px; }

/* ---------- welcome / empty / lock ---------- */
.ad-welcome { display: grid; gap: 14px; align-items: center; padding: 22px; background: var(--navy-800); color: #e3eaf8; border-radius: var(--radius-lg); border: 2px solid var(--gold-600); }
.ad-welcome h2 { color: var(--white); } .ad-welcome p { margin: 6px 0 0; } .ad-welcome a { color: var(--gold); }
@media (min-width: 760px) { .ad-welcome { grid-template-columns: 1fr auto; } }
.ad-emptybox, .ad-lockcard { text-align: center; padding: 38px 20px; background: var(--cream); border: 2px dashed var(--gold-600); border-radius: var(--radius-lg); display: grid; gap: 8px; justify-items: center; }
.ad-emptybox svg, .ad-lockcard svg { width: 36px; height: 36px; color: var(--gold-600); }
.ad-emptybox h2, .ad-emptybox h3, .ad-lockcard h2 { margin: 0; } .ad-emptybox p, .ad-lockcard p { margin: 0; max-width: 56ch; }
.ad-lockcard { padding: 46px 22px; gap: 12px; }
.ad-lockcard svg { width: 44px; height: 44px; }

/* ---------- a form's desk ---------- */
.ad-back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 700; color: var(--royal); padding: 6px 2px; justify-self: start; }
.ad-back svg { width: 18px; height: 18px; }
.ad-desk-h { display: flex; align-items: center; gap: 14px; }
.ad-desk-h p { margin: 2px 0 0; }
.ad-filters { display: grid; gap: 10px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; }
@media (min-width: 900px) { .ad-filters { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; } }
.ad-filters input, .ad-filters select { min-height: 46px; padding: 8px 12px; }
.ad-search { position: relative; }
.ad-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--ink-soft); pointer-events: none; }
.ad-search input { padding-left: 40px; }
.ad-date { display: grid; gap: 2px; } .ad-date label { margin: 0; font-size: .78rem; color: var(--ink-soft); }
.ad-export { display: grid; gap: 10px 18px; align-items: center; background: var(--navy-800); color: #dbe5f8; border-radius: var(--radius-lg); padding: 14px 18px; border: 2px solid var(--gold-600); }
@media (min-width: 900px) { .ad-export { grid-template-columns: auto 1fr auto; } }
.ad-export-t strong { display: block; color: var(--gold); font-family: var(--font-display); font-weight: 400; font-size: 1.15rem; }
.ad-export-t span { font-size: .88rem; }
.ad-export-b { display: flex; flex-wrap: wrap; gap: 8px; }
.ad-export .ad-btn { background: var(--gold); border-color: var(--gold); color: var(--navy-900); }
.ad-export .ad-btn:hover { background: #ffd95e; }
.ad-export .ad-btn[disabled] { background: rgba(255,255,255,.18); border-color: transparent; color: #aab8d6; }
.ad-check { display: flex; gap: 10px; align-items: center; cursor: pointer; grid-column: 1 / -1; font-size: .95rem; color: var(--white); margin: 0; font-weight: 700; }
.ad-check input { width: 22px; height: 22px; accent-color: var(--gold); flex: none; }
.ad-check small { color: #aab8d6; font-weight: 400; }
@media (min-width: 900px) { .ad-check { grid-column: auto; } }

/* ---------- table (turns into cards on phones) ---------- */
.ad-tablewrap { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.ad-table { width: 100%; border-collapse: collapse; min-width: 0; font-size: .93rem; }
.ad-table th { background: var(--navy-800); color: var(--gold); text-align: left; padding: 11px 12px; font-size: .76rem; letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; }
.ad-table td { padding: 11px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.ad-table tbody tr.ad-row:nth-child(4n+1), .ad-table tbody tr.ad-row:nth-child(4n+3) { background: transparent; }
.ad-table tbody tr.ad-row:hover { background: var(--cream); }
.ad-row.is-open { background: var(--cream); }
.ad-acts { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.ad-td-veh { min-width: 260px; }
.ad-chip { display: block; width: max-content; max-width: 100%; margin: 0 0 4px; padding: 3px 10px; background: var(--cream); border: 1px solid var(--line); border-left: 4px solid var(--gold-600); border-radius: 8px; font-size: .86rem; }
.ad-status { min-height: 36px; padding: 2px 8px; font-size: .88rem; border-radius: 8px; border-width: 1.5px; width: auto; }
.ad-detail td { background: var(--cream); border-top: 0; padding: 4px 16px 18px; }
.ad-dl { display: grid; gap: 8px 22px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin: 0; }
.ad-dl-row { display: grid; gap: 1px; } .ad-dl-wide { grid-column: 1 / -1; }
.ad-dl dt { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.ad-dl dd { margin: 0; overflow-wrap: anywhere; }
.ad-vtable table { border-collapse: collapse; background: var(--white); border-radius: 10px; overflow: hidden; font-size: .9rem; min-width: 0; width: auto; }
.ad-vtable th { background: var(--navy-700); color: var(--white); padding: 6px 12px; font-size: .72rem; } .ad-vtable td { padding: 6px 12px; border-top: 1px solid var(--line); background: var(--white); }

@media (max-width: 860px) {
  .ad-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ad-table, .ad-table tbody, .ad-table tr, .ad-table td { display: block; width: 100%; }
  .ad-table tr.ad-row { padding: 10px 12px; border-top: 3px solid var(--gold-600); }
  .ad-table tr.ad-row:first-child { border-top: 0; }
  .ad-table td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: start; }
  .ad-table td[data-label]::before { content: attr(data-label); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; padding-top: 3px; }
  .ad-table td.ad-acts { display: flex; padding-top: 8px; }
  .ad-table tr.ad-detail td { display: block; padding: 0 12px 16px; }
  .ad-td-veh { min-width: 0; }
}

.ad-foot { border-top: 1px solid var(--line); background: var(--cream); padding: 18px 0 26px; font-size: .88rem; color: var(--ink-soft); }
.ad-toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; background: var(--navy-800); color: var(--white); border: 1.5px solid var(--gold); border-radius: 999px; padding: 10px 22px; font-weight: 700; box-shadow: var(--shadow-lg); transition: opacity .25s, transform .25s; z-index: 90; max-width: calc(100vw - 32px); text-align: center; }
.ad-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media print { .ad-top, .ad-foot, .ad-filters, .ad-export, .ad-toast { display: none; } }

/* ---------- sign in ---------- */
.ad-top.is-out .ad-actions { display: none; }
.ad-top.is-out .ad-top-in { grid-template-columns: 1fr; }
.ad-login { max-width: 420px; margin: 18px auto 0; text-align: center; display: grid; gap: 6px; justify-items: center; }
.ad-login img { width: 120px; height: 120px; aspect-ratio: 1; filter: drop-shadow(0 12px 22px rgba(3,21,48,.35)); }
.ad-login h1 { margin: 6px 0 0; }
.ad-login p { margin: 0 0 8px; }
.ad-login form { width: 100%; text-align: left; background: var(--white); border: 1px solid var(--line); border-top: 6px solid var(--gold-600); border-radius: var(--radius-lg); padding: 22px 20px; box-shadow: var(--shadow); display: grid; gap: 4px; margin-top: 6px; }
.ad-login-err { color: var(--err); font-weight: 700; min-height: 1.4em; font-size: .95rem; }
.ad-showpw { display: flex; gap: 10px; align-items: center; font-weight: 400; color: var(--ink); margin: 0 0 12px; cursor: pointer; }
.ad-showpw input { width: 22px; height: 22px; accent-color: var(--navy-800); }
.ad-login-btn { width: 100%; }
.ad-sharelink { font-family: var(--font-display); font-size: 1.1rem; color: var(--gold); word-break: break-all; }

/* ---------- installed app (PWA) ---------- */
.ad-btn[hidden] { display: none; }
.ad-install { background: var(--gold); border-color: var(--gold); color: var(--navy-900); min-height: 44px; align-self: center; }
.ad-install:hover { background: #ffd95e; color: var(--navy-900); }
.ad-top { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.ad-foot { padding-bottom: calc(26px + env(safe-area-inset-bottom)); }
.ad-toast { bottom: calc(22px + env(safe-area-inset-bottom)); }
@media (display-mode: standalone) { .ad-main { padding-bottom: calc(40px + env(safe-area-inset-bottom)); } }
