:root {
  --navy: #0f2942;
  --navy-deep: #001428;
  --emerald: #0d7a53;
  --emerald-dark: #006c48;
  --mint: #10b981;
  --mint-soft: #98f6c5;
  --surface: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #191c1e;
  --muted: #64748b;
  --danger: #b91c1c;
  --warn: #b45309;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 41, 66, 0.04), 0 4px 8px rgba(15, 41, 66, 0.02);
  --shadow-lg: 0 8px 24px -4px rgba(15, 41, 66, 0.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--emerald); }
.font-tabular { font-variant-numeric: tabular-nums; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 10px; object-fit: contain;
  background: #0f2942; display: block;
}
.brand-logo-lg { width: 72px; height: 72px; border-radius: 16px; }
.brand small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.brand strong { color: var(--navy); }
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.page-wide { max-width: 1280px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.hero {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
}
.hero h1, .hero h2 { margin: 0 0 .35rem; }
.hero p { margin: 0; color: #b0c9e8; }
.hero-media {
  padding: 0; background: #0f2942;
  aspect-ratio: 16 / 9; min-height: 180px; max-height: 240px;
  width: 100%;
}
.hero-media img {
  position: absolute; inset: 0;
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  border-radius: var(--radius);
}
.card-hero { padding: 0; overflow: hidden; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: 0 1rem; border-radius: 10px; border: 0;
  font-weight: 600; cursor: pointer; width: 100%;
}
.btn-primary { background: var(--navy-deep); color: #fff; }
.btn-primary:hover { background: var(--navy); color: #fff; }
.btn-success { background: var(--emerald); color: #fff; }
.btn-success:hover { color: #fff; }
.btn-outline { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 36px; width: auto; padding: 0 .75rem; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (min-width: 992px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .desktop-split { display: grid; grid-template-columns: 240px 1fr; gap: 1.25rem; }
  .side-nav { display: block !important; }
  .bottom-nav { display: none !important; }
  .page { padding-bottom: 2rem; }
}
.metric { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.metric .n { font-size: 24px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.metric .l { color: var(--muted); font-size: 12px; font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: .25rem; border-radius: 999px; padding: .15rem .55rem; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.badge-success { background: #ecfdf5; color: #0d7a53; }
.badge-warn { background: #fffbeb; color: #b45309; }
.badge-danger { background: #fef2f2; color: #b91c1c; }
.badge-muted { background: #f1f5f9; color: #475569; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: .35rem; color: var(--navy); }
.form-control, .form-select {
  width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: 10px;
  padding: .5rem .75rem; background: #fff; font-size: 15px;
}
.form-control:focus, .form-select:focus { outline: 2px solid var(--mint); border-color: var(--mint); }
.alert { border-radius: 10px; padding: .85rem 1rem; margin-bottom: 1rem; font-size: 14px; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger { background: #fef2f2; color: #991b1b; }
.alert-info { background: #eff6ff; color: #1e3a8a; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: .6rem; border-bottom: 1px solid var(--border); }
table.data td { padding: .7rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; background: #fff;
  border-top: 1px solid var(--border); display: flex; justify-content: space-around;
  padding: .4rem .25rem calc(.4rem + env(safe-area-inset-bottom)); z-index: 50;
}
.bottom-nav a { flex: 1; text-align: center; color: var(--muted); font-size: 11px; font-weight: 600; padding: .25rem; }
.bottom-nav a.active, .bottom-nav a:hover { color: var(--navy); }
.bottom-nav i { display: block; font-size: 20px; }
.side-nav { display: none; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; height: fit-content; position: sticky; top: 80px; }
.side-nav a { display: flex; align-items: center; gap: .6rem; padding: .65rem .75rem; border-radius: 8px; color: var(--text); font-weight: 600; font-size: 14px; }
.side-nav a.active, .side-nav a:hover { background: #f2f4f6; color: var(--navy); }
.side-nav .sec { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: .5rem .75rem; font-weight: 700; }
.camera-frame {
  position: relative; background: #001428; border-radius: 16px; overflow: hidden;
  aspect-ratio: 3/4; max-height: 420px;
}
.camera-frame video, .camera-frame canvas { width: 100%; height: 100%; object-fit: cover; }
.scan-overlay {
  position: absolute; inset: 12%; border: 2px solid #98f6c5; border-radius: 24px; pointer-events: none;
  box-shadow: 0 0 0 999px rgba(0,20,40,.35);
}
.muted { color: var(--muted); }
.progress { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--emerald); }
.list-item { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); display: inline-block; }
.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.logo-crest { width: 72px; height: 72px; object-fit: contain; }
.welcome-wrap { max-width: 480px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.input-group-text { background: #fff; }
.form-check-input:checked { background-color: var(--emerald); border-color: var(--emerald); }
.navbar-dark { background: var(--navy) !important; }
.stat-ring { width: 64px; height: 64px; }
.chip { font-size: 11px; background: #e6e8ea; border-radius: 99px; padding: .15rem .5rem; }
.map-box { height: 220px; background: linear-gradient(180deg,#dbeafe,#ecfdf5); border-radius: 12px; position: relative; overflow: hidden; border: 1px solid var(--border); }
.map-pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-100%); color: var(--danger); font-size: 32px; }
.geo-ring { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; border: 2px dashed var(--emerald); border-radius: 50%; transform: translate(-50%,-50%); }
pre.demo { background: #0f2942; color: #98f6c5; padding: .75rem; border-radius: 8px; font-size: 12px; }
.footer-note { text-align: center; color: var(--muted); font-size: 12px; margin-top: 1rem; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(15,41,66,.15); background: #e2e8f0;
}
.avatar-lg { width: 80px; height: 80px; }
.avatar-sm { width: 36px; height: 36px; font-size: 13px; }
.avatar-initials {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy); color: #98f6c5; font-weight: 700; letter-spacing: .03em;
  font-size: 20px; line-height: 1; user-select: none;
}
.topbar .avatar { border-color: var(--border); }
.photo-compare { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.photo-compare figure { margin: 0; }
.photo-compare img, .photo-missing {
  width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--border); background: #f1f5f9;
}
.photo-missing {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; font-weight: 600; text-align: center; padding: 1rem;
}
.photo-compare figcaption {
  text-align: center; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); margin-top: .4rem;
}
.photo-compare-sm { grid-template-columns: 72px 72px; gap: .5rem; justify-content: start; }
.photo-compare-sm img, .photo-compare-sm .photo-missing {
  width: 72px; height: 72px; aspect-ratio: 1; border-radius: 8px;
}
.photo-compare-sm .photo-missing { font-size: 10px; padding: .25rem; }
hr.soft { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
