/* ========================================================================== */
/* fst-treasury — brutalist monochrome (echoes pos-v2's visual language)      */
/* Pure black on white, 1px borders, no radii/shadows; typography does the    */
/* heavy lifting. Danger red is the only color.                               */
/* ========================================================================== */

:root {
  --bg:        #ffffff;
  --bg-sunken: #f0f0f0;
  --surface-2: #fafafa;

  --ink:        #000000;
  --ink-muted:  #666666;
  --ink-faint:  #999999;

  --line:      #000000;
  --line-soft: #cccccc;

  --primary:       #000000;
  --primary-hover: #1a1a1a;
  --primary-ink:   #ffffff;

  --danger:      #d00000;
  --danger-soft: #ffeeee;
  --warn-soft:   #f5f0dc;

  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; overflow-y: scroll; }
body { font-family: var(--font); color: var(--ink); font-size: 14px; line-height: 1.45; }

/* ============================ shell / topbar ============================== */

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.shell__main { flex: 1; padding: 20px; max-width: 1280px; width: 100%; margin: 0 auto; }
.shell__notice { max-width: 1280px; width: 100%; margin: 0 auto; padding: 12px 20px 0; cursor: pointer; }

.topbar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.topbar__brand { display: flex; flex-direction: column; }
.topbar__name { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.topbar__version { font-size: 11px; color: var(--ink-faint); }
.topbar__nav { display: flex; gap: 0; flex: 1; flex-wrap: wrap; }
.topbar__tab {
  appearance: none; background: none; border: 1px solid transparent; border-bottom: 2px solid transparent;
  padding: 8px 14px; font: inherit; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  font-size: 12px; cursor: pointer; color: var(--ink-muted);
}
.topbar__tab:hover { color: var(--ink); }
.topbar__tab--active { color: var(--ink); border-bottom-color: var(--ink); }
.topbar__user { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.topbar__role { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.topbar__email { color: var(--ink-muted); }

/* ============================ login ======================================= */

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-sunken); padding: 20px; }
.login__card {
  background: var(--bg); border: 1px solid var(--line); padding: 32px; width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 14px;
}
.login__title { margin: 0; font-size: 18px; text-transform: uppercase; letter-spacing: 0.05em; }
.login__subtitle { margin: 0; color: var(--ink-muted); font-size: 12px; }
.login__version { margin: 0; color: var(--ink-faint); font-size: 11px; text-align: center; }

.boot-error { max-width: 640px; margin: 40px auto; padding: 20px; border: 1px solid var(--danger); background: var(--danger-soft); color: #8a1f1f; }

/* ============================ screens / cards ============================= */

.screen { display: flex; flex-direction: column; gap: 16px; }
.screen__title { margin: 0; font-size: 20px; text-transform: uppercase; letter-spacing: 0.05em; }
.screen__titlebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.card { border: 1px solid var(--line); background: var(--bg); }
.card__header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft); background: var(--surface-2);
}
.card__title { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.card__body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.card__actions { display: flex; gap: 8px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.split { display: grid; grid-template-columns: minmax(320px, 5fr) minmax(360px, 7fr); gap: 16px; align-items: start; }
.split__list, .split__detail { min-width: 0; overflow-x: auto; }

@media (max-width: 900px) {
  .grid-2, .split { grid-template-columns: 1fr; }
  .shell__main { padding: 12px; }
}

/* ============================ forms ======================================= */

.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.field__label { font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; }
.field__hint { color: var(--ink-muted); font-size: 11px; }

.input {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); width: 100%; min-width: 0;
}
.input:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.input:disabled { background: var(--bg-sunken); color: var(--ink-faint); }
.input--textarea { resize: vertical; font-family: var(--font); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.inline-form { border: 1px dashed var(--line-soft); padding: 12px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.inline-form__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; border: 1px solid var(--line-soft); padding: 12px; }
.filters .field { min-width: 140px; }
.filters__actions { padding-bottom: 2px; }

/* ============================ buttons ===================================== */

.btn {
  appearance: none; font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  padding: 8px 16px; text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px;
}
.btn:hover:not(:disabled) { background: var(--bg-sunken); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: var(--primary-ink); }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn--danger { border-color: var(--danger); color: var(--danger); background: var(--bg); }
.btn--danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn--warn { border-color: var(--ink); background: var(--warn-soft); }
.btn--small { padding: 4px 10px; font-size: 11px; }

.confirm-pair { display: inline-flex; gap: 6px; }

/* ============================ tables ====================================== */

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-muted); padding: 6px 8px; border-bottom: 1px solid var(--line);
}
.table td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table--clickable tbody tr { cursor: pointer; }
.table--clickable tbody tr:hover { background: var(--bg-sunken); }
.row--selected { background: var(--bg-sunken); }
.row--inactive { color: var(--ink-faint); }
.td--num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.td--actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.table--lines .input { min-width: 80px; }

