/* ═══════════════════════════════════════════════════════════════
   AgeDash Portal — Label QA & PDF Inspection Suite
   Orange accent #FF7A1A · soft shadows · 16px cards · Inter
   ═══════════════════════════════════════════════════════════════ */

:root {
    --brand:        #FF7A1A;
    --brand-600:    #E66600;
    --brand-700:    #C25200;
    --brand-deep:   #FF5500;
    --brand-50:     #FFF7ED;
    --brand-100:    #FFEDD5;
    --brand-200:    #FED7AA;

    --bg:           #F8F9FA;
    --gray-50:      #F9FAFB;
    --gray-100:     #F3F4F6;
    --gray-200:     #E5E7EB;
    --gray-300:     #D1D5DB;
    --gray-400:     #9CA3AF;
    --gray-500:     #6B7280;
    --gray-600:     #4B5563;
    --gray-700:     #374151;
    --gray-900:     #111827;

    --emerald-50:   #ECFDF5;
    --emerald-100:  #D1FAE5;
    --emerald-200:  #A7F3D0;
    --emerald-500:  #10B981;
    --emerald-600:  #059669;
    --emerald-700:  #047857;

    --red-50:       #FEF2F2;
    --red-200:      #FECACA;
    --red-500:      #EF4444;
    --red-600:      #DC2626;
    --red-700:      #B91C1C;

    --slate-900:    #0F172A;

    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;

    --sh-sm: 0 1px 3px 0 rgba(0,0,0,.03), 0 1px 2px 0 rgba(0,0,0,.02);
    --sh-md: 0 4px 12px -2px rgba(0,0,0,.04), 0 2px 4px -1px rgba(0,0,0,.02);
    --sh-lg: 0 10px 25px -5px rgba(0,0,0,.05), 0 8px 10px -6px rgba(0,0,0,.02);
    --sh-xl: 0 25px 50px -12px rgba(0,0,0,.25);
    --sh-brand: 0 4px 14px 0 rgba(255,122,26,.3);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--gray-900);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* the hidden attribute must always win over display rules */
[hidden] { display: none !important; }

svg { display: block; width: 18px; height: 18px; flex-shrink: 0; }

::selection { background: var(--brand-100); color: var(--brand); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: 700 12px/1 var(--font);
    padding: 12px 20px;
    border: none;
    border-radius: var(--r-md);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .2s ease, box-shadow .2s ease, transform .12s ease, opacity .2s ease;
}
.btn svg { width: 15px; height: 15px; }
.btn:active:not(:disabled) { transform: scale(.99); }
.btn:focus-visible { outline: 3px solid var(--brand-200); outline-offset: 2px; }
.btn:disabled { cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
    color: #fff;
    box-shadow: var(--sh-brand);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--brand-600), #E64400); }
.btn-primary:disabled { background: var(--gray-200); color: var(--gray-400); box-shadow: none; }

.btn-outline {
    background: #fff;
    color: var(--brand);
    border: 1px solid var(--brand-200);
}
.btn-outline:hover:not(:disabled) { background: var(--brand-50); border-color: var(--brand); }
.btn-outline:disabled { opacity: .5; }

.btn-success {
    background: var(--emerald-600);
    color: #fff;
    box-shadow: var(--sh-sm);
}
.btn-success:hover:not(:disabled) { background: var(--emerald-700); }
.btn-success:disabled { background: var(--gray-50); border: 1px solid var(--gray-200); color: var(--gray-300); box-shadow: none; }

.btn-grey { background: var(--gray-100); color: var(--gray-700); }
.btn-grey:hover { background: var(--gray-200); }

.btn-ghost {
    background: #fff;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    box-shadow: var(--sh-sm);
    font-weight: 600;
}
.btn-ghost:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-block { width: 100%; }
.btn-sm { padding: 9px 14px; font-size: 11.5px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--r-md);
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-500);
    cursor: pointer;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}
