/* Zed Plus admin — control-room theme built from the mobile app's tokens */
:root {
  --navy: #0B1F3A; --navy-2: #16325A; --gold: #C8A951; --gold-soft: #EAD695;
  --bg: #EEF2F6; --surface: #FFFFFF; --line: #D7DEE7; --line-soft: #E6EBF1;
  --text: #13202F; --muted: #5D6B7E; --link: #1B4E8C;
  --danger: #B0414F; --danger-bg: #FBEDEF; --success: #2F6B4F; --success-bg: #E7F3EC;
  --warn: #8A6410; --warn-bg: #FBF3DC; --neutral-bg: #EDF0F4;
  --radius: 6px; --font: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131C28; --surface: #1B2430; --line: #37404E; --line-soft: #2B3440;
    --text: #F2F3F5; --muted: #97A6BC; --link: #9CC2F2;
    --danger-bg: #422932; --success-bg: #16372B; --warn-bg: #3A3016; --neutral-bg: #262F3B;
    --danger: #FFB3B7; --success: #9BE3B9; --warn: #EAD695;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); font-variant-numeric: tabular-nums; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }
.muted { color: var(--muted); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #D3DCE8; padding: 18px 0 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 18px; color: #fff; font-weight: 700; font-size: 16px; }
.shield { width: 34px; height: 38px; display: grid; place-items: center; background: var(--gold); color: var(--navy); font-weight: 800;
  clip-path: polygon(50% 0, 100% 14%, 100% 58%, 50% 100%, 0 58%, 0 14%); font-size: 13px; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: #97A6BC; }
.nav-group { margin-top: 14px; }
.nav-group > span { display: block; padding: 4px 20px; font-size: 12px; color: #7E8EA6; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 7px 20px; color: #D3DCE8; border-left: 3px solid transparent; }
.side a.nav:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.side a.nav.on { background: var(--navy-2); border-left-color: var(--gold); color: #fff; }
.side a.nav .count { margin-left: auto; background: var(--gold); color: var(--navy); border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 16px; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy-2); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.content { padding: 24px 28px 48px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.top .menu-toggle { display: none; }

/* ---------- the alert band (the one loud element) ---------- */
.alert-band { background: #B0414F; color: #fff; padding: 10px 28px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.alert-band strong { font-size: 15px; }
.alert-band .pulse { width: 12px; height: 12px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; flex: none; }
.alert-band form { margin: 0; }
.alert-band .btn { background: #fff; color: #7A1E2B; border-color: #fff; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.8); } 70% { box-shadow: 0 0 0 10px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }
@media (prefers-reduced-motion: reduce) { .alert-band .pulse { animation: none; } }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn.primary:hover { background: var(--gold-soft); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; width: 100%; }
textarea { min-height: 96px; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; min-height: 140px; }
label { font-weight: 600; display: block; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.err { color: var(--danger); font-size: 13px; margin-top: 4px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.panel > header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.panel > header h2 { margin: 0; }
.panel > header a { margin-left: auto; font-size: 13px; }
.panel .body { padding: 18px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); white-space: nowrap; }
th a { color: inherit; }
tbody tr:hover { background: color-mix(in srgb, var(--gold) 6%, transparent); }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; }
.thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
code.json { font-size: 12px; color: var(--muted); }
.empty { padding: 40px 18px; text-align: center; color: var(--muted); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.filters input[type=search] { max-width: 260px; }
.filters select, .filters input[type=date] { width: auto; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--neutral-bg); color: var(--muted); text-transform: capitalize; white-space: nowrap; }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.warning { background: var(--warn-bg); color: var(--warn); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-right: 6px; }
.dot.ok { background: var(--success); }

.pagination { display: flex; gap: 6px; padding: 12px 14px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px; }
.pagination .on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- forms & detail ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.check input { width: auto; }
.multi { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; max-height: 180px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px; }
.multi label { font-weight: 400; display: flex; gap: 6px; align-items: center; margin: 0; }
.multi input { width: auto; }
dl.detail { display: grid; grid-template-columns: 220px 1fr; margin: 0; }
dl.detail dt { color: var(--muted); padding: 9px 18px; border-bottom: 1px solid var(--line-soft); }
dl.detail dd { margin: 0; padding: 9px 18px; border-bottom: 1px solid var(--line-soft); white-space: pre-wrap; word-break: break-word; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; background: var(--success-bg); color: var(--success); font-weight: 600; }
.flash.bad { background: var(--danger-bg); color: var(--danger); }
.gallery { display: flex; gap: 10px; flex-wrap: wrap; }
.gallery a img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.timeline { list-style: none; margin: 0; padding: 0 18px; }
.timeline li { position: relative; padding: 10px 0 10px 24px; border-left: 2px solid var(--line); }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 15px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); }
.timeline li.approved::before { background: var(--success); border-color: var(--success); }
.timeline li.rejected::before, .timeline li.returned::before { background: var(--danger); border-color: var(--danger); }
.timeline li.pending.current::before { background: var(--gold); border-color: var(--gold); }

/* ---------- dashboard status board ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 20px; }
.board a { padding: 16px 18px; border-right: 1px solid var(--line-soft); color: var(--text); }
.board a:last-child { border-right: 0; }
.board a:hover { text-decoration: none; background: color-mix(in srgb, var(--gold) 8%, transparent); }
.board b { display: block; font-size: 26px; font-weight: 700; line-height: 1.1; }
.board span { color: var(--muted); font-size: 13px; }
.board a.hot b { color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); }
.list li:last-child { border-bottom: 0; }
.list .meta { margin-left: auto; text-align: right; color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .hero { background: linear-gradient(160deg, #16325A, #0B1F3A 70%); color: #D3DCE8; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login .hero p.lead { font-size: 30px; line-height: 1.25; color: #fff; font-weight: 700; max-width: 14ch; margin: 0; }
.login form { align-self: center; justify-self: center; width: min(380px, 90vw); display: grid; gap: 16px; }

#map { height: calc(100vh - 190px); min-height: 420px; border-radius: 8px; border: 1px solid var(--line); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .top .menu-toggle { display: inline-flex; }
  .grid-2, .form-grid, .login { grid-template-columns: 1fr; }
  .login .hero { display: none; }
  dl.detail { grid-template-columns: 1fr; }
  dl.detail dt { border-bottom: 0; padding-bottom: 0; }
  .content, .top { padding-left: 16px; padding-right: 16px; }
}
