/*
 * Clearing: the idebit UI foundation.
 * Tokens, app shell (sidebar + top bar + drawer), auth layout and shared components.
 * Loaded only by pages using views/partials/clearing/*; legacy pages keep core.css/themes.css.
 * Dark mode: every colour is a token (see the dark overrides below :root), so components never
 * hardcode color and never need their own dark-mode rules.
 */

/* ---- Fonts (self-hosted via @fontsource, served from /vendor/fonts) ---- */
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/vendor/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-400-normal.woff2') format('woff2'), url('/vendor/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-400-normal.woff') format('woff'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/vendor/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-500-normal.woff2') format('woff2'), url('/vendor/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-500-normal.woff') format('woff'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/vendor/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-600-normal.woff2') format('woff2'), url('/vendor/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-600-normal.woff') format('woff'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/vendor/fonts/ibm-plex-mono/files/ibm-plex-mono-latin-400-normal.woff2') format('woff2'), url('/vendor/fonts/ibm-plex-mono/files/ibm-plex-mono-latin-400-normal.woff') format('woff'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/vendor/fonts/ibm-plex-mono/files/ibm-plex-mono-latin-500-normal.woff2') format('woff2'), url('/vendor/fonts/ibm-plex-mono/files/ibm-plex-mono-latin-500-normal.woff') format('woff'); }

/* ---- Tokens ---- */
:root {
  --cl-font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cl-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --cl-brand: #074D93;          /* sampled from the idebit logo */
  --cl-brand-hover: #053C74;
  --cl-brand-soft: #E4EEF9;
  --cl-brand-ink: #053C74;      /* text on brand-soft */
  --cl-on-accent: #fff;         /* text on a solid --cl-brand/--cl-danger fill */

  --cl-navy: #0F2438;           /* sidebar / auth panel */
  --cl-navy-active: #1E4269;
  --cl-navy-line: #27435F;
  --cl-on-navy: #D3DCE8;
  --cl-on-navy-muted: #9FB1C4;

  --cl-bg: #F4F6F9;
  --cl-surface: #FFFFFF;
  --cl-surface-2: #F8FAFC;
  --cl-border: #DCE2EA;
  --cl-border-soft: #E8ECF1;
  --cl-border-strong: #7C8B9C;  /* 3:1 on white: input/control outlines */
  --cl-text: #14202E;
  --cl-muted: #4B5A6B;

  --cl-ok: #0B5B33;      --cl-ok-bg: #E6F2EC;      --cl-ok-line: #A9D3BC;
  --cl-warn: #7A4A00;    --cl-warn-bg: #FFF1D6;    --cl-warn-line: #E8C98A;
  --cl-danger: #B42318;  --cl-danger-bg: #FDECEA;   --cl-danger-line: #E5A29B;  --cl-danger-hover: #8F1B12;
  --cl-info: #08427F;    --cl-info-bg: #E4EEF9;    --cl-info-line: #A9C7E6;

  --cl-chip-bg: #EAEEF3;   /* inline code / small badges (docs) */

  --cl-focus: #1A6FD1;
  --cl-radius: 6px;
  --cl-radius-lg: 10px;
  --cl-shadow: 0 1px 2px rgba(15, 36, 56, 0.06);
  --cl-shadow-pop: 0 12px 32px rgba(15, 36, 56, 0.22);

  --cl-sidebar-w: 248px;
  --cl-topbar-h: 64px;
}

/*
 * Dark tokens. Two ways in: the OS-level media query (for anyone who hasn't set an explicit
 * preference — [data-theme] is only set server-side from users.theme_preference when it's
 * 'light' or 'dark', never for 'system'), and the explicit [data-theme="dark"] override, which
 * always wins regardless of OS setting. The sidebar/navy tokens barely move since the sidebar
 * is already a dark surface; brand blue is brightened so it doesn't look muddy on dark surfaces.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cl-brand: #3D8BDB;
    --cl-brand-hover: #5FA0E6;
    --cl-brand-soft: #12283F;
    --cl-brand-ink: #BFE0FF;
    /* Dark text on the bright fill, not white: at this luminance #3D8BDB only
       gives white text ~3.5:1 contrast (fails WCAG AA's 4.5:1 for normal text),
       but ~5:1 against a dark ink. Same reasoning for --cl-danger below. */
    --cl-on-accent: #0B1420;

    --cl-navy: #0B1B2B;
    --cl-navy-active: #24507D;
    --cl-navy-line: #2E4A66;

    --cl-bg: #0B141F;
    --cl-surface: #121D2B;
    --cl-surface-2: #17232F;
    --cl-border: #26333F;
    --cl-border-soft: #1E2A36;
    --cl-border-strong: #4A5A6B;
    --cl-text: #E7ECF2;
    --cl-muted: #93A3B4;

    --cl-ok: #4ADE94;      --cl-ok-bg: #113C29;      --cl-ok-line: #2F6B49;
    --cl-warn: #FFC466;    --cl-warn-bg: #3A2A0A;    --cl-warn-line: #7A5A28;
    --cl-danger: #FF8A80;  --cl-danger-bg: #3B1512;   --cl-danger-line: #7A382F;  --cl-danger-hover: #E8695C;
    --cl-info: #7FB8FF;    --cl-info-bg: #13263D;    --cl-info-line: #3D5A7A;

    --cl-chip-bg: #1E2A36;

    --cl-focus: #5FA8F5;
    --cl-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --cl-shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  --cl-brand: #3D8BDB;
  --cl-brand-hover: #5FA0E6;
  --cl-brand-soft: #12283F;
  --cl-brand-ink: #BFE0FF;
  --cl-on-accent: #0B1420;

  --cl-navy: #0B1B2B;
  --cl-navy-active: #24507D;
  --cl-navy-line: #2E4A66;

  --cl-bg: #0B141F;
  --cl-surface: #121D2B;
  --cl-surface-2: #17232F;
  --cl-border: #26333F;
  --cl-border-soft: #1E2A36;
  --cl-border-strong: #4A5A6B;
  --cl-text: #E7ECF2;
  --cl-muted: #93A3B4;

  --cl-ok: #4ADE94;      --cl-ok-bg: #113C29;      --cl-ok-line: #2F6B49;
  --cl-warn: #FFC466;    --cl-warn-bg: #3A2A0A;    --cl-warn-line: #7A5A28;
  --cl-danger: #FF8A80;  --cl-danger-bg: #3B1512;   --cl-danger-line: #7A382F;  --cl-danger-hover: #E8695C;
  --cl-info: #7FB8FF;    --cl-info-bg: #13263D;    --cl-info-line: #3D5A7A;

  --cl-chip-bg: #1E2A36;

  --cl-focus: #5FA8F5;
  --cl-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --cl-shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* ---- Base (scoped to body.cl so legacy pages are never touched) ---- */
body.cl { margin: 0; background: var(--cl-bg); color: var(--cl-text); font-family: var(--cl-font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.cl *, body.cl *::before, body.cl *::after { box-sizing: border-box; }
.cl h1, .cl h2, .cl h3 { margin: 0; letter-spacing: -0.01em; line-height: 1.2; }
/* :where() keeps plain links at zero specificity so component classes (buttons, nav links) always win */
:where(.cl) a { color: var(--cl-brand); }
:where(.cl) a:hover { color: var(--cl-brand-hover); }
.cl :focus-visible { outline: 3px solid var(--cl-focus); outline-offset: 2px; border-radius: 3px; }
.cl [hidden] { display: none !important; }
.cl-skip { position: absolute; left: 8px; top: -80px; z-index: 100; padding: 10px 14px; background: var(--cl-surface); color: var(--cl-text); border-radius: var(--cl-radius); }
.cl-skip:focus { top: 8px; box-shadow: var(--cl-shadow-pop); }
.cl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cl-mono { font-family: var(--cl-mono); font-size: 13px; }
.cl-muted { color: var(--cl-muted); }

/* ---- App shell ---- */
.cl-app { display: grid; grid-template-columns: var(--cl-sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.cl-sidebar { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; background: var(--cl-navy); color: var(--cl-on-navy); padding: 20px 12px 24px; display: flex; flex-direction: column; }
.cl-sidebar a:focus-visible, .cl-sidebar button:focus-visible { outline-color: #9CC9FF; }
.cl-brand { display: flex; flex-direction: column; gap: 8px; padding: 4px 12px 18px; }
.cl-brand img { display: block; height: 30px; width: auto; }
.cl-brand__bank { align-self: flex-start; background: #fff; border-radius: var(--cl-radius); padding: 6px 10px; }
.cl-brand__bank img { height: 28px; max-width: 170px; object-fit: contain; }
.cl-brand__by { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--cl-on-navy-muted); }
.cl-brand__by img { height: 16px; }
.cl-nav-group { padding: 16px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cl-on-navy-muted); }
.cl-nav-link { display: flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--cl-radius); color: var(--cl-on-navy); font-size: 14px; text-decoration: none; }
.cl-nav-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.cl-nav-link[aria-current='page'] { background: var(--cl-navy-active); color: #fff; font-weight: 500; }
.cl-sidebar__foot { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid var(--cl-navy-line); display: none; align-items: center; justify-content: space-between; gap: 10px; }
.cl-sidebar__foot a { color: #9CC9FF; font-size: 14px; }
.cl-sidebar__user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cl-sidebar__user span:last-child { color: #fff; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-sidebar .cl-sidebar__close { display: none; margin: -6px -6px 6px auto; color: var(--cl-on-navy); }

.cl-main-wrap { min-width: 0; display: flex; flex-direction: column; }
.cl-topbar { position: sticky; top: 0; z-index: 20; height: var(--cl-topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 32px; background: var(--cl-surface); border-bottom: 1px solid var(--cl-border); }
.cl-topbar__left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cl-topbar__right { display: flex; align-items: center; gap: 20px; }
.cl-crumb { font-size: 14px; color: var(--cl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-crumb strong { color: var(--cl-text); font-weight: 500; }
.cl-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: var(--cl-radius); background: transparent; color: inherit; cursor: pointer; }
.cl-iconbtn:hover { background: rgba(127, 139, 156, 0.16); }
.cl-menu-btn { display: none; }
.cl-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--cl-brand); color: var(--cl-on-accent); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.cl-user { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.cl-user a { font-weight: 500; text-decoration: none; }
.cl-user a[aria-current='page'] { text-decoration: underline; }
.session-timer { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; background: var(--cl-ok-bg); color: var(--cl-ok); font-size: 13px; font-weight: 500; }
.session-timer.warning { background: var(--cl-danger-bg); color: var(--cl-danger); }
.session-timer .cl-mono { font-size: 13px; }
.cl-logout { font-size: 14px; font-weight: 500; }
.cl-linkbtn { border: 0; background: transparent; color: inherit; font: inherit; padding: 0; cursor: pointer; text-align: inherit; }
.cl-main { padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.cl-backdrop { display: none; }

@media (max-width: 960px) {
  .cl-app { grid-template-columns: minmax(0, 1fr); }
  .cl-sidebar { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(310px, 86vw); height: auto; visibility: hidden; transform: translateX(-100%); transition: transform 0.2s ease, visibility 0s linear 0.2s; }
  .cl-sidebar__foot { display: flex; }
  .cl-sidebar .cl-sidebar__close { display: inline-flex; }
  body.cl-nav-open .cl-sidebar { visibility: visible; transform: none; transition: transform 0.2s ease; }
  body.cl-nav-open { overflow: hidden; }
  body.cl-nav-open .cl-backdrop { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(15, 36, 56, 0.55); }
  .cl-menu-btn { display: inline-flex; margin-left: -8px; }
  .cl-topbar { padding: 0 12px 0 16px; }
  .cl-topbar__right .cl-user span:not(.cl-avatar), .cl-topbar__right .cl-logout, .cl-topbar__right .cl-user a { display: none; }
  .cl-main { padding: 20px 16px 40px; }
  .cl-crumb__group { display: none; }
}
@media (prefers-reduced-motion: reduce) { .cl-sidebar { transition: none; } }

/* ---- Page header ---- */
.cl-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.cl-page-head h1 { font-size: 28px; font-weight: 600; }
.cl-page-head p { margin: 6px 0 0; color: var(--cl-muted); font-size: 15px; max-width: 62ch; }
.cl-eyebrow { font-size: 13px; color: var(--cl-muted); margin-bottom: 4px; }
.cl-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 720px) { .cl-page-head h1 { font-size: 24px; } .cl-page-head .cl-actions { width: 100%; } .cl-page-head .cl-actions > * { flex: 1; } }

/* ---- Buttons ---- */
.cl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: var(--cl-radius); font: 500 14px/1 var(--cl-font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.cl-btn--primary { background: var(--cl-brand); color: var(--cl-on-accent); font-weight: 600; }
.cl-btn--primary:hover { background: var(--cl-brand-hover); color: var(--cl-on-accent); }
.cl-btn--secondary { background: var(--cl-surface); color: var(--cl-text); border-color: var(--cl-border-strong); }
.cl-btn--secondary:hover { background: var(--cl-surface-2); color: var(--cl-text); }
.cl-btn--danger { background: var(--cl-surface); color: var(--cl-danger); border-color: var(--cl-danger-line); }
.cl-btn--danger:hover { background: var(--cl-danger-bg); color: var(--cl-danger); }
.cl-btn--danger-solid { background: var(--cl-danger); color: var(--cl-on-accent); font-weight: 600; }
.cl-btn--danger-solid:hover { background: var(--cl-danger-hover); color: var(--cl-on-accent); }
.cl-btn--sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.cl-btn--block { width: 100%; min-height: 48px; font-size: 16px; }
.cl-btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---- Forms ---- */
.cl-field { display: flex; flex-direction: column; gap: 8px; }
.cl-label { font-size: 14px; font-weight: 500; }
.cl-input, .cl-select { width: 100%; min-height: 46px; padding: 0 14px; font: 16px var(--cl-font); color: var(--cl-text); background: var(--cl-surface); border: 1px solid var(--cl-border-strong); border-radius: var(--cl-radius); }
.cl-select { padding-right: 8px; }
.cl-input:focus, .cl-select:focus { outline: 3px solid var(--cl-focus); outline-offset: 1px; border-color: var(--cl-focus); }
.cl-help { font-size: 13px; color: var(--cl-muted); }
.cl-form { display: flex; flex-direction: column; gap: 20px; }
.cl-form-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cl-form-row--center { justify-content: center; }
.cl-divider { height: 1px; background: var(--cl-border); border: 0; margin: 0; }

/* ---- Alerts ---- */
.cl-alert { padding: 12px 16px; border-radius: var(--cl-radius); font-size: 14px; border: 1px solid; }
.cl-alert--error { background: var(--cl-danger-bg); color: var(--cl-danger); border-color: var(--cl-danger-line); }
.cl-alert--success { background: var(--cl-ok-bg); color: var(--cl-ok); border-color: var(--cl-ok-line); }
.cl-alert--info { background: var(--cl-info-bg); color: var(--cl-info); border-color: var(--cl-info-line); }
.cl-alert--warning { background: var(--cl-warn-bg); color: var(--cl-warn); border-color: var(--cl-warn-line); }

/* ---- Cards, chips, pills ---- */
.cl-card { background: var(--cl-surface); border: 1px solid var(--cl-border); border-radius: var(--cl-radius-lg); box-shadow: var(--cl-shadow); }
.cl-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.cl-chip { flex-shrink: 0; min-height: 40px; padding: 0 16px; border: 1px solid var(--cl-border-strong); border-radius: 999px; background: var(--cl-surface); color: var(--cl-text); font: 14px var(--cl-font); cursor: pointer; }
.cl-chip:hover { background: var(--cl-surface-2); }
.cl-chip[aria-pressed='true'], .cl-chip[aria-selected='true'] { background: var(--cl-brand-soft); border-color: var(--cl-brand); color: var(--cl-brand-ink); font-weight: 600; }
.cl-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.cl-pill--ok { background: var(--cl-ok-bg); color: var(--cl-ok); }
.cl-pill--warn { background: var(--cl-warn-bg); color: var(--cl-warn); }
.cl-pill--danger { background: var(--cl-danger-bg); color: var(--cl-danger); }
.cl-pill--info { background: var(--cl-info-bg); color: var(--cl-info); }
.cl-pill--muted { background: var(--cl-chip-bg); color: var(--cl-muted); }
.cl-empty { padding: 40px 20px; text-align: center; color: var(--cl-muted); }

/* ---- Data table (real <table>; becomes stacked cards on phones) ---- */
.cl-tablecard { overflow: hidden; }
.cl-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cl-table th { padding: 12px 16px; text-align: left; background: var(--cl-surface-2); border-bottom: 1px solid var(--cl-border); font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--cl-muted); white-space: nowrap; }
.cl-table td { padding: 14px 16px; border-bottom: 1px solid var(--cl-border-soft); vertical-align: middle; }
.cl-table tbody tr:last-child td { border-bottom: 0; }
.cl-table tbody tr:hover td { background: var(--cl-surface-2); }
.cl-table .cl-num { text-align: right; }
.cl-cell-stack { display: flex; flex-direction: column; }
.cl-cell-stack small { color: var(--cl-muted); font-size: 13px; overflow-wrap: anywhere; }
.cl-row-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.cl-inline-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.cl-inline-form .cl-select { min-height: 36px; font-size: 13px; width: auto; }
.cl-scroll-x { overflow-x: auto; }

@media (max-width: 1180px) and (min-width: 721px) { .cl-table th, .cl-table td { padding: 12px 10px; } }
@media (max-width: 720px) {
  .cl-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cl-table, .cl-table tbody { display: block; }
  .cl-tablecard { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .cl-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 12px; padding: 16px; background: var(--cl-surface); border: 1px solid var(--cl-border); border-radius: var(--cl-radius-lg); box-shadow: var(--cl-shadow); }
  .cl-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .cl-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cl-muted); }
  .cl-table td[data-primary], .cl-table td[data-wide], .cl-table td[data-actions] { grid-column: 1 / -1; }
  .cl-table td[data-primary]::before, .cl-table td[data-actions]::before { display: none; }
  .cl-table td[data-actions] { padding-top: 14px; border-top: 1px solid var(--cl-border-soft); }
  .cl-table td[data-actions] .cl-row-actions { justify-content: stretch; }
  .cl-table td[data-actions] .cl-row-actions > *, .cl-table td[data-actions] .cl-inline-form { flex: 1; }
  .cl-table td[data-actions] .cl-btn { width: 100%; min-height: 46px; }
  .cl-table tbody tr:hover td { background: transparent; }
  .cl-table td.cl-empty { grid-column: 1 / -1; }
}

/* ---- Modal ---- */
.cl-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 36, 56, 0.55); overflow-y: auto; }
.cl-modal__box { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--cl-surface); border-radius: 12px; box-shadow: var(--cl-shadow-pop); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.cl-modal__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cl-modal__head h2 { font-size: 22px; font-weight: 600; }
.cl-modal__foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.cl-modal__foot form { margin: 0; }
.cl-kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.cl-kv dt { color: var(--cl-muted); }
.cl-kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 720px) { .cl-modal { align-items: flex-end; padding: 0; } .cl-modal__box { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; padding: 20px 16px 24px; } .cl-modal__foot > * { flex: 1; } .cl-modal__foot .cl-btn { width: 100%; } }

/* Session-expiry warning (injected by session-timer.js) */
.cl-session-warning { position: fixed; z-index: 300; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 400px); background: var(--cl-surface); border: 1px solid var(--cl-danger-line); border-radius: 12px; box-shadow: var(--cl-shadow-pop); padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.cl-session-warning h2 { font-size: 20px; color: var(--cl-danger); }
.cl-session-warning p { margin: 0; }

/* ---- Search results list (register: company lookup) ---- */
.cl-search-results { margin-top: 8px; border: 1px solid var(--cl-border-strong); border-radius: var(--cl-radius); background: var(--cl-surface); overflow: hidden; }
.cl-search-result { display: block; width: 100%; min-height: 44px; padding: 10px 14px; text-align: left; border: 0; border-bottom: 1px solid var(--cl-border-soft); background: var(--cl-surface); color: var(--cl-text); font: 15px var(--cl-font); cursor: pointer; }
.cl-search-result:last-child { border-bottom: 0; }
.cl-search-result:hover, .cl-search-result:focus-visible { background: var(--cl-brand-soft); }
.cl-search-empty { padding: 12px 14px; color: var(--cl-muted); font-size: 14px; }
.cl-search-warn { color: var(--cl-warn); font-weight: 500; }

/* ---- Auth layout (sign in / register / password reset) ---- */
.cl-auth { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); min-height: 100vh; }
.cl-auth__panel { background: var(--cl-navy); color: var(--cl-on-navy); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.cl-auth__panel img { height: 40px; width: auto; }
.cl-auth__headline { margin: 0 0 16px; font-size: 40px; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; color: #fff; }
.cl-auth__lede { margin: 0; font-size: 17px; line-height: 1.55; max-width: 400px; }
.cl-auth__legal { font-size: 13px; color: var(--cl-on-navy-muted); }
.cl-auth__main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.cl-auth__box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 22px; }
.cl-auth__box--wide { max-width: 520px; }
.cl-auth__box h1 { font-size: 30px; font-weight: 600; }
.cl-auth__box > p { margin: -12px 0 0; color: var(--cl-muted); }
.cl-auth__links { display: flex; flex-direction: column; gap: 2px; font-size: 15px; color: var(--cl-muted); }
.cl-auth__links > * { display: block; padding: 8px 0; }
@media (max-width: 860px) {
  .cl-auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .cl-auth__panel { padding: 28px 24px 32px; gap: 18px; }
  .cl-auth__panel img { height: 30px; }
  .cl-auth__headline { font-size: 26px; margin-bottom: 10px; }
  .cl-auth__lede { font-size: 15px; }
  .cl-auth__legal { display: none; }
  .cl-auth__main { align-items: flex-start; padding: 28px 24px 32px; }
  .cl-auth__box h1 { font-size: 24px; }
}

@media print { .cl-sidebar, .cl-topbar, .cl-backdrop { display: none !important; } .cl-app { display: block; } .cl-main { padding: 0; } }

/* ---- Public layout (landing, about, contact, getting started, FAQs) ---- */
.cl-pubbar { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding: 14px 32px; background: var(--cl-surface); border-bottom: 1px solid var(--cl-border); }
.cl-pubbar__brand img { display: block; height: 30px; width: auto; }
.cl-pubnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cl-pubnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--cl-radius); color: var(--cl-text); font-size: 15px; text-decoration: none; }
.cl-pubnav a:hover { background: var(--cl-brand-soft); color: var(--cl-brand-ink); }
.cl-pubnav a[aria-current='page'] { color: var(--cl-brand-ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--cl-brand); border-radius: 0; }
.cl-pubbar__actions { display: flex; align-items: center; gap: 10px; }
.cl-pubmain { min-height: calc(100vh - 140px); }
.cl-pubfoot { padding: 24px 32px 32px; border-top: 1px solid var(--cl-border); background: var(--cl-surface); display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; font-size: 14px; color: var(--cl-muted); }
.cl-pubfoot nav { display: flex; gap: 8px 20px; flex-wrap: wrap; }
.cl-container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 32px; }
.cl-container--narrow { max-width: 760px; }
.cl-hero { padding: 88px 0 56px; text-align: center; }
.cl-hero h1 { font-size: 48px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.cl-hero p { margin: 18px auto 0; max-width: 34ch; font-size: 20px; color: var(--cl-muted); }
.cl-hero .cl-actions { justify-content: center; margin-top: 32px; }
.cl-hero .cl-btn { min-height: 50px; padding: 0 26px; font-size: 16px; }
.cl-feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding-bottom: 72px; }
.cl-feature { padding: 24px; }
.cl-feature h2 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.cl-feature p { margin: 0; color: var(--cl-muted); font-size: 15px; }
.cl-section { padding: 48px 0; }
.cl-pagehead { padding: 48px 0 8px; }
.cl-pagehead h1 { font-size: 36px; font-weight: 600; letter-spacing: -0.02em; }
.cl-pagehead p { margin: 10px 0 0; color: var(--cl-muted); font-size: 18px; max-width: 60ch; }
.cl-prose { font-size: 16px; line-height: 1.7; }
.cl-prose h2 { font-size: 24px; font-weight: 600; margin: 40px 0 12px; }
.cl-prose h3 { font-size: 18px; font-weight: 600; margin: 28px 0 8px; }
.cl-prose p { margin: 0 0 16px; }
.cl-prose ul, .cl-prose ol { margin: 0 0 16px; padding-left: 22px; }
.cl-prose li { margin-bottom: 6px; }
.cl-prose img { max-width: 100%; height: auto; }
.cl-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: step; }
.cl-steps > li { counter-increment: step; display: grid; grid-template-columns: 40px 1fr; gap: 16px; padding: 20px; background: var(--cl-surface); border: 1px solid var(--cl-border); border-radius: var(--cl-radius-lg); }
.cl-steps > li::before { content: counter(step); display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--cl-brand); color: var(--cl-on-accent); font-weight: 600; }
.cl-steps h3 { margin: 0 0 4px; font-size: 17px; }
.cl-steps p { margin: 0; color: var(--cl-muted); }
.cl-faq { margin-bottom: 10px; background: var(--cl-surface); border: 1px solid var(--cl-border); border-radius: var(--cl-radius-lg); }
.cl-faq > summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; padding: 12px 20px; font-size: 16px; font-weight: 500; cursor: pointer; list-style: none; }
.cl-faq > summary::-webkit-details-marker { display: none; }
.cl-faq > summary::after { content: '+'; font-size: 22px; font-weight: 400; color: var(--cl-muted); line-height: 1; }
.cl-faq[open] > summary::after { content: '\2212'; }
.cl-faq__body { padding: 0 20px 18px; color: var(--cl-text); }
.cl-faq__body > :last-child { margin-bottom: 0; }
.cl-contact { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; align-items: start; padding-bottom: 72px; }
.cl-contact__form { padding: 28px; }
.cl-contact__info { padding: 28px; }
.cl-contact__info h2 { font-size: 18px; margin-bottom: 12px; }
.cl-textarea { width: 100%; min-height: 140px; padding: 12px 14px; font: 16px/1.5 var(--cl-font); color: var(--cl-text); background: var(--cl-surface); border: 1px solid var(--cl-border-strong); border-radius: var(--cl-radius); resize: vertical; }
.cl-textarea:focus { outline: 3px solid var(--cl-focus); outline-offset: 1px; border-color: var(--cl-focus); }
@media (max-width: 860px) {
  .cl-pubbar { padding: 12px 16px; }
  .cl-pubnav { order: 3; width: 100%; margin: 0 -12px; }
  .cl-container { padding: 0 16px; }
  .cl-hero { padding: 48px 0 32px; }
  .cl-hero h1 { font-size: 34px; }
  .cl-hero p { font-size: 18px; }
  .cl-feature-grid { grid-template-columns: minmax(0, 1fr); padding-bottom: 48px; }
  .cl-pagehead { padding-top: 32px; }
  .cl-pagehead h1 { font-size: 28px; }
  .cl-contact { grid-template-columns: minmax(0, 1fr); padding-bottom: 48px; }
  .cl-pubfoot { padding: 20px 16px 28px; }
}
@media (max-width: 480px) { .cl-hero .cl-actions > * { width: 100%; } }
.cl-landing-cta { justify-content: center; padding-bottom: 88px; }
.cl-landing-cta .cl-btn { min-height: 50px; padding: 0 30px; font-size: 16px; }
@media (max-width: 860px) { .cl-landing-cta { padding-bottom: 56px; } }
@media (max-width: 480px) { .cl-landing-cta .cl-btn { width: 100%; } }