.icon-btn:hover { color: var(--gray-900); background: var(--gray-50); }
.icon-btn:focus-visible { outline: 3px solid var(--brand-200); outline-offset: 2px; }

/* ─── Fields (login) ──────────────────────────────────────────── */
.field { display: block; margin-bottom: 18px; }
.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 7px;
}
input[type="email"], input[type="password"] {
    width: 100%;
    font: 400 15px/1.5 var(--font);
    color: var(--gray-900);
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--r-md);
    padding: 13px 15px;
    transition: border-color .2s ease, box-shadow .2s ease;
}
input:hover { border-color: var(--gray-300); }
input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(255,122,26,.12);
}
input::placeholder { color: var(--gray-400); }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: var(--r-md);
    background: linear-gradient(45deg, var(--brand), var(--brand-deep));
    color: #fff;
    box-shadow: var(--sh-brand);
}
.brand-mark svg { width: 22px; height: 22px; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════════ */
.login-body {
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(255,122,26,.12), transparent 60%),
        radial-gradient(700px 450px at -10% 110%, rgba(255,122,26,.10), transparent 60%),
        var(--bg);
}
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-md);
    padding: 40px 32px 26px;
    animation: rise .4s ease both;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .brand-mark { width: 52px; height: 52px; border-radius: 15px; }
.login-brand .brand-mark svg { width: 27px; height: 27px; }
.login-brand h1 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-top: 14px; }
.login-brand p { font-size: 13px; color: var(--gray-500); margin-top: 3px; }

.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 48px; }
.password-toggle {
    position: absolute;
    top: 50%; right: 8px;
    transform: translateY(-50%);
    background: none; border: none;
    padding: 8px; cursor: pointer;
    color: var(--gray-400);
    border-radius: 8px;
    transition: color .2s ease;
}
.password-toggle:hover { color: var(--gray-600); }

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    padding: 12px 14px;
    border-radius: var(--r-md);
    margin-bottom: 18px;
}
.alert-error { background: var(--red-50); color: var(--red-700); border: 1px solid var(--red-200); }

.login-card .btn-primary { padding: 14px 20px; font-size: 14px; }
.login-foot { text-align: center; font-size: 12px; color: var(--gray-400); margin-top: 22px; }

/* ═══════════════════════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════════════════════ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--gray-100);
}
.navbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.nav-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nav-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.menu-btn { position: relative; width: 40px; height: 40px; background: var(--gray-50); }
.menu-btn:hover { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand); }
.menu-badge {
    position: absolute;
    top: -5px; right: -5px;
    min-width: 19px; height: 19px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.nav-title { min-width: 0; }
.nav-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav-title strong { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.nav-title p { font-size: 11.5px; color: var(--gray-500); font-weight: 500; }
.chip {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: var(--brand-50);
    color: var(--brand);
    border: 1px solid var(--brand-200);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.nav-right { display: flex; align-items: center; gap: 10px; }
.pill-btn {
    height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: var(--r-md);
    border: 1px solid var(--brand-200);
    background: rgba(255,247,237,.6);
    color: var(--brand);
    font: 700 12px/1 var(--font);
    cursor: pointer;
    box-shadow: var(--sh-sm);
    transition: background-color .2s ease;
}
.pill-btn:hover { background: var(--brand-100); }
.pill-btn svg { width: 15px; height: 15px; }
.pill-count {
    min-width: 17px; height: 17px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.nav-user { display: flex; align-items: center; gap: 9px; padding-left: 4px; }
.avatar {
    width: 36px; height: 36px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand-100), var(--brand-200));
    color: var(--brand);
    border: 1px solid rgba(253,186,116,.5);
    font-size: 11.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nav-user-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.nav-user-name {
    font-size: 11.5px; font-weight: 600; color: var(--gray-900);
    max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-user-role { font-size: 10.5px; color: var(--gray-400); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════
   PAGE
   ═══════════════════════════════════════════════════════════════ */
