/* DURANGO CHECKPOINT — Windows 11 Fluent design system, light theme.
   Tokens follow WinUI 3 light: Mica base, layer cards, accent fill.
   Theme is intentionally locked to light — facility branding (logo on white)
   and front-desk readability beat OS preference here. */

:root {
    --accent: #0067c0;                /* overridden per-tenant inline */
    --mica: #f3f3f3;
    --layer: rgba(255, 255, 255, 0.7);
    --card: #ffffff;
    --stroke: rgba(0, 0, 0, 0.0578);
    --stroke-strong: rgba(0, 0, 0, 0.14);
    --text-primary: rgba(0, 0, 0, 0.894);
    --text-secondary: rgba(0, 0, 0, 0.606);
    --text-tertiary: rgba(0, 0, 0, 0.45);
    --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.04), 0 0 2px rgba(0, 0, 0, 0.06);
    --shadow-flyout: 0 8px 16px rgba(0, 0, 0, 0.14);
    --radius-overlay: 8px;
    --radius-control: 4px;
    --danger: #c42b1c;
    --success: #0f7b0f;
    --warn: #9d5d00;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--mica);
    background-image: radial-gradient(ellipse 80% 60% at 70% -10%,
        color-mix(in srgb, var(--accent) 7%, transparent), transparent);
    color: var(--text-primary);
    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    min-height: 100vh;
}

/* ---- Title bar ---- */
.titlebar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--layer);
    backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid var(--stroke);
    position: sticky;
    top: 0;
    z-index: 10;
}
.titlebar .app-shield {
    width: 18px; height: 18px; flex: none; color: var(--accent);
}
.titlebar .app-shield .pulse-dot {
    animation: shield-pulse 2.4s ease-in-out infinite;
    transform-origin: center;
}
@media (prefers-reduced-motion: reduce) {
    .titlebar .app-shield .pulse-dot { animation: none; }
}
@keyframes shield-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}
.titlebar .app-name { font-size: 12px; color: var(--text-secondary); }
.titlebar .app-name b { color: var(--text-primary); font-weight: 600; }
.titlebar .spacer { flex: 1; }
.titlebar a { color: var(--text-secondary); text-decoration: none; font-size: 12px; padding: 6px 10px; border-radius: var(--radius-control); }
.titlebar a:hover { background: rgba(127,127,127,0.12); color: var(--text-primary); }
.titlebar a:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 1px; }

/* ---- Layout ---- */
.page { max-width: 560px; margin: 0 auto; padding: 32px 20px 60px; }
.page-wide { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }

h1.title { font-family: "Segoe UI Variable Display", "Segoe UI", sans-serif; font-size: 28px; font-weight: 600; margin: 0 0 4px; }
p.subtitle { color: var(--text-secondary); margin: 0 0 24px; }

/* ---- Cards ---- */
.card {
    background: var(--card);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-overlay);
    box-shadow: var(--shadow-card);
    padding: 24px;
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 18px; font-weight: 600; margin: 0 0 14px; }