/* ---- Documentation library ---- */
.cl-doclist { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cl-doc { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 20px 22px; background: var(--cl-surface); border: 1px solid var(--cl-border); border-radius: var(--cl-radius-lg); box-shadow: var(--cl-shadow); color: var(--cl-text); text-decoration: none; }
a.cl-doc:hover { border-color: var(--cl-brand); color: var(--cl-text); }
a.cl-doc:hover .cl-doc__title { color: var(--cl-brand-ink); }
.cl-doc__title { font-size: 17px; font-weight: 600; }
.cl-doc__text { color: var(--cl-muted); font-size: 15px; }
.cl-doc__tag { margin-top: 6px; font-size: 13px; color: var(--cl-muted); }
.cl-doc--locked { background: var(--cl-surface-2); box-shadow: none; }
@media (max-width: 720px) { .cl-doclist { grid-template-columns: minmax(0, 1fr); } }

/* ---- Report pages: filter toolbar, KPI tiles, panels ---- */
.cl-toolbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 16px; align-items: end; padding: 16px; margin-bottom: 20px; }
.cl-toolbar .cl-field--grow { grid-column: span 2; }
.cl-toolbar__actions { display: flex; gap: 10px; }
.cl-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.cl-kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cl-kpi__label { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--cl-muted); }
.cl-kpi__value { font-size: 28px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.cl-kpi__value--sm { font-size: 16px; font-weight: 500; }
.cl-kpi__meta { font-size: 13px; color: var(--cl-muted); }
.cl-panel { padding: 20px; margin-bottom: 20px; }
.cl-panel > h2, .cl-panel__head h2 { font-size: 18px; font-weight: 600; margin: 0; }
.cl-panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cl-tablecard > .cl-panel__head { padding: 16px 16px 0; margin-bottom: 12px; }
.cl-table td.cl-mono, .cl-table .cl-mono { font-size: 13px; }
.cl-table--dense td { padding-top: 6px; padding-bottom: 6px; }
.cl-btn[aria-pressed='true'] { background: var(--cl-brand-soft); border-color: var(--cl-brand); color: var(--cl-brand-ink); }
.cl-msg { font-size: 14px; }
.cl-msg--error { color: var(--cl-danger); }
.cl-file-hint { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--cl-muted); }
@media (max-width: 720px) { .cl-toolbar .cl-field--grow { grid-column: auto; } .cl-toolbar__actions .cl-btn { flex: 1; } }