.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 20px 60px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ─── Progress panel ──────────────────────────────────────────── */
.progress-panel {
    background: #fff;
    border: 1px solid var(--brand-200);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-md);
    padding: 16px;
    animation: fadeIn .3s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.progress-title { display: flex; align-items: center; gap: 8px; }
.progress-title strong { font-size: 12px; font-weight: 700; }
.progress-step-text { font-size: 12px; color: var(--gray-500); font-weight: 500; }

.mini-spinner {
    width: 22px; height: 22px;
    border-radius: 999px;
    background: var(--brand-100);
    position: relative;
    flex-shrink: 0;
}
.mini-spinner::after {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 999px;
    border: 2px solid rgba(255,122,26,.25);
    border-top-color: var(--brand);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.step-pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.step-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 10px;
    border-radius: var(--r-md);
    border: 1px solid var(--gray-100);
    background: var(--gray-50);
    color: var(--gray-400);
    transition: background-color .25s ease, color .25s ease, border-color .25s ease;
    min-width: 0;
}
.step-pill svg { width: 14px; height: 14px; }
.step-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-pill.active {
    background: var(--brand-50);
    border-color: var(--brand);
    color: var(--brand);
    box-shadow: var(--sh-sm);
}
.step-pill.active svg { animation: bounce 1s infinite; }
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
.step-pill.done {
    background: var(--emerald-50);
    border-color: var(--emerald-200);
    color: var(--emerald-700);
}

.shimmer-track {
    width: 100%;
    height: 8px;
    background: var(--brand-100);
    border-radius: 999px;
    overflow: hidden;
}
.shimmer-track.sm { height: 7px; margin-top: 12px; border: 1px solid rgba(254,215,170,.5); }
.shimmer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--brand), #FB923C, var(--brand-deep));
    animation: shimmer 2s infinite linear;
}
@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ─── Card grid ───────────────────────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: stretch;
}
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-width: 0; /* let grid columns shrink below their content on phones */
    transition: box-shadow .25s ease;
}
.card:hover { box-shadow: var(--sh-md); }

.card-title { font-size: 12px; font-weight: 700; color: var(--gray-900); }
.card-sub { font-size: 11.5px; color: var(--gray-500); margin-top: 4px; }
.card-top { margin-bottom: 16px; }

.slot { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 144px; }

.card-error {
    display: flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--red-600);
    margin-top: 8px;
}

.hidden-input { display: none; }
.card .upload-btn, .card > .btn { margin-top: 16px; }

/* ─── Product information form (card 1) ───────────────────────── */
.form-slot { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mini-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}
.mini-label { font-size: 11.5px; font-weight: 700; color: var(--gray-700); }
.mini-link {
    font-size: 11px;
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
    white-space: nowrap;
}
.mini-link:hover { text-decoration: underline; }

.select-row { display: flex; gap: 8px; align-items: flex-start; }
.textarea {
    width: 100%;
    min-height: 230px;
    padding: 12px 14px;
    resize: vertical;
    font: 400 12.5px/1.55 var(--font);
    color: var(--gray-900);
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--r-md);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.textarea:hover:not(:disabled) { border-color: var(--gray-300); }
.textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(255,122,26,.12);
}
.textarea:disabled { background: var(--gray-50); color: var(--gray-500); }
.textarea::placeholder { color: var(--gray-400); }
.select-row .icon-btn { height: 46px; width: 46px; flex-shrink: 0; }

/* Searchable product picker */
.combo { position: relative; flex: 1; min-width: 0; }
.combo-toggle {
    width: 100%;
    height: 46px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--r-md);
    font: 600 13.5px/1.3 var(--font);
    color: var(--gray-900);
    text-align: left;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.combo-toggle:hover:not(:disabled) { border-color: var(--gray-300); }
