:root {
  --sidebar-w: 268px;
  --navy: #123a63;
  --navy-2: #0c2a4a;
  --navy-3: #1b4b7a;
  --gold: #b08d57;
  --accent: #123a63;
  --bg: #f4f1ea;
  --paper: #fbfaf7;
  --text: #1a2330;
  --muted: #6b7280;
  --border: #e4ddd2;
  --card: #ffffff;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: .01em;
}
h1, h2, .page-title, .sidebar-brand .name, .auth-title {
  font-family: "Cormorant Garamond", Georgia, serif;
}
a { color: var(--navy); }
.app-shell { min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0e2d4f 0%, #123a63 55%, #0c2744 100%);
  color: #eef3f8;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(176, 141, 87, .25);
}
.sidebar-brand {
  padding: 1.35rem 1.2rem 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand img {
  height: 40px;
  width: auto;
  background: #fff;
  border-radius: 6px;
  padding: 4px 6px;
}
.sidebar-brand .name {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1;
}
.sidebar-brand .sub {
  font-size: 11px;
  opacity: .72;
  margin-top: .25rem;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.nav-side { padding: .9rem .7rem; flex: 1; overflow: auto; }
.nav-side a {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: #d7e1ec;
  text-decoration: none;
  padding: .68rem .85rem;
  border-radius: 6px;
  margin-bottom: .2rem;
  font-size: 14px;
}
.nav-side a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-side a.active {
  background: rgba(176, 141, 87, .18);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--gold);
}
.topbar {
  margin-left: var(--sidebar-w);
  background: rgba(251,250,247,.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.main {
  margin-left: var(--sidebar-w);
  padding: 1.6rem 1.7rem 2.8rem;
}
.page-title {
  font-size: 2rem;
  font-weight: 600;
  margin: 0;
  color: var(--navy);
  letter-spacing: .01em;
}
.page-sub { color: var(--muted); font-size: 14px; }
.card-soft {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(18, 58, 99, .04);
}
.stat-card {
  padding: 1.15rem 1.2rem;
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.stat-card:hover { border-color: var(--gold); }
.stat-label {
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.stat-value { font-size: 1.7rem; font-weight: 650; color: var(--navy); font-family: "Cormorant Garamond", Georgia, serif; }
.btn {
  border-radius: 5px;
  font-weight: 600;
  letter-spacing: .02em;
}
.btn-primary { background: var(--navy); border-color: var(--navy); }
.btn-primary:hover, .btn-primary:focus { background: var(--navy-2); border-color: var(--navy-2); }
.btn-navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-navy:hover { background: var(--navy-2); color: #fff; }
.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}
.btn-gold:hover { background: #9c7848; color: #fff; }
.table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
  background: #f7f4ee;
  border-bottom: 1px solid var(--border);
}
.table td { vertical-align: middle; }
.form-control, .form-select {
  border-color: var(--border);
  border-radius: 6px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 .2rem rgba(18,58,99,.12);
}
.search-global { max-width: 440px; }
.search-global .form-control { background: #fff; }
.filter-chip {
  background: #f3ead8;
  color: #5c4318;
  border-radius: 999px;
  padding: .2rem .65rem;
  font-size: 12px;
}
.empty-state { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(18,58,99,.12), transparent 50%),
    linear-gradient(180deg, #ece7dc, #f7f4ee);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.2rem;
  box-shadow: 0 24px 50px rgba(18,58,99,.1);
}
.auth-logo { height: 42px; width: auto; }
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; background: rgba(12, 39, 68, .5); z-index: 1035;
}
.form-section-title {
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--navy);
  border-bottom: 1px solid var(--border); padding-bottom: .5rem; margin-bottom: 1rem;
}
.required:after { content: " *"; color: #b42318; }
.company-cards { display: none; }
.global-results {
  position: absolute; top: 100%; left: 0; right: 0; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; margin-top: 4px;
  box-shadow: 0 12px 28px rgba(18,58,99,.1); display: none; z-index: 20;
}
.extract-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.scan-tabs .nav-link {
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-weight: 600;
  padding: .7rem 1rem;
}
.scan-tabs .nav-link.active {
  color: var(--navy);
  background: transparent;
  border-bottom-color: var(--gold);
}
.drop-well {
  border: 1px dashed #cfc6b6;
  background: var(--paper);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: .55rem;
}
.drop-well.is-live { border-style: solid; border-color: var(--gold); background: #fff; }
.extract-preview {
  max-width: 100%;
  max-height: 150px;
  object-fit: contain;
  border-radius: 8px;
}
.camera-stage {
  background: #0b1d33;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
.camera-stage video {
  width: 100%;
  min-height: 280px;
  max-height: 420px;
  object-fit: cover;
  display: block;
}
.camera-frame {
  position: absolute;
  inset: 12% 8%;
  border: 1px solid rgba(176,141,87,.85);
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 0 0 999px rgba(0,0,0,.28);
}
.camera-hint {
  position: absolute;
  left: 0; right: 0; bottom: .75rem;
  text-align: center;
  color: #fff;
  font-size: 13px;
}
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; }
  .sidebar-backdrop.show { display: block; }
  .topbar, .main { margin-left: 0; }
  .table-desktop { display: none; }
  .company-cards { display: block; }
  .extract-hero { flex-direction: column; align-items: flex-start; }
}
