/* GB Case Update Portal — M2 (plan v6 §C3). Palette + shapes follow the approved
   design-canvas mockup (fd1df363…, "GB Case Update Portal"); fonts self-hosted
   (N19: no third-party assets). */

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/plexsans-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Serif';
  src: url('fonts/plexserif-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #1e3350;
  --navy-deep: #16273e;
  --gold: #b8923d;
  --gold-ink: #8a6a1c;
  --gold-ink-dark: #6e5416;
  --cream: #f4f1ea;
  --paper: #fffdf8;
  --paper-warm: #fbf9f4;
  --paper-band: #f1ecdf;
  --paper-edit: #faf6ec;
  --line: #e2dccc;
  --line-soft: #e8e2d2;
  --line-edit: #e0d5b8;
  --line-input: #d8d2c0;
  --ink: #202a38;
  --ink-soft: #5d6675;
  --ink-band: #6b6353;
  --ok-bg: #e5f1e5;
  --ok-ink: #2c6e46;
  --ok-line: #bcd9c4;
  --ok-row: #f4f9f4;
  --err-bg: #f9ecec;
  --err-ink: #a63244;
  --err-line: #e3c3c8;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
a { color: var(--gold-ink); }
a:hover { color: var(--gold-ink-dark); }

/* ---------- header ---------- */
.topbar {
  background: var(--navy);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 3vw, 40px);
  height: 62px;
}
.brand { display: flex; align-items: baseline; gap: 14px; }
.brand-name {
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 2.5px;
}
.brand-rule { width: 1px; height: 18px; background: var(--gold); align-self: center; }
.brand-sub { font-size: 14px; font-weight: 500; color: #cdd6e2; }
.topbar-firm { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #cdd6e2; }

/* ---------- cycle banner ---------- */
.banner {
  background: var(--paper-warm);
  border-bottom: 1px solid var(--line);
  padding: 16px clamp(16px, 3vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.banner-title { font-size: 17px; font-weight: 600; }
.banner-sub { font-size: 13px; color: var(--ink-soft); margin-top: 3px; max-width: 760px; }
.progress-wrap { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.progress-bar { width: 160px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gold); transition: width .2s; }

/* ---------- notices ---------- */
.notice {
  margin: 14px clamp(16px, 3vw, 40px) 0;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 13px;
  border: 1px solid var(--line-input);
  background: var(--paper);
}
.notice.error { background: var(--err-bg); border-color: var(--err-line); color: var(--err-ink); }
.notice.warn { background: var(--paper-edit); border-color: var(--line-edit); color: var(--gold-ink-dark); }
.notice h3 { margin: 0 0 6px; font-size: 13px; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice .notice-actions { margin-top: 8px; }

/* ---------- table ---------- */
.list-wrap { padding: 20px clamp(16px, 3vw, 40px) 0; }
.table-scroll { overflow-x: auto; }
.case-table {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  min-width: 1180px;
}
.crow {
  display: grid;
  grid-template-columns: 76px minmax(220px, 1fr) 120px 170px 120px 170px minmax(150px, 220px) 150px;
  gap: 12px;
  padding: 12px 20px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.crow.chead {
  padding: 11px 20px;
  background: var(--paper-band);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .7px;
  color: var(--ink-band);
}
.crow.marked { background: var(--ok-row); }
.crow.editing { border-top: 2px solid var(--gold); background: var(--paper-edit); border-bottom: 0; }
.crow:last-child { border-bottom: 0; }
.cell-matter { font-weight: 600; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--ink-soft); font-weight: 400; margin-top: 1px; }
.cell-sub2 { font-size: 11px; color: var(--ink-soft); font-weight: 400; }
.cell-dim { font-size: 12px; color: var(--ink-soft); }
.stage-cell { display: flex; align-items: center; gap: 8px; }
.stage-badge {
  width: 24px; height: 24px; flex: 0 0 24px;
  border-radius: 4px;
  background: var(--navy);
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.stage-name { font-size: 12px; line-height: 1.25; }
.cell-update { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 4px; padding: 5px 10px;
  font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
  background: none;
}
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.chip.ghost { border-color: var(--line-input); color: var(--ink-soft); font-weight: 400; }
.chip.primary { border-color: var(--navy); color: var(--navy); }
.chip.editing-label { color: var(--gold-ink); border: 0; padding: 5px 0; }
.chip.err { background: var(--err-bg); color: var(--err-ink); border-color: var(--err-line); }
button.chip:hover { filter: brightness(.97); }

/* ---------- inline editor ---------- */
.editor-holder { background: var(--paper-edit); border-bottom: 1px solid var(--line-soft); }
.editor {
  margin: 0 20px 18px;
  background: var(--paper);
  border: 1px solid var(--line-edit);
  border-radius: 6px;
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.seg { display: inline-flex; border: 1px solid var(--line-input); border-radius: 5px; overflow: hidden; align-self: flex-start; }
.seg button {
  padding: 7px 16px; font-size: 13px; border: 0; background: var(--paper); color: var(--ink-soft);
}
.seg button + button { border-left: 1px solid var(--line-input); }
.seg button.on { background: var(--navy); color: var(--paper); font-weight: 600; }

.fields-row { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 11px; font-weight: 700; letter-spacing: .6px; color: var(--ink-band); }
.field .static {
  padding: 8px 12px; background: var(--paper-band); border-radius: 5px;
  font-size: 13px; font-weight: 600;
}
.field input, .field select, .field textarea {
  padding: 8px 12px; border: 1px solid var(--line-input); border-radius: 5px;
  background: var(--paper); font-size: 13px;
}
.field select.accent { border: 1.5px solid var(--navy); font-weight: 600; }
.field textarea { min-height: 52px; resize: vertical; width: 100%; }
.field.grow { flex: 1 1 320px; }
.arrow { color: var(--gold-ink); font-size: 18px; align-self: center; padding-bottom: 6px; }

.entry-chips { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.entry-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--cream); border: 1px solid var(--line-input);
  border-radius: 14px; padding: 5px 12px; font-size: 12px;
}
.entry-chip .x { border: 0; background: none; color: var(--ink-soft); font-size: 13px; padding: 0 2px; }
.entry-chip .x:hover { color: var(--err-ink); }

.attach-row { display: flex; align-items: center; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.attach-note { color: var(--ink-soft); font-size: 12px; }

.editor-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.editor-foot .left { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.editor-foot .right { display: flex; align-items: center; gap: 10px; }

.btn {
  border-radius: 5px; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border: 1px solid var(--line-input);
  background: var(--paper); color: var(--navy);
}
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--paper); }
.btn.primary:hover { background: var(--navy-deep); }
.btn.big { padding: 11px 26px; font-size: 14px; font-weight: 700; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.linkish { border: 0; background: none; color: var(--gold-ink); padding: 4px 6px; }

.field-error { color: var(--err-ink); font-size: 12px; }

/* ---------- case details strip (case-grain manifest fields) ---------- */
.details-strip { border-top: 1px dashed var(--line-input); padding-top: 12px; }
.details-title { font-size: 11px; font-weight: 700; letter-spacing: .6px; color: var(--ink-band); margin-bottom: 8px; }
.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px 20px;
  font-size: 12px;
}
.dt { color: var(--ink-soft); }
.dd { font-weight: 600; overflow-wrap: anywhere; }

/* ---------- S8 footer row ---------- */
.s8-row { display: flex; align-items: center; gap: 8px; padding: 14px 4px; font-size: 13px; flex-wrap: wrap; }
.s8-row a { font-weight: 600; text-decoration: none; }
.s8-note { color: var(--ink-soft); }
.s8-editor-wrap { background: var(--paper-edit); border: 1px solid var(--line-edit); border-radius: 6px; margin-top: 4px; }

/* ---------- footer bar ---------- */
.footbar {
  background: var(--paper-warm);
  border-top: 1px solid var(--line);
  padding: 16px clamp(16px, 3vw, 40px);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-top: 22px;
  position: sticky; bottom: 0;
}
.footbar .foot-note { font-size: 13px; color: var(--ink-soft); max-width: 560px; }
.footbar .foot-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.submitter-wrap { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.submitter-wrap input {
  border: 0; border-bottom: 1px solid #b9b19c; background: none;
  padding: 2px 6px; min-width: 130px; color: var(--ink); border-radius: 0;
}

/* ---------- gate / status screens ---------- */
.gate { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  padding: 36px 44px; max-width: 520px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.gate-card h1 { font-size: 20px; margin: 0; }
.gate-card p { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.gate-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
}
.gate-icon.ok { background: var(--ok-bg); border: 1.5px solid var(--ok-line); color: var(--ok-ink); }
.gate-icon.err { background: var(--err-bg); border: 1.5px solid var(--err-line); color: var(--err-ink); }
.receipt-pill {
  margin-top: 6px; padding: 7px 14px; background: var(--paper-band);
  border-radius: 4px; font-size: 12px; color: var(--ink-band); letter-spacing: .4px;
  overflow-wrap: anywhere;
}
.upload-list { width: 100%; text-align: left; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.upload-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.upload-state { font-size: 12px; font-weight: 600; }
.upload-state.ok { color: var(--ok-ink); }
.upload-state.err { color: var(--err-ink); }
.upload-state.busy { color: var(--gold-ink); }

/* utility classes — the deployed CSP has NO 'unsafe-inline' for styles, so the
   page must never rely on style="" attributes (R1-F10) */
.cell-right { text-align: right; }
.span-all { grid-column: 1 / -1; }
.input-hidden { display: none; }

.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .topbar { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; gap: 6px; }
  .banner { flex-direction: column; align-items: flex-start; }
}