.combo-toggle:focus-visible, .combo.open .combo-toggle {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(255,122,26,.12);
}
.combo-toggle:disabled { background: var(--gray-50); color: var(--gray-400); cursor: not-allowed; }
.combo-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-value.placeholder { color: var(--gray-400); font-weight: 500; }
.combo-series {
    flex-shrink: 0;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--brand);
    background: var(--brand-50);
    border: 1px solid var(--brand-200);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.combo-chevron { width: 16px; height: 16px; color: var(--gray-400); transition: transform .2s ease; }
.combo.open .combo-chevron { transform: rotate(180deg); }

.combo-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 40;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--r-md);
    box-shadow: var(--sh-lg), 0 2px 6px rgba(0,0,0,.06);
    overflow: hidden;
    animation: fadeIn .15s ease both;
}
.combo-search {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-400);
}
.combo-search svg { width: 17px; height: 17px; }
.combo-search input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 2px 0;
    font: 500 14px/1.4 var(--font);
    color: var(--gray-900);
    background: transparent;
}
.combo-search input:focus { outline: none; box-shadow: none; border: none; }
.combo-count { font-size: 11px; font-weight: 600; color: var(--gray-400); white-space: nowrap; }
.combo-list { list-style: none; max-height: 340px; overflow-y: auto; padding: 6px; }
.combo-group {
    display: flex;
    justify-content: space-between;
    padding: 10px 10px 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--gray-500);
}
.combo-group:first-child { padding-top: 4px; }
.combo-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--gray-900);
    cursor: pointer;
}
.combo-option.active { background: var(--brand-50); }
.combo-option.selected { color: var(--brand); font-weight: 700; }
.combo-option svg { width: 15px; height: 15px; color: var(--brand); }
.combo-option-name { flex: 1; min-width: 0; }
.combo-list mark { background: var(--brand-100); color: inherit; border-radius: 3px; padding: 0 1px; }
.combo-empty { padding: 22px 16px; text-align: center; font-size: 12.5px; color: var(--gray-500); }
.select-row .icon-btn svg { width: 15px; height: 15px; }
.select-row .icon-btn.spinning svg { animation: spin .9s linear infinite; }

