/* ReliefRail - caseworker console
   Direction: calm, trustworthy humanitarian fintech. Cool paper background, deep navy ink,
   PayPal-blue action color, semantic teal / amber / red reserved for decisions. */

:root {
  --navy: #0b1f3a;
  --navy-2: #143259;
  --ink: #0b1f3a;
  --ink-2: #3a4c69;
  --muted: #6a7a93;
  --faint: #95a3b8;
  --line: #e2e8f1;
  --line-2: #eef2f7;
  --bg: #f3f6fa;
  --surface: #ffffff;
  --blue: #0070e0;
  --blue-600: #005bb8;
  --blue-50: #eaf3fe;
  --blue-100: #d4e7fd;
  --teal: #0b8f80;
  --teal-500: #14b8a6;
  --teal-50: #e3f6f3;
  --amber: #a45f00;
  --amber-500: #f0a020;
  --amber-50: #fff3df;
  --red: #c9302c;
  --red-500: #e5484d;
  --red-50: #fdeceb;
  --violet: #5b4bd6;
  --violet-50: #efedfc;

  --font: "Inter", "Inter var", "Noto Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, "DejaVu Sans Mono", "Liberation Mono", Menlo, monospace;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(11, 31, 58, .06), 0 1px 1px rgba(11, 31, 58, .04);
  --shadow-2: 0 6px 24px -8px rgba(11, 31, 58, .18), 0 2px 6px rgba(11, 31, 58, .05);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --gap: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 85% -120px, rgba(0, 112, 224, .07), transparent 70%),
    radial-gradient(900px 300px at -10% -80px, rgba(20, 184, 166, .06), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "tnum" 0;
}
button { font: inherit; }
svg { flex: none; }
a { color: var(--blue); }

/* ---------- App frame ---------- */
.app {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 14px;
  height: 100vh;
  min-height: 900px;
  padding: 0 24px 0;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0 -24px;
  padding: 12px 24px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 8px 24px -16px rgba(11, 31, 58, .6);
  position: relative;
}
.topbar::after { /* thin blue rail under the bar */
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--teal-500), var(--blue) 40%, rgba(0, 112, 224, 0) 100%);
  opacity: .9;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__logo { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-weight: 750; font-size: 19px; letter-spacing: -.01em; }