/* ---- WinUI text inputs: bottom accent underline on focus ---- */
.form-group { margin-bottom: 18px; }
label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-primary); font-weight: 400; }
input[type="text"], input[type="password"], select {
    width: 100%;
    padding: 9px 12px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--card) 92%, var(--text-primary) 3%);
    border: 1px solid var(--stroke-strong);
    border-bottom: 1.5px solid color-mix(in srgb, var(--text-primary) 42%, transparent);
    border-radius: var(--radius-control);
    outline: none;
    transition: border-color .1s ease, background .1s ease;
}
input:hover, select:hover { background: color-mix(in srgb, var(--card) 97%, var(--text-primary) 3%); }
input:focus, select:focus {
    background: var(--card);
    border-bottom: 2.5px solid var(--accent);
    padding-bottom: 8px;   /* compensate thicker underline */
}
input:disabled, select:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-control);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: filter .08s ease, background .08s ease, transform .05s ease;
}
.btn-accent { background: var(--accent); color: #fff; border-color: rgba(0,0,0,0.1); width: 100%; padding: 13px 22px; font-size: 15px; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-accent:active { filter: brightness(0.92); transform: scale(0.995); }
.btn-accent:disabled { filter: grayscale(0.4) brightness(0.9); cursor: not-allowed; }
.btn-standard { background: color-mix(in srgb, var(--card) 96%, var(--text-primary) 4%); color: var(--text-primary); border-color: var(--stroke-strong); }
.btn-standard:hover { background: color-mix(in srgb, var(--card) 90%, var(--text-primary) 6%); }
.btn-small { padding: 5px 12px; font-size: 12px; font-weight: 400; }
.btn-danger-text { background: transparent; color: var(--danger); border-color: var(--stroke-strong); }
.btn-danger-text:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
:where(a.btn, button.btn):focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
input:focus-visible, select:focus-visible { outline: none; }

/* ---- Segmented (kiosk mode switch) ---- */
.segmented { display: flex; gap: 4px; background: rgba(127,127,127,0.12); padding: 4px; border-radius: var(--radius-overlay); margin-bottom: 24px; }
.segmented a {
    flex: 1; text-align: center; padding: 9px 12px; border-radius: 5px;
    text-decoration: none; color: var(--text-secondary); font-weight: 600; font-size: 14px;
}
.segmented a.active { background: var(--card); color: var(--text-primary); box-shadow: var(--shadow-card); }

/* ---- InfoBar ---- */
.infobar {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: var(--radius-control);
    border: 1px solid var(--stroke); font-size: 13px; margin-bottom: 18px;
}
.infobar.warn { background: color-mix(in srgb, var(--warn) 16%, var(--card)); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.infobar.error { background: color-mix(in srgb, var(--danger) 12%, var(--card)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.infobar.ok { background: color-mix(in srgb, var(--success) 14%, var(--card)); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success); }

/* ---- Dashboard ---- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
    background: var(--card); border: 1px solid var(--stroke);
    border-radius: var(--radius-overlay); box-shadow: var(--shadow-card);
    padding: 16px 18px;
}
.stat .n { font-family: "Segoe UI Variable Display", "Segoe UI", sans-serif; font-size: 30px; font-weight: 600; line-height: 1.1; }
.stat .n.accent { color: var(--accent); }
.stat .l { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
    text-align: left; padding: 8px 12px; color: var(--text-secondary);
    font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--stroke-strong);
}
table.grid td { padding: 9px 12px; border-bottom: 1px solid var(--stroke); }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: rgba(127,127,127,0.05); }

.badge-chip {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent); font-weight: 600; font-size: 12px;
}
.action-chip {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .02em;
}
.action-chip.ok { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.action-chip.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.action-chip.danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.action-chip.neutral { background: rgba(127,127,127,0.16); color: var(--text-secondary); }
.pill-open { color: var(--success); font-weight: 600; }
.muted { color: var(--text-tertiary); }
.mono { font-family: "Cascadia Code", "Consolas", ui-monospace, monospace; font-size: 12px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.toolbar input[type="date"] {
    padding: 6px 10px; border: 1px solid var(--stroke-strong);
    border-radius: var(--radius-control); font-family: inherit; font-size: 13px;
    background: var(--card); color: var(--text-primary);
}

/* ---- Success screen ---- */
.success-icon {
    width: 64px; height: 64px; border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent); font-size: 30px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px;
}
.center { text-align: center; }
.badge-big {
    font-family: "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: 40px; font-weight: 700; color: var(--accent); letter-spacing: 1px;
}

/* ---- Lockout / attempts meter (login) ---- */
.attempts-meter { display: flex; gap: 4px; margin: 4px 0 18px; }
.attempts-meter span {
    flex: 1; height: 4px; border-radius: 2px; background: rgba(127,127,127,0.2);
}
.attempts-meter span.used { background: var(--danger); }
.lock-countdown {
    font-family: "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: 22px; font-weight: 600; color: var(--danger);
}

/* ---- Toasts ---- */
.toast-stack {
    position: fixed; bottom: 20px; right: 20px; z-index: 100;
    display: flex; flex-direction: column; gap: 8px; max-width: 320px;
}
.toast {
    background: var(--card); border: 1px solid var(--stroke-strong);
    box-shadow: var(--shadow-flyout); border-radius: var(--radius-control);
    padding: 10px 14px; font-size: 13px; display: flex; gap: 8px; align-items: center;
    animation: toast-in .18s ease-out both;
}
.toast.ok { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---- Error page ---- */
.error-code {
    font-family: "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: 56px; font-weight: 700; color: var(--text-tertiary); line-height: 1;
}

@media (prefers-reduced-motion: no-preference) {
    .card, .stat { animation: rise .18s ease-out both; }
    @keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
@media (max-width: 640px) {
    .page, .page-wide { padding: 20px 12px 40px; }
    .card { padding: 18px; }
    table.grid .hide-sm { display: none; }
    .toast-stack { left: 12px; right: 12px; max-width: none; }
}

/* ---- Tabs (WinUI top NavigationView: sliding underline indicator) ---- */
.tabs {
    display: flex; gap: 2px; border-bottom: 1px solid var(--stroke-strong);
    margin: 0 0 20px; overflow-x: auto;
}
.tabs button {
    appearance: none; background: none; border: none; cursor: pointer;
    font-family: inherit; font-size: 14px; font-weight: 400;
    color: var(--text-secondary); padding: 10px 14px 12px;
    border-radius: var(--radius-control) var(--radius-control) 0 0;
    position: relative; white-space: nowrap;
}
.tabs button:hover { background: rgba(127,127,127,0.08); color: var(--text-primary); }
.tabs button:focus-visible { outline: 2px solid var(--text-primary); outline-offset: -2px; }
.tabs button[aria-selected="true"] { color: var(--text-primary); font-weight: 600; }
.tabs button[aria-selected="true"]::after {
    content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px;
    height: 3px; border-radius: 2px; background: var(--accent);
}
.tabs .tab-count {
    display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px;
    background: rgba(127,127,127,0.16); color: var(--text-secondary);
    font-size: 11px; font-weight: 600; line-height: 18px; vertical-align: 1px;
}
.tab-panel[hidden] { display: none; }

/* ---- "?" tooltips (Fluent flyout style) ---- */
.tip { position: relative; display: inline-flex; vertical-align: middle; margin-left: 6px; }
.tip-btn {
    appearance: none; border: 1px solid var(--stroke-strong); background: var(--card);
    color: var(--text-secondary); cursor: help;
    width: 17px; height: 17px; border-radius: 50%;
    font-size: 11px; font-weight: 700; line-height: 1; font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.tip-btn:hover, .tip-btn:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.tip-bubble {
    position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    width: max-content; max-width: 260px; z-index: 60;
    background: var(--card); color: var(--text-primary);
    border: 1px solid var(--stroke-strong); border-radius: var(--radius-control);
    box-shadow: var(--shadow-flyout); padding: 8px 11px;
    font-size: 12px; font-weight: 400; line-height: 1.5; text-align: left;
    opacity: 0; visibility: hidden; transition: opacity .1s ease;
    pointer-events: none;
}
.tip-bubble::after {
    content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: var(--stroke-strong);
}
.tip:hover .tip-bubble, .tip:focus-within .tip-bubble { opacity: 1; visibility: visible; }
.tip-bubble.tip-left { left: auto; right: -8px; transform: none; }
.tip-bubble.tip-left::after { left: auto; right: 12px; transform: none; }
@media (prefers-reduced-motion: reduce) { .tip-bubble { transition: none; } }
@media (max-width: 640px) { .tip-bubble { max-width: 200px; } }

/* ---- Admin console identity ---- */
.admin-badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent); font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
}
.facility-tile {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; border: 1px solid var(--stroke);
    border-radius: var(--radius-overlay); background: var(--card);
    box-shadow: var(--shadow-card); margin-bottom: 10px;
}
.facility-tile .swatch { width: 34px; height: 34px; border-radius: var(--radius-overlay); flex: none; border: 1px solid var(--stroke-strong); }
.facility-tile .meta { flex: 1; min-width: 0; }
.facility-tile .meta .name { font-weight: 600; }
.facility-tile .meta .id { font-size: 12px; color: var(--text-tertiary); }
.facility-tile .counts { display: flex; gap: 16px; text-align: center; }
.facility-tile .counts .c { font-size: 18px; font-weight: 600; font-family: "Segoe UI Variable Display", "Segoe UI", sans-serif; }
.facility-tile .counts .cl { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .04em; }
textarea.code-edit {
    width: 100%; min-height: 180px; resize: vertical;
    font-family: "Cascadia Code", "Consolas", ui-monospace, monospace; font-size: 12px;
    color: var(--text-primary); background: color-mix(in srgb, var(--card) 92%, var(--text-primary) 3%);
    border: 1px solid var(--stroke-strong); border-radius: var(--radius-control);
    padding: 10px 12px; outline: none; line-height: 1.55;
}
textarea.code-edit:focus { border-bottom: 2.5px solid var(--accent); }

/* ---- Live status indicator ---- */
.live-wrap { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; font-size: 11px; font-weight: 600; color: var(--success); vertical-align: 2px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
@media (prefers-reduced-motion: no-preference) {
    .live-dot { animation: live-pulse 2s ease-in-out infinite; }
    @keyframes live-pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 45%, transparent); }
                            60% { box-shadow: 0 0 0 6px transparent; } }
}
.live-wrap.stale { color: var(--warn); }
.live-wrap.stale .live-dot { background: var(--warn); animation: none; }
.updated-at { font-size: 11px; color: var(--text-tertiary); font-weight: 400; }

/* ---- Facility logo ---- */
.titlebar .brand-logo { height: 30px; width: auto; display: block; border-radius: 3px; }
.page-logo { display: block; margin: 0 auto 18px; max-width: 260px; max-height: 110px; width: auto; height: auto; }
.pdf-note { font-size: 12px; color: var(--text-tertiary); }

/* ---- Demo sandbox banner ---- */
.demo-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 9px 20px; font-size: 12.5px;
    background: color-mix(in srgb, var(--warn) 14%, var(--card));
    border-bottom: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
    color: var(--warn);
}
.demo-bar b { color: var(--warn); }
.demo-bar .spacer { flex: 1; }
.demo-bar form { margin: 0; }
.demo-bar button {
    appearance: none; font-family: inherit; font-size: 12px; font-weight: 600;
    padding: 4px 12px; border-radius: var(--radius-control); cursor: pointer;
    background: var(--card); color: var(--text-primary);
    border: 1px solid var(--stroke-strong);
}
.demo-bar button:hover { background: color-mix(in srgb, var(--card) 90%, var(--text-primary) 6%); }
.demo-bar a { color: var(--warn); font-weight: 600; }

/* ---- Discreet staff link at the foot of the kiosk ---- */
.kiosk-foot {
    margin-top: 26px; text-align: center;
    font-size: 12px; color: var(--text-tertiary);
}
.kiosk-foot a { color: var(--text-tertiary); text-decoration: none; }
.kiosk-foot a:hover { color: var(--accent); text-decoration: underline; }
.kiosk-foot a:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; border-radius: 3px; }