.field-hint { font-size: 11px; color: var(--gray-500); min-height: 0; }
.field-hint:empty { display: none; }
.field-hint.error { color: var(--red-600); font-weight: 600; }
.field-foot { display: flex; justify-content: flex-end; font-size: 10.5px; color: var(--gray-400); font-weight: 500; }
.field-foot .warn { color: #B45309; font-weight: 600; }

.sheet-preview {
    border: 1px solid var(--gray-200);
    border-radius: var(--r-md);
    background: var(--gray-50);
    font-size: 11.5px;
}
.sheet-preview summary {
    cursor: pointer;
    padding: 8px 11px;
    font-weight: 600;
    color: var(--gray-600);
    list-style-position: inside;
}
.sheet-preview[open] summary { border-bottom: 1px solid var(--gray-200); }
.sheet-preview dl { max-height: 190px; overflow-y: auto; padding: 8px 11px 10px; }
.sheet-preview dt { font-weight: 700; color: var(--gray-700); margin-top: 7px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; }
.sheet-preview dt:first-child { margin-top: 0; }
.sheet-preview dd { color: var(--gray-600); white-space: pre-line; word-break: break-word; }

/* ─── Dropzone ────────────────────────────────────────────────── */
.dropzone {
    border: 2px dashed var(--gray-200);
    border-radius: var(--r-md);
    padding: 16px;
    height: 144px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease;
}
.dropzone:hover { border-color: var(--brand-200); background: rgba(249,250,251,.6); }
.dropzone.dragover { border-color: var(--brand); background: rgba(255,247,237,.7); }
.dropzone.disabled { opacity: .5; cursor: not-allowed; }
.dz-icon {
    width: 40px; height: 40px;
    border-radius: 999px;
    background: var(--brand-50);
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 9px;
}
.dz-icon svg { width: 19px; height: 19px; }
.dz-title { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.dz-title .accent { color: var(--brand); }
.dz-hint { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* ─── Selected file box ───────────────────────────────────────── */
.file-box {
    position: relative;
    overflow: hidden;
    background: rgba(255,247,237,.5);
    border: 1px solid var(--brand-200);
    border-radius: var(--r-md);
    padding: 14px;
    height: 144px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.file-box-row { display: flex; align-items: flex-start; gap: 10px; }
.file-icon {
    width: 38px; height: 38px;
    border-radius: var(--r-md);
    background: var(--brand-100);
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.file-meta { flex: 1; min-width: 0; }
.file-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-size { font-size: 11px; font-weight: 500; color: var(--gray-500); margin-top: 2px; }
.ok-badge {
    width: 23px; height: 23px;
    border-radius: 999px;
    background: var(--emerald-500);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--sh-sm);
}
.ok-badge svg { width: 13px; height: 13px; }
.file-box .replace-btn { margin-top: 10px; padding: 9px; }

.scan-beam {
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--brand), transparent);
    box-shadow: 0 0 12px var(--brand);
    z-index: 5;
    pointer-events: none;
    animation: scan-beam 2s ease-in-out infinite;
}
@keyframes scan-beam {
    0%   { top: 0;   opacity: 0; }
    20%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { top: 95%; opacity: 0; }
}

/* ─── Output card states ──────────────────────────────────────── */
.out-idle {
    border: 1px dashed var(--gray-200);
    border-radius: var(--r-md);
    background: rgba(249,250,251,.5);
    height: 144px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.out-icon {
    width: 40px; height: 40px;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-400);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 9px;
}
.out-text { font-size: 11.5px; font-weight: 500; color: var(--gray-500); }

.out-busy {
    position: relative;
    background: linear-gradient(180deg, rgba(255,247,237,.85), rgba(255,251,235,.45));
    border: 1px solid var(--brand-200);
    border-radius: var(--r-md);
    padding: 16px;
    height: 144px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.out-spinner {
    width: 36px; height: 36px;
    border-radius: 999px;
    background: var(--brand-100);
    position: relative;
    z-index: 2;
    box-shadow: var(--sh-sm);
}
.out-spinner::after {
    content: '';
    position: absolute;
    inset: 9px;
    border-radius: 999px;
    border: 2.5px solid rgba(255,122,26,.25);
    border-top-color: var(--brand);
    animation: spin .8s linear infinite;
}
.pulse-ring {
    position: absolute;
    width: 40px; height: 40px;
    top: 50%; left: 50%;
    margin: -46px 0 0 -20px;
    border-radius: 999px;
    background: rgba(251,146,60,.25);
    animation: ping 1.6s cubic-bezier(0,0,.2,1) infinite;
}
@keyframes ping {
    75%, 100% { transform: scale(1.9); opacity: 0; }
}
.out-busy-text { font-size: 12px; font-weight: 700; color: var(--gray-900); margin-top: 10px; }

.out-done {
    background: rgba(236,253,245,.6);
    border: 1px solid var(--emerald-200);
    border-radius: var(--r-md);
    padding: 14px;
    min-height: 144px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}
.out-done-row { display: flex; align-items: center; gap: 10px; }
.done-icon {
    width: 32px; height: 32px;
    border-radius: var(--r-md);
    background: var(--emerald-100);
    color: var(--emerald-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.done-title { font-size: 12px; font-weight: 700; color: var(--gray-900); }
.done-sub { font-size: 11px; font-weight: 500; color: var(--emerald-700); margin-top: 2px; }
.out-done .btn-primary { padding: 11px; }

/* ─── Action bar ──────────────────────────────────────────────── */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.btn-run { width: 320px; max-width: 100%; padding: 14px 22px; }
.btn-run.busy svg { animation: spin 1s linear infinite; }

/* ─── Failure banner ──────────────────────────────────────────── */
.fail-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 680px;
    margin: 0 auto;
    background: var(--red-50);
    border: 1px solid var(--red-200);
    border-radius: var(--r-lg);
    padding: 14px 16px;
    font-size: 12px;
    color: var(--red-700);
}
.fail-banner svg { width: 19px; height: 19px; color: var(--red-600); }
.fail-text { flex: 1; font-weight: 500; word-break: break-word; }
.fail-dismiss {
    background: none; border: none;
    color: var(--red-500);
    font: 700 12px/1 var(--font);
    cursor: pointer;
    flex-shrink: 0;
}
.fail-dismiss:hover { color: var(--red-700); }

/* ─── How it works ────────────────────────────────────────────── */
.info-wrap {
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.info-card h3 { font-size: 13px; font-weight: 700; margin-bottom: 16px; }
.steps { list-style: none; position: relative; }
.steps::before {
    content: '';
    position: absolute;
    left: 13px; top: 12px; bottom: 12px;
    width: 2px;
    background: var(--gray-100);
}
.steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    z-index: 1;
}
.steps li + li { margin-top: 16px; }
.step-num {
    width: 28px; height: 28px;
    border-radius: 999px;
    background: linear-gradient(45deg, var(--brand), var(--brand-deep));
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--sh-sm);
}
.step-title { font-size: 12px; font-weight: 700; color: var(--gray-900); }
.step-desc { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

.security-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, rgba(255,247,237,.75), rgba(255,251,235,.75));
    border: 1px solid var(--brand-200);
    border-radius: var(--r-lg);
    padding: 15px;
}
.sec-icon {
    width: 34px; height: 34px;
    border-radius: var(--r-md);
    background: rgba(255,122,26,.1);
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sec-icon svg { width: 16px; height: 16px; }
.sec-title { font-size: 12px; font-weight: 700; color: var(--gray-900); }
.security-banner p { font-size: 11px; color: var(--gray-600); margin-top: 3px; }

/* ═══════════════════════════════════════════════════════════════
   HISTORY DRAWER
   ═══════════════════════════════════════════════════════════════ */
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0,0,0,.4);
    display: flex;
    animation: fadeIn .2s ease both;
}
.drawer {
    width: 100%;
    max-width: 420px;
    height: 100%;
    background: #fff;
    box-shadow: var(--sh-xl);
    display: flex;
    flex-direction: column;
    animation: slideIn .28s ease both;
}
@keyframes slideIn {
    from { transform: translateX(-100%); }
    to   { transform: none; }
}
.drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid var(--gray-100);
    background: linear-gradient(90deg, rgba(255,247,237,.6), rgba(255,251,235,.35));
}
.drawer-head-left { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.drawer-icon {
    width: 36px; height: 36px;
    border-radius: var(--r-md);
    background: rgba(255,122,26,.1);
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.drawer-head h3 {
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.drawer-count {
    font-size: 10px;
    font-weight: 800;
    background: var(--brand);
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
}
.drawer-head p { font-size: 11px; color: var(--gray-500); font-weight: 500; margin-top: 2px; }

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}
.drawer-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}
.drawer-empty svg { width: 46px; height: 46px; color: var(--gray-300); margin-bottom: 12px; }
.de-title { font-size: 12px; font-weight: 600; color: var(--gray-600); }
.de-sub { font-size: 11px; color: var(--gray-400); margin-top: 4px; max-width: 220px; }

.h-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 11px;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.h-card:hover { border-color: rgba(255,122,26,.5); box-shadow: var(--sh-md); }
.h-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.h-files { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.h-file { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; min-width: 0; }
.h-tag { font-size: 9.5px; text-transform: uppercase; font-weight: 700; color: var(--gray-400); flex-shrink: 0; }
.h-file.sample { color: var(--red-600); }
.h-file.sample .h-tag { color: #F87171; }
.h-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.h-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    flex-shrink: 0;
}
.h-badge svg { width: 11px; height: 11px; }
.h-badge.ok { background: var(--emerald-50); color: var(--emerald-700); border: 1px solid var(--emerald-200); }
.h-badge.bad { background: var(--red-50); color: var(--red-700); border: 1px solid var(--red-200); }

.h-foot {
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--gray-500);
}
.h-meta { display: flex; align-items: center; gap: 11px; font-weight: 500; flex-wrap: wrap; }
.h-meta span { display: inline-flex; align-items: center; gap: 4px; }
.h-meta svg { width: 12px; height: 12px; color: var(--gray-400); }
.h-errs { font-weight: 700; color: var(--brand); }
.h-del {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 8px;
    color: var(--gray-400);
    cursor: pointer;
    transition: color .2s ease, background-color .2s ease;
    flex-shrink: 0;
}
.h-del:hover { color: var(--red-600); background: var(--red-50); }
.h-del svg { width: 14px; height: 14px; }

.drawer-foot {
    padding: 14px 16px;
    border-top: 1px solid var(--gray-100);
    background: rgba(249,250,251,.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 500;
}
.clear-all {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--red-600);
    font: 700 11px/1 var(--font);
    cursor: pointer;
}
.clear-all:hover { color: var(--red-700); }
.clear-all svg { width: 12px; height: 12px; }

/* ═══════════════════════════════════════════════════════════════
   REPORT MODAL
   ═══════════════════════════════════════════════════════════════ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(17,24,39,.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    animation: fadeIn .2s ease both;
}
.modal-inner {
    width: 100%;
    max-width: 1140px;
    height: 92vh;
    background: #fff;
    border-radius: var(--r-xl);
    box-shadow: var(--sh-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: rise .25s ease both;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
    flex-shrink: 0;
}
.modal-head-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.modal-icon {
    width: 36px; height: 36px;
    border-radius: var(--r-md);
    background: var(--brand-100);
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.modal-head h2 { font-size: 13px; font-weight: 700; }
.modal-head p {
    font-size: 11.5px;
    color: var(--gray-500);
    font-weight: 500;
    margin-top: 2px;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.modal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.modal-tabs {
    display: inline-flex;
    background: var(--gray-100);
    border-radius: var(--r-md);
    padding: 4px;
    gap: 3px;
}
.mtab {
    background: none;
    border: none;
    padding: 7px 12px;
    border-radius: 9px;
    font: 700 11.5px/1 var(--font);
    color: var(--gray-500);
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}
.mtab:hover { color: var(--gray-700); }
.mtab.active { background: #fff; color: var(--brand); box-shadow: var(--sh-sm); }

.modal-body {
    flex: 1;
    background: var(--slate-900);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 0;
}
.modal-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--r-lg);
    background: #fff;
}
.modal-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    color: #94A3B8;
}
.modal-empty svg { width: 46px; height: 46px; color: #64748B; margin-bottom: 12px; }
.me-title { font-size: 13px; font-weight: 600; color: #E2E8F0; }
.me-sub { font-size: 11.5px; color: #94A3B8; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .card-grid { grid-template-columns: 1fr 1fr; }
    #cardProduct { grid-column: span 2; }
    #cardOutput { grid-column: auto; }
}

@media (max-width: 760px) {
    .navbar-inner { padding: 10px 14px; }
    .nav-user-meta, .pill-label { display: none; }
    .nav-title strong { font-size: 15px; }
    .nav-title p { display: none; }
    .page { padding: 18px 14px 48px; gap: 18px; }
    .page-head h1 { font-size: 19px; }
    .card-grid { grid-template-columns: 1fr; }
    #cardProduct, #cardOutput { grid-column: auto; }
    .step-pills { grid-template-columns: 1fr; }
    .action-bar { flex-direction: column; }
    .btn-run { width: 100%; }
    .btn-ghost { width: 100%; }
    .modal { padding: 0; }
    .modal-inner { height: 100vh; border-radius: 0; max-width: none; }
    .modal-head p { max-width: 180px; }
    .modal-tabs { order: 3; }
    .drawer { max-width: 100%; }
}

@media (max-width: 420px) {
    .chip { display: none; }
    .modal-actions .btn-sm span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
