@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  --bg: #f4f0e7;
  --paper: #fffdf8;
  --ink: #111820;
  --muted: #62717b;
  --faint: #87949c;
  --line: #d8cebd;
  --midnight: #102136;
  --midnight-2: #172d46;
  --evergreen: #0d2f2a;
  --cobalt: #2457b8;
  --mint: #b7ead8;
  --copper: #b96a3d;
  --gold: #b18a46;
  --red: #943236;
  --soft-blue: #e8efff;
  --soft-green: #e6f8ef;
  --soft-amber: #fff1da;
  --soft-red: #fae6e2;
  --shadow: 0 22px 60px rgba(17, 24, 32, 0.12);
  --soft-shadow: 0 12px 30px rgba(17, 24, 32, 0.08);
  --radius: 8px;
  --font-body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    repeating-linear-gradient(90deg, rgba(16, 33, 54, 0.035) 0 1px, transparent 1px 54px),
    repeating-linear-gradient(0deg, rgba(16, 33, 54, 0.028) 0 1px, transparent 1px 54px),
    var(--bg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button { cursor: pointer; }

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: var(--radius);
  min-height: 43px;
  padding: 9px 11px;
  outline: none;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(36, 87, 184, 0.12);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  color: var(--paper);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent 240px),
    var(--midnight);
  border-right: 1px solid rgba(255,255,255,0.08);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 6px 28px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background:
    url("./logo-mark.png?v=20260515-logo2") center / cover no-repeat,
    var(--paper);
  color: transparent;
  font-size: 0;
  font-weight: 950;
  box-shadow: 0 14px 34px rgba(0,0,0,0.18);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
}

.brand span {
  margin-top: 3px;
  color: rgba(255,253,248,0.62);
  font-size: 12px;
  font-weight: 760;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav button {
  width: 100%;
  min-height: 43px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 12px;
  color: rgba(255,253,248,0.74);
  background: transparent;
  text-align: left;
  font-weight: 820;
}

.side-nav button.active,
.side-nav button:hover {
  color: var(--paper);
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.1);
}

.side-nav button.active {
  box-shadow: inset 4px 0 0 var(--mint);
}

.sidebar-note {
  margin: 24px 6px 0;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.07);
  padding: 14px;
  border-radius: var(--radius);
}

.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.sidebar-note strong {
  font-size: 13px;
}

.sidebar-note span {
  margin-top: 6px;
  color: rgba(255,253,248,0.66);
  font-size: 12px;
  line-height: 1.45;
}

.main {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--copper);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p { margin-top: 0; }

h1,
h2,
h3 {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 50px;
  line-height: 0.98;
  font-weight: 950;
}

.subtitle {
  margin: 10px 0 0;
  max-width: 820px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.danger-button,
.mini-button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  padding: 0 15px;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.mini-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  border: 1px solid var(--evergreen);
  background: var(--evergreen);
  color: var(--paper);
  box-shadow: 0 15px 30px rgba(13, 47, 42, 0.18);
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255,253,248,0.86);
  color: var(--ink);
}

.danger-button {
  border: 1px solid #ebc1bd;
  background: var(--soft-red);
  color: var(--red);
}

.mini-button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 12px;
}

.view-root {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(330px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stack {
  display: grid;
  gap: 18px;
}

.panel {
  min-width: 0;
  background: rgba(255,253,248,0.92);
  border: 1px solid rgba(216,206,189,0.96);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--soft-shadow);
}

.panel.prominent {
  background:
    linear-gradient(135deg, rgba(13,47,42,0.05), transparent 38%),
    var(--paper);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 19px;
  line-height: 1.15;
  font-weight: 930;
}

.panel h3 {
  margin: 0 0 9px;
  font-size: 15px;
  font-weight: 900;
}

.panel p,
.copy {
  color: var(--muted);
  line-height: 1.58;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field.full,
.full { grid-column: 1 / -1; }

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

label,
.label {
  color: #33424b;
  font-size: 12px;
  font-weight: 880;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.muted {
  color: var(--muted);
}

.meta,
.tiny,
.help-text {
  color: var(--faint);
  font-size: 12px;
  line-height: 1.45;
}

.tag,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 900;
}

.tag.green,
.status.green,
.status.good,
.status.ready {
  background: var(--soft-green);
  color: var(--evergreen);
  border-color: #c4ead6;
}

.tag.blue,
.status.blue,
.status.info {
  background: var(--soft-blue);
  color: var(--cobalt);
  border-color: #cfdcff;
}

.tag.amber,
.status.amber,
.status.warning,
.status.watch {
  background: var(--soft-amber);
  color: #81500d;
  border-color: #efd2a2;
}

.tag.red,
.status.red,
.status.danger,
.status.missing {
  background: var(--soft-red);
  color: var(--red);
  border-color: #edc0bc;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fact {
  border: 1px solid rgba(216,206,189,0.92);
  border-radius: var(--radius);
  padding: 13px;
  background: white;
}

.fact span {
  display: block;
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 880;
}

.fact strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  line-height: 1.1;
}

.score-layout {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.score-ring {
  width: 126px;
  height: 126px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    conic-gradient(var(--copper) 0 78%, #e9dfcf 78% 100%);
  color: var(--paper);
  font-size: 34px;
  font-weight: 950;
  box-shadow: inset 0 0 0 12px var(--paper), 0 16px 34px rgba(185, 106, 61, 0.22);
}

.progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e7dece;
  overflow: hidden;
}

.progress-bar span,
.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--evergreen), var(--cobalt));
}

