/* ==========================================================================
   FikaFlow — design system
   Light + dark themes, modern SaaS visual language.
   ========================================================================== */

:root {
    /* Surfaces */
    --bg:              #f6f7fb;
    --bg-grad:         radial-gradient(1200px 600px at 20% -10%, #eef0ff 0%, transparent 60%),
                       radial-gradient(900px 500px at 100% 10%, #f1ebff 0%, transparent 60%),
                       #f6f7fb;
    --surface:         #ffffff;
    --surface-2:       #f1f3f9;
    --surface-elev:    #ffffff;
    --surface-glass:   rgba(255,255,255,0.72);

    /* Borders */
    --border:          #e6e8ef;
    --border-strong:   #d3d7e0;

    /* Foreground */
    --fg:              #0b1020;
    --fg-soft:         #1f2638;
    --fg-muted:        #5b6478;
    --fg-subtle:       #8b94a6;

    /* Brand */
    --brand:           #5b6cff;
    --brand-2:         #7c3aed;
    --brand-soft:      rgba(91,108,255,0.10);
    --brand-grad:      linear-gradient(135deg, #5b6cff 0%, #7c3aed 100%);

    /* Semantic */
    --green:           #10b981;
    --green-2:         #059669;
    --green-soft:      rgba(16,185,129,0.10);
    --red:             #ef4444;
    --red-2:           #dc2626;
    --red-soft:        rgba(239,68,68,0.10);
    --orange:          #f59e0b;
    --orange-soft:     rgba(245,158,11,0.12);
    --info:            #3b82f6;

    /* Effects */
    --shadow-xs:       0 1px 2px rgba(15,23,42,0.05);
    --shadow-sm:       0 2px 4px rgba(15,23,42,0.04), 0 1px 2px rgba(15,23,42,0.06);
    --shadow:          0 4px 16px rgba(15,23,42,0.06), 0 2px 4px rgba(15,23,42,0.04);
    --shadow-lg:       0 24px 48px -12px rgba(15,23,42,0.18), 0 8px 16px rgba(15,23,42,0.06);
    --shadow-glow:     0 0 0 6px var(--brand-soft);

    --radius-sm:       10px;
    --radius:          14px;
    --radius-lg:       20px;
    --radius-xl:       28px;
    --radius-pill:     999px;

    --ease:            cubic-bezier(0.22, 1, 0.36, 1);
    --dur:             180ms;
    --dur-lg:          280ms;
}

[data-theme="dark"] {
    --bg:              #0a0d18;
    --bg-grad:         radial-gradient(1200px 600px at 20% -10%, rgba(91,108,255,0.18) 0%, transparent 55%),
                       radial-gradient(900px 500px at 100% 10%, rgba(124,58,237,0.18) 0%, transparent 55%),
                       #0a0d18;
    --surface:         #11151f;
    --surface-2:       #161b27;
    --surface-elev:    #161b27;
    --surface-glass:   rgba(22,27,39,0.72);

    --border:          #1f2533;
    --border-strong:   #2b3243;

    --fg:              #eef1f8;
    --fg-soft:         #d6dae5;
    --fg-muted:        #8a93a7;
    --fg-subtle:       #5e6678;

    --brand:           #818cf8;
    --brand-2:         #a78bfa;
    --brand-soft:      rgba(129,140,248,0.16);
    --brand-grad:      linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);

    --green:           #34d399;
    --green-2:         #10b981;
    --green-soft:      rgba(52,211,153,0.14);
    --red:             #f87171;
    --red-2:           #ef4444;
    --red-soft:        rgba(248,113,113,0.14);
    --orange:          #fbbf24;
    --orange-soft:     rgba(251,191,36,0.14);
    --info:            #60a5fa;

    --shadow-xs:       0 1px 2px rgba(0,0,0,0.4);
    --shadow-sm:       0 2px 4px rgba(0,0,0,0.4);
    --shadow:          0 8px 24px rgba(0,0,0,0.45);
    --shadow-lg:       0 24px 48px -12px rgba(0,0,0,0.6), 0 8px 16px rgba(0,0,0,0.35);
    --shadow-glow:     0 0 0 6px var(--brand-soft);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light dark; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-feature-settings: "cv11", "ss01";
    color: var(--fg);
    background: var(--bg);
    background-image: var(--bg-grad);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    min-height: 100vh;
    transition: background-color var(--dur-lg) var(--ease), color var(--dur-lg) var(--ease);
}

button { font-family: inherit; }
a { color: var(--brand); text-decoration: none; }
code { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ==========================================================================
   App shell
   ========================================================================== */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 28px;
    background: var(--surface-glass);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.app-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 18px; font-weight: 700; letter-spacing: -0.2px;
    color: var(--fg);
}
.app-title .brand-mark {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: var(--brand-grad);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.25);
}

.app-topbar-nav { display: flex; align-items: center; gap: 6px; }
.app-topbar-nav a {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--fg-muted);
    font-weight: 600; font-size: 14px;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.app-topbar-nav a:hover { background: var(--surface-2); color: var(--fg); }

.app-main {
    flex: 1;
    display: flex;
    width: 100%;
}

.page-pad {
    flex: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 28px 56px;
    animation: fadeUp var(--dur-lg) var(--ease) both;
}

.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 24px;
}
.page-head h1 {
    font-size: 32px; font-weight: 800;
    margin: 0; letter-spacing: -0.6px;
    background: linear-gradient(180deg, var(--fg) 0%, var(--fg-soft) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.title-success { background: linear-gradient(180deg, var(--green-2) 0%, var(--green) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.title-danger  { background: linear-gradient(180deg, var(--red-2) 0%, var(--red) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 18px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 14px; font-weight: 600; letter-spacing: 0.1px;
    cursor: pointer;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
    user-select: none; white-space: nowrap;
}
.btn-primary {
    background: var(--brand-grad); color: #fff;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.18); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-secondary {
    background: var(--surface);
    color: var(--fg);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-danger {
    background: var(--red); color: #fff;
}
.btn-danger:hover { background: var(--red-2); }

.btn-ghost {
    background: transparent;
    color: var(--fg-muted);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--fg); }

.btn-icon {
    width: 38px; height: 38px; padding: 0;
    border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--border);
    color: var(--fg-muted);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    transition: all var(--dur) var(--ease);
}
.btn-icon:hover { background: var(--surface-2); color: var(--fg); }

/* ==========================================================================
   Cards & metrics
   ========================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-xs);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.metric-label {
    font-size: 12px; font-weight: 600; letter-spacing: 0.6px;
    color: var(--fg-muted); text-transform: uppercase;
    display: flex; align-items: center; gap: 8px;
}
.metric-value {
    font-size: 32px; font-weight: 800; letter-spacing: -0.4px;
    margin-top: 8px; color: var(--fg);
}
.metric-sub { font-size: 13px; color: var(--fg-subtle); margin-top: 4px; }
.metric-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.metric-dot.green { background: var(--green); }
.metric-dot.orange { background: var(--orange); }
.metric-dot.red { background: var(--red); }

/* ==========================================================================
   Home action cards
   ========================================================================== */

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
@media (max-width: 900px) {
    .action-grid { grid-template-columns: 1fr; }
}

.action-card {
    position: relative;
    display: flex; flex-direction: column; justify-content: space-between;
    min-height: 240px;
    padding: 28px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    overflow: hidden;
    transition: transform var(--dur-lg) var(--ease), box-shadow var(--dur-lg) var(--ease), border-color var(--dur-lg) var(--ease);
    text-align: left;
}
.action-card::before {
    content: ""; position: absolute; inset: 0;
    background: var(--accent-grad, var(--brand-grad));
    opacity: 0; transition: opacity var(--dur-lg) var(--ease);
    z-index: 0;
}
.action-card > * { position: relative; z-index: 1; }
.action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}
.action-card:hover::before { opacity: 1; }
.action-card:hover .action-icon,
.action-card:hover .action-title,
.action-card:hover .action-desc,
.action-card:hover .action-cta { color: #fff; }
.action-card:hover .action-icon-wrap { background: rgba(255,255,255,0.18); }
.action-card:active { transform: translateY(-2px); }

.action-icon-wrap {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: var(--accent-soft, var(--brand-soft));
    display: flex; align-items: center; justify-content: center;
    transition: background var(--dur-lg) var(--ease);
}
.action-icon { color: var(--accent, var(--brand)); transition: color var(--dur-lg) var(--ease); }

.action-title { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; margin-top: 24px; color: var(--fg); transition: color var(--dur-lg) var(--ease); }
.action-desc { color: var(--fg-muted); margin-top: 6px; font-size: 14px; transition: color var(--dur-lg) var(--ease); }
.action-cta {
    margin-top: 20px;
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--accent, var(--brand)); font-weight: 700; font-size: 14px;
    transition: color var(--dur-lg) var(--ease);
}

.action-card.success { --accent: var(--green); --accent-soft: var(--green-soft); --accent-grad: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.action-card.danger  { --accent: var(--red);   --accent-soft: var(--red-soft);   --accent-grad: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }
.action-card.brand   { --accent: var(--brand); --accent-soft: var(--brand-soft); --accent-grad: var(--brand-grad); }

/* ==========================================================================
   Scan listening panel
   ========================================================================== */

.scan-panel {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 80px 24px;
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    text-align: center;
}
.scan-panel.success { box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(16,185,129,0.18); }
.scan-panel.danger  { box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(239,68,68,0.18); }

.scan-radar {
    position: relative;
    width: 160px; height: 160px;
    display: flex; align-items: center; justify-content: center;
}
.scan-radar .pulse {
    position: absolute; inset: 0;
    border-radius: 50%;
    border: 2px solid var(--brand);
    opacity: 0;
    animation: pulseRing 2s var(--ease) infinite;
}
.scan-radar .pulse:nth-child(2) { animation-delay: 0.6s; }
.scan-radar .pulse:nth-child(3) { animation-delay: 1.2s; }
.scan-radar .core {
    position: relative;
    width: 88px; height: 88px;
    border-radius: 50%;
    background: var(--brand-grad);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 12px 40px -8px rgba(91,108,255,0.5), inset 0 1px 0 rgba(255,255,255,0.25);
}
.scan-panel.success .scan-radar .pulse { border-color: var(--green); }
.scan-panel.success .scan-radar .core  { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 12px 40px -8px rgba(16,185,129,0.45), inset 0 1px 0 rgba(255,255,255,0.25); }
.scan-panel.danger .scan-radar .pulse  { border-color: var(--red); }
.scan-panel.danger .scan-radar .core   { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 12px 40px -8px rgba(239,68,68,0.4), inset 0 1px 0 rgba(255,255,255,0.25); }

.scan-title {
    margin-top: 32px;
    font-size: 28px; font-weight: 800; letter-spacing: -0.4px;
    color: var(--fg);
}
.scan-sub { margin-top: 6px; color: var(--fg-muted); font-size: 15px; }
.scan-barcode { margin-top: 10px; font-size: 13px; color: var(--fg-subtle); }

@keyframes pulseRing {
    0%   { transform: scale(0.5); opacity: 0.7; }
    80%  { transform: scale(1.4); opacity: 0; }
    100% { opacity: 0; }
}

/* ==========================================================================
   Product result card (scan response)
   ========================================================================== */

.product-result {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow);
    animation: popIn var(--dur-lg) var(--ease) both;
    position: relative;
    overflow: hidden;
}
.product-result.level-success::before,
.product-result.level-warn::before,
.product-result.level-danger::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
}
.product-result.level-success::before { background: var(--green); }
.product-result.level-warn::before    { background: var(--orange); }
.product-result.level-danger::before  { background: var(--red); }

.product-result-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; flex-wrap: wrap;
}
.product-image {
    width: 88px; height: 88px;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--surface-2);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.product-result-name { font-size: 24px; font-weight: 800; letter-spacing: -0.3px; color: var(--fg); }
.product-result-sub  { color: var(--fg-muted); font-size: 14px; margin-top: 4px; }

.product-result-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 28px;
    margin: 24px 0 8px 0;
}
.kv {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 15px;
}
.kv span { color: var(--fg-muted); }
.kv strong { color: var(--fg); font-weight: 700; }
.kv strong.big { font-size: 26px; letter-spacing: -0.3px; }

