:root {
    --font-body: "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
    --font-display: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    --ink: #2a2530;
    --muted: #756d78;
    --navy: #31263b;
    --navy-2: #57425f;
    --blue: #b84b55;
    --cyan: #f0a36e;
    --surface: #fffdfa;
    --canvas: #f7f2ee;
    --line: #e6dcd8;
    --success: #3f7d68;
    --success-soft: #e4f2ec;
    --warning: #9a5c18;
    --warning-soft: #fff0cf;
    --danger: #b23a48;
    --danger-soft: #fde7e9;
    --shadow: 0 18px 48px rgba(52, 36, 58, .12);
    --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); font-family: var(--font-body); font-size: 16px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body.app-busy { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.app-loader { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(49, 38, 59, .46); backdrop-filter: blur(4px); }
.app-loader-card { display: inline-flex; align-items: center; gap: 12px; min-width: min(250px, 100%); padding: 15px 18px; color: #fff; border: 1px solid rgba(255,255,255,.22); border-radius: 15px; background: rgba(49, 38, 59, .95); box-shadow: 0 16px 38px rgba(30, 19, 36, .3); font-size: .9rem; font-weight: 750; }
.app-loader-spinner { width: 24px; height: 24px; flex: 0 0 24px; border: 3px solid rgba(255,255,255,.28); border-top-color: var(--cyan); border-radius: 50%; animation: app-spin .75s linear infinite; }
@keyframes app-spin { to { transform: rotate(360deg); } }

.topbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 10px max(20px, calc((100vw - 1220px) / 2)); color: #fff; background: var(--navy); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.08rem; font-weight: 750; letter-spacing: -.025em; }
.brand-mark { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(145deg, var(--cyan), var(--blue)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); font-weight: 900; }
.brand-mark.large { width: 48px; height: 48px; border-radius: 14px; font-size: 1.3rem; }
.topbar-user { display: flex; align-items: center; gap: 16px; }
.topbar-user form { margin: 0; }
.user-copy { display: grid; text-align: right; line-height: 1.25; }
.user-copy strong { font-size: .88rem; }
.user-copy span { color: #d8c9dc; font-size: .72rem; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; color: #f7eef4; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; background: rgba(255,255,255,.06); }
.icon-button:hover { background: rgba(255,255,255,.14); }
.icon-button svg { width: 20px; }
.nav-strip { height: 50px; display: flex; align-items: stretch; gap: 28px; padding: 0 max(20px, calc((100vw - 1220px) / 2)); background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.nav-strip a { position: relative; display: grid; place-items: center; color: var(--muted); font-size: .85rem; font-weight: 700; white-space: nowrap; }
.nav-strip a > svg, .scan-tab-icon > svg { display: none; }
.nav-strip a.active { color: var(--blue); }
.nav-strip a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--blue); }

.page-shell { width: min(1220px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 60px; }
.site-footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); color: var(--muted); border-top: 1px solid var(--line); background: rgba(255,253,250,.82); font-size: .72rem; letter-spacing: .01em; text-align: center; }
.site-footer a { color: var(--blue); font-weight: 800; }
.site-footer a:hover { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.site-footer-separator { color: var(--cyan); font-weight: 900; }
.auth-shell { width: 100%; min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 15% 15%, rgba(240,163,110,.24), transparent 27%), radial-gradient(circle at 85% 80%, rgba(184,75,85,.24), transparent 32%), var(--navy); }
.eyebrow { display: block; margin-bottom: 8px; color: var(--blue); font-size: .72rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 750; }
h1 { margin-bottom: 10px; font-size: clamp(1.75rem, 4vw, 2.55rem); line-height: 1.08; letter-spacing: -.035em; }
h2 { letter-spacing: -.02em; }
p { color: var(--muted); line-height: 1.55; }

.login-card { width: min(480px, 100%); padding: 34px; border: 1px solid rgba(255,255,255,.4); border-radius: 26px; background: rgba(255,255,255,.98); box-shadow: 0 36px 90px rgba(0,0,0,.3); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 38px; }
.login-brand h1 { margin: 0; font-size: 1.25rem; }
.login-brand p { margin: 1px 0 0; font-size: .78rem; }
.login-intro h2 { margin-bottom: 7px; font-size: 2rem; }
.login-intro p { margin-bottom: 24px; }
.stack-form { display: grid; gap: 18px; }
.stack-form label, .field-label { display: grid; gap: 7px; color: #463e49; font-size: .79rem; font-weight: 700; }
input, select { width: 100%; min-height: 48px; padding: 0 14px; color: var(--ink); border: 1px solid #d8ccc7; border-radius: 11px; outline: 0; background: #fff; }
.stack-form, .stack-form > label, .password-field, .filter-panel > *, .report-controls > *, .manual-form, .manual-row { min-width: 0; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(184,75,85,.15); }
.password-field { position: relative; }
.password-field input { padding-right: 64px; }
.password-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--blue); border: 0; background: transparent; font-size: .75rem; font-weight: 800; }
.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; border: 1px solid transparent; border-radius: 11px; font-weight: 800; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--blue); box-shadow: 0 8px 18px rgba(184,75,85,.24); }
.button.primary:hover { background: #983a45; }
.button.secondary { color: #463e49; border-color: var(--line); background: #fff; }
.button.full { width: 100%; margin-top: 4px; }
.login-foot { margin: 25px 0 -12px; text-align: center; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; }
.alert { margin-bottom: 18px; padding: 12px 14px; border-radius: 10px; font-size: .82rem; font-weight: 650; }
.alert.danger { color: var(--danger); background: var(--danger-soft); }
.alert.warning { color: var(--warning); background: var(--warning-soft); }

.hero { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 36px; color: #fff; border-radius: 24px; background: linear-gradient(120deg, var(--navy), var(--navy-2)); box-shadow: var(--shadow); }
.hero p { margin: 0; color: #dfd2e2; }
.hero .eyebrow { color: #f3b07f; }
.department-pill { flex: 0 0 auto; display: grid; place-items: center; gap: 4px; min-width: 145px; padding: 18px 22px; border: 1px solid rgba(255,255,255,.15); border-radius: 16px; background: rgba(255,255,255,.08); color: #dfd2e2; font-size: .78rem; }
.department-pill span { color: #fff; font-size: 1.45rem; font-weight: 900; letter-spacing: .08em; }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px; margin-top: 24px; }
.action-card { position: relative; overflow: hidden; min-height: 280px; padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 10px 30px rgba(52,36,58,.07); transition: transform .2s ease, box-shadow .2s ease; }
.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.action-card.scan-action { color: #fff; border: 0; background: linear-gradient(145deg, #c9555f, #8f3542); }
.action-card.scan-action::after { content: ""; position: absolute; width: 200px; height: 200px; right: -60px; top: -60px; border-radius: 50%; background: rgba(255,255,255,.08); }
.action-card.scan-action p, .action-card.scan-action .eyebrow { color: #f8e2df; }
.action-icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 34px; border-radius: 15px; background: rgba(255,255,255,.16); }
.action-icon.light { color: var(--blue); background: #f8e7e4; }
.action-icon svg { width: 28px; }
.action-card h2 { margin-bottom: 9px; }
.action-card p { max-width: 440px; margin-bottom: 28px; }
.card-link { font-size: .82rem; font-weight: 850; }
.floor-tip { display: flex; align-items: center; gap: 13px; margin-top: 24px; padding: 17px 20px; border: 1px solid #e5d9d4; border-radius: 14px; background: #f3ece8; }
.floor-tip > span { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; border-radius: 50%; background: #837682; font-weight: 900; }
.floor-tip p { margin: 0; font-size: .83rem; }

.page-heading { margin-bottom: 24px; }
.page-heading.split { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-heading p { margin-bottom: 0; }
.scan-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.scan-intro h1 { margin-bottom: 5px; }
.scan-intro p { margin-bottom: 0; }
.manual-jump { flex: 0 0 auto; padding: 9px 12px; color: var(--blue); border-radius: 9px; background: #f8e7e4; font-size: .73rem; font-weight: 850; }
.scan-count { flex: 0 0 auto; display: grid; min-width: 145px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: center; }
.scan-count span { color: var(--blue); font-size: 1.55rem; font-weight: 900; }
.scan-count small { color: var(--muted); font-size: .68rem; }
.scanner-card, .manual-card, .filter-panel, .report-panel, .metric-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 26px rgba(52,36,58,.06); }
.scanner-card { overflow: hidden; }
.scanner-toolbar { display: flex; justify-content: space-between; padding: 14px 18px; color: #eadfea; background: var(--navy); font-size: .78rem; font-weight: 800; }
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,.14); }
.live-dot.busy { background: #fbbf24; box-shadow: 0 0 0 4px rgba(251,191,36,.14); }
.live-dot.unavailable { background: #94a3b8; box-shadow: none; }
.scanner-total { color: #d1becf; font-size: .72rem; font-weight: 700; }
.scanner-total b { color: #fff; font-size: .85rem; }
.text-button { color: #f0a5a8; border: 0; background: transparent; font-weight: 750; }
.scanner-viewport { position: relative; min-height: min(54vh, 470px); display: grid; place-items: center; overflow: hidden; background: #030712; }
.scanner-viewport video { object-fit: cover !important; }
.scanner-viewport #qr-shaded-region { border-width: 35px !important; }
.scanner-placeholder { color: #b7c5dc; text-align: center; }
.scan-corners { width: 160px; height: 160px; display: block; margin: 0 auto 18px; border: 2px solid #f28c84; border-radius: 12px; box-shadow: inset 0 0 30px rgba(242,140,132,.14); }
.camera-help { margin: 0; padding: 11px 18px; background: #f7f9fc; font-size: .75rem; text-align: center; }
.scanner-card.photo-mode .scanner-viewport { min-height: 145px; height: 145px; }
.scanner-card.photo-mode .scan-corners { width: 78px; height: 78px; margin-bottom: 10px; }
.scanner-card.photo-mode .scanner-placeholder p { margin-bottom: 0; font-size: .75rem; }
.photo-scan { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 18px; border-top: 1px solid var(--line); background: #fff6ee; }
.photo-scan div { display: grid; gap: 3px; }
.photo-scan strong { font-size: .83rem; }
.photo-scan span { color: var(--muted); font-size: .73rem; line-height: 1.4; }
.photo-scan-button { flex: 0 0 auto; }
.manual-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 18px; padding: 20px; }
.manual-card h2 { margin-bottom: 3px; font-size: 1rem; }
.manual-card p { margin: 0; font-size: .78rem; }
.manual-form { width: min(500px, 100%); display: flex; gap: 9px; }
.manual-form input { flex: 1; }
.manual-card.simplified .manual-form { display: grid; gap: 6px; }
.manual-label { color: #463e49; font-size: .72rem; font-weight: 800; }
.manual-row { display: flex; gap: 8px; }
.manual-row input { min-width: 0; }
.manual-row .button { min-width: 92px; }
.manual-form small { color: var(--muted); font-size: .68rem; }
.connection-banner { margin-bottom: 14px; padding: 13px 16px; color: #7a4400; border: 1px solid #f4d38b; border-radius: 12px; background: #fff3d5; font-size: .8rem; font-weight: 750; }
.review-open { overflow: hidden; }
.scan-review { position: fixed; z-index: 70; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(29,20,34,.72); backdrop-filter: blur(6px); }
.review-card { width: min(680px, 100%); max-height: calc(100dvh - 36px); overflow-y: auto; padding: 25px; border: 1px solid rgba(255,255,255,.45); border-radius: 22px; background: var(--surface); box-shadow: 0 28px 80px rgba(18,10,23,.36); }
.review-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.review-heading h2 { margin-bottom: 0; }
.review-close { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; padding: 0 0 3px; color: var(--muted); border: 1px solid var(--line); border-radius: 11px; background: #fff; font-size: 1.5rem; line-height: 1; }
.review-identity { display: grid; gap: 4px; margin: 20px 0 16px; padding: 16px; border-radius: 14px; background: linear-gradient(135deg, #f8e7e4, #fff4e9); }
.review-identity strong { color: var(--blue); font-size: 1.12rem; }
.review-identity span { color: var(--ink); font-size: .82rem; line-height: 1.45; }
.review-details { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin: 0 0 20px; }
.review-details div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.review-details dt { margin-bottom: 4px; color: var(--muted); font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.review-details dd { overflow: hidden; margin: 0; color: var(--ink); font-size: .83rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.review-section-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .68rem; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.review-stages { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; }
.review-stage { display: grid; gap: 3px; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: #faf6f3; }
.review-stage span { overflow: hidden; color: var(--muted); font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.review-stage b { font-size: .76rem; }
.review-stage.current { border-color: #dbaeb0; background: #fae9e7; }
.review-stage.complete { border-color: #bcd9cd; background: var(--success-soft); }
.review-note { margin: 17px 0 0; padding: 11px 13px; color: #705126; border-radius: 10px; background: #fff0d8; font-size: .75rem; font-weight: 750; }
.review-note.blocked { color: var(--danger); background: var(--danger-soft); }
.review-actions { display: grid; grid-template-columns: .75fr 1.25fr; gap: 9px; margin-top: 14px; }
.review-actions .button { width: 100%; }
.item-detail-open { overflow: hidden; }
.production-item { cursor: pointer; }
.production-item:focus-visible { outline: 3px solid rgba(184,75,85,.28); outline-offset: 2px; }
.item-detail-modal { position: fixed; z-index: 65; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(29,20,34,.72); backdrop-filter: blur(6px); }
.item-detail-card { width: min(640px, 100%); max-height: calc(100dvh - 36px); overflow-y: auto; padding: 25px; border: 1px solid rgba(255,255,255,.45); border-radius: 22px; background: var(--surface); box-shadow: 0 28px 80px rgba(18,10,23,.36); }
.item-detail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.item-detail-heading h2 { margin-bottom: 0; }
.item-detail-identity { display: grid; gap: 4px; margin: 20px 0 16px; padding: 16px; border-radius: 14px; background: linear-gradient(135deg, #f8e7e4, #fff4e9); }
.item-detail-identity strong { color: var(--blue); font-size: 1.12rem; }
.item-detail-identity span { color: var(--ink); font-size: .82rem; line-height: 1.45; }
.item-detail-fields { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin: 0 0 20px; }
.item-detail-fields div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.item-detail-fields dt { margin-bottom: 4px; color: var(--muted); font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.item-detail-fields dd { overflow: hidden; margin: 0; color: var(--ink); font-size: .83rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.item-detail-section-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .68rem; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.item-detail-progress { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; }
.item-detail-stage { display: grid; gap: 3px; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: #faf6f3; }
.item-detail-stage span { overflow: hidden; color: var(--muted); font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.item-detail-stage b { font-size: .76rem; }
.item-detail-stage.complete { border-color: #bcd9cd; background: var(--success-soft); }
.item-detail-stage.in-progress { border-color: #dbaeb0; background: #fae9e7; }
.item-detail-scope { margin: 17px 0 0; padding: 11px 13px; color: var(--muted); border-radius: 10px; background: #f3ece8; font-size: .75rem; font-weight: 750; }
.recent-card { margin-top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 8px 26px rgba(52,36,58,.06); }
.recent-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.recent-heading h2 { margin: 0; font-size: 1rem; }
.secure-note { color: var(--success); padding: 6px 9px; border-radius: 99px; background: var(--success-soft); font-size: .67rem; font-weight: 850; }
.recent-scans { display: grid; gap: 8px; margin-top: 15px; }
.recent-empty { margin: 0; padding: 18px; border: 1px dashed #cdd6e5; border-radius: 11px; text-align: center; font-size: .78rem; }
.recent-scan-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid #e2e8f1; border-radius: 11px; background: #f9fbfe; }
.recent-check { width: 28px; height: 28px; display: grid; place-items: center; color: #fff; border-radius: 50%; background: var(--success); font-weight: 900; }
.recent-scan-item div { min-width: 0; }
.recent-scan-item strong, .recent-scan-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-scan-item strong { font-size: .78rem; }
.recent-scan-item small { margin-top: 2px; color: var(--muted); font-size: .68rem; }
.recent-scan-item > b { color: var(--success); font-size: .8rem; }
.scan-toast { position: fixed; z-index: 20; top: 88px; left: 50%; width: min(520px, calc(100% - 28px)); transform: translateX(-50%); padding: 16px 18px; color: #fff; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25); animation: toast-in .2s ease both; }
.scan-toast.success { background: var(--success); }
.scan-toast.error { background: var(--danger); }
.scan-toast strong { display: block; margin-bottom: 2px; }
.scan-toast span { color: rgba(255,255,255,.85); font-size: .8rem; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%,-12px); } }

.filter-panel { display: flex; gap: 16px; padding: 16px; }
.search-field { position: relative; flex: 1; }
.search-field svg { position: absolute; left: 14px; top: 50%; width: 19px; transform: translateY(-50%); color: #8190aa; }
.search-field input { padding-left: 42px; }
.segmented { flex: 0 0 auto; display: flex; padding: 4px; border-radius: 11px; background: #efe8e5; }
.segmented button { min-height: 40px; padding: 0 15px; color: var(--muted); border: 0; border-radius: 8px; background: transparent; font-size: .77rem; font-weight: 800; }
.segmented button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(52,36,58,.11); }
.list-summary { display: flex; justify-content: space-between; margin: 18px 2px 10px; color: var(--muted); font-size: .77rem; }
.production-list { display: grid; gap: 10px; }
.production-item { display: grid; grid-template-columns: minmax(220px, 1.8fr) minmax(150px, .8fr) minmax(180px, 1fr); align-items: center; gap: 20px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.item-main { min-width: 0; }
.item-main strong { display: block; margin-bottom: 4px; font-size: .9rem; }
.item-main p { overflow: hidden; margin: 0; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; }
.item-meta { color: var(--muted); font-size: .75rem; }
.item-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 7px 12px; }
.item-progress strong { font-size: .82rem; }
.progress-track { grid-column: 1 / -1; height: 7px; overflow: hidden; border-radius: 99px; background: #eadfda; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.status-chip { display: inline-flex; align-items: center; width: max-content; padding: 5px 8px; border-radius: 99px; font-size: .66rem; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.status-chip.complete { color: var(--success); background: var(--success-soft); }
.status-chip.in-progress { color: var(--warning); background: var(--warning-soft); }
.status-chip.not-started { color: #5f6c83; background: #edf0f5; }
.empty-state { padding: 55px 24px; border: 1px dashed #cbd5e3; border-radius: 16px; background: #fff; text-align: center; }
.empty-state h2 { margin-bottom: 5px; font-size: 1.05rem; }
.empty-state p { margin: 0; }
.loading-card { height: 83px; border-radius: 14px; background: linear-gradient(90deg, #e8edf5 25%, #f5f7fa 50%, #e8edf5 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 26px; }
.metric-card { padding: 21px; }
.metric-card span { color: var(--muted); font-size: .72rem; font-weight: 750; }
.metric-card strong { display: block; margin: 8px 0 3px; font-size: 2rem; letter-spacing: -.04em; }
.metric-card small { color: #8190aa; font-size: .68rem; }
.metric-card.accent { color: #fff; border: 0; background: linear-gradient(145deg, var(--blue), #8f3542); }
.metric-card.accent span, .metric-card.accent small { color: #f6dedd; }
.dashboard-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 20px; }
.panel { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.panel h2 { margin-bottom: 7px; font-size: 1.05rem; }
.panel p { font-size: .8rem; }
.stage-list { display: grid; gap: 9px; margin-top: 20px; }
.stage-row { display: grid; grid-template-columns: 55px 1fr; align-items: center; gap: 12px; }
.stage-row span { font-size: .72rem; font-weight: 850; }
.quick-links { display: grid; gap: 10px; margin-top: 20px; }
.quick-link { display: flex; align-items: center; justify-content: space-between; padding: 15px; border: 1px solid var(--line); border-radius: 11px; font-size: .8rem; font-weight: 800; }
.quick-link:hover { color: var(--blue); border-color: #dbaeb0; }

.report-tabs { display: flex; gap: 6px; margin-bottom: 18px; padding: 5px; border-radius: 13px; background: #eee6e3; width: max-content; }
.report-tabs button { padding: 11px 17px; color: var(--muted); border: 0; border-radius: 9px; background: transparent; font-size: .78rem; font-weight: 850; }
.report-tabs button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 9px rgba(52,36,58,.11); }
.report-panel { overflow: hidden; }
.report-controls { display: flex; align-items: end; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.report-controls label { min-width: 130px; }
.report-controls .search-field { min-width: 230px; }
.report-controls input, .report-controls select { min-height: 42px; }
.table-wrap { width: 100%; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .74rem; white-space: nowrap; }
.data-table th { position: sticky; top: 0; z-index: 1; padding: 12px 14px; color: #7b6f79; background: #faf6f3; border-bottom: 1px solid var(--line); text-align: left; font-size: .66rem; letter-spacing: .05em; text-transform: uppercase; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid #ede5e1; }
.data-table tbody tr:hover { background: #fcf7f5; }
.report-item-row { cursor: pointer; }
.report-item-row:focus-visible { outline: 3px solid rgba(184,75,85,.28); outline-offset: -2px; }
.table-code { font-weight: 850; }
.stage-cell { display: inline-grid; min-width: 56px; place-items: center; padding: 5px 7px; border-radius: 7px; font-weight: 850; }
.stage-cell.complete { color: var(--success); background: var(--success-soft); }
.stage-cell.in-progress { color: var(--warning); background: var(--warning-soft); }
.stage-cell.not-started { color: #6c7890; background: #edf0f5; }
.report-status { padding: 45px 20px; color: var(--muted); text-align: center; }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 900px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .production-item { grid-template-columns: 1.4fr .7fr; }
    .item-progress { grid-column: 1 / -1; }
    .report-controls { flex-wrap: wrap; }
}

@media (max-width: 650px) {
    body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
    body.auth-page { padding-bottom: 0; }
    .page-shell { width: min(100% - 24px, 1220px); padding-top: 20px; padding-bottom: 34px; }
    .site-footer { gap: 5px; padding-inline: 14px; font-size: .68rem; }
    .topbar { min-height: 62px; padding: 8px 13px; }
    .brand { font-size: .94rem; }
    .brand-mark { width: 31px; height: 31px; }
    .user-copy span { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .nav-strip { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: calc(70px + env(safe-area-inset-bottom)); display: flex; align-items: flex-start; gap: 0; padding: 7px 8px env(safe-area-inset-bottom); border-top: 1px solid #e6dad6; border-bottom: 0; background: rgba(255,253,250,.98); box-shadow: 0 -10px 30px rgba(52,36,58,.13); backdrop-filter: blur(12px); overflow: visible; }
    .nav-strip a { flex: 1; min-width: 0; height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 12px; font-size: .68rem; }
    .nav-strip a > svg { display: block; width: 22px; height: 22px; }
    .nav-strip a.active { background: #fae9e7; }
    .nav-strip a.active::after { display: none; }
    .nav-strip .scan-tab { overflow: visible; }
    .nav-strip .scan-tab .scan-tab-icon { width: 44px; height: 44px; display: grid; place-items: center; margin-top: -24px; color: #fff; border: 4px solid var(--canvas); border-radius: 50%; background: var(--blue); box-shadow: 0 8px 18px rgba(184,75,85,.3); }
    .nav-strip .scan-tab .scan-tab-icon > svg { display: block; width: 23px; height: 23px; }
    .nav-strip .scan-tab > span:last-child { margin-top: -1px; }
    .hero { display: block; padding: 25px; }
    .department-pill { display: inline-flex; margin-top: 20px; min-width: 0; padding: 9px 13px; }
    .department-pill span { font-size: .9rem; }
    .action-grid { grid-template-columns: 1fr; }
    .action-card { min-height: 240px; padding: 24px; }
    .action-icon { margin-bottom: 25px; }
    .page-heading.split { align-items: flex-start; }
    .scan-intro { align-items: center; }
    .scan-count { min-width: 110px; }
    .scanner-viewport { min-height: 390px; }
    .photo-scan { align-items: stretch; flex-direction: column; gap: 11px; }
    .photo-scan-button { width: 100%; }
    .manual-card { display: block; }
    .manual-form { margin-top: 15px; }
    .filter-panel { display: grid; }
    .segmented { width: 100%; }
    .segmented button { flex: 1; }
    .production-item { grid-template-columns: 1fr auto; gap: 10px 14px; }
    .item-meta { text-align: right; }
    .metric-grid { gap: 10px; }
    .metric-card { padding: 16px; }
    .metric-card strong { font-size: 1.6rem; }
    .report-tabs { width: 100%; }
    .report-tabs button { flex: 1; }
    .report-controls > *, .report-controls label, .report-controls .search-field { width: 100%; min-width: 0; }
    .review-details { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .review-stages { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .item-detail-fields { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .item-detail-progress { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 430px) {
    .page-shell.auth-shell { width: 100%; min-height: 100svh; place-items: start center; padding: max(18px, env(safe-area-inset-top)) 14px 24px; }
    .login-card { padding: 22px 20px; border-radius: 20px; }
    .login-brand { margin-bottom: 18px; }
    .login-brand .brand-mark.large { width: 42px; height: 42px; border-radius: 12px; font-size: 1.1rem; }
    .login-intro h2 { margin-bottom: 5px; font-size: 1.75rem; }
    .login-intro p { margin-bottom: 16px; font-size: .9rem; line-height: 1.45; }
    .stack-form { gap: 13px; }
    .stack-form label { gap: 5px; }
    .stack-form input { min-height: 46px; }
    .login-foot { margin: 17px 0 0; }
    .user-copy { display: none; }
    .page-heading.split { display: block; }
    .page-heading.split > * { width: 100%; }
    .page-heading .button, .scan-count { width: 100%; margin-top: 15px; }
    .scan-count { width: 100%; }
    .manual-form { display: grid; }
    .manual-row { display: grid; grid-template-columns: minmax(0, 1fr) 82px; }
    .manual-row .button { min-width: 0; padding: 0 10px; }
    .scan-intro p { font-size: .82rem; }
    .manual-jump { max-width: 92px; text-align: center; }
    .scanner-viewport { min-height: 340px; }
    .scan-review { align-items: end; padding: 0; }
    .review-card { width: 100%; max-height: calc(100dvh - 18px); padding: 20px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
    .review-identity { margin-top: 16px; }
    .item-detail-modal { align-items: end; padding: 0; }
    .item-detail-card { width: 100%; max-height: calc(100dvh - 18px); padding: 20px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
    .item-detail-identity { margin-top: 16px; }
}

@media (max-width: 360px) {
    .page-shell.auth-shell { padding-inline: 10px; }
    .login-card { width: 100%; padding-inline: 18px; }
    .manual-row { grid-template-columns: 1fr; }
    .manual-row .button { width: 100%; }
    .filter-panel, .report-controls { padding-inline: 13px; }
    .segmented button { padding-inline: 7px; }
    .report-tabs button { padding-inline: 8px; }
    .recent-heading { align-items: flex-start; }
}
