:root {
  --brand: #01A6FF;
  --navy: #062338;
  --ink: #0E2230;
  --ink-2: #2C4456;
  --muted: #4A5C6B;
  --line: #DCE4EC;
  --line-2: #B9C7D3;
  --ground: #F3F6F9;
  --soft: #F7FAFC;
  --primary: #0A6CB0;
  --primary-dk: #074E80;
  --go: #13795B;
  --go-dk: #0D5A43;
  --go-bg: #E8F6EF;
  --wait-bg: #FFF3E0;
  --wait: #8A4B00;
  --bad: #9B1C1C;
  --mark: #FF6A13;
  --radius: 14px;
  --display: 'Bricolage Grotesque', Figtree, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Figtree, system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--ground); font-size: 16px; line-height: 1.45; }
img { max-width: 100%; }
a { color: var(--primary); } a:hover { color: var(--primary-dk); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }

/* header */
.topbar { position: sticky; top: 0; z-index: 20; min-height: 72px; background: var(--brand); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 24px 8px 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); }
.brand img { width: 52px; height: 52px; display: block; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 25px; line-height: 1; letter-spacing: -0.5px; }
.brand-sub { font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.topnav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tab { height: 42px; padding: 0 16px; border-radius: 999px; border: none; background: transparent; color: var(--navy); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.tab:hover { background: rgba(255,255,255,.35); color: var(--navy); }
.tab[aria-current="page"] { background: #fff; }
.tab-outline { border: 2px solid var(--navy); }
.count { background: var(--go); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.count-navy { background: var(--navy); }

/* layout */
.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 64px; }
.page-center { display: flex; justify-content: center; padding-top: 72px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.row { display: flex; align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.between { justify-content: space-between; }
.split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.split-side { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .split, .split-side { grid-template-columns: minmax(0, 1fr); } .page { padding: 22px 16px 56px; } .topbar { padding: 8px 12px; } }

/* type */
.h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: -0.5px; line-height: 1.15; }
.h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 23px; line-height: 1.2; }
.muted { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.error { margin: 0; color: var(--bad); font-size: 14px; font-weight: 600; }
.small { font-size: 13.5px; color: var(--muted); }
.pre { white-space: pre-wrap; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* forms */
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-weight: 700; font-size: 15px; }
.input, .textarea, .select { width: 100%; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink); font-size: 16px; }
.input, .select { height: 48px; padding: 0 14px; }
.textarea { padding: 12px 14px; line-height: 1.55; resize: vertical; min-height: 120px; }
.input[aria-invalid="true"] { border-color: var(--bad); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; min-height: 36px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--go); margin: 0; }

/* buttons */
.btn { height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn-lg { height: 52px; font-size: 17px; }
.btn-primary { background: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-dk); color: #fff; }
.btn-go { background: var(--go); color: #fff; } .btn-go:hover { background: var(--go-dk); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line-2); color: var(--ink); } .btn-ghost:hover { border-color: var(--primary); color: var(--ink); }
.btn-danger { background: #fff; border-color: #E3B4B4; color: var(--bad); }
.btn-link { background: none; border: none; color: var(--primary); padding: 0 6px; height: 40px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-mark[aria-pressed="true"] { background: var(--mark); border-color: var(--mark); color: var(--ink); }
.icon-btn { width: 44px; height: 44px; border-radius: 999px; border: none; background: #fff; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; padding: 0; box-shadow: 0 1px 4px rgba(6,35,56,.25); }

/* chips */
.chip { display: inline-flex; align-items: center; font-weight: 700; font-size: 13px; padding: 5px 11px; border-radius: 999px; white-space: nowrap; }
.chip-wait { background: var(--wait-bg); color: var(--wait); }
.chip-go { background: var(--go-bg); color: var(--go-dk); }
.chip-solid { background: var(--go); color: #fff; font-size: 14px; padding: 7px 13px; }
.chip-gray { background: #E9EEF3; color: var(--ink-2); }
.chip-bad { background: var(--bad); color: #fff; }

/* login */
.login-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 20px; padding: 32px; }
.login-top { display: flex; align-items: center; justify-content: space-between; }
.lock-badge { width: 52px; height: 52px; border-radius: 14px; background: #E3F4FF; color: var(--primary); display: flex; align-items: center; justify-content: center; }
.client-logo-lg { width: 76px; height: 76px; object-fit: contain; }

/* client cards */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.client-card { text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px; color: var(--ink); }
.client-card:hover { border-color: var(--primary); }
.avatar { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: #fff; object-fit: contain; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--navy); flex-shrink: 0; }
.avatar-fill { background: #CFE6F5; border: none; }
.add-tile { border: 2px dashed #9FB3C3; background: var(--soft); border-radius: 16px; min-height: 170px; color: var(--primary); font-size: 16px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }

/* image tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.tile { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: #E9EEF3; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .num { position: absolute; top: 7px; left: 7px; background: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.tile .tile-actions { position: absolute; bottom: 6px; right: 6px; display: flex; gap: 4px; }
.tile .mini { width: 32px; height: 32px; border-radius: 999px; border: none; background: #fff; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; padding: 0; box-shadow: 0 1px 3px rgba(6,35,56,.3); }
.drop { aspect-ratio: 1 / 1; border-radius: 12px; border: 2px dashed #9FB3C3; background: var(--soft); color: var(--primary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 700; text-align: center; padding: 8px; }
.drop.over { border-color: var(--primary); background: #E3F4FF; }

/* preview */
.preview { overflow: hidden; padding: 0; }
.preview-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-weight: 700; }
.preview-media { position: relative; aspect-ratio: 1 / 1; background: #E9EEF3; }
.preview-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-count { position: absolute; top: 10px; right: 10px; background: rgba(14,34,48,.82); color: #fff; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 3px 10px; }
.preview-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 6px; }

/* list rows */
.list-row { display: flex; align-items: center; gap: 18px; padding: 16px 18px; }
.thumb { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; background: #E9EEF3; flex-shrink: 0; display: block; }
@media (max-width: 640px) { .list-row { flex-wrap: wrap; gap: 12px; } .list-row .thumb { width: 60px; height: 60px; } }

/* stage with markup */
.stage { position: relative; display: flex; justify-content: center; align-items: center; background: #0E2230; border-radius: 12px; padding: 10px; min-height: 280px; }
.stage-inner { position: relative; display: inline-block; line-height: 0; max-width: 100%; }
.stage-inner img { max-width: 100%; max-height: 64vh; display: block; user-select: none; -webkit-user-drag: none; }
.stage-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.stage.drawing svg { cursor: crosshair; }
.stage .nav-prev, .stage .nav-next { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.stage .nav-prev { left: 12px; } .stage .nav-next { right: 12px; }
.stage .removed-flag { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 2; }
.stage.is-removed img { opacity: .35; }
.mark-path { fill: none; stroke: var(--mark); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.markup-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mark-path-sm { fill: none; stroke: var(--mark); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.thumb-btn { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; border: 3px solid transparent; padding: 0; background: #E9EEF3; display: block; width: 100%; }
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-btn[aria-current="true"] { border-color: var(--primary); }
.thumb-btn.off img { opacity: .4; }
.thumb-btn .num { position: absolute; top: 5px; left: 5px; background: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 7px; line-height: 1.4; }
.thumb-btn .flag { position: absolute; bottom: 5px; right: 5px; background: var(--mark); color: var(--ink); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; line-height: 1.4; }

/* approved images */
.approved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.approved-img { position: relative; line-height: 0; border-radius: 12px; overflow: hidden; background: #E9EEF3; }
.approved-img img { width: 100%; display: block; }
.approved-img.off img { opacity: .35; }
.approved-img .num { position: absolute; top: 7px; left: 7px; background: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; line-height: 1.4; }
.approved-img .chip-bad { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); line-height: 1.2; }
.side-item { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 14px; background: #fff; border: 2px solid var(--line); color: var(--ink); width: 100%; }
.side-item[aria-current="true"] { border-color: var(--primary); }
.box { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-size: 15px; line-height: 1.55; }
.banner { border-radius: 12px; padding: 14px 18px; font-weight: 700; }
.banner-go { background: var(--go-bg); border: 1px solid #9CD3B9; color: var(--go-dk); }
.empty { border: 1px dashed var(--line-2); background: #fff; border-radius: 16px; padding: 28px; color: var(--muted); }
.secret { height: 44px; display: flex; align-items: center; padding: 0 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; overflow-x: auto; white-space: nowrap; }

/* dialog */
dialog { border: none; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(6,35,56,.35); }
dialog::backdrop { background: rgba(6,35,56,.5); }
.dialog-body { padding: 26px; display: flex; flex-direction: column; gap: 18px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; transition: transform .25s ease; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