/* ============================ notices / chips ============================= */

.notice { padding: 10px 14px; border: 1px solid var(--line); font-size: 13px; }
.notice--ok { background: var(--bg-sunken); }
.notice--warn { background: var(--warn-soft); }
.notice--error { background: var(--danger-soft); border-color: var(--danger); color: #8a1f1f; }

.chip {
  display: inline-block; padding: 2px 8px; border: 1px solid var(--line); font-size: 10px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
}
.chip--captured { background: var(--bg); }
.chip--shipped { background: var(--warn-soft); }
.chip--invoiced { background: var(--bg-sunken); }
.chip--settled { background: var(--ink); color: var(--primary-ink); border-color: var(--ink); }
.chip--cancelled { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.chip--pending { background: var(--surface-2); color: var(--ink-muted); }

.empty { padding: 24px; text-align: center; color: var(--ink-faint); border: 1px dashed var(--line-soft); }
.loading { padding: 16px; color: var(--ink-muted); }
.loading--page { padding: 60px; text-align: center; }
.muted { color: var(--ink-muted); font-size: 12px; margin: 0; }

/* ============================ detail / timeline =========================== */

.info-row { display: flex; gap: 10px; font-size: 13px; }
.info-row__label { min-width: 160px; color: var(--ink-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px; }
.info-row__value { flex: 1; }

.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-head__total { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.timeline__item { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; border-bottom: 1px solid var(--line-soft); padding-bottom: 6px; }
.timeline__when { color: var(--ink-faint); white-space: nowrap; }
.timeline__type { font-weight: 700; }
.timeline__transition { color: var(--ink-muted); }
.timeline__actor { color: var(--ink-muted); }
.timeline__reason { flex-basis: 100%; color: var(--ink-muted); }

.danger-zone { display: flex; justify-content: flex-end; }

/* ============================ nueva venta ================================= */

.refs-banner { margin: 0; padding: 8px 10px; background: var(--warn-soft); border: 1px solid var(--line); font-weight: 600; font-size: 12px; }
.line-hint { font-size: 11px; color: var(--ink-muted); margin-top: 3px; }
.line-hint--warn { color: #7a5a00; font-weight: 600; }
.line-total { font-variant-numeric: tabular-nums; font-weight: 600; }

.totals { display: flex; flex-direction: column; gap: 6px; max-width: 420px; }
.totals__row { display: flex; justify-content: space-between; gap: 20px; font-size: 14px; }
.totals__row--grand { font-size: 18px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 6px; }
.totals__value { font-variant-numeric: tabular-nums; }

.panel { border: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.panel h3 { margin: 0; font-size: 15px; }
.panel p { margin: 0; font-size: 13px; }
.panel--ok { background: var(--bg-sunken); }
.panel--lockout { background: var(--danger-soft); border-color: var(--danger); }

.override-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line-soft); padding-top: 8px; font-size: 12px; }
.override-row .input { max-width: 240px; }

/* ============================ tablero (2D dashboard) ====================== */

/* The freshness-first status banner. Green ONLY renders when the bank is fresh
   AND there are zero open exceptions (the #1 rule: green = checked-and-clean). */
.tablero-banner { border: 2px solid var(--line); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.tablero-banner__headline { font-size: 22px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.tablero-banner__sub { font-size: 13px; }
.tablero-banner__meta { font-size: 11px; color: var(--ink-muted); margin-top: 4px; }
.tablero-banner--red   { border-color: var(--danger); background: var(--danger-soft); color: #8a1f1f; }
.tablero-banner--amber { border-color: var(--ink);    background: var(--warn-soft); }
.tablero-banner--green { border-color: var(--ink);    background: var(--bg-sunken); }

/* KPI strip — a few big numbers at a glance. */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); padding: 14px; background: var(--bg); display: flex; flex-direction: column; gap: 2px; }
.kpi--warn { border-color: var(--danger); background: var(--danger-soft); }
.kpi--link { cursor: pointer; }
.kpi--link:hover { background: var(--bg-sunken); }
.kpi--warn.kpi--link:hover { background: #ffdede; }
.kpi__value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); font-weight: 700; }
.kpi__hint { font-size: 11px; color: var(--ink-muted); }

/* Clickable exception rows + critical highlight. */
.table--clickable-row { cursor: pointer; }
.table--clickable-row:hover { background: var(--bg-sunken); }
.row--critical { background: var(--danger-soft); }
.row--critical:hover { background: #ffdede; }
