:root {
  --bg: #f1f5f9; --surface: #fff; --surface-muted: #e2e8f0; --text: #0f172a; --muted: #64748b;
  --primary: #2563eb; --primary-dark: #1d4ed8; --danger: #b91c1c; --success: #15803d; --warning: #a16207;
  --radius-sm: .5rem; --radius-md: .8rem; --radius-lg: 1.1rem;
  --space-1: .35rem; --space-2: .65rem; --space-3: .9rem; --space-4: 1.25rem; --space-5: 1.75rem;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.shell { width: min(100% - 2rem, 720px); margin: 0 auto; padding: var(--space-5) 0 6.5rem; }
.auth-shell { width: min(100% - 2rem, 440px); margin: 0 auto; padding: 8vh 0 2rem; }
.auth-heading { display: grid; justify-items: center; gap: .4rem; margin-bottom: var(--space-4); text-align: center; }
.auth-heading i { color: var(--primary); font-size: 2.5rem; }
.auth-heading h1 { margin-bottom: 0; }
.auth-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; margin-bottom: var(--space-3); }
.auth-tabs .button { min-width: 0; padding: .7rem .45rem; font-size: .82rem; }
.topbar-actions { display: flex; align-items: center; gap: .25rem; }
.topbar { display: flex; justify-content: space-between; gap: var(--space-3); align-items: center; margin-bottom: var(--space-5); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 1.8rem; margin-bottom: .2rem; }
h2 { font-size: 1.35rem; }
.muted { color: var(--muted); }
.card, .action-card { background: var(--surface); border: 1px solid #dbe3ef; border-radius: var(--radius-lg); padding: var(--space-4); box-shadow: 0 8px 25px #0f172a0b; }
.stack { display: grid; gap: var(--space-3); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.action-card { min-height: 145px; display: grid; align-content: center; gap: var(--space-2); text-align: left; color: var(--text); transition: border-color .15s, transform .15s; }
.action-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.action-card i { color: var(--primary); font-size: 2rem; }
.action-card strong { font-size: 1.15rem; }
.button { border: 0; border-radius: var(--radius-md); padding: .85rem 1rem; min-height: 48px; font-weight: 700; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: var(--surface-muted); color: var(--text); }
.button.danger { background: #fee2e2; color: var(--danger); }
.button.link { border: 0; background: transparent; color: var(--primary); padding: .5rem; }
.form-field { display: grid; gap: .4rem; }
.form-field label { font-weight: 700; }
input { width: 100%; border: 1px solid #cbd5e1; border-radius: var(--radius-md); min-height: 48px; padding: .7rem .8rem; background: #fff; color: var(--text); }
.toolbar { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.toolbar .button.link { margin-left: auto; }
.note-card, .history-item { display: grid; gap: .45rem; }
.note-card { text-align: left; }
.note-card .meta, .history-item .meta { display: flex; flex-wrap: wrap; gap: .45rem .8rem; color: var(--muted); font-size: .92rem; }
.badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 99px; padding: .2rem .55rem; background: #dbeafe; color: #1e40af; font-size: .82rem; font-weight: 700; }
.badge.success { background: #dcfce7; color: var(--success); } .badge.warning { background: #fef3c7; color: var(--warning); } .badge.error { background: #fee2e2; color: var(--danger); }
.progress { display: grid; gap: .45rem; } .progress-bar { height: .55rem; border-radius: 99px; background: var(--surface-muted); overflow: hidden; } .progress-bar > span { display: block; height: 100%; background: var(--primary); }
.series-section { display: grid; gap: .7rem; }
.series-section h2 { margin-bottom: 0; font-size: 1.05rem; }
.series-divider { border-top: 2px dashed #cbd5e1; margin: 1rem 0; }
.series-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.series-button { border: 1px solid #cbd5e1; border-radius: var(--radius-md); background: #fff; padding: .8rem .65rem; min-height: 54px; font-weight: 700; text-align: left; overflow-wrap: anywhere; }
.series-button.processed { background: #f0fdf4; border-color: #86efac; color: var(--success); }
.series-button.partial { background: #fffbeb; border-color: #facc15; }
.camera-card { display: grid; gap: var(--space-3); } video { width: 100%; max-height: 60vh; object-fit: cover; border-radius: var(--radius-md); background: #0f172a; aspect-ratio: 4/3; }
.camera-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); min-width: 0; } .preview { display: grid; gap: .5rem; min-width: 0; } .preview img { display: block; width: 100%; max-width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-md); background: #0f172a; } .existing-photo { min-width: 0; } .photo-placeholder { display: grid; place-items: center; gap: .35rem; min-height: 180px; border-radius: var(--radius-md); background: #f0fdf4; color: var(--success); text-align: center; } .photo-placeholder i { font-size: 2rem; }
.camera-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; } .camera-actions .button { min-width: 0; padding-right: .35rem; padding-left: .35rem; font-size: .78rem; overflow-wrap: anywhere; }
.add-extra-tile { width: 100%; aspect-ratio: 1 / 1; min-height: 0; align-self: start; align-content: center; justify-items: center; border: 2px dashed #94a3b8; border-radius: var(--radius-md); background: #f8fafc; color: #64748b; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .15s; } .add-extra-tile i { font-size: 3rem; line-height: 1; } .add-extra-tile:hover { border-color: var(--primary); background: #eff6ff; color: var(--primary); } .add-extra-tile:active { transform: scale(.97); } .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.photo-lightbox-open { overflow: hidden; }
.photo-lightbox { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); background: rgb(2 6 23 / 92%); }
.photo-lightbox img { display: block; width: auto; max-width: 100%; height: auto; max-height: 100%; object-fit: contain; border-radius: var(--radius-md); box-shadow: 0 16px 50px rgb(0 0 0 / 45%); }
.photo-lightbox-close { position: absolute; z-index: 1; top: max(1rem, env(safe-area-inset-top)); right: max(1rem, env(safe-area-inset-right)); display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 1px solid rgb(255 255 255 / 35%); border-radius: 999px; background: rgb(15 23 42 / 80%); color: #fff; cursor: pointer; }
.photo-lightbox-close i { font-size: 1.5rem; }
.photo-lightbox-close:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.camera-active { overflow: hidden; }
.camera-active .bottom-nav { display: none; }
.camera-screen { position: fixed; z-index: 20; inset: 0; width: 100%; min-height: 100dvh; overflow: hidden; isolation: isolate; background: #000; color: #fff; }
.camera-screen video { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; object-fit: cover; border-radius: 0; touch-action: none; }
.camera-top-overlay, .camera-bottom-overlay { position: absolute; z-index: 2; right: 0; left: 0; display: flex; align-items: flex-start; gap: .75rem; padding-right: max(1rem, env(safe-area-inset-right)); padding-left: max(1rem, env(safe-area-inset-left)); pointer-events: none; }
.camera-top-overlay { top: 0; min-height: 7rem; padding-top: max(1rem, env(safe-area-inset-top)); background: linear-gradient(rgb(0 0 0 / 72%), rgb(0 0 0 / 0%)); }
.camera-bottom-overlay { bottom: 0; min-height: 9rem; align-items: center; justify-content: center; padding-bottom: max(1.25rem, env(safe-area-inset-bottom)); background: linear-gradient(rgb(0 0 0 / 0%), rgb(0 0 0 / 78%)); }
.camera-control, .camera-back { pointer-events: auto; display: grid; place-items: center; min-width: 48px; min-height: 48px; border: 1px solid rgb(255 255 255 / 38%); border-radius: 999px; background: rgb(15 23 42 / 78%); color: #fff; font-weight: 700; box-shadow: 0 4px 16px rgb(0 0 0 / 25%); }
.camera-control:hover, .camera-control:active { background: rgb(37 99 235 / 90%); }
.camera-back { flex: 0 0 48px; }
.camera-back i { font-size: 1.35rem; }
.camera-info { display: grid; gap: .1rem; min-width: 0; padding-top: .35rem; text-shadow: 0 1px 3px #000; }
.camera-info strong { font-size: 1.1rem; }
.camera-info span { color: #e2e8f0; font-size: .86rem; overflow-wrap: anywhere; }
.camera-tools { display: flex; margin-left: auto; }
.camera-tools .camera-control[hidden] { display: none; }
.camera-message { position: absolute; top: 5.6rem; right: max(1rem, env(safe-area-inset-right)); left: max(1rem, env(safe-area-inset-left)); display: flex; align-items: flex-start; gap: .5rem; max-width: 42rem; margin: 0 auto; padding: .75rem .9rem; border: 1px solid rgb(255 255 255 / 30%); border-radius: var(--radius-md); background: rgb(15 23 42 / 82%); color: #fff; pointer-events: auto; text-shadow: 0 1px 2px #000; }
.camera-message.error { background: rgb(127 29 29 / 90%); }
.camera-message.notice { background: rgb(30 64 175 / 90%); }
.camera-bottom-overlay .camera-hint { align-self: center; max-width: 20rem; margin: 0; color: #f8fafc; font-size: .86rem; text-align: center; text-shadow: 0 1px 3px #000; }
.camera-bottom-stack { display: grid; justify-items: center; gap: .7rem; width: min(100%, 34rem); }
.camera-manual-toggle { padding: .7rem 1rem; }
.camera-manual-panel { position: absolute; right: max(1rem, env(safe-area-inset-right)); bottom: calc(7.75rem + env(safe-area-inset-bottom)); left: max(1rem, env(safe-area-inset-left)); max-width: 34rem; margin: 0 auto; padding: 1rem; border: 1px solid rgb(255 255 255 / 28%); border-radius: var(--radius-lg); background: rgb(15 23 42 / 92%); box-shadow: 0 10px 30px rgb(0 0 0 / 35%); pointer-events: auto; }
.camera-manual-panel[hidden] { display: none !important; }
.camera-manual-panel label { color: #fff; }
.camera-manual-panel input { background: #fff; }
.camera-shutter { pointer-events: auto; display: grid; place-items: center; width: 76px; height: 76px; padding: 0; border: 5px solid #fff; border-radius: 50%; background: #fff; color: var(--primary); box-shadow: 0 4px 18px rgb(0 0 0 / 35%), inset 0 0 0 3px #cbd5e1; transition: transform .12s, background .12s; }
.camera-shutter i { font-size: 2rem; }
.camera-shutter:active { transform: scale(.92); background: #dbeafe; }
.focus-reticle { position: absolute; z-index: 1; width: 70px; height: 70px; transform: translate(-50%, -50%) scale(.78); border: 2px solid #facc15; border-radius: .7rem; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; box-shadow: 0 0 0 1px rgb(0 0 0 / 35%); }
.focus-reticle::before, .focus-reticle::after { position: absolute; content: ''; background: #facc15; }
.focus-reticle::before { top: 50%; right: -9px; left: -9px; height: 1px; }
.focus-reticle::after { top: -9px; right: 50%; bottom: -9px; width: 1px; }
.focus-reticle.visible { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.scan-region-overlay { position: absolute; z-index: 1; top: 50%; left: 50%; width: min(66.6667vw, 66.6667vh); aspect-ratio: 1; transform: translate(-50%, -50%); border: 2px solid rgb(255 255 255 / 85%); border-radius: 1rem; box-shadow: 0 0 0 9999px rgb(0 0 0 / 18%), 0 0 0 1px rgb(0 0 0 / 45%); pointer-events: none; }
.target-card { display: grid; gap: var(--space-3); margin-bottom: var(--space-3); } .section-heading { display: flex; align-items: flex-start; gap: .7rem; } .section-heading > i { color: var(--primary); font-size: 1.5rem; } .section-heading div { display: grid; gap: .15rem; } .target-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; margin: 0; } .target-grid div { min-width: 0; padding: .65rem .75rem; border-radius: var(--radius-md); background: #f8fafc; } .target-grid dt { color: var(--muted); font-size: .78rem; font-weight: 700; overflow-wrap: anywhere; } .target-grid dd { margin: .15rem 0 0; font-weight: 700; overflow-wrap: anywhere; }
.alert { border-radius: var(--radius-md); padding: .85rem 1rem; } .alert.error { background: #fee2e2; color: #7f1d1d; } .alert.success { background: #dcfce7; color: #14532d; } .alert.info { background: #dbeafe; color: #1e3a8a; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); } .empty i { font-size: 2rem; }
.bottom-nav { position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: 1fr 1fr; padding: .45rem max(1rem, env(safe-area-inset-right)) calc(.45rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); background: #fff; border-top: 1px solid #dbe3ef; box-shadow: 0 -5px 20px #0f172a0d; }
body:not(.app-authenticated) .bottom-nav { display: none; }
.nav-item { display: grid; justify-items: center; gap: .1rem; border: 0; background: transparent; color: var(--muted); padding: .4rem; font-size: .78rem; } .nav-item i { font-size: 1.4rem; } .nav-item.active { color: var(--primary); font-weight: 700; }
@media (max-width: 430px) { .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } .preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .shell { width: min(100% - 1.2rem, 720px); } }
@media (orientation: landscape) and (max-height: 560px) { .camera-top-overlay { min-height: 5rem; } .camera-bottom-overlay { min-height: 6.5rem; } .camera-manual-panel { bottom: calc(5.5rem + env(safe-area-inset-bottom)); } }