/* ---- Column customizer (partials/column-customization-modal.ejs) ---- */
.cl-modal__box--wide { max-width: 860px; }
.cl-colbar { align-items: flex-end; }
.cl-colbar .cl-field--grow { flex: 1; }
.cl-collist { display: flex; flex-direction: column; gap: 8px; }
.cl-colrow { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--cl-border); border-radius: var(--cl-radius); background: var(--cl-surface); }
.cl-colrow input[type='checkbox'] { width: 20px; height: 20px; accent-color: var(--cl-brand); }
.cl-colrow__info { display: flex; flex-direction: column; min-width: 0; }
.cl-colrow__info small { color: var(--cl-muted); }
.cl-colrow__order { display: flex; gap: 6px; }
.cl-colpreview { padding: 12px 14px; background: var(--cl-surface-2); border: 1px solid var(--cl-border); border-radius: var(--cl-radius); display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.cl-toasts { position: fixed; z-index: 400; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(92vw, 380px); }
.cl-toast { padding: 12px 16px; border-radius: var(--cl-radius); border: 1px solid; background: var(--cl-surface); box-shadow: var(--cl-shadow-pop); font-size: 14px; }
.cl-toast--success { color: var(--cl-ok); border-color: var(--cl-ok-line); }
.cl-toast--error { color: var(--cl-danger); border-color: var(--cl-danger-line); }
.cl-toast--info { color: var(--cl-info); border-color: var(--cl-info-line); }
@media (max-width: 720px) { .cl-colrow { grid-template-columns: 28px minmax(0, 1fr); } .cl-colrow__hdr, .cl-colrow__order { grid-column: 2; } }

/* ---- SDACH expandable rows ---- */
.cl-expand { min-width: 32px; min-height: 32px; border: 0; background: transparent; color: var(--cl-brand); font-size: 14px; cursor: pointer; border-radius: var(--cl-radius); }
.cl-expand:hover { background: var(--cl-brand-soft); }
.cl-table tr.cl-detail > td { padding: 0; background: var(--cl-surface-2); }
.cl-detail__merchant { padding: 12px 16px 4px 32px; font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cl-detail__merchant .cl-detail__sum { margin-left: auto; }
.cl-detail__tx { display: grid; grid-template-columns: minmax(0, 2fr) 1fr minmax(0, 2fr) auto; gap: 4px 16px; padding: 6px 16px 6px 48px; font-size: 13px; border-top: 1px solid var(--cl-border-soft); }
@media (max-width: 720px) { .cl-table tr.cl-detail { display: block; padding: 0; } .cl-table tr.cl-detail > td { display: block; } .cl-detail__tx { grid-template-columns: 1fr auto; padding-left: 16px; } .cl-detail__merchant { padding-left: 16px; } }
.cl-table tr[hidden] { display: none; }
.cl-detail__merchant, .cl-detail__tx { max-width: 760px; }
.cl-input[type='file'] { padding: 9px 12px; height: auto; }

/* ---- Banking Forms landing: form cards ---- */
.cl-formcards { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cl-formcard { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 18px; color: var(--cl-text); text-decoration: none; }
.cl-formcard:hover { border-color: var(--cl-brand); box-shadow: var(--cl-shadow-pop); }
.cl-formcard__code { font-size: 20px; font-weight: 600; color: var(--cl-brand); }
.cl-formcard__name { font-weight: 500; }
.cl-formcard__desc { font-size: 14px; color: var(--cl-muted); }

/* ---- Profile pages ---- */
.cl-form--wide { max-width: 760px; }
.cl-form--narrow { max-width: 480px; }
.cl-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.cl-fieldset > legend { padding: 0; margin-bottom: 12px; font-size: 18px; font-weight: 600; }
.cl-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cl-field--full { grid-column: 1 / -1; }
.cl-kv--profile { margin-top: 12px; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 15px; }
@media (max-width: 720px) { .cl-form-grid { grid-template-columns: 1fr; } .cl-kv--profile { grid-template-columns: 1fr; gap: 2px; } .cl-kv--profile dd { margin-bottom: 10px; } }

/* ---- Domain allowlist ---- */
.cl-section-title { font-size: 18px; font-weight: 600; margin: 28px 0 12px; }
.cl-domainlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cl-domainlist li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cl-domainlist form { margin: 0; }
.cl-domainform { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto auto; gap: 8px; align-items: center; }
.cl-domainform .cl-input { min-height: 40px; font-size: 14px; }
.cl-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
@media (max-width: 720px) { .cl-domainform { grid-template-columns: 1fr; } .cl-domainform .cl-btn { width: 100%; } }

/* ---- System settings rows ---- */
.cl-setting { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; margin-top: 12px; }
.cl-setting__info { flex: 1; min-width: 260px; }
.cl-setting__info h3 { font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.cl-setting__info p { margin: 0 0 10px; }
.cl-setting__action form { margin: 0; }
.cl-download__title { font-size: 18px; font-weight: 600; margin: 0 0 8px; }

/* ---- Security dashboard ---- */
.cl-kpi__value--danger { color: var(--cl-danger); }
.cl-kpi__value--warn { color: var(--cl-warn); }
.cl-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.cl-grid-3 > .cl-panel { margin-bottom: 0; }
.cl-grid-3 h2 { font-size: 17px; font-weight: 600; margin: 0 0 10px; }
.cl-rowlist { list-style: none; margin: 0; padding: 0; }
.cl-rowlist li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--cl-border-soft); }
.cl-rowlist li:last-child { border-bottom: 0; }
.cl-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cl-event { padding: 14px 16px; }
.cl-event__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cl-event__msg { margin: 0; }
.cl-event__details { margin: 10px 0 0; padding: 10px 12px; background: var(--cl-surface-2); border: 1px solid var(--cl-border); border-radius: var(--cl-radius); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cl-actions > .cl-pill { align-self: center; }
.cl-actions > .cl-pill { align-self: center; }

/* ---- 2FA pages ---- */
.cl-2fa-steps { list-style: none; display: flex; gap: 8px; margin: 0 0 20px; padding: 0; }
.cl-2fa-steps__step { flex: 1; text-align: center; padding: 10px 8px; border-radius: var(--cl-radius); background: var(--cl-surface-2); color: var(--cl-muted); font-size: 13px; font-weight: 600; }
.cl-2fa-steps__step.is-active { background: var(--cl-brand-soft); color: var(--cl-brand-ink); }
.cl-2fa-steps__num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--cl-border); color: var(--cl-text); font-size: 12px; margin-right: 6px; }
.cl-2fa-steps__step.is-active .cl-2fa-steps__num { background: var(--cl-brand); color: var(--cl-on-accent); }
.cl-2fa-qr { display: flex; justify-content: center; padding: 16px; margin-bottom: 16px; background: #fff; border: 1px solid var(--cl-border); border-radius: var(--cl-radius-lg); }
.cl-2fa-qr img { max-width: 220px; width: 100%; height: auto; }
.cl-2fa-secret { padding: 10px 14px; background: var(--cl-surface-2); border: 1px solid var(--cl-border); border-radius: var(--cl-radius); letter-spacing: 0.08em; font-size: 15px; word-break: break-all; }
.cl-2fa-code { max-width: 220px; text-align: center; font: 600 28px var(--cl-mono); letter-spacing: 0.3em; padding-left: 20px; }
.cl-2fa-code.is-complete { border-color: var(--cl-ok); }
