/* Agio Compliance — design tokens & base styles
 *
 * Aesthetic: institutional, software-native, regulator-credible.
 * Type: IBM Plex Sans (UI) + IBM Plex Mono (IDs, addresses, hashes, amounts).
 * Density: hot — 28px row height in compact, 32px in regular.
 * Color: cool neutral grays; status (green/amber/red/slate) is the only color.
 */

:root, :root[data-theme="light"] {
  --bg:           #f7f8fa;
  --bg-elev:     #ffffff;
  --bg-sunk:     #f1f3f6;
  --bg-rail:     #fbfbfd;
  --bg-hover:   rgba(15, 23, 42, 0.035);
  --bg-active:  rgba(15, 23, 42, 0.06);
  --bg-selected: rgba(37, 99, 235, 0.08);

  --line:        #e4e7ec;
  --line-strong: #d5d9e0;
  --line-soft:   #eef0f3;

  --fg:          #0f172a;
  --fg-2:        #344256;
  --fg-3:        #5b6573;
  --fg-4:        #8892a0;
  --fg-5:        #aab2bd;

  --accent:      #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --accent-fg:   #1d4ed8;

  --green:       #16a34a;
  --green-bg:    rgba(22, 163, 74, 0.10);
  --green-fg:    #14803c;

  --amber:       #d97706;
  --amber-bg:    rgba(217, 119, 6, 0.10);
  --amber-fg:    #b45309;

  --red:         #dc2626;
  --red-bg:      rgba(220, 38, 38, 0.10);
  --red-fg:      #b91c1c;

  --slate:       #64748b;
  --slate-bg:    rgba(100, 116, 139, 0.10);
  --slate-fg:    #475569;

  --shadow-sm:   0 1px 1px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:   0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-panel:0 1px 0 rgba(15, 23, 42, 0.04), -16px 0 40px rgba(15, 23, 42, 0.08);

  --rail-w:       56px;
  --subnav-w:    216px;
  --header-h:     44px;
  --subheader-h:  40px;

  --row-h-compact: 30px;
  --row-h-regular: 34px;

  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg:           #0b0d10;
  --bg-elev:      #14171c;
  --bg-sunk:      #0a0c0f;
  --bg-rail:      #0e1115;
  --bg-hover:    rgba(255, 255, 255, 0.04);
  --bg-active:   rgba(255, 255, 255, 0.07);
  --bg-selected: rgba(96, 165, 250, 0.12);

  --line:        #232830;
  --line-strong: #2e343d;
  --line-soft:   #1b1f25;

  --fg:          #e7ecf3;
  --fg-2:        #c7cfdb;
  --fg-3:        #97a1b0;
  --fg-4:        #6b7686;
  --fg-5:        #525c6c;

  --accent:      #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --accent-fg:   #93c5fd;

  --green:       #22c55e;
  --green-bg:    rgba(34, 197, 94, 0.14);
  --green-fg:    #4ade80;

  --amber:       #f59e0b;
  --amber-bg:    rgba(245, 158, 11, 0.14);
  --amber-fg:    #fbbf24;

  --red:         #ef4444;
  --red-bg:      rgba(239, 68, 68, 0.14);
  --red-fg:      #f87171;

  --slate:       #94a3b8;
  --slate-bg:    rgba(148, 163, 184, 0.12);
  --slate-fg:    #cbd5e1;

  --shadow-sm:   0 1px 0 rgba(0, 0, 0, 0.5);
  --shadow-md:   0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-panel:0 0 0 1px var(--line), -16px 0 40px rgba(0, 0, 0, 0.5);
}

/* Density modifier — applied to body */
body[data-density="compact"] { --row-h: var(--row-h-compact); --cell-pad-y: 4px; --cell-pad-x: 10px; }
body[data-density="regular"] { --row-h: var(--row-h-regular); --cell-pad-y: 6px; --cell-pad-x: 12px; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html, body, #root { height: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
  overflow: hidden;
}

button { font-family: inherit; }

/* Surface column — stacks subheader / filter bar / table vertically inside app-body */
.surface-col {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mono { font-family: var(--font-mono); font-feature-settings: "zero", "tnum"; }
.tnum { font-variant-numeric: tabular-nums; }

/* Auditor mode — subtle red-tinted treatment, watermark, cursor */
body[data-auditor="true"] {
  --auditor-tint: rgba(220, 38, 38, 0.025);
}
body[data-auditor="true"] .app-main::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--auditor-tint);
  pointer-events: none;
  z-index: 1;
}
body[data-auditor="true"] .auditor-watermark {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--red-fg);
  background: var(--bg-elev);
  border: 1px solid var(--red-bg);
  padding: 4px 10px;
  border-radius: 999px;
  z-index: 100;
  pointer-events: none;
  opacity: 0.85;
}

/* Generic scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--fg-5); background-clip: content-box; border: 2px solid transparent; }

/* Focus ring */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
