:root{
    --navy:#1A2E52;
    --navy-deep:#0F1A30;
    --navy-panel:#152544;
    --gold:#C89A3E;
    --gold-soft:#E7D9BE;
    --paper:#FAF7F1;
    --card:#FFFFFF;
    --ink:#1F2430;
    --muted:#6B7280;
    --line:#E4DFD4;
    --amber:#B3691D;
    --amber-bg:#FBF0E1;
    --safe:#2F6F4E;
    --safe-bg:#EAF4EE;
  }
  *{box-sizing:border-box;}
  body{ margin:0; font-family: ui-sans-serif, -apple-system, "Segoe UI", Inter, sans-serif; background:var(--paper); color:var(--ink); }
  .serif{ font-family: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif; }
  a{ color:inherit; }

  /* ---- Top bar (Goliathon-style) ---- */
  .topbar{
    background:var(--navy-deep);
    color:#fff;
    padding:12px 24px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    flex-wrap:wrap;
    gap:10px;
    border-bottom:2px solid var(--gold);
    position:sticky;
    top:0;
    z-index:60;
  }
  .topbar-brand{ display:flex; align-items:center; gap:10px; }
  .topbar-brand .shield{ width:30px; height:30px; flex-shrink:0; }
  .topbar-brand .txt .eyebrow2{ font-size:10px; letter-spacing:1.4px; color:var(--gold-soft); text-transform:uppercase; }
  .topbar-brand .txt .name{ font-size:16px; font-weight:800; letter-spacing:0.5px; }
  .topbar-actions{ display:flex; gap:8px; flex-wrap:wrap; }
  .tb-btn{
    background:rgba(255,255,255,0.06);
    border:1px solid rgba(255,255,255,0.16);
    color:#fff; font-size:12.5px; font-weight:600;
    padding:8px 13px; border-radius:6px; cursor:pointer;
    display:flex; align-items:center; gap:6px;
  }
  .tb-btn:hover{ background:rgba(255,255,255,0.14); }
  .tb-btn.danger{ border-color:rgba(214,110,80,0.5); color:#E9A98F; }
  .tb-btn.danger:hover{ background:rgba(214,110,80,0.18); }
  .tb-btn.gold{ background:var(--gold); border-color:var(--gold); color:#241a06; }
  .tb-btn.gold:hover{ background:#B08631; }

  /* ---- Centred page (Investigator-style) ---- */
  .page-center{ max-width:820px; margin:0 auto; padding:44px 24px 90px; }

  .brand-block{ display:flex; align-items:center; gap:16px; margin-bottom:6px; }
  .shield-lg{ width:52px; height:52px; flex-shrink:0; }
  .brand-txt .eyebrow3{ font-size:11px; letter-spacing:1.6px; text-transform:uppercase; color:var(--muted); font-weight:700; }
  .brand-txt .brand-name{ font-family: ui-serif, Georgia, serif; font-size:30px; font-weight:700; color:var(--navy); margin:2px 0 0; line-height:1.1; }
  .brand-txt .brand-name sup{ font-size:13px; }
  .brand-subtitle{ font-size:13.5px; color:var(--muted); margin:16px 0 28px; padding-bottom:22px; border-bottom:1px solid var(--line); line-height:1.6; }
  .brand-subtitle a{ color:var(--navy); font-weight:700; text-decoration:underline; cursor:pointer; }
  .about-panel{ background:#F4EFE4; border:1px solid var(--line); border-radius:8px; padding:14px 16px; font-size:12.5px; line-height:1.6; color:#4A4433; margin:-14px 0 28px; }

  .stage-track{ display:flex; gap:6px; margin-bottom:10px; }
  .stage-seg{ flex:1; height:6px; border-radius:4px; background:#E7E1D2; cursor:pointer; border:none; padding:0; }
  .stage-seg.active{ background:var(--navy); }
  .stage-seg.done{ background:var(--gold); }
  .stage-meta{ display:flex; justify-content:space-between; align-items:baseline; margin-bottom:32px; font-size:12.5px; color:var(--muted); flex-wrap:wrap; gap:6px; }
  .stage-meta .stage-current{ font-weight:700; color:var(--navy); text-transform:uppercase; letter-spacing:0.6px; font-size:11px; }

  /* ---- Main ---- */
  .panel-head{ margin-bottom:22px; }
  .eyebrow{ font-size:11px; letter-spacing:1.2px; text-transform:uppercase; color:var(--gold); font-weight:700; margin-bottom:6px; }
  .panel-title{ font-family: ui-serif, Georgia, serif; font-size:24px; margin:0 0 8px; color:var(--navy); }
  .panel-intro{ color:var(--muted); font-size:13.5px; max-width:640px; line-height:1.55; }

  /* ---- Case header card (Goliathon style) ---- */
  .case-header{
    background:var(--navy); color:#fff; border-radius:10px; padding:18px 22px; margin-bottom:16px;
    display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap;
  }
  .case-header .ch-left{ display:flex; flex-direction:column; gap:4px; flex:1; min-width:240px; }
  .case-header .ch-eyebrow{ font-size:10px; letter-spacing:1.4px; text-transform:uppercase; color:var(--gold-soft); }
  .case-header .ch-title{ font-family: ui-serif, Georgia, serif; font-size:19px; font-weight:700; }
  .case-header input.ch-title-input{
    font-family: ui-serif, Georgia, serif; font-size:17px; font-weight:700; background:rgba(255,255,255,0.1);
    border:1px solid rgba(255,255,255,0.3); color:#fff; padding:6px 10px; border-radius:6px; width:100%; max-width:480px;
  }
  .ch-right{ display:flex; align-items:center; gap:10px; }
  .chip{ background:rgba(255,255,255,0.12); border-radius:20px; padding:5px 12px; font-size:11.5px; font-weight:600; }
  .ch-edit-btn{ background:transparent; border:1px solid rgba(255,255,255,0.35); color:#fff; font-size:12px; padding:6px 12px; border-radius:6px; cursor:pointer; }
  .ch-edit-btn:hover{ background:rgba(255,255,255,0.1); }

  .strength-card{ background:var(--card); border:1px solid var(--line); border-radius:10px; padding:16px 22px; margin-bottom:18px; }
  .strength-top{ display:flex; justify-content:space-between; align-items:baseline; margin-bottom:8px; }
  .strength-label{ font-size:12px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:0.6px; }
  .strength-value{ font-size:12.5px; font-weight:700; color:var(--gold); }
  .strength-bar-track{ height:8px; border-radius:6px; background:#EFE9DA; overflow:hidden; }
  .strength-bar-fill{ height:100%; background:linear-gradient(90deg, var(--gold), #DDB35F); border-radius:6px; transition:width 0.4s ease; }

  .card{ background:var(--card); border:1px solid var(--line); border-radius:10px; padding:22px 24px; margin-bottom:18px; box-shadow: 0 1px 2px rgba(20,20,10,0.03); }
  .card h3{ margin:0 0 14px; font-size:15px; color:var(--navy); font-family: ui-serif, Georgia, serif; }

  label{ display:block; font-size:12px; color:var(--muted); margin-bottom:5px; font-weight:600; line-height:1.4; }
  .grid2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:end; }
  .grid2 .field{ display:flex; flex-direction:column; height:100%; }
  .grid2 .field label{ min-height:34px; display:flex; align-items:flex-end; }
  .grid2 .field select, .grid2 .field input{ margin-top:auto; }
  .field{ margin-bottom:14px; }
  input[type=text], input[type=number], input[type=date], input[type=url], select, textarea{
    width:100%; font-family:inherit; font-size:13.5px; padding:9px 11px; border:1px solid #D8D2C4; border-radius:6px; background:#FDFCFA; color:var(--ink);
  }
  textarea{ resize:vertical; min-height:70px; line-height:1.5; }
  input:focus, select:focus, textarea:focus{ outline:2px solid var(--navy); outline-offset:1px; border-color:var(--navy); }

  button{ font-family:inherit; font-size:13px; font-weight:600; border-radius:6px; border:1px solid transparent; padding:10px 16px; cursor:pointer; }
  .btn-primary{ background:var(--navy); color:#fff; }
  .btn-primary:hover{ background:var(--navy-deep); }
  .btn-primary:disabled{ background:#9AA5BB; cursor:not-allowed; }
  .btn-ghost{ background:transparent; border-color:#C9C2B2; color:var(--ink); }
  .btn-ghost:hover{ background:#F1ECE0; }
  .btn-gold{ background:var(--gold); color:#241a06; }
  .btn-gold:hover{ background:#B08631; }
  .btn-danger-text{ background:none; border:none; color:#A6432B; font-size:12px; cursor:pointer; padding:2px 4px; }

  /* ---- Upload dropzone (Goliathon style) ---- */
  .dropzone{
    border:2px dashed #D6CFBD; border-radius:12px; padding:32px 24px; text-align:center; background:#FCFAF5; margin-bottom:18px;
  }
  .dropzone .plus{ font-size:26px; color:var(--gold); margin-bottom:6px; }
  .dropzone h4{ font-family: ui-serif, Georgia, serif; font-size:16px; margin:2px 0 4px; color:var(--navy); }
  .dropzone .dz-sub{ font-size:12.5px; color:var(--muted); margin-bottom:16px; }
  .dz-buttons{ display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin-bottom:10px; }
  .dz-btn{ background:var(--card); border:1px solid #D8D2C4; padding:9px 15px; border-radius:7px; font-size:12.5px; font-weight:600; cursor:pointer; color:var(--ink); }
  .dz-btn:hover{ background:#F1ECE0; }
  .dz-btn.primary{ background:var(--gold); color:#241a06; border-color:var(--gold); }
  .dz-btn.primary:hover{ background:#B08631; }
  .dz-hint{ font-size:11px; color:var(--muted); }
  .inline-form{ margin-top:14px; text-align:left; max-width:440px; margin-left:auto; margin-right:auto; }

  .evidence-item{ padding:14px 0; border-bottom:1px solid var(--line); }
  .evidence-item:last-child{ border-bottom:none; }
  .ev-top{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
  .evidence-meta{ font-size:11px; color:var(--muted); margin-bottom:3px; text-transform:uppercase; letter-spacing:0.5px; }
  .evidence-name{ font-size:13.5px; font-weight:700; margin-bottom:2px; }
  .evidence-text{ font-size:13px; line-height:1.5; color:var(--ink); }
  .ev-thumb{ width:52px; height:52px; object-fit:cover; border-radius:6px; border:1px solid var(--line); flex-shrink:0; }
  .ev-body{ display:flex; gap:12px; }
  .ev-analysis{ margin-top:10px; padding:12px 14px; background:#F7F4EC; border-radius:8px; }
  .ev-analysis .label-shows{ font-size:11px; font-weight:800; letter-spacing:0.4px; color:var(--navy); text-transform:uppercase; margin-bottom:3px; }
  .ev-analysis .label-matters{ font-size:11px; font-weight:800; letter-spacing:0.4px; color:var(--amber); text-transform:uppercase; margin:10px 0 3px; }
  .ev-analysis .disclaimer{ font-size:10.5px; color:var(--muted); font-style:italic; margin-top:10px; }
  .empty{ color:var(--muted); font-size:13px; font-style:italic; padding:14px 0; }

  .split{ display:grid; grid-template-columns:1fr 1fr; gap:0; border:1px solid var(--line); border-radius:10px; overflow:hidden; }
  .split-pane{ padding:22px 24px; }
  .split-pane.left{ background:#F4EFE4; border-right:1px solid var(--line); }
  .split-pane.right{ background:#FFFDF9; }
  .pane-label{ font-size:11px; letter-spacing:1px; text-transform:uppercase; color:var(--muted); font-weight:700; margin-bottom:10px; }
  .letter{ font-family: ui-serif, Georgia, "Times New Roman", serif; font-size:13.5px; line-height:1.75; white-space:pre-wrap; min-height:220px; padding:14px; border:1px solid var(--line); border-radius:6px; background:#fff; }
  .letter[contenteditable="true"]:focus{ outline:2px solid var(--navy); }
  .letter-placeholder{ color:var(--muted); font-style:italic; }
  .recipient-tabs{ display:flex; gap:6px; margin-bottom:16px; flex-wrap:wrap; }
  .recipient-tab{ font-size:12px; padding:7px 12px; border-radius:20px; border:1px solid #D8D2C4; background:#fff; cursor:pointer; color:var(--ink); }
  .recipient-tab.active{ background:var(--navy); color:#fff; border-color:var(--navy); }
  .row-actions{ display:flex; gap:10px; margin-top:14px; align-items:center; }
  .status-pill{ font-size:11px; padding:4px 10px; border-radius:20px; font-weight:700; letter-spacing:0.3px; }
  .status-draft{ background:#EFEAE0; color:var(--muted); }
  .status-sent{ background:var(--safe-bg); color:var(--safe); }

  .ladder{ position:relative; padding-left:38px; }
  .ladder::before{ content:""; position:absolute; left:13px; top:8px; bottom:8px; width:2px; background:var(--line); }
  .rung{ position:relative; padding-bottom:26px; }
  .rung:last-child{ padding-bottom:0; }
  .rung-dot{ position:absolute; left:-38px; top:2px; width:28px; height:28px; border-radius:50%; background:#fff; border:2px solid #D8D2C4; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; color:var(--muted); }
  .rung-dot.done{ background:var(--safe); border-color:var(--safe); color:#fff; }
  .rung-dot.last-resort{ border-style:dashed; }
  .rung-card{ background:var(--card); border:1px solid var(--line); border-radius:10px; padding:16px 18px; }
  .rung-card.last-resort{ background:#F5F3EE; border-style:dashed; }
  .rung-title{ font-family:ui-serif, Georgia, serif; font-size:15px; color:var(--navy); margin-bottom:4px; }
  .rung-note{ font-size:12.5px; color:var(--muted); line-height:1.5; }
  .rung-status{ margin-top:8px; font-size:12px; }
  .exp-badge{ display:inline-block; font-size:10.5px; font-weight:800; letter-spacing:0.4px; text-transform:uppercase; padding:3px 9px; border-radius:20px; margin-bottom:8px; }
  .exp-real{ background:var(--safe-bg); color:var(--safe); }
  .exp-foundation{ background:#EAEEF6; color:var(--navy); }
  .exp-record{ background:#EFEAE0; color:var(--muted); }
  .exp-conditional{ background:var(--amber-bg); color:var(--amber); }
  .exp-path{ background:var(--gold-soft); color:#5A4310; }
  .ladder-intro{ background:#F4EFE4; border:1px solid var(--line); border-radius:10px; padding:16px 18px; margin-bottom:22px; font-size:13px; line-height:1.6; color:#4A4433; }

  .flag-row{ display:flex; gap:10px; align-items:flex-start; padding:10px 0; border-bottom:1px solid var(--line); }
  .flag-row:last-child{ border-bottom:none; }
  .flag-icon{ width:20px; height:20px; border-radius:50%; flex-shrink:0; margin-top:1px; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; }
  .flag-icon.hit{ background:var(--amber-bg); color:var(--amber); }
  .flag-icon.clear{ background:var(--safe-bg); color:var(--safe); }
  .flag-text{ font-size:13px; line-height:1.5; }
  .verdict-banner{ padding:14px 16px; border-radius:8px; font-size:13.5px; margin-bottom:16px; line-height:1.55; }
  .verdict-caution{ background:var(--amber-bg); color:#7a4413; border:1px solid #E3C69A; }
  .verdict-clear{ background:var(--safe-bg); color:#1e4d34; border:1px solid #B9DEC7; }

  .helper-note{ font-size:12px; color:var(--muted); margin-top:10px; line-height:1.5; }
  .loading{ display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); }
  .spinner{ width:14px; height:14px; border:2px solid #D8D2C4; border-top-color:var(--navy); border-radius:50%; animation:spin 0.8s linear infinite; flex-shrink:0; }
  @keyframes spin{ to{ transform:rotate(360deg); } }

  /* ---- Modal (Download Dossier) ---- */
  .modal-overlay{ position:fixed; inset:0; background:rgba(10,15,30,0.55); display:flex; align-items:center; justify-content:center; z-index:100; padding:20px; }
  .modal{ background:var(--navy); color:#fff; border-radius:14px; width:100%; max-width:520px; max-height:86vh; overflow-y:auto; padding:26px 26px 30px; }
  .modal-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; }
  .modal-head h2{ font-family:ui-serif, Georgia, serif; font-size:20px; margin:0; }
  .modal-close{ background:rgba(255,255,255,0.1); border:none; color:#fff; width:30px; height:30px; border-radius:8px; cursor:pointer; font-size:15px; }
  .modal-item{ display:flex; justify-content:space-between; align-items:center; background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.1); border-radius:9px; padding:13px 16px; margin-bottom:10px; cursor:pointer; }
  .modal-item:hover{ background:rgba(255,255,255,0.1); }
  .modal-item .mi-title{ font-size:14px; font-weight:700; }
  .modal-item .mi-sub{ font-size:11.5px; color:#AEB8CC; margin-top:2px; }
  .modal-item .mi-icon{ font-size:16px; opacity:0.8; }

  .confirm-overlay{ position:fixed; inset:0; background:rgba(10,15,30,0.55); display:flex; align-items:center; justify-content:center; z-index:110; padding:20px; }
  .confirm-box{ background:#fff; border-radius:12px; padding:24px 26px; max-width:380px; width:100%; }
  .confirm-box h3{ margin:0 0 10px; font-family:ui-serif, Georgia, serif; color:var(--navy); }
  .confirm-box p{ font-size:13.5px; color:var(--muted); line-height:1.5; margin:0 0 18px; }
  .confirm-actions{ display:flex; gap:10px; justify-content:flex-end; }

  .toast{
    position:fixed; bottom:26px; left:50%; transform:translateX(-50%);
    background:var(--navy-deep); color:#fff; padding:12px 20px; border-radius:8px; font-size:13px;
    box-shadow:0 6px 20px rgba(0,0,0,0.25); z-index:200; opacity:0; pointer-events:none; transition:opacity 0.25s ease;
  }
  .toast.show{ opacity:1; }

  @media (max-width: 820px){
    .page-center{ padding:28px 16px 70px; }
    .grid2, .split{ grid-template-columns:1fr; }
    .grid2{ align-items:stretch; }
    .split-pane.left{ border-right:none; border-bottom:1px solid var(--line); }
    .topbar{ padding:12px 14px; }
    .brand-txt .brand-name{ font-size:24px; }
  }
