:root {
  --ink: #1E2A45;
  --ink-soft: #2E3D5E;
  --cream: #F7F3EA;
  --paper: #FFFDF8;
  --brass: #B8862E;
  --brass-soft: #E8D9B8;
  --slate: #5B6472;
  --red: #A63D40;
  --line: #DDD5C2;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--cream); color: var(--ink); min-height: 100vh; }

.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.rail { background: var(--ink); color: var(--cream); padding: 28px 20px; display: flex; flex-direction: column; gap: 4px; }
.rail-brand { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.rail-brand span { color: var(--brass); }
.rail-sub { font-size: 11px; color: #97A2BE; margin-bottom: 32px; letter-spacing: 0.4px; }
.rail-nav a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 6px; font-size: 13.5px; font-weight: 500; color: #C7CFE2; text-decoration: none; margin-bottom: 2px; }
.rail-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.rail-nav a.active { background: var(--brass); color: var(--ink); font-weight: 600; }
.rail-num { font-family: 'IBM Plex Mono', monospace; font-size: 11px; opacity: 0.6; }
.rail-foot { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 11.5px; color: #8590AC; line-height: 1.6; }

.main { padding: 32px 40px 60px; max-width: 1100px; }
.topline { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 28px; }
.page-title { font-family: 'Fraunces', serif; font-size: 27px; font-weight: 600; }
.page-desc { color: var(--slate); font-size: 13.5px; margin-top: 4px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.stat-num { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 600; }
.stat-label { font-size: 11.5px; color: var(--slate); margin-top: 2px; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 22px 24px; margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.panel-title { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 600; }
.panel-note { font-size: 12px; color: var(--slate); }

.field-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid #EFEADC; font-size: 13px; }
.field-row:last-child { border-bottom: none; }
.field-name { width: 150px; font-weight: 500; }
.bar-track { flex: 1; height: 7px; background: #EFEADC; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brass); border-radius: 4px; }
.bar-fill.low { background: var(--red); }
.field-pct { width: 80px; text-align: right; color: var(--slate); font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

.alert-box { background: #FBF1EC; border: 1px solid #EBC9BE; color: #7A2E2E; border-radius: 8px; padding: 12px 16px; font-size: 12.5px; display: flex; gap: 10px; align-items: flex-start; }

.ocr-form .form-row { margin-bottom: 13px; }
.ocr-form label { display: block; font-size: 11.5px; font-weight: 600; color: var(--slate); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.ocr-form input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.btn-primary { padding: 12px 24px; border: none; border-radius: 7px; background: var(--ink); color: #fff; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.btn-primary:hover { background: var(--ink-soft); }
.btn-primary:disabled { opacity: 0.6; }

.search-shell { display: grid; grid-template-columns: 56px 1fr; gap: 18px; }
.klapper-rail { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; padding: 8px 0; height: fit-content; }
.klapper-rail button { all: unset; text-align: center; padding: 7px 0; font-family: 'Fraunces', serif; font-size: 13px; font-weight: 600; color: #C9C1AC; cursor: default; border-radius: 4px; margin: 0 6px; }
.klapper-rail button.on { color: var(--slate); cursor: pointer; }
.klapper-rail button.active { background: var(--brass); color: var(--ink); }

.search-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.search-bar input { flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 7px; font-size: 13.5px; }
.search-bar select { padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; background: #fff; }

table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--slate); padding: 8px 12px; border-bottom: 1px solid var(--line); }
tbody td { padding: 11px 12px; font-size: 13px; border-bottom: 1px solid #EFEADC; }
tbody tr:hover { background: #FBF8F0; cursor: pointer; }
.nis-cell { font-family: 'IBM Plex Mono', monospace; color: var(--slate); }
.status-pill { font-size: 10.5px; padding: 2px 9px; border-radius: 10px; font-weight: 600; }
.status-ok { background: #E4EFE3; color: #3B6B3E; }
.status-warn { background: #FBEAE7; color: var(--red); }
.klapper-badge { width: 22px; height: 22px; border-radius: 5px; background: var(--brass-soft); display: inline-flex; align-items: center; justify-content: center; font-family: 'Fraunces', serif; font-weight: 700; font-size: 11px; margin-right: 8px; }
