/* ==========================================================================
   Insurance Lot Processer — design tokens
   Ledger / policy-stamp direction: deep ink sidebar, brass "seal" accent,
   paper working surface, ledger-mono for figures and IDs.
   ========================================================================== */
:root{
  --ink:        #0E1526;
  --ink-2:      #172140;
  --ink-3:      #212D52;
  --paper:      #F1F2EE;
  --paper-2:    #FFFFFF;
  --line:       #DCDFDC;
  --line-soft:  #E9EAE6;
  --text:       #16192A;
  --text-muted: #626A78;
  --text-dim:   #8A92A0;
  --brass:      #B8862F;
  --brass-dark: #8F6A22;
  --brass-tint: #F4E8D2;
  --teal:       #256B5C;
  --teal-tint:  #DDEEE9;
  --brick:      #B3453B;
  --brick-tint: #F7E1DE;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 2px rgba(14,21,38,.06);
  --shadow:     0 8px 24px rgba(14,21,38,.10);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; }
body{
  margin:0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a{ color: inherit; }
button{ font-family: inherit; }
::selection{ background: var(--brass-tint); }
:focus-visible{ outline: 2px solid var(--brass); outline-offset: 2px; }

h1,h2,h3,h4{ font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.mono{ font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow{
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600; margin: 0 0 6px;
}

/* ---------------------------- App shell ---------------------------- */
.app-shell{
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

/* ---------------------------- Sidebar ---------------------------- */
.sidebar{
  background: linear-gradient(180deg, var(--ink) 0%, #0A0F1D 100%);
  color: #E7E9F2;
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 22px;
  border-bottom: 1px solid rgba(231,233,242,.10);
  margin-bottom: 16px;
}
.brand-mark{
  width: 40px; height: 40px; flex: none;
  border-radius: 50%;
  border: 1.5px dashed rgba(184,134,47,.65);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.brand-mark::before{
  content: '';
  position: absolute; inset: 4px;
  border-radius: 50%;
  border: 1px solid rgba(184,134,47,.4);
}
.brand-mark svg{ width: 18px; height: 18px; }
.brand-text{ min-width: 0; }
.brand-text .title{
  font-family: var(--font-display);
  font-size: 15px; font-weight: 600; color: #fff;
  line-height: 1.2; letter-spacing: -0.01em;
}
.brand-text .sub{ font-size: 11px; color: #8D93AB; margin-top: 2px; }

.nav{ list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item{
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: #B9BED2; font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  transition: background .15s ease, color .15s ease;
}
.nav-item svg{ width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item:hover{ background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active{ background: rgba(184,134,47,.16); color: #F3D9A2; }
.nav-item.active svg{ opacity: 1; }
.nav-num{ font-family: var(--font-mono); font-size: 10.5px; color: #6C7391; width: 14px; }
.nav-item.active .nav-num{ color: var(--brass); }

.sidebar-footer{
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(231,233,242,.10);
}
.coverage-mini{ padding: 12px; border-radius: var(--radius-sm); background: rgba(255,255,255,.04); }
.coverage-mini .label{ font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #7A81A0; margin-bottom: 8px; }
.coverage-bar{ height: 5px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; margin-bottom: 8px; }
.coverage-bar > span{ display: block; height: 100%; background: linear-gradient(90deg, var(--brass), #E0B15C); }
.coverage-mini .count{ font-family: var(--font-mono); font-size: 12px; color: #D6D9E6; }
.coverage-mini .count b{ color: #fff; }

/* ---------------------------- Main / topbar ---------------------------- */
.main{ min-width: 0; display: flex; flex-direction: column; }
.topbar{
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 20px 32px; background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1{ font-size: 21px; }
.topbar .desc{ color: var(--text-muted); font-size: 12.5px; margin-top: 3px; }
.topbar-right{ display: flex; align-items: center; gap: 10px; flex: none; }
.lot-chip{
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line);
  font-size: 12px; color: var(--text-muted);
}
.lot-chip .dot{ width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); flex: none; }
.lot-chip.live .dot{ background: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint); }
.lot-chip b{ color: var(--text); font-family: var(--font-mono); font-weight: 600; }

.view{ padding: 28px 32px 48px; flex: 1; }
.view[hidden]{ display: none; }

/* ---------------------------- Cards / grid ---------------------------- */
.grid{ display: grid; gap: 16px; }
.kpi-row{ grid-template-columns: repeat(4, 1fr); margin-bottom: 24px; }
.kpi-card{
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 16px;
  position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
}
.kpi-card::before{
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--spine, var(--brass));
}
.kpi-card .kpi-label{ font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; }
.kpi-card .kpi-value{ font-family: var(--font-display); font-size: 28px; margin-top: 8px; font-weight: 600; }
.kpi-card .kpi-sub{ font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.kpi-card.spine-teal{ --spine: var(--teal); }
.kpi-card.spine-brick{ --spine: var(--brick); }
.kpi-card.spine-ink{ --spine: var(--ink-3); }

.panel{
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.panel-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line-soft);
}
.panel-head h2{ font-size: 16px; }
.panel-head .desc{ font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.panel-body{ padding: 22px; }

.two-col{ display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }

/* ---------------------------- Dashboard extras ---------------------------- */
.stamp{
  width: 118px; height: 118px; border-radius: 50%; flex: none;
  border: 2px dashed rgba(184,134,47,.55);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.stamp::before{ content: ''; position: absolute; inset: 8px; border-radius: 50%; border: 1px solid rgba(184,134,47,.35); }
.stamp .txt{ text-align: center; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .06em; color: var(--brass-dark); line-height: 1.5; }
.stamp .txt b{ display:block; font-size: 11px; color: var(--ink); }

.hero-panel{ display: flex; align-items: center; gap: 26px; padding: 26px 28px; }
.hero-panel .copy{ flex: 1; }
.hero-panel h2{ font-size: 22px; margin-bottom: 6px; }
.hero-panel p{ color: var(--text-muted); font-size: 13px; max-width: 56ch; margin: 0 0 14px; }

.mini-list{ list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mini-list li{
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.mini-list li:last-child{ border-bottom: none; }
.mini-list .name{ font-weight: 600; }
.mini-list .meta{ color: var(--text-dim); font-size: 11.5px; }

.pill{
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.pill-active{ background: var(--teal-tint); color: var(--teal); }
.pill-soon{ background: var(--line-soft); color: var(--text-muted); }
.pill-error{ background: var(--brick-tint); color: var(--brick); }
.pill-ok{ background: var(--teal-tint); color: var(--teal); }

/* ---------------------------- Forms ---------------------------- */
.field{ margin-bottom: 14px; }
.field label{ display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field input[type=text], .field input[type=date], .field select{
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--paper); font-size: 13px; color: var(--text);
  font-family: var(--font-body);
}
.field input:focus, .field select:focus{ background: var(--paper-2); border-color: var(--brass); }
.field.disabled{ opacity: .55; pointer-events: none; }
.field .hint{ font-size: 11px; color: var(--text-dim); margin-top: 5px; }
.field-row{ display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.file-drop{
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  background: var(--paper);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.file-drop:hover, .file-drop.drag{ border-color: var(--brass); background: var(--brass-tint); }
.file-drop svg{ width: 26px; height: 26px; color: var(--text-dim); margin-bottom: 8px; }
.file-drop .fname{ font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); margin-top: 6px; }
.file-drop .ftitle{ font-weight: 600; font-size: 13px; }
.file-drop .fsub{ font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }
input[type=file]{ display: none; }

.attach-list{ list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px; color: var(--text-muted); }
.attach-list li{ padding: 4px 0; }

/* ---------------------------- Buttons ---------------------------- */
.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: filter .15s ease, background .15s ease;
}
.btn:disabled{ opacity: .45; cursor: not-allowed; }
.btn-primary{ background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled){ background: var(--ink-2); }
.btn-brass{ background: var(--brass); color: #fff; }
.btn-brass:hover:not(:disabled){ background: var(--brass-dark); }
.btn-ghost{ background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover:not(:disabled){ background: var(--paper); }
.btn-sm{ padding: 7px 12px; font-size: 12px; }
.btn-block{ width: 100%; }
.btn-row{ display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------------------------- Status / callouts ---------------------------- */
.status-line{ font-size: 12.5px; color: var(--text-muted); margin-top: 12px; min-height: 18px; }
.status-line.err{ color: var(--brick); }
.status-line.ok{ color: var(--teal); }
.callout{
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--brass-tint); border: 1px solid rgba(184,134,47,.3); font-size: 12.5px; color: var(--brass-dark);
}

/* ---------------------------- Product cards ---------------------------- */
.product-grid{ grid-template-columns: repeat(3, 1fr); }
.product-card{
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm);
}
.product-card .top{ display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.product-card h3{ font-size: 15.5px; }
.product-card .insurer{ font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.product-card .desc{ font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.product-card .meta-row{ display: flex; gap: 14px; font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }
.product-card ul{ margin: 4px 0 0; padding-left: 16px; font-size: 12px; color: var(--text-muted); }
.product-card ul li{ margin-bottom: 3px; }
.product-card.is-soon{ opacity: .82; }

/* ---------------------------- Tables ---------------------------- */
.table-wrap{ overflow: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table{ width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th{
  position: sticky; top: 0; background: var(--ink); color: #E7E9F2;
  text-align: left; padding: 10px 12px; font-weight: 600; font-size: 11px;
  letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
}
tbody td{ padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:hover{ background: var(--paper); }
tbody tr:last-child td{ border-bottom: none; }
td.num, th.num{ font-family: var(--font-mono); text-align: right; }
.empty-row td{ text-align: center; color: var(--text-dim); padding: 34px; }

.search-row{ display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.search-row input{
  flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--paper);
}

.badge-count{
  font-family: var(--font-mono); font-size: 11px; background: var(--line-soft);
  color: var(--text-muted); padding: 3px 8px; border-radius: 999px;
}
.badge-count.err{ background: var(--brick-tint); color: var(--brick); }

/* ---------------------------- Utility ---------------------------- */
.flex{ display: flex; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-8{ gap: 8px; } .gap-12{ gap: 12px; } .gap-16{ gap: 16px; }
.mt-24{ margin-top: 24px; } .mb-16{ margin-bottom: 16px; }
.text-muted{ color: var(--text-muted); }
.text-dim{ color: var(--text-dim); }

/* ---------------------------- Responsive ---------------------------- */
@media (max-width: 1100px){
  .kpi-row{ grid-template-columns: repeat(2, 1fr); }
  .product-grid{ grid-template-columns: repeat(2, 1fr); }
  .two-col{ grid-template-columns: 1fr; }
}
@media (max-width: 860px){
  .app-shell{ grid-template-columns: 1fr; }
  .sidebar{ position: relative; height: auto; }
  .nav{ flex-direction: row; overflow-x: auto; }
  .nav-item{ white-space: nowrap; }
  .sidebar-footer{ display: none; }
  .topbar{ padding: 16px 18px; flex-wrap: wrap; }
  .view{ padding: 20px 18px 40px; }
  .kpi-row{ grid-template-columns: 1fr 1fr; }
  .product-grid{ grid-template-columns: 1fr; }
  .hero-panel{ flex-direction: column; text-align: center; }
}
