/* ── Newon receivables cockpit — dark fintech ─────────────────────── */

:root {
  --bg: #0a0e1a;
  --bg-glow-1: rgba(66, 99, 235, 0.14);
  --bg-glow-2: rgba(23, 178, 156, 0.08);
  --surface: #121828;
  --surface-2: #171f33;
  --line: rgba(148, 168, 220, 0.13);
  --line-strong: rgba(148, 168, 220, 0.25);
  --ink: #e9edf8;
  --ink-2: #9aa5c1;
  --ink-3: #667092;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --l1: #34d399;
  --l2: #fbbf24;
  --l3: #fb923c;
  --l4: #f43f5e;
  --radius: 14px;
  --radius-sm: 9px;
  font-size: 15px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1100px 500px at 15% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at 95% 0%, var(--bg-glow-2), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 1.7rem; font-weight: 650; }
h2 { font-size: 1.05rem; font-weight: 600; }

/* ── topbar ────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(10, 14, 26, 0.75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background:
    radial-gradient(circle at 30% 30%, #8fb0ff, var(--accent) 55%, #2748b3);
  box-shadow: 0 0 18px rgba(91, 140, 255, 0.55);
}
.brand-mark.big { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 0.95rem; letter-spacing: 0.22em; }
.brand-text span { font-size: 0.68rem; color: var(--ink-3); letter-spacing: 0.12em; text-transform: uppercase; }

.top-actions { display: flex; align-items: center; gap: 10px; }

.chip {
  font-size: 0.75rem;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  background: var(--surface);
}
.domain-chip { color: var(--accent); border-color: rgba(91, 140, 255, 0.35); }

/* ── page scaffolding ─────────────────────────────────────────────── */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 28px 80px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.kicker {
  display: block;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.lede { color: var(--ink-2); margin: 8px 0 0; max-width: 60ch; }

.workspace-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.status-stack { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 13px;
  white-space: nowrap;
}
.pill i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-3);
}
.pill.ok i { background: var(--l1); box-shadow: 0 0 8px var(--l1); }
.pill.down i { background: var(--l4); box-shadow: 0 0 8px var(--l4); }

/* ── metrics ───────────────────────────────────────────────────────── */

.metrics {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr);
  gap: 12px;
}

.metric {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.metric span { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.metric strong {
  font-size: 1.65rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.metric strong em { font-style: normal; font-size: 1rem; color: var(--ink-2); margin-left: 2px; }
.metric small { color: var(--ink-3); font-size: 0.72rem; }

.hero-metric { border-color: rgba(91, 140, 255, 0.3); }
.hero-metric strong { font-size: 2.15rem; color: #fff; text-shadow: 0 0 24px rgba(91, 140, 255, 0.35); }

.metric.warn { border-color: rgba(244, 63, 94, 0.45); }
.metric.warn strong { color: var(--l4); }

/* ── urgency strip ─────────────────────────────────────────────────── */

.levels-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.level-seg {
  --lv: var(--ink-3);
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 16px 11px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.level-seg::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--lv);
  opacity: 0.9;
}
.level-seg.l1 { --lv: var(--l1); }
.level-seg.l2 { --lv: var(--l2); }
.level-seg.l3 { --lv: var(--l3); }
.level-seg.l4 { --lv: var(--l4); }
.level-seg.active { box-shadow: inset 0 0 40px -28px var(--lv); border-color: color-mix(in srgb, var(--lv) 35%, transparent); }

.seg-label { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.level-seg strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; color: var(--lv); }
.level-seg small { color: var(--ink-3); font-size: 0.72rem; }

/* ── cards ─────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.hint { color: var(--ink-3); font-size: 0.75rem; }
.hint-block { color: var(--ink-3); font-size: 0.78rem; margin: 12px 0 0; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}

/* ── upload ────────────────────────────────────────────────────────── */

.upload-form { display: flex; flex-direction: column; gap: 14px; }
.dropzones { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 12px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: rgba(52, 211, 153, 0.5); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.dz-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--accent);
  font-weight: 700;
}
.dz-title { font-size: 0.85rem; font-weight: 600; }
.file-name { font-size: 0.72rem; color: var(--l1); word-break: break-all; min-height: 1em; }

/* ── forms & fields ────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.field > span { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }

input[type="text"], input[type="email"], input[type="password"], input:not([type]), select, textarea {
  background: #0d1322;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 9px 12px;
  font: inherit;
  font-size: 0.9rem;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; line-height: 1.45; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.82rem; }
select { appearance: none; }

.settings-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
}

/* ── buttons ───────────────────────────────────────────────────────── */

.btn {
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 18px;
  cursor: pointer;
  transition: filter 0.12s, background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn.small { padding: 6px 13px; font-size: 0.78rem; }
.btn.wide { width: 100%; }

.btn.primary {
  background: linear-gradient(180deg, #6f9aff, var(--accent));
  color: #071022;
  box-shadow: 0 4px 18px -6px rgba(91, 140, 255, 0.6);
}
.btn.primary:hover { filter: brightness(1.08); }

.btn.ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line-strong);
}
.btn.ghost:hover { color: var(--ink); border-color: var(--accent); }

.btn.danger-ghost {
  background: transparent;
  color: var(--l4);
  border-color: rgba(244, 63, 94, 0.35);
}
.btn.danger-ghost:hover { background: rgba(244, 63, 94, 0.1); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── queue / drafts ────────────────────────────────────────────────── */

.queue { display: flex; flex-direction: column; gap: 10px; }

.draft {
  --lv: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.draft.l1 { --lv: var(--l1); }
.draft.l2 { --lv: var(--l2); }
.draft.l3 { --lv: var(--l3); }
.draft.l4 { --lv: var(--l4); }

.draft summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  border-left: 3px solid var(--lv);
}
.draft summary::-webkit-details-marker { display: none; }
.draft[open] summary { border-bottom: 1px solid var(--line); }

.badge {
  --bv: var(--lv);
  font-size: 0.72rem;
  font-weight: 700;
  color: #0a0e1a;
  background: var(--bv);
  border-radius: 6px;
  padding: 3px 8px;
  box-shadow: 0 0 12px -2px var(--bv);
}
.badge.sm { font-size: 0.65rem; padding: 2px 6px; box-shadow: none; }
.badge.l1 { --bv: var(--l1); }
.badge.l2 { --bv: var(--l2); }
.badge.l3 { --bv: var(--l3); }
.badge.l4 { --bv: var(--l4); }

.draft-client { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn-tag {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--l4);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 8px;
  vertical-align: 1px;
}
.draft-lang { font-size: 0.7rem; color: var(--ink-3); letter-spacing: 0.08em; }
.draft-days { font-size: 0.8rem; color: var(--lv); font-variant-numeric: tabular-nums; white-space: nowrap; }
.draft-amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.chev {
  width: 8px; height: 8px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg);
  transition: transform 0.15s;
  flex: none;
}
.draft[open] .chev { transform: rotate(-135deg); }

.draft-body { padding: 16px; position: relative; }

.draft-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-3);
  font-size: 0.8rem;
  margin-bottom: 14px;
}
.warn-text { color: var(--l4); }

