/* ===========================================================================
   ID Card Admin — "credentialing console" design system
   Deep pine command rail · document-paper canvas · brass action accent ·
   monospace serials as the subject-specific signature.
   =========================================================================== */

:root {
    /* Palette */
    --ink:       #17271f;
    --pine:      #1e3d2e;
    --pine-2:    #274d3a;
    --pine-3:    #2f5c45;
    --brass:     #b4884d;
    --brass-2:   #a3763c;
    --brass-ink: #6f5222;
    --paper:     #f4f6f2;
    --surface:   #ffffff;
    --surface-2: #fbfbf8;
    --line:      #e3e7df;
    --line-2:    #d3d9cf;
    --muted:     #6c7a70;
    --sage:      #8a978c;
    --success:   #3e7c57;
    --success-bg:#e9f2ec;
    --danger:    #b23a3a;
    --danger-bg: #f6e9e8;
    --warning:   #b9812a;
    --warning-bg:#f7efdd;
    --info:      #3a6a8a;
    --info-bg:   #e8eff4;

    --radius:    12px;
    --radius-sm: 8px;
    --shadow:    0 1px 2px rgba(23,39,31,.04), 0 8px 24px rgba(23,39,31,.06);
    --shadow-lg: 0 24px 60px rgba(23,39,31,.22);

    --font-display: "Archivo", system-ui, "Segoe UI", sans-serif;
    --font-body:    "Inter", system-ui, "Segoe UI", "Hind Siliguri", sans-serif;
    --font-bn:      "Hind Siliguri", "Noto Sans Bengali", system-ui, sans-serif;
    --font-mono:    "Spline Sans Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

    --sidebar-w: 264px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--paper);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--pine-2); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 4px; }

.serial {
    font-family: var(--font-mono);
    letter-spacing: .02em;
    font-feature-settings: "tnum" 1;
}
.bn { font-family: var(--font-bn); }

