:root {
  --ink: #162033;
  --muted: #657084;
  --line: #d8dee8;
  --bg: #eef2f6;
  --panel: #ffffff;
  --navy: #0c2b57;
  --blue: #225ea8;
  --green: #16864a;
  --amber: #d88900;
  --red: #c93a3a;
  --violet: #6c4ab6;
  --shadow: 0 14px 36px rgba(20, 35, 61, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.side {
  background: var(--navy);
  color: white;
  padding: 20px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #1b7b66;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand small { color: #c7d5e8; display: block; margin-top: 2px; }

.nav { display: grid; gap: 6px; }
.nav a {
  display: block;
  padding: 11px 12px;
  border-radius: 8px;
  color: #e7eef8;
  text-decoration: none;
}
.nav a.active, .nav a:hover { background: rgba(255,255,255,.12); color: #fff; }

.main { min-width: 0; }
.top {
  min-height: 86px;
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid var(--line);
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 28px; line-height: 1.15; }
h2 { font-size: 20px; margin-bottom: 14px; }
.eyebrow { color: var(--blue); font-weight: 800; font-size: 12px; text-transform: uppercase; margin-bottom: 4px; }

.content { padding: 28px; display: grid; gap: 18px; }
.grid { display: grid; gap: 16px; }
.two { grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.panel, .metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel { padding: 18px; }
.metric { padding: 16px; min-height: 108px; }
.metric span { color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { display: block; margin-top: 10px; font-size: 32px; }
.metric.blue { border-top: 4px solid var(--blue); }
.metric.red { border-top: 4px solid var(--red); }
.metric.amber { border-top: 4px solid var(--amber); }
.metric.violet { border-top: 4px solid var(--violet); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { color: var(--red); border-color: rgba(201,58,58,.4); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: white;
  color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.field-shell { display: grid; gap: 6px; }
.field-shell.required-missing input,
.field-shell.required-missing select,
.field-shell.required-missing textarea {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(201, 58, 58, .14);
}
.field-shell.suspect input,
.field-shell.suspect select,
.field-shell.suspect textarea {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(108, 74, 182, .16);
}
.field-hint {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.field-shell.required-missing .field-hint { color: var(--red); }
.field-shell.suspect .field-hint { color: var(--violet); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }

.filters { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 860px; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
tr:hover td { background: #f7faff; }

.pill, .traffic, .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.pill { color: var(--blue); background: #e9f1fb; }
.critical { color: #9b2222; background: #ffe9e9; }
.medium { color: #8a5a00; background: #fff3d6; }
.low { color: #12673b; background: #e7f6ed; }
.traffic.green { color: #0f6b3b; background: #e7f6ed; }
.traffic.yellow { color: #8a5a00; background: #fff3d6; }
.traffic.red { color: #9b2222; background: #ffe9e9; }
.traffic::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
}
.tag { background: #f0f2f6; color: var(--muted); }
.muted { color: var(--muted); }
.stack { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list { display: grid; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.flash {
  padding: 12px 14px;
  border: 1px solid #b8d8c4;
  background: #e7f6ed;
  color: #0f6b3b;
  border-radius: 8px;
}
.dropzone {
  border: 2px dashed #aeb9c9;
  background: #fff;
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 10px;
}
.dropzone.drag {
  border-color: var(--blue);
  background: #f7faff;
}
.dropzone input { background: #f8fafc; }
.extract-result {
  display: none;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
.extract-result.visible { display: block; }
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login .panel { width: min(440px, 100%); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { text-decoration: none; }
.tabs .active { background: var(--navy); color: white; border-color: var(--navy); }

@media (max-width: 1120px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two, .three, .four, .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .top { flex-direction: column; align-items: stretch; padding: 18px; }
  .content { padding: 18px; }
  .nav, .two, .three, .four, .filters, .form, .form.three, .row { grid-template-columns: 1fr; }
}