.product-result-actions {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    margin-top: 20px;
}
@media (max-width: 700px) { .product-result-actions { grid-template-columns: 1fr; } }

/* ==========================================================================
   Status pill / badges
   ========================================================================== */

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 700; letter-spacing: 0.4px;
    text-transform: uppercase;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-success { background: var(--green-soft); color: var(--green-2); }
.pill-warn    { background: var(--orange-soft); color: #b45309; }
.pill-danger  { background: var(--red-soft); color: var(--red-2); }
.pill-info    { background: var(--brand-soft); color: var(--brand); }
.pill-neutral { background: var(--surface-2); color: var(--fg-muted); }
[data-theme="dark"] .pill-warn { color: var(--orange); }

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 700;
}
.badge-success { background: var(--green-soft); color: var(--green-2); }
.badge-warn    { background: var(--orange-soft); color: #b45309; }
.badge-danger  { background: var(--red-soft); color: var(--red-2); }
[data-theme="dark"] .badge-warn { color: var(--orange); }

/* ==========================================================================
   Confirmation banner (check-in / check-out)
   ========================================================================== */

.confirm-hero {
    display: flex; align-items: center; gap: 18px;
    padding: 22px 28px;
    border-radius: var(--radius-xl);
    color: #fff;
    font-size: 22px; font-weight: 800; letter-spacing: 0.4px;
    box-shadow: var(--shadow);
    animation: popIn var(--dur-lg) var(--ease) both;
    margin-bottom: 16px;
}
.confirm-hero .check {
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(255,255,255,0.22);
    display: flex; align-items: center; justify-content: center;
}
.confirm-hero.success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.confirm-hero.danger  { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }

.qty-flow { display: flex; align-items: baseline; gap: 14px; font-weight: 700; }
.qty-flow .from { color: var(--fg-muted); font-size: 22px; }
.qty-flow .arrow { color: var(--fg-subtle); }
.qty-flow .to { font-size: 56px; font-weight: 900; letter-spacing: -1px; background: var(--brand-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.warn-banner {
    margin-top: 18px; padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px; font-weight: 700; letter-spacing: 0.6px;
    display: inline-flex; align-items: center; gap: 8px;
    text-transform: uppercase;
}
.warn-banner.warn-danger { background: var(--red-soft); color: var(--red-2); }
.warn-banner.warn-low    { background: var(--orange-soft); color: #b45309; }
[data-theme="dark"] .warn-banner.warn-low { color: var(--orange); }

.session-counter {
    display: inline-flex; align-items: center; gap: 12px;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 14px; color: var(--fg-muted);
    box-shadow: var(--shadow-xs);
}
.session-counter strong { color: var(--fg); font-size: 18px; font-weight: 800; }

/* ==========================================================================
   Inputs / search / filters
   ========================================================================== */

.search-row { display: flex; gap: 10px; margin-bottom: 16px; }
.input, .search-input, .form-grid input, .modal textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg);
    font-size: 14px;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.input::placeholder, .search-input::placeholder { color: var(--fg-subtle); }
.input:focus, .search-input:focus, .form-grid input:focus, .modal textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-soft);
}

.filter-row { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chip {
    padding: 8px 14px; border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--fg-muted);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}
.filter-chip:hover { color: var(--fg); border-color: var(--border-strong); }
.filter-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.filter-chip.filter-warn.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.filter-chip.filter-danger.active { background: var(--red); border-color: var(--red); color: #fff; }
.filter-meta { color: var(--fg-subtle); font-size: 13px; margin-left: 6px; }

/* ==========================================================================
   Data table
   ========================================================================== */

.data-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.admin-table {
    width: 100%;
    border-collapse: separate; border-spacing: 0;
    font-size: 14px;
}
.admin-table th, .admin-table td {
    text-align: left; padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.admin-table thead th {
    background: var(--surface-2);
    font-size: 12px; font-weight: 700; color: var(--fg-muted);
    letter-spacing: 0.4px; text-transform: uppercase;
}
.admin-table tbody tr { transition: background var(--dur) var(--ease); }
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table code {
    font-size: 12px;
    padding: 3px 8px; border-radius: 6px;
    background: var(--surface-2); color: var(--fg-soft);
}
.muted { color: var(--fg-muted); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn-secondary, .row-actions .btn-danger { padding: 7px 12px; font-size: 13px; }

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(11, 16, 32, 0.55);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; padding: 24px;
    animation: fadeIn var(--dur) var(--ease);
}
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 100%; max-width: 880px;
    max-height: 90vh; overflow: auto;
    box-shadow: var(--shadow-lg);
    animation: popIn var(--dur-lg) var(--ease);
}
.modal h2 { margin: 0 0 18px 0; font-size: 22px; letter-spacing: -0.3px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid label, .modal label.full {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 12px; font-weight: 600; color: var(--fg-muted);
    letter-spacing: 0.3px; text-transform: uppercase;
}
.modal label.full { margin-top: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* Empty / loading */
.empty-state {
    padding: 60px 24px; text-align: center;
    color: var(--fg-muted);
}
.empty-state .empty-title { font-size: 18px; font-weight: 700; color: var(--fg); margin-bottom: 6px; }

/* Alerts */
.alert {
    padding: 14px 18px; border-radius: var(--radius);
    font-size: 14px;
    border: 1px solid var(--border);
}
.alert-warn { background: var(--orange-soft); border-color: rgba(245,158,11,0.3); color: #b45309; }
[data-theme="dark"] .alert-warn { color: var(--orange); }

/* ==========================================================================
   Flash toast
   ========================================================================== */

.flash {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
    padding: 14px 22px;
    border-radius: var(--radius);
    font-size: 14px; font-weight: 700; letter-spacing: 0.4px;
    color: #fff;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 10px;
    animation: slideDown var(--dur-lg) var(--ease);
}
.flash-success { background: linear-gradient(135deg, #10b981, #059669); }
.flash-danger  { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.flash-info    { background: var(--brand-grad); }

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn    { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes slideDown { from { opacity: 0; transform: translate(-50%, -16px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* Selection */
::selection { background: var(--brand-soft); color: var(--fg); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-subtle); background-clip: padding-box; }

/* Focus visible */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* Validation */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--green); }
.invalid { outline: 1px solid var(--red); }
.validation-message { color: var(--red); font-size: 12px; }

#blazor-error-ui {
    background: var(--surface); border: 1px solid var(--red);
    color: var(--fg); border-radius: var(--radius);
    bottom: 16px; left: 16px; right: 16px;
    box-shadow: var(--shadow-lg);
    box-sizing: border-box; display: none;
    padding: 12px 18px; position: fixed;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 12px; top: 8px; }

/* Scanner-page convenience */
.scanner-page { user-select: none; -webkit-user-select: none; }