/* ---- App shell ---------------------------------------------------------- */
.nav-scrim { display: none; }
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
    background: linear-gradient(185deg, var(--pine) 0%, #182f24 100%);
    color: #e7ede8;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}

.brand { padding: 20px 22px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark {
    width: 38px; height: 38px; border-radius: 9px; flex: 0 0 auto;
    background: linear-gradient(150deg, var(--brass), #caa063);
    color: #21170a; display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 800; font-size: 18px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.brand-name { font-family: var(--font-display); font-weight: 650; font-size: 15px; letter-spacing: .01em; line-height: 1.15; }
.brand-sub { font-size: 11px; color: #9fb2a5; letter-spacing: .14em; text-transform: uppercase; margin-top: 2px; }

.nav { padding: 14px 12px; overflow-y: auto; flex: 1; }
.nav-group { margin-bottom: 18px; }
.nav-label { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: #8ba295; padding: 0 12px 8px; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 9px; color: #d5ded7;
    font-size: 14px; font-weight: 500; margin-bottom: 2px;
    border-left: 3px solid transparent; transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-item.is-active { background: rgba(180,136,77,.16); color: #fff; border-left-color: var(--brass); }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .85; }
.nav-item .lock { margin-left: auto; font-size: 10px; color: #8ba295; letter-spacing: .06em; }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #9fb2a5; }

/* ---- Main ---------------------------------------------------------------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 64px; background: var(--surface); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 16px; padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-family: var(--font-display); font-size: 19px; font-weight: 620; margin: 0; letter-spacing: -.01em; }
.topbar .eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--sage); }
.topbar-spacer { flex: 1; }

.admin-chip { display: flex; align-items: center; gap: 10px; }
.admin-avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--pine); color: #f0f4f1;
    display: grid; place-items: center; font-weight: 600; font-size: 14px; font-family: var(--font-display);
}
.admin-meta { line-height: 1.15; }
.admin-name { font-weight: 600; font-size: 13.5px; }
.admin-role { font-size: 11px; color: var(--muted); text-transform: capitalize; }

.hamburger { display: none; background: none; border: 1px solid var(--line-2); border-radius: 8px; width: 38px; height: 38px; cursor: pointer; }
.hamburger span, .hamburger span::before, .hamburger span::after {
    content: ""; display: block; width: 16px; height: 2px; background: var(--ink); margin: 0 auto; position: relative;
}
.hamburger span::before { position: absolute; top: -5px; }
.hamburger span::after { position: absolute; top: 5px; }

.content { padding: 26px 24px 40px; max-width: 1160px; width: 100%; }

/* ---- Flash --------------------------------------------------------------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.flash-success { background: var(--success-bg); border-color: #bfdbc9; color: #245c3c; }
.flash-error   { background: var(--danger-bg);  border-color: #e6c4c2; color: #8f2b2b; }
.flash-info    { background: var(--info-bg);    border-color: #c4d7e2; color: #2c5470; }
.flash-warning { background: var(--warning-bg); border-color: #e8d3a6; color: #8a6216; }

/* ---- Cards --------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.card-head h2 { font-family: var(--font-display); font-size: 15px; font-weight: 620; margin: 0; }
.card-head .eyebrow { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--sage); }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.section-head { margin: 0 0 18px; }
.section-head .eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--sage); }
.section-head h1 { font-family: var(--font-display); font-size: 24px; font-weight: 650; margin: 4px 0 0; letter-spacing: -.015em; }
.section-head p { color: var(--muted); margin: 6px 0 0; }

/* ---- Stat tiles (credential dossier style) ------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px; position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brass); opacity: .0; }
.stat.accent::before { opacity: 1; }
.stat .stat-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--sage); }
.stat .stat-value { font-family: var(--font-display); font-size: 30px; font-weight: 680; line-height: 1; margin-top: 8px; font-feature-settings: "tnum" 1; }
.stat .stat-foot { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat.tone-pending .stat-value { color: var(--warning); }
.stat.tone-approved .stat-value { color: var(--success); }
.stat.tone-generated .stat-value { color: var(--pine-2); }

/* ---- Ledger table -------------------------------------------------------- */
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger th { text-align: left; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--sage); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.ledger td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ledger tr:last-child td { border-bottom: none; }
.ledger tbody tr:hover { background: var(--surface-2); }
.ledger .empty { text-align: center; color: var(--muted); padding: 34px; }

/* ---- Badges -------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pending   { background: var(--warning-bg); color: var(--warning); }
.badge-approved  { background: var(--success-bg); color: var(--success); }
.badge-generated { background: #e7efe9; color: var(--pine-2); }
.badge-rejected  { background: var(--danger-bg); color: var(--danger); }
.badge-neutral   { background: #eef0ec; color: var(--muted); }

/* ---- Forms --------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #33443b; }
.field .req { color: var(--danger); }
.input, .select, .textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
    font: inherit; color: var(--ink); background: var(--surface); transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--pine-2); box-shadow: 0 0 0 3px rgba(39,77,58,.12); outline: none; }
.input.has-error, .select.has-error { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 6px; }
.form-help { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-weight: 600; font-size: 14px; padding: 11px 18px;
    border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; transition: background .12s, border-color .12s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brass); color: #211705; }
.btn-primary:hover { background: var(--brass-2); text-decoration: none; }
.btn-dark { background: var(--pine); color: #eef4f0; }
.btn-dark:hover { background: var(--pine-2); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---- Placeholder --------------------------------------------------------- */
.placeholder { text-align: center; padding: 56px 24px; }
.placeholder .ph-icon { width: 60px; height: 60px; border-radius: 14px; background: #eef0ec; display: grid; place-items: center; margin: 0 auto 18px; color: var(--sage); }
.placeholder h2 { font-family: var(--font-display); font-size: 20px; margin: 0 0 8px; }
.placeholder p { color: var(--muted); max-width: 460px; margin: 0 auto; }
.phase-tag { display: inline-block; margin-top: 16px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--brass-ink); background: var(--warning-bg); border: 1px solid #e8d3a6; padding: 5px 12px; border-radius: 999px; }

/* ===========================================================================
   Auth screen — the signature moment (credential on security paper)
   =========================================================================== */
.auth-body {
    margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 24px;
    color: var(--ink);
    background:
        radial-gradient(1200px 500px at 15% -10%, #24483706 0, transparent 60%),
        repeating-linear-gradient(45deg, #eef1ea 0 2px, transparent 2px 9px),
        repeating-linear-gradient(-45deg, #eef1ea 0 2px, transparent 2px 9px),
        linear-gradient(180deg, #f0f3ee, #e9ede6);
}

.credential {
    width: 100%; max-width: 420px; background: var(--surface);
    border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
    border: 1px solid var(--line);
}
.credential-strip {
    background: linear-gradient(120deg, var(--pine) 0%, #1a3327 100%);
    color: #eef4f0; padding: 22px 26px; position: relative;
}
.credential-strip::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
    background: linear-gradient(90deg, var(--brass), #d8b579, var(--brass));
}
.credential-strip .cs-mark {
    width: 42px; height: 42px; border-radius: 10px; background: linear-gradient(150deg, var(--brass), #caa063);
    color: #21170a; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 20px; margin-bottom: 14px;
}
.credential-strip h1 { font-family: var(--font-display); font-size: 18px; font-weight: 640; margin: 0; }
.credential-strip .cs-sub { font-size: 12px; color: #a9bcb0; margin-top: 4px; letter-spacing: .02em; }
.credential-strip .cs-serial { position: absolute; top: 22px; right: 26px; font-family: var(--font-mono); font-size: 11px; color: #8ba295; letter-spacing: .08em; }

.credential-body { padding: 26px; }
.credential-body h2 { font-family: var(--font-display); font-size: 16px; margin: 0 0 4px; }
.credential-body .lede { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.credential-foot { text-align: center; font-size: 12px; color: var(--muted); padding: 0 26px 22px; }
.credential-foot .serial { color: var(--sage); }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; z-index: 50; width: 82%; max-width: var(--sidebar-w);
        transform: translateX(-100%); transition: transform .2s ease;
    }
    .app-shell.nav-open .sidebar { transform: translateX(0); }
    .nav-scrim { display: none; position: fixed; inset: 0; background: rgba(20,30,24,.45); z-index: 40; }
    .app-shell.nav-open .nav-scrim { display: block; }
    .hamburger { display: inline-grid; place-items: center; }
    .content { padding: 20px 16px 36px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---- Phase 3: taxonomy CRUD utilities ------------------------------------ */
.page-actions { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.check { display: flex; align-items: center; gap: 9px; padding: 9px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--pine-2); }
.check label { margin: 0; font-weight: 500; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eef0ec; color: var(--muted); }
.chip-bn { font-family: var(--font-bn); }
.chip-key { font-family: var(--font-mono); background: #eef2ee; color: var(--pine-2); }
.chip-type { background: var(--info-bg); color: var(--info); text-transform: capitalize; }
.chip-lang { background: #f0ecf5; color: #6b4e8a; text-transform: uppercase; letter-spacing: .04em; }
.chip-auto { background: var(--warning-bg); color: var(--warning); }
.chip-off  { background: var(--danger-bg); color: var(--danger); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono  { font-family: var(--font-mono); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.inline-form { display: inline; margin: 0; }

.subpanel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 18px; }
.subpanel > .sp-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.subpanel > .sp-head h2 { font-family: var(--font-display); font-size: 15px; margin: 0; }
.subpanel > .sp-body { padding: 16px 18px; }
.sp-hint { color: var(--muted); font-size: 12.5px; }

.mini-form { background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 14px; }
.mini-form h3 { font-size: 13px; font-family: var(--font-display); margin: 0 0 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--sage); }

.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }
.field-sm label { font-size: 12px; }
.field-sm .input, .field-sm .select { padding: 8px 10px; font-size: 13.5px; }
.stack-sm > * + * { margin-top: 10px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }

/* ---- Phase 4: templates ---------------------------------------------------- */
.bg-thumb { width: 96px; height: 60px; border-radius: 6px; border: 1px solid var(--line-2); object-fit: cover; background: #f0f2ee; display: inline-block; }
.bg-slot { display: flex; gap: 16px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.bg-slot .bg-preview { width: 150px; height: 94px; border-radius: 8px; border: 1px solid var(--line-2); object-fit: contain; background: #eceee9 repeating-linear-gradient(45deg,#e6e9e3 0 6px,transparent 6px 12px); }
.bg-slot .bg-meta { flex: 1; }
.bg-slot h4 { margin: 0 0 4px; font-family: var(--font-display); font-size: 13.5px; }

/* ===========================================================================
   Card designer
   =========================================================================== */
.designer-body { margin: 0; background: #eceee9; color: var(--ink); }
.dz-top { height: 56px; background: var(--pine); color: #eef4f0; display: flex; align-items: center; gap: 14px; padding: 0 18px; position: sticky; top: 0; z-index: 30; }
.dz-top .dz-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.dz-top .dz-sub { color: #a9bcb0; font-size: 12px; }
.dz-top .spacer { flex: 1; }
.dz-side-toggle { display: inline-flex; background: rgba(255,255,255,.1); border-radius: 8px; padding: 3px; }
.dz-side-toggle button { background: none; border: 0; color: #cfe0d5; font: inherit; font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 6px; cursor: pointer; }
.dz-side-toggle button.on { background: var(--brass); color: #21170a; }

.dz-wrap { display: grid; grid-template-columns: 232px 1fr 280px; height: calc(100vh - 56px); }
.dz-panel { background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.dz-panel.right { border-right: 0; border-left: 1px solid var(--line); }
.dz-panel h3 { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--sage); margin: 0; padding: 16px 16px 8px; }
.dz-stage { display: grid; place-items: center; overflow: auto; padding: 30px; }

.palette-item { display: flex; align-items: center; gap: 8px; margin: 0 12px 6px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); cursor: pointer; font-size: 13px; transition: border-color .12s, background .12s; }
.palette-item:hover { border-color: var(--brass); background: #fff; }
.palette-item .pk { font-family: var(--font-mono); font-size: 10.5px; color: var(--sage); margin-left: auto; }
.palette-add { display: flex; gap: 8px; padding: 8px 12px 14px; flex-wrap: wrap; }
.palette-add button { flex: 1; min-width: 84px; }

.card-canvas { position: relative; background: #fff; box-shadow: 0 10px 40px rgba(23,39,31,.25); overflow: hidden; user-select: none; }
.card-canvas .bg-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.dz-el { position: absolute; box-sizing: border-box; border: 1px dashed transparent; cursor: move; overflow: hidden; line-height: 1.15; }
.dz-el:hover { border-color: rgba(180,136,77,.6); }
.dz-el.sel { border: 1px solid var(--brass); box-shadow: 0 0 0 2px rgba(180,136,77,.25); }
.dz-el .rz { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: var(--brass); border: 2px solid #fff; border-radius: 3px; cursor: se-resize; }
.dz-el.type-photo, .dz-el.type-qr { background: rgba(39,77,58,.06); border: 1px dashed var(--pine-3); display: grid; place-items: center; color: var(--pine-2); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.dz-el.type-qr { background: rgba(23,39,31,.06); }

.prop { padding: 4px 16px 18px; }
.prop .field { margin-bottom: 12px; }
.prop label { font-size: 11.5px; }
.prop .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.prop .seg { display: flex; gap: 4px; }
.prop .seg button { flex: 1; padding: 7px 0; border: 1px solid var(--line-2); background: var(--surface); border-radius: 6px; cursor: pointer; font-size: 12px; }
.prop .seg button.on { background: var(--pine); color: #fff; border-color: var(--pine); }
.dz-empty { color: var(--muted); font-size: 13px; padding: 20px 16px; }
.dz-hint { color: var(--sage); font-size: 11.5px; padding: 0 16px 14px; }

/* ===========================================================================
   Public applicant area
   =========================================================================== */
.pub-body { margin: 0; background:
    radial-gradient(1100px 460px at 90% -10%, rgba(180,136,77,.06) 0, transparent 60%),
    linear-gradient(180deg, #f6f8f4, #eef1ec); min-height: 100vh; }
.pub-header { background: var(--pine); color: #eef4f0; }
.pub-header .inner { max-width: 960px; margin: 0 auto; padding: 16px 20px; display: flex; align-items: center; gap: 12px; }
.pub-header .mark { width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(150deg, var(--brass), #caa063); color: #21170a; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; }
.pub-header .name { font-family: var(--font-display); font-weight: 650; font-size: 16px; }
.pub-header .sub { font-size: 11px; color: #a9bcb0; letter-spacing: .14em; text-transform: uppercase; }
.pub-nav { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pub-header a.track { color: #eef4f0; border: 1px solid rgba(255,255,255,.28); padding: 8px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600; }
.pub-header a.track:hover { background: rgba(255,255,255,.1); text-decoration: none; }
@media (max-width: 560px) { .pub-header .inner { align-items: flex-start; } .pub-nav { width: 100%; margin-left: 0; justify-content: flex-start; } }
.pub-main { max-width: 960px; margin: 0 auto; padding: 30px 20px 60px; }
.pub-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 24px; }

.pub-hero { margin-bottom: 26px; }
.pub-hero .eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--sage); }
.pub-hero h1 { font-family: var(--font-display); font-size: 30px; font-weight: 680; margin: 6px 0 8px; letter-spacing: -.02em; }
.pub-hero p { color: var(--muted); max-width: 560px; margin: 0; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.cat-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: transform .1s, box-shadow .12s, border-color .12s; }
.cat-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(23,39,31,.1); border-color: var(--brass); text-decoration: none; }
.cat-card .ct-orient { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--sage); }
.cat-card h3 { font-family: var(--font-bn); font-size: 19px; margin: 8px 0 4px; color: var(--ink); }
.cat-card .ct-en { color: var(--muted); font-size: 13px; }
.cat-card .ct-go { color: var(--brass-2); font-weight: 600; font-size: 13.5px; margin-top: 14px; display: inline-flex; gap: 6px; }

.pub-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pub-card .pc-head { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.pub-card .pc-head h1 { font-family: var(--font-bn); font-size: 22px; margin: 0; }
.pub-card .pc-head .pc-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.pub-card .pc-body { padding: 22px 24px; }

.form-section { margin-bottom: 26px; }
.form-section > .fs-title { font-family: var(--font-bn); font-size: 15px; font-weight: 600; color: var(--pine-2); margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.field-bn label { font-family: var(--font-bn); font-weight: 600; }
.translit-roman { margin-bottom: 6px; }
.translit-toggle { background: none; border: 0; color: var(--brass-2); font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 0; }
.translit-target { background: #fbfbf8; }
.req-star { color: var(--danger); }

.success-wrap { text-align: center; padding: 20px 0; }
.success-wrap .tick { width: 66px; height: 66px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: grid; place-items: center; margin: 0 auto 18px; }
.tracking-box { display: inline-block; margin: 14px 0; padding: 14px 22px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--surface-2); }
.tracking-box .lbl { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--sage); }
.tracking-box .val { font-family: var(--font-mono); font-size: 24px; font-weight: 600; letter-spacing: .06em; color: var(--pine-2); }

.timeline { display: flex; gap: 0; margin: 22px 0; }
.timeline .tl-step { flex: 1; text-align: center; position: relative; }
.timeline .tl-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--line); color: #fff; display: grid; place-items: center; margin: 0 auto 8px; font-size: 13px; position: relative; z-index: 2; }
.timeline .tl-step.done .tl-dot { background: var(--success); }
.timeline .tl-step::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 1; }
.timeline .tl-step:first-child::before { display: none; }
.timeline .tl-step.done::before { background: var(--success); }
.timeline .tl-label { font-size: 12.5px; color: var(--muted); }
.timeline .tl-step.done .tl-label { color: var(--ink); font-weight: 600; }
.status-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }

/* ---- Phase 6: applications ------------------------------------------------- */
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; }
.filter-pill:hover { border-color: var(--brass); text-decoration: none; }
.filter-pill.on { background: var(--pine); color: #fff; border-color: var(--pine); }
.filter-pill .n { font-size: 11px; opacity: .8; background: rgba(0,0,0,.08); padding: 1px 7px; border-radius: 999px; }
.filter-pill.on .n { background: rgba(255,255,255,.2); }

.search-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar .input, .search-bar .select { max-width: 260px; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 18px; }
.pager .muted { font-size: 13px; }

.app-detail { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .app-detail { grid-template-columns: 1fr; } }

.review-photo { width: 130px; height: 165px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line-2); background: #eef0ec; }
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
@media (max-width: 640px) { .review-grid { grid-template-columns: 1fr; } }
.review-row { padding: 9px 0; border-bottom: 1px solid var(--line); }
.review-row .rk { font-size: 11.5px; color: var(--sage); letter-spacing: .04em; }
.review-row .rv { font-size: 14.5px; margin-top: 2px; }
.review-section-title { font-family: var(--font-bn); font-size: 14px; font-weight: 600; color: var(--pine-2); margin: 18px 0 6px; }

.action-card { position: sticky; top: 84px; }
.action-btns { display: flex; flex-direction: column; gap: 8px; }
.doc-list a { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; font-size: 13px; background: var(--surface-2); }
.doc-list a:hover { border-color: var(--brass); text-decoration: none; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv .k { color: var(--muted); }
.notes-box { white-space: pre-wrap; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 220px; overflow-y: auto; }
details.action-more { border: 1px solid var(--line); border-radius: 8px; padding: 0; margin-bottom: 8px; }
details.action-more summary { padding: 10px 12px; cursor: pointer; font-weight: 600; font-size: 13.5px; list-style: none; }
details.action-more summary::-webkit-details-marker { display: none; }
details.action-more[open] summary { border-bottom: 1px solid var(--line); }
details.action-more .body { padding: 12px; }
.badge-payment-requested, .badge-payment-submitted { background: var(--info-bg); color: var(--info); }

/* ---- Phase 7: card generation & verify ------------------------------------ */
.gen-stage { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.gen-preview { display: flex; gap: 20px; flex-wrap: wrap; }
.gen-side { text-align: center; }
.gen-side canvas { border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); background: #fff; }
.gen-side-label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--sage); margin-bottom: 8px; }
.gen-status { color: var(--muted); font-size: 13.5px; margin: 12px 0; }

.verify-card { max-width: 460px; margin: 0 auto; text-align: center; }
.verify-badge { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; }
.verify-badge.ok { background: var(--success-bg); color: var(--success); }
.verify-badge.bad { background: var(--danger-bg); color: var(--danger); }
.verify-kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; text-align: left; }
.verify-kv .k { color: var(--muted); }
.verify-search-card { max-width: 560px; }
.verify-form { display: flex; gap: 10px; align-items: flex-end; }
@media (max-width: 560px) { .verify-form { flex-direction: column; align-items: stretch; } }

/* ---- Phase 8: notifications ------------------------------------------------ */
.quicklinks { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .stat-grid { grid-template-columns: 1fr; } }
.queue-nums { display: flex; gap: 18px; margin-top: 8px; font-size: 14px; }
.queue-nums strong { font-size: 20px; font-family: var(--font-display); }
.queue-nums .ok strong { color: var(--success); }
.queue-nums .bad strong { color: var(--danger); }
.switch-row { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.switch-row input { width: 16px; height: 16px; }
.select-sm, .input-sm { padding: 5px 8px; font-size: 13px; }
.token-hint { margin-top: 14px; font-size: 12.5px; color: var(--muted); line-height: 2; }
.token-hint .chip { cursor: default; }
.bg-slot .signature-preview { height: 70px; object-fit: contain; }
.dz-el.type-signature { background: rgba(39,77,58,.04); border: 1px dashed var(--pine-3); display: grid; place-items: center; color: var(--pine-2); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.dz-el.type-signature img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