.lang-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.lang-toggle button {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 13px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.lang-toggle button.on { background: var(--accent); color: #071022; }

.toggles { display: inline-flex; gap: 8px; align-items: center; flex: none; }
.level-toggle button.on.lv1 { background: var(--l1); }
.level-toggle button.on.lv2 { background: var(--l2); }
.level-toggle button.on.lv3 { background: var(--l3); }
.level-toggle button.on.lv4 { background: var(--l4); }

.btn.tiny { padding: 3px 11px; font-size: 0.7rem; border-radius: 999px; }

.draft-form { display: flex; flex-direction: column; gap: 12px; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.draft-actions { display: flex; justify-content: flex-end; }
.reject-form { position: absolute; bottom: 16px; left: 16px; }

/* ── tables ────────────────────────────────────────────────────────── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.data-table th {
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .num { font-variant-numeric: tabular-nums; text-align: right; }
.data-table .dim { color: var(--ink-3); font-size: 0.76rem; white-space: nowrap; }

.status-chip {
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 10px;
  text-transform: capitalize;
}
.status-chip.sent { color: var(--l1); background: rgba(52, 211, 153, 0.12); }
.status-chip.rejected { color: var(--ink-2); background: rgba(148, 168, 220, 0.12); }
.status-chip.superseded { color: var(--ink-3); background: rgba(148, 168, 220, 0.07); }
.status-chip.neutral { color: var(--accent); background: var(--accent-soft); }

/* ── flash / empty ─────────────────────────────────────────────────── */

.flash {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  padding: 11px 16px;
  font-size: 0.86rem;
  transition: opacity 0.6s;
}
.flash.success { border-color: rgba(52, 211, 153, 0.5); color: var(--l1); }
.flash.error { border-color: rgba(244, 63, 94, 0.5); color: var(--l4); }
.flash.info { color: var(--ink-2); }
.flash.hide { opacity: 0; }

.empty {
  color: var(--ink-3);
  text-align: center;
  padding: 26px 0;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
}

/* ── login ─────────────────────────────────────────────────────────── */

.login-wrap {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
}
.login-card { width: min(400px, 100%); padding: 34px 32px; }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 { letter-spacing: 0.25em; font-size: 1.3rem; margin-top: 14px; }
.login-brand p { color: var(--ink-3); font-size: 0.8rem; margin: 4px 0 0; }
.login-form { display: flex; flex-direction: column; gap: 14px; }

/* ── responsive ────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .hero-metric { grid-column: 1 / -1; }
  .levels-strip { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .two-fields { grid-template-columns: 1fr; }
  .workspace-head { flex-direction: column; }
  .status-stack { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .page { padding: 20px 14px 60px; }
}
