@import url("/shared/ui.css");
/* AML statistics dashboard — self-contained, no dependencies. Matches the onboarding wizard's
   refined compliance-tool aesthetic: deep-slate surfaces, indigo/teal accents, CSS custom props. */
:root {
  --bg: #0f172a;
  --panel: #ffffff;
  --panel-muted: #f8fafc;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #5f6f86; /* WCAG AA: ≥4.5:1 on white & on --panel-muted */
  --line: #e2e8f0;
  --indigo: #4f46e5;
  --indigo-dark: #4338ca;
  --teal: #0d9488;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Visible keyboard focus on every interactive control (WCAG 2.4.7). */
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: 4px; }
.btn:focus-visible, .affix-btn:focus-visible { outline-offset: 3px; }

/* Skip-to-content link — visible only when focused. */
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 40;
  background: var(--indigo); color: #fff; padding: 9px 14px; border-radius: 8px;
  font: inherit; font-weight: 600; text-decoration: none; transition: top .12s ease;
}
.skip-link:focus { top: 12px; }

/* Visually-hidden but available to assistive tech. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 220px, #eef2f7 220px, #eef2f7 100%);
  min-height: 100vh;
}

.shell { max-width: 1100px; margin: 0 auto; padding: 24px 20px 64px; }

/* ---- topbar ---- */
.topbar { display: flex; flex-direction: column; gap: 18px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: #fff; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255, 255, 255, .1); color: #a5b4fc;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: .2px; }
.brand-sub { font-size: .8rem; color: #cbd5e1; }

.config-bar {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 16px; align-items: end;
  background: var(--panel); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.field input {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-muted); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.hint { font-size: .72rem; color: var(--ink-faint); }
.input-affix { position: relative; display: flex; }
.input-affix input { flex: 1; padding-right: 64px; }
.affix-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; color: var(--indigo); font: inherit; font-size: .78rem;
  font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.affix-btn:hover { background: rgba(79, 70, 229, .08); }
.config-action { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 600;
  border: none; border-radius: 9px; padding: 10px 20px; cursor: pointer; transition: background .15s, transform .05s;
}
.btn.primary { background: var(--indigo); color: #fff; }
.btn.primary:hover { background: var(--indigo-dark); }
.btn.primary:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.spinner {
  width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- content ---- */
.banner { border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: .9rem; }
.banner.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

.placeholder {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  background: var(--panel); border-radius: var(--radius); padding: 56px 24px; box-shadow: var(--shadow); color: var(--ink-soft);
}
.placeholder svg { color: var(--indigo); }
.placeholder h1 { margin: 6px 0 0; font-size: 1.3rem; color: var(--ink); }
.placeholder p { margin: 0; max-width: 460px; }

.section { background: var(--panel); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.section-title { margin: 0 0 16px; font-size: 1.05rem; }

/* Watchlists-screened chips */
.lists-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.lists-head .section-title { margin: 0; }
.lists-updated { font-size: .72rem; color: var(--ink-faint); }
.lists { display: flex; flex-wrap: wrap; gap: 8px; }
.list-chip { display: inline-flex; align-items: baseline; gap: 7px; border: 1px solid var(--line); background: var(--panel-muted); border-radius: 999px; padding: 6px 13px; font-size: .85rem; }
.list-chip b { color: var(--ink); }
.list-count { color: var(--ink-faint); font-size: .78rem; }
.lists-total { margin: 14px 0 0; font-size: .8rem; }
.lists-total strong { color: var(--ink); }
/* Watchlist-updates table now uses the shared .ui-table grid (see /shared/ui.css);
   only the cell-level helpers remain local. */
.rf-when { color: var(--muted-ink, #64748b); white-space: nowrap; }
.rf-badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.rf-ok { background: #dcfce7; color: #166534; }
.rf-fail { background: #fee2e2; color: #991b1b; }

/* Tenant watchlists editor */
.cfg-row { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cfg-row input { flex: 1 1 320px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-muted); color: var(--ink); font: inherit; outline: none; }
.cfg-row input:focus { border-color: var(--indigo); }
.cfg-lists { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.cfg-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel-muted); border-radius: 999px; padding: 7px 14px; font-size: .85rem; cursor: pointer; }
.cfg-chip input { accent-color: var(--indigo); margin: 0; }
.cfg-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.card { background: var(--panel-muted); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.card-label { font-size: .78rem; color: var(--ink-soft); font-weight: 600; }
.card-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.5px; }
.card-sub { font-size: .74rem; color: var(--ink-faint); }

.breakdowns { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 20px; }
.breakdown-title { margin: 0 0 10px; font-size: .82rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 56px; align-items: center; gap: 10px; font-size: .85rem; }
.bar-label { color: var(--ink-soft); }
.bar-track { background: #eef2f7; border-radius: 6px; height: 12px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--indigo); border-radius: 6px; min-width: 2px; }
.bar-fill.is-good { background: var(--good); }
.bar-fill.is-warn { background: var(--warn); }
.bar-fill.is-bad { background: var(--bad); }
.bar-count { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.muted { color: var(--ink-faint); font-size: .85rem; margin: 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: .85rem; }

@media (max-width: 720px) {
  .config-bar { grid-template-columns: 1fr; }
  .breakdowns { grid-template-columns: 1fr; }
}