.notice-banner {
  border: 1px solid rgba(185, 106, 61, 0.34);
  border-left: 5px solid var(--copper);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff3e5;
  color: #623b24;
  font-weight: 760;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #33424b;
  background: #eee6d8;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 920;
}

tr:hover td { background: rgba(255,253,248,0.74); }

.draft-box,
.packet-document {
  border: 1px solid #d8cebd;
  border-radius: var(--radius);
  background: #fffefa;
  color: #17212b;
  box-shadow: var(--soft-shadow);
}

.draft-box {
  white-space: pre-wrap;
  padding: 16px;
  line-height: 1.58;
}

.packet-document {
  max-width: 850px;
  margin: 0 auto;
  padding: 34px;
}

.packet-cover {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  min-height: 210px;
  margin: -34px -34px 26px;
  padding: 34px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--midnight);
  color: var(--paper);
}

.packet-cover h1 {
  max-width: 540px;
  margin: 9px 0 12px;
  font-size: 38px;
  line-height: 1;
}

.packet-cover span {
  display: block;
  color: rgba(255,253,248,0.62);
  font-size: 11px;
  font-weight: 880;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.packet-cover strong {
  display: block;
  margin-bottom: 7px;
  color: var(--paper);
}

.packet-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 2px solid #1f2933;
}

.packet-header h2 {
  margin: 0 0 6px;
  font-size: 28px;
}

.packet-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  color: #3e4d56;
}

.packet-section {
  margin-top: 24px;
}

.packet-section h3 {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.evidence-list,
.todo-list,
.case-list,
.upload-list {
  display: grid;
  gap: 10px;
}

.evidence-card,
.todo-card,
.case-card,
.upload-card,
.task-row {
  border: 1px solid rgba(216,206,189,0.94);
  border-radius: var(--radius);
  padding: 13px;
  background: white;
}

.todo-card {
  display: grid;
  gap: 5px;
}

.todo-card strong {
  color: var(--ink);
}

.todo-card span {
  color: var(--muted);
  line-height: 1.45;
}

.source-card {
  color: inherit;
  text-decoration: none;
  word-break: break-word;
}

.source-card:hover {
  border-color: rgba(13,47,42,0.42);
  transform: translateY(-1px);
}

.extraction-preview {
  display: grid;
  gap: 14px;
}

.case-card,
.task-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.case-card.active {
  border-color: rgba(13,47,42,0.42);
  box-shadow: inset 4px 0 0 var(--evergreen);
}

.task-row input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
}

.task-row label {
  flex: 1;
  color: var(--ink);
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
}

.task-row.completed label {
  color: var(--muted);
  text-decoration: line-through;
}

.upload-name {
  color: var(--ink);
  font-weight: 880;
}

.savings-figure {
  font-size: 42px;
  line-height: 1;
  font-weight: 950;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  min-height: 112px;
  border: 1px solid rgba(216,206,189,0.92);
  border-radius: var(--radius);
  padding: 14px;
  background: white;
  display: grid;
  align-content: space-between;
}

.stat span {
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 880;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.hidden { display: none !important; }

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .side-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid,
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 18px 14px;
  }

  h1 {
    font-size: 38px;
    line-height: 1.04;
  }

  .side-nav,
  .form-grid,
  .two-col,
  .three-col,
  .facts,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .score-layout {
    grid-template-columns: 1fr;
  }

  .packet-document {
    padding: 20px;
  }

  .packet-header,
  .packet-cover,
  .case-card,
  .task-row {
    display: grid;
  }

  .topbar-actions,
  .primary-button,
  .ghost-button,
  .danger-button {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .no-print,
  button {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
    padding: 0;
  }

  .panel,
  .packet-document {
    box-shadow: none;
    border: 0;
  }
}