.brand__tag { font-size: 12.5px; color: #a9bbd6; }
.campaign {
  display: flex; align-items: baseline; gap: 10px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  white-space: nowrap; min-width: 0;
}
.campaign__label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8fa6c7; }
.campaign__name { font-weight: 650; font-size: 15px; }
.campaign__meta { font-size: 13px; color: #a9bbd6; overflow: hidden; text-overflow: ellipsis; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.status-pills { display: flex; gap: 8px; }

.pill--status {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px 0 10px; border-radius: 999px;
  font-size: 13px; white-space: nowrap;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  transition: background .3s var(--ease), border-color .3s var(--ease);
}
.pill--status .pill__k { color: #c9d6ea; }
.pill--status .pill__v { font-weight: 650; text-transform: capitalize; }
.pill--status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); position: relative; }
.pill--status.is-live .dot { background: #2dd4bf; box-shadow: 0 0 0 0 rgba(45, 212, 191, .6); animation: pulse 2.2s infinite; }
.pill--status.is-live .pill__v { color: #5eead4; }
.pill--status.is-replay .dot { background: var(--amber-500); }
.pill--status.is-replay .pill__v { color: #ffc766; }
.pill--status.is-off .dot { background: var(--red-500); }
.pill--status.is-off .pill__v { color: #ff9b9e; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(45, 212, 191, .55); }
  70% { box-shadow: 0 0 0 8px rgba(45, 212, 191, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0); }
}

/* ---------- Buttons ---------- */
.btn {
  --h: 38px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 16px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer;
  font-size: 14px; font-weight: 620; letter-spacing: .005em; white-space: nowrap;
  transition: transform .15s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease), opacity .2s, color .2s, border-color .2s;
  position: relative;
}
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:focus-visible { outline: 3px solid rgba(0, 112, 224, .35); outline-offset: 2px; }
.btn:not(:disabled):active { transform: translateY(1px) scale(.99); }
.btn:disabled { cursor: not-allowed; }

.btn--primary { background: var(--blue); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 6px 14px -6px rgba(0, 112, 224, .7); }
.btn--primary:not(:disabled):hover { background: var(--blue-600); }
.btn--paypal { background: var(--navy); color: #fff; box-shadow: 0 6px 14px -6px rgba(11, 31, 58, .7); }
.btn--paypal:not(:disabled):hover { background: var(--navy-2); }
.btn--soft { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--soft:not(:disabled):hover { border-color: #c7d3e3; background: #f8fafd; }
.btn--danger { color: var(--red); }
.btn--ghost { background: transparent; color: #dbe6f5; border-color: rgba(255, 255, 255, .22); --h: 34px; font-size: 13px; }
.btn--ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.btn--sm { --h: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn--primary:disabled, .btn--paypal:disabled { background: #dfe6ef; color: #8a9ab1; box-shadow: none; }
.btn--soft:disabled { color: #a7b3c4; background: #fafbfd; }

.btn.is-busy { pointer-events: none; }
.btn.is-busy::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite;
}
.btn.is-busy svg { display: none; }
.btn.is-next { animation: nudge 2.4s var(--ease) infinite; }
@keyframes nudge {
  0%, 100% { box-shadow: 0 6px 14px -6px rgba(0, 112, 224, .7), 0 0 0 0 rgba(0, 112, 224, .35); }
  50% { box-shadow: 0 6px 14px -6px rgba(0, 112, 224, .7), 0 0 0 6px rgba(0, 112, 224, 0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- KPI strip ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi {
  --k: var(--ink);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 18px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
}
.kpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--k); opacity: .85; }
.kpi--teal { --k: var(--teal); }
.kpi--red { --k: var(--red-500); }
.kpi--blue { --k: var(--blue); }
.kpi--navy { --k: var(--navy); }
.kpi__label { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi__value {
  font-size: 32px; font-weight: 720; letter-spacing: -.02em; line-height: 1.15;
  font-variant-numeric: tabular-nums; color: var(--ink);
  transition: color .4s;
}
.kpi--teal .kpi__value { color: var(--teal); }
.kpi--red .kpi__value { color: var(--red); }
.kpi--blue .kpi__value { color: var(--blue); }
.kpi__value.is-bump { animation: bump .6s var(--ease); }
@keyframes bump { 0% { transform: translateY(0); } 30% { transform: translateY(-3px); } 100% { transform: translateY(0); } }
.kpi__sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Step rail ---------- */
.rail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 12px 14px 14px;
}
.rail__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 4px 10px; }
.rail__title { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.guardrail {
  margin: 0; display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--teal-50), var(--blue-50));
  border: 1px solid #cfe6ef;
  font-size: 14px; color: var(--navy);
}
.guardrail svg { width: 20px; height: 20px; fill: none; stroke: var(--teal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.guardrail b { font-weight: 650; }
.guardrail b + b { margin-left: 4px; }
.guardrail b:last-child { color: var(--blue-600); }

.steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: .85fr 1fr 1.75fr 1fr 1.1fr; gap: 10px;
  counter-reset: s;
}
.step {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  padding: 11px 13px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: #f8fafc;
  min-width: 0;
  transition: background .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease), opacity .35s;
}
.step:not(:last-child)::after { /* connector chevron */
  content: ""; position: absolute; right: -9px; top: 22px; width: 8px; height: 2px;
  background: var(--line); border-radius: 2px;
}
.step__top { display: flex; align-items: center; gap: 10px; }
.step__num {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: #e6ecf4; color: var(--ink-2);
  transition: background .3s, color .3s;
}
.step__name { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step__status { margin: 0; font-size: 13.5px; color: var(--muted); min-height: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step__status b { color: var(--ink); font-weight: 650; }
.step__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 2px; }
.step__progress { position: absolute; left: 14px; right: 14px; bottom: 6px; height: 3px; border-radius: 3px; background: transparent; overflow: hidden; }
.step__progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--teal-500)); border-radius: 3px; transition: width .5s var(--ease); }

.step.is-done { background: #f3fbf9; border-color: #cdeee8; }
.step.is-done .step__num { background: var(--teal); color: #fff; font-size: 0; }
.step.is-done .step__num::before {
  content: ""; width: 11px; height: 6px; margin-top: -3px;
  border-left: 2.4px solid #fff; border-bottom: 2.4px solid #fff; transform: rotate(-45deg);
}
.step.is-current {
  background: #fff; border-color: #9ccaf7;
  box-shadow: 0 0 0 3px rgba(0, 112, 224, .1), var(--shadow-2);
}
.step.is-current .step__num { background: var(--blue); color: #fff; }
.step.is-current .step__name { color: var(--navy); }
.step.is-running .step__num { background: var(--blue); color: #fff; animation: ring 1.6s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(0, 112, 224, .45); } 100% { box-shadow: 0 0 0 9px rgba(0, 112, 224, 0); } }
.step.is-locked { opacity: .78; }

/* ---------- Workspace ---------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px 340px;
  gap: var(--gap);
  min-height: 0;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.panel__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 14px 18px 12px; }
.panel__title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.panel__hint { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.legend { display: flex; gap: 6px; }
.grid-wrap { flex: 1; min-height: 0; padding: 0 10px 10px; }

/* ---------- Grid cells ---------- */
#grid .ag-cell { display: flex; align-items: center; }
#grid .ag-cell.ag-right-aligned-cell { justify-content: flex-end; }
#grid .ag-cell > .ag-cell-wrapper { width: 100%; }
#grid .ag-cell-value { display: flex; align-items: center; height: 100%; min-width: 0; }
#grid .ag-right-aligned-cell .ag-cell-value { justify-content: flex-end; }
#grid .ag-cell-value > span { display: flex; align-items: center; height: 100%; min-width: 0; line-height: 1.3; }
#grid .ag-right-aligned-cell > span { justify-content: flex-end; width: 100%; }
#grid .ag-header-cell-text { letter-spacing: .02em; }
.ag-theme-rr .ag-row.rr-processing { background: linear-gradient(90deg, rgba(0, 112, 224, .08), rgba(0, 112, 224, 0) 70%); }
.ag-row.rr-focused { box-shadow: inset 3px 0 0 var(--blue); }
.cell-photo { display: flex; align-items: center; height: 100%; }
.thumb {
  width: 52px; height: 38px; border-radius: 7px; object-fit: cover;
  background: linear-gradient(135deg, #dce7f4, #eef3f9);
  box-shadow: 0 0 0 1px rgba(11, 31, 58, .08);
  display: block;
}
.thumb--ph { display: grid; place-items: center; color: #8ea2bd; }
.thumb--ph svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.cell-app { display: flex; flex-direction: column; justify-content: center; height: 100%; line-height: 1.25; min-width: 0; }
.cell-app__name { font-weight: 620; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; }
.cell-app__id { font-size: 12px; color: var(--faint); font-family: var(--mono); }
.lang {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  background: var(--violet-50); color: var(--violet); border: 1px solid #dcd7fa;
}
.lang--en { background: #f0f3f7; color: var(--ink-2); border-color: var(--line); }

.sev { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px 0 4px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.sev__n { width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 750; color: #fff; }
.sev--0 { background: #f0f3f7; color: var(--muted); } .sev--0 .sev__n { background: #a5b2c4; }
.sev--1 { background: #eaf3fe; color: #1d5fa8; } .sev--1 .sev__n { background: #5aa2ee; }
.sev--2 { background: var(--amber-50); color: var(--amber); } .sev--2 .sev__n { background: var(--amber-500); }
.sev--3 { background: var(--red-50); color: var(--red); } .sev--3 .sev__n { background: var(--red-500); }
.sevbar { display: inline-flex; gap: 2px; margin-left: 2px; }

.match { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; }
.match i { width: 8px; height: 8px; border-radius: 50%; }
.match--yes { color: var(--teal); } .match--yes i { background: var(--teal-500); }
.match--no { color: var(--red); } .match--no i { background: var(--red-500); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; height: 100%; }
.chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--red-50); color: var(--red); border: 1px solid #f6cfcd;
}
.chip--warn { background: var(--amber-50); color: var(--amber); border-color: #f5ddb2; }
.chip--none { background: transparent; border-color: transparent; color: var(--faint); font-weight: 500; padding: 0; }

.money { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--ink); }
.money--muted { color: var(--faint); font-weight: 500; }

.rec {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 650; text-transform: capitalize; white-space: nowrap;
}
.rec::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.rec--approve { background: var(--teal-50); color: var(--teal); }
.rec--review { background: var(--amber-50); color: var(--amber); }
.rec--reject { background: var(--red-50); color: var(--red); }

.dec { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 620; text-transform: capitalize; }
.dec svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.dec--approved { color: var(--teal); }
.dec--rejected { color: var(--red); }
.dec--pending { color: var(--muted); font-weight: 500; }

.pay {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .03em; font-family: var(--mono);
  background: #f0f3f7; color: var(--ink-2);
}
.pay i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pay--SUCCESS { background: #e1f5f1; color: var(--teal); }
.pay--PENDING, .pay--PROCESSING, .pay--UNCLAIMED, .pay--ONHOLD, .pay--QUEUED { background: var(--blue-50); color: var(--blue-600); }
.pay--PENDING i, .pay--PROCESSING i, .pay--QUEUED i { animation: blink 1.2s infinite; }
.pay--UNCLAIMED { background: var(--amber-50); color: var(--amber); }
.pay--FAILED, .pay--DENIED, .pay--BLOCKED, .pay--RETURNED, .pay--REFUNDED { background: var(--red-50); color: var(--red); }
@keyframes blink { 50% { opacity: .25; } }

.muted { color: var(--faint); font-size: 13px; }
.analyzing { display: inline-flex; align-items: center; gap: 8px; color: var(--blue); font-size: 13px; font-weight: 600; }
.analyzing::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.skeleton { display: inline-block; width: 56px; height: 10px; border-radius: 6px; background: linear-gradient(90deg, #eef2f7, #f7f9fc, #eef2f7); background-size: 200% 100%; animation: shimmer 1.6s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Detail panel ---------- */
.panel--detail { overflow-y: auto; scrollbar-width: thin; }
.detail { animation: slideIn .35s var(--ease); }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.detail__head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 12px; position: sticky; top: 0; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); z-index: 2; border-bottom: 1px solid var(--line-2); }
.detail__who { flex: 1; min-width: 0; }
.detail__name { margin: 0; font-size: 19px; font-weight: 720; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.detail__meta { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.detail__meta code { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--ink); border-color: #c7d3e3; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.detail__body { padding: 14px 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.photo {
  position: relative; border-radius: var(--r); overflow: hidden; aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #d9e5f3, #eef3f9);
  box-shadow: 0 0 0 1px rgba(11, 31, 58, .08);
}
.photo img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.photo__ph { position: absolute; inset: 0; display: grid; place-items: center; color: #8ea2bd; }
.photo__ph svg { width: 48px; height: 48px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.photo__badges { z-index: 2; position: absolute; left: 10px; bottom: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.photo__badges > * { box-shadow: 0 2px 10px rgba(11, 31, 58, .18); }
.photo__badges .sev, .photo__badges .glass { background: rgba(255, 255, 255, .94); }
.glass { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 650; }
.photo__tag { z-index: 2; position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: rgba(11, 31, 58, .66); color: #fff; letter-spacing: .02em; }

.sec__title { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.sec__title .lang { text-transform: none; }
.quote { margin: 0; padding: 12px 14px; border-radius: var(--r-sm); background: #f6f8fb; border: 1px solid var(--line-2); font-size: 15px; line-height: 1.55; color: var(--ink); }
.quote--ai { background: #fff; border-color: #d6e6f8; border-left: 3px solid var(--blue); }
.quote__label { display: block; font-size: 11.5px; font-weight: 650; color: var(--blue-600); margin-bottom: 4px; letter-spacing: .02em; }
.evidence { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.evidence li { position: relative; padding-left: 22px; font-size: 14.5px; color: var(--ink); }
.evidence li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 2px; background: var(--blue); transform: rotate(45deg); opacity: .8; }
.rationale { margin: 0; font-size: 15px; line-height: 1.55; }
.conf { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.conf__bar { flex: 1; height: 6px; border-radius: 6px; background: #eef2f7; overflow: hidden; }
.conf__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--teal-500)); border-radius: 6px; transition: width .8s var(--ease); }
.conf code { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }

.notice {
  position: relative; padding: 14px 16px 14px 16px; border-radius: var(--r);
  background: linear-gradient(180deg, #f2f8ff, #fff);
  border: 1px solid #cfe2f8;
}
.notice__label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: var(--blue-600); margin-bottom: 8px; }
.notice__label svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.notice__text { margin: 0; font-size: 16px; line-height: 1.55; color: var(--navy); font-weight: 500; }
.notice__foot { margin-top: 8px; font-size: 12px; color: var(--muted); }

.award { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.award td { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.award td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.award tr.total td { border-bottom: 0; border-top: 2px solid var(--navy); padding-top: 10px; font-weight: 750; font-size: 16px; }
.dup {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--red-50); border: 1px solid #f6cfcd; color: var(--red); font-size: 14px; font-weight: 600;
}
.dup svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-family: var(--mono); font-size: 13.5px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.kv code { font-family: var(--mono); font-size: 12.5px; }
.detail__actions { display: flex; gap: 8px; }
.detail__actions .btn { flex: 1; }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 36px; gap: 10px; color: var(--muted); }
.empty__art { width: 120px; height: 96px; margin-bottom: 6px; }
.empty h3 { margin: 0; font-size: 17px; color: var(--ink); }
.empty p { margin: 0; font-size: 14.5px; max-width: 300px; }
.empty ol { text-align: left; margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }

/* ---------- Money cards ---------- */
.money-cards { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 0; }
.mcard {
  position: relative; border-radius: var(--r); padding: 12px 14px;
  border: 1px dashed #d3dce8; background: #fafbfd;
  transition: background .4s var(--ease), border-color .4s, box-shadow .4s;
}
.mcard.is-active { border-style: solid; border-color: transparent; background: var(--navy); color: #fff; box-shadow: var(--shadow-2); animation: pop .45s var(--ease); }
.mcard.is-active.mcard--invoice { background: linear-gradient(135deg, #0b3b6e, #0070e0); }
@keyframes pop { from { transform: scale(.97); opacity: .4; } to { transform: none; opacity: 1; } }
.mcard__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mcard__kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.mcard__kicker svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mcard.is-active .mcard__kicker { color: #9fc3ec; }
.mcard__big { margin-top: 6px; font-size: 22px; font-weight: 740; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.mcard__id { font-family: var(--mono); font-size: 12.5px; color: #cfe0f5; overflow-wrap: anywhere; }
.mcard__hint { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.mcard__meta { margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: #c3d4ea; }
.mcard a { color: #fff; font-weight: 650; text-underline-offset: 3px; }
.mstat { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 750; letter-spacing: .05em; font-family: var(--mono); background: rgba(255, 255, 255, .14); color: #fff; }
.mstat i { width: 7px; height: 7px; border-radius: 50%; background: #ffc766; }
.mstat--ok i { background: #2dd4bf; }
.mstat--busy i { animation: blink 1s infinite; }
.mbar { margin-top: 10px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.mbar span { display: block; height: 100%; background: #2dd4bf; border-radius: 5px; transition: width .7s var(--ease); }

/* ---------- Feed ---------- */
.panel__head--feed { padding-top: 14px; padding-bottom: 8px; align-items: center; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); display: inline-block; }
.live-dot.is-on { background: var(--teal-500); animation: pulse 2.2s infinite; }
.live-dot.is-err { background: var(--red-500); }
.feed { list-style: none; margin: 0; padding: 4px 12px 14px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; scroll-behavior: smooth; }
.ev {
  display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px;
  padding: 8px 8px; border-radius: 10px; position: relative;
  animation: evIn .4s var(--ease) both;
}
.ev:hover { background: #f7f9fc; }
@keyframes evIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.ev__icon {
  --c: var(--blue); --cb: var(--blue-50);
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--cb); color: var(--c);
}
.ev__icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ev--teal .ev__icon { --c: var(--teal); --cb: var(--teal-50); }
.ev--amber .ev__icon { --c: var(--amber); --cb: var(--amber-50); }
.ev--red .ev__icon { --c: var(--red); --cb: var(--red-50); }
.ev--navy .ev__icon { --c: #fff; --cb: var(--navy); }
.ev--violet .ev__icon { --c: var(--violet); --cb: var(--violet-50); }
.ev--muted .ev__icon { --c: var(--muted); --cb: #f0f3f7; }
.ev__body { min-width: 0; }
.ev__line { display: flex; align-items: baseline; gap: 8px; }
.ev__title { font-size: 14px; font-weight: 600; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.ev__time { margin-left: auto; font-size: 11.5px; color: var(--faint); font-family: var(--mono); white-space: nowrap; }
.ev__text { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.ev__text--thought { font-style: italic; color: var(--ink-2); }
.ev--compact { padding-top: 4px; padding-bottom: 4px; }
.ev--compact .ev__icon { width: 22px; height: 22px; border-radius: 6px; margin-left: 3px; }
.ev--compact .ev__icon svg { width: 13px; height: 13px; }
.ev--compact .ev__title { font-weight: 500; font-size: 13.5px; color: var(--ink-2); }
.tool {
  display: inline-block; max-width: 100%; margin-top: 5px;
  padding: 5px 9px; border-radius: 7px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.45;
  background: #0f2340; color: #d6e6ff; border: 1px solid #1d3a63;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.tool .fn { color: #7cc4ff; font-weight: 700; }
.tool .ns { color: #8aa5c8; }
.tool .arg { color: #ffd78a; }
.tool--result { background: #effaf7; color: #0b5d53; border-color: #cdeee8; }
.feed__empty { margin: auto; padding: 24px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.feed__empty b { color: var(--ink); }

/* ---------- Footer ---------- */
.footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 2px 4px 14px; font-size: 13px; color: var(--muted);
}
.footer a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.footer a:hover { color: var(--blue); }
.footer svg { width: 16px; height: 16px; fill: currentColor; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 52px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  min-width: 320px; max-width: 640px; padding: 11px 16px; border-radius: 12px;
  background: var(--navy); color: #fff; font-size: 14px; box-shadow: 0 14px 40px -12px rgba(11, 31, 58, .55);
  animation: toastIn .35s var(--ease);
}
.toast svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toast--error { background: #7f1d1d; }
.toast--ok svg { color: #5eead4; }
.toast.is-out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1679px) {
  .app { height: auto; min-height: 100vh; }
  .workspace { grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: 640px 380px; }
  .panel--grid { grid-row: 1; }
  .panel--detail { grid-row: 1; }
  .panel--feed { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: 340px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .panel--feed .money-cards { grid-row: 1 / span 2; padding: 12px; border-right: 1px solid var(--line-2); overflow-y: auto; }
  .panel--feed .panel__head--feed { grid-column: 2; }
  .panel--feed .feed { grid-column: 2; }
  .kpi__value { font-size: 27px; }
}
@media (max-width: 1440px) {
  .campaign__meta { display: none; }
  .brand__tag { display: none; }
  .kpi { padding: 12px 14px; }
  .kpi__sub { font-size: 12px; }
  .steps { grid-template-columns: .8fr 1fr 1.9fr 1.05fr 1.15fr; }
  .step { padding: 10px 11px; }
  .btn { padding: 0 12px; font-size: 13.5px; }
  .guardrail { font-size: 13px; }
  .step .btn svg { display: none; }
  .step .btn { max-width: 100%; }
  .workspace { grid-template-columns: minmax(0, 1fr) 380px; }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps { grid-template-columns: 1fr 1fr; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: 560px auto 420px; }
  .panel--detail { grid-row: 2; max-height: 720px; }
  .panel--feed { grid-row: 3; grid-template-columns: 1fr; }
  .panel--feed .money-cards { grid-row: auto; border-right: 0; }
  .panel--feed .panel__head--feed, .panel--feed .feed { grid-column: 1; }
  .topbar { flex-wrap: wrap; }
  .rail__head { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
