/* ClaimGPT adjuster widget — extends site.css tokens */
body.widget-app {
  --header: var(--dark);
  --sidebar: #1a2233;
  --sidebar-border: rgba(255,255,255,0.07);
  --bg: var(--paper);
  --fast-c: #1a5c36; --fast-bg: #e8f5ee; --fast-border: #a3d4b8;
  --complex-c: #8a3010; --complex-bg: #fff0eb; --complex-border: #f0b499;
  --low-c: #1a5c36; --low-bg: #e8f5ee; --low-border: #a3d4b8;
  --mod-c: #7a4a00; --mod-bg: #fff8e8; --mod-border: #f0d080;
  --high-c: #8a1c1c; --high-bg: #fff0f0; --high-border: #f0aaaa;
  margin: 0;
  min-height: unset;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: Georgia, "Iowan Old Style", serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
html.widget-root, html.widget-root body.widget-app { height: 100%; }

body.widget-app * { box-sizing: border-box; }

.ws-header {
        display: grid; grid-template-columns: auto 1fr auto;
        align-items: center; gap: 16px; padding: 0 18px; height: 52px;
        background: var(--header); color: #fff; flex-shrink: 0;
        border-bottom: 1px solid rgba(255,255,255,0.06);
      }
      .header-brand { display: flex; align-items: baseline; gap: 6px; }
      .brand-name { font-size: 16px; font-weight: 700; letter-spacing: 0.06em; }
      .brand-tag { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.35); font-family: var(--mono); }
      .header-claim { display: flex; align-items: center; gap: 12px; }
      .hdr-claim-id { font-family: var(--mono); font-size: 13px; color: rgba(255,255,255,0.5); }
      .hdr-claim-type { font-size: 13px; color: rgba(255,255,255,0.8); }
      .routing-pill {
        display: inline-flex; align-items: center; gap: 5px;
        padding: 4px 10px; border-radius: 999px; font-size: 11px;
        font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-family: var(--mono);
      }
      .routing-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
      .r-fast { background: var(--fast-bg); color: var(--fast-c); border: 1px solid var(--fast-border); }
      .r-complex { background: var(--complex-bg); color: var(--complex-c); border: 1px solid var(--complex-border); }
      .r-pending { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.35); border: 1px solid rgba(255,255,255,0.1); }

      .ws-body { display: flex; flex: 1; overflow: hidden; }

      .sidebar {
        width: 228px; flex-shrink: 0; background: var(--sidebar);
        border-right: 1px solid var(--sidebar-border);
        display: flex; flex-direction: column; overflow-y: auto;
      }
      .sb-sec { padding: 14px 16px; border-bottom: 1px solid var(--sidebar-border); }
      .sb-label { font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255,255,255,0.28); font-family: var(--mono); margin-bottom: 10px; }
      .sb-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
      .sb-key { font-size: 11px; color: rgba(255,255,255,0.38); flex-shrink: 0; }
      .sb-val { font-size: 12px; color: rgba(255,255,255,0.82); font-family: var(--mono); text-align: right; max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      .sb-val.accent { color: #f0a070; }
      .active-status { color: #6dda96; }
      .lapsed-status { color: #f08080; }

      .gauge-wrap { margin: 2px 0 8px; }
      .gauge-scores { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
      .gauge-score { font-size: 22px; font-weight: 700; color: #fff; font-family: var(--mono); }
      .gauge-band { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; font-family: var(--mono); }
      .gauge-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; margin-bottom: 5px; }
      .gauge-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
      .g-low { background: #4caf76; } .g-mod { background: #e8a020; } .g-high { background: #e04040; }
      .b-low { color: #6dda96; } .b-mod { color: #e8a020; } .b-high { color: #f07070; }
      .gauge-note { font-size: 10px; color: rgba(255,255,255,0.25); font-family: var(--mono); }

      .reserve-amt { font-size: 22px; font-weight: 700; color: #fff; font-family: var(--mono); }
      .reserve-note { font-size: 10px; color: rgba(255,255,255,0.3); margin-top: 2px; font-family: var(--mono); }

      .sb-actions { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
      .sb-btn {
        width: 100%; min-height: var(--touch); padding: 0 14px; border-radius: 10px; border: 0;
        font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
        transition: opacity 0.15s, background 0.15s;
      }
      .sb-btn:hover:not(:disabled) { opacity: 0.9; }
      .sb-btn:focus-visible { outline: 2px solid #f0a070; outline-offset: 2px; }
      .sb-btn:disabled { opacity: 0.55; cursor: wait; }
      .sb-btn.primary { background: var(--accent); color: #fff; }
      .sb-btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
      .sb-btn.ghost { background: rgba(255,255,255,0.09); color: rgba(255,255,255,0.75); border: 1px solid rgba(255,255,255,0.1); }
      .sb-note { font-size: 10px; color: rgba(255,255,255,0.2); text-align: center; font-family: var(--mono); margin-top: 4px; }

      .main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

      .empty-state {
        flex: 1; display: flex; flex-direction: column;
        align-items: center; justify-content: center;
        gap: 18px; padding: 32px 24px; text-align: center;
        overflow-y: auto;
      }
      .empty-eyebrow {
        font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
        text-transform: uppercase; color: var(--accent); font-weight: 700;
      }
      .empty-icon {
        width: 56px; height: 56px; border-radius: 16px;
        display: flex; align-items: center; justify-content: center;
        background: rgba(165,68,29,0.08); border: 1px solid rgba(165,68,29,0.14);
        font-size: 26px; color: var(--accent);
      }
      .empty-title { font-size: 22px; line-height: 1.2; }
      .empty-body { color: var(--muted); line-height: 1.65; max-width: 380px; font-size: 14px; }
      .empty-steps {
        display: grid; gap: 10px; width: 100%; max-width: 340px; text-align: left;
      }
      .empty-step {
        display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start;
        padding: 10px 12px; border-radius: 12px; background: var(--card);
        border: 1px solid var(--line); font-size: 13px; line-height: 1.45;
      }
      .empty-step-num {
        font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent);
        padding-top: 2px;
      }
      .empty-step strong { display: block; font-size: 13px; margin-bottom: 2px; color: var(--ink); }
      .empty-step span { color: var(--muted); font-size: 12px; }
      .empty-btn {
        margin-top: 4px; min-height: var(--touch); padding: 0 28px; border-radius: 999px; border: 0;
        background: var(--accent); color: #fff; font: inherit; font-size: 14px;
        font-weight: 700; cursor: pointer; transition: background 0.15s, opacity 0.15s;
      }
      .empty-btn:hover:not(:disabled) { background: var(--accent-hover); }
      .empty-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
      .empty-btn:disabled { opacity: 0.6; cursor: wait; }
      .empty-or {
        font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
        text-transform: uppercase; color: var(--muted);
      }

      .workspace { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

      .tab-nav {
        display: flex; flex-wrap: wrap; gap: 4px;
        padding: 10px 14px 0; border-bottom: 1px solid var(--line);
        background: var(--card); flex-shrink: 0;
      }
      .tab-btn {
        min-height: var(--touch); padding: 0 14px; border: 0; background: none; font: inherit;
        font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
        border-bottom: 3px solid transparent; margin-bottom: -1px;
        border-radius: 8px 8px 0 0;
        transition: color 0.15s, border-color 0.15s, background 0.15s;
      }
      .tab-btn:hover { color: var(--ink); background: rgba(165,68,29,0.04); }
      .tab-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
      .tab-btn.active {
        color: var(--accent); border-bottom-color: var(--accent);
        background: rgba(165,68,29,0.06);
      }
      .tab-btn[aria-selected="true"] { font-weight: 700; }

      .tab-panels { flex: 1; overflow-y: auto; }
      .tab-panel { display: none; padding: 18px; flex-direction: column; gap: 14px; }
      .tab-panel.active { display: flex; }

body.widget-app .card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
      .card-title { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; font-family: var(--mono); }
      .card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
      .card-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

      .stat { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
      .stat-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; font-family: var(--mono); }
      .stat-value { font-size: 18px; font-weight: 700; font-family: var(--mono); }

      .summary-banner { background: linear-gradient(135deg, rgba(165,68,29,0.07), rgba(255,255,255,0.85)); border: 1px solid rgba(165,68,29,0.14); border-radius: 14px; padding: 14px 18px; line-height: 1.65; }

      .action-list { display: flex; flex-direction: column; gap: 8px; }
      .action-item { display: flex; gap: 10px; align-items: start; padding: 10px 13px; background: var(--bg); border-radius: 10px; border: 1px solid var(--line); line-height: 1.5; font-size: 13px; }
      .action-num { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent); min-width: 20px; padding-top: 1px; flex-shrink: 0; }

      .timeline { display: flex; flex-direction: column; }
      .tl-row { display: grid; grid-template-columns: 94px 1fr auto; gap: 10px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--line); }
      .tl-row:last-child { border-bottom: none; }
      .tl-date { font-family: var(--mono); font-size: 11px; color: var(--muted); padding-top: 2px; }
      .tl-event { font-size: 13px; line-height: 1.4; }
      .tl-high { color: var(--accent); font-weight: 700; }
      .tl-src { font-size: 10px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }

      table { width: 100%; border-collapse: collapse; font-size: 13px; }
      th { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 0 10px 8px; font-family: var(--mono); font-weight: 600; }
      td { padding: 9px 10px; border-top: 1px solid var(--line); }
      .cov-yes { color: var(--low-c); font-weight: 700; }
      .cov-no { color: var(--muted); }
      .mono { font-family: var(--mono); }

      .tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
      .tag { padding: 4px 10px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }

      .pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; font-family: var(--mono); white-space: nowrap; }
      .p-low { background: var(--low-bg); color: var(--low-c); border: 1px solid var(--low-border); }
      .p-mod { background: var(--mod-bg); color: var(--mod-c); border: 1px solid var(--mod-border); }
      .p-high { background: var(--high-bg); color: var(--high-c); border: 1px solid var(--high-border); }

      .anomaly-list { display: flex; flex-direction: column; gap: 8px; }
      .anomaly { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 11px 13px; border-radius: 10px; border: 1px solid; }
      .anomaly.high { background: var(--high-bg); border-color: var(--high-border); }
      .anomaly.moderate { background: var(--mod-bg); border-color: var(--mod-border); }
      .anomaly.low { background: var(--low-bg); border-color: var(--low-border); }
      .anom-signal { font-weight: 700; font-size: 13px; margin-bottom: 3px; }
      .anom-detail { font-size: 12px; color: var(--muted); line-height: 1.45; }

      .doc-list { display: flex; flex-direction: column; gap: 6px; }
      .doc-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
      .doc-icon { width: 20px; height: 20px; border-radius: 4px; border: 2px solid; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
      .doc-icon.req { border-color: var(--high-c); color: var(--high-c); }
      .doc-icon.opt { border-color: var(--mod-c); color: var(--mod-c); }
      .doc-name { font-size: 13px; font-weight: 600; }
      .doc-meta { font-size: 11px; color: var(--muted); }

      .res-breakdown { display: flex; flex-direction: column; }
      .res-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
      .res-row:last-child { border-bottom: none; font-weight: 700; font-size: 15px; }
      .res-label { color: var(--muted); }
      .res-val { font-family: var(--mono); }

      .comm-draft { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
      .comm-subject { font-weight: 700; font-size: 13px; margin-bottom: 10px; }
      .comm-body { white-space: pre-wrap; line-height: 1.65; font-size: 12px; font-family: var(--mono); }
      .comm-warn { margin-top: 10px; padding: 8px 10px; background: var(--high-bg); border: 1px solid var(--high-border); border-radius: 6px; font-size: 11px; color: var(--high-c); font-weight: 600; }

      .meta-bar { padding: 5px 18px; background: var(--card); border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); font-family: var(--mono); display: flex; justify-content: space-between; flex-shrink: 0; }

      .sidebar-toggle {
        display: none; min-height: var(--touch); padding: 0 12px;
        border-radius: 8px; border: 1px solid rgba(255,255,255,0.12);
        background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8);
        font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
      }
      .sidebar-toggle:focus-visible { outline: 2px solid #f0a070; outline-offset: 2px; }

      @media (max-width: 640px) {
        .sidebar { width: 200px; }
        .card-grid, .card-grid-3 { grid-template-columns: 1fr; }
        .hdr-claim-type { display: none; }
        .tab-btn { padding: 0 10px; font-size: 12px; }
      }
      @media (max-width: 520px) {
        .sidebar-toggle { display: inline-flex; align-items: center; }
        .sidebar {
          position: absolute; z-index: 20; top: 52px; left: 0; bottom: 0;
          width: min(260px, 88vw); transform: translateX(-100%);
          transition: transform 0.22s ease; box-shadow: 8px 0 24px rgba(0,0,0,0.2);
        }
        .sidebar.open { transform: translateX(0); }
        .ws-body { position: relative; }
        .ws-header { grid-template-columns: auto 1fr auto; gap: 10px; }
        .header-claim { min-width: 0; }
        .hdr-claim-id { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
      }
      @media (prefers-reduced-motion: reduce) {
        .sidebar { transition: none; }
        .gauge-fill { transition: none; }
      }
    