/* ==========================================================================
   Vendor Ops — shared design system.
   A financial-operations console, not a consumer app: dense, precise,
   built for someone scanning many records fast and acting on money with
   confidence. Deliberately distinct from the customer-facing site's
   warm marketplace identity — different audience, different job.
   Plain CSS, no build step — matches the rest of the Vendor stack.
   ========================================================================== */

:root {
  /* Color: a ledger-book palette — near-black ink, cool paper (not the
     warm cream that's become an AI-design cliché), and one decisive
     accent (a deep teal, evoking ledger ink) rather than a playful ones.
     Status colors are the real signal system here — see .stripe-*. */
  --ink: #14171F;
  --ink-soft: #2A2E3A;
  --paper: #F1F2EF;
  --paper-raised: #FFFFFF;
  --ledger: #0F6E5C;
  --ledger-deep: #0B5647;
  --success: #1D8A5C;
  --success-bg: #E1F3EA;
  --warning: #B8790A;
  --warning-bg: #FBF0DC;
  --danger: #C23B3B;
  --danger-bg: #F8E4E2;
  --charcoal: #20222B;
  --charcoal-soft: #5B5E6B;
  --line: #DDD9CF;

  --font-display: 'Space Grotesk', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --sidebar-width: 220px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--charcoal);
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 6px;
  font-weight: 600;
}

h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--charcoal-soft); }

p { margin: 0 0 10px; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.mono { font-family: var(--font-mono); }

/* --- App shell: sidebar + main --- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--ink);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  padding: 20px 20px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar__brand .dot { color: var(--ledger); font-size: 20px; }
.sidebar__brand small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 11px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

.sidebar__nav { flex: 1; padding: 12px 10px; overflow-y: auto; }

.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.68);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
}

.sidebar__nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar__nav a.is-active { background: var(--ledger); color: #fff; }
.sidebar__nav .badge-count {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.sidebar__footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12.5px;
  color: rgba(255,255,255,0.6);
}

.sidebar__footer button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  margin-top: 4px;
  text-decoration: underline;
}

.main { flex: 1; min-width: 0; }

.topbar {
  background: var(--paper-raised);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.content { padding: 24px 28px 60px; max-width: 1180px; }

/* --- Cards & the signature "ledger stripe" ---------------------------
   Status colors as a left border, not a badge alone — like a paper
   ledger's marginal tally marks. Scanning down a list of colored
   stripes tells you what needs attention before reading a word. ------ */
.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--line);
  overflow: hidden;
}

.card + .card { margin-top: 10px; }

.stripe-ok { border-left-color: var(--success); }
.stripe-warn { border-left-color: var(--warning); }
.stripe-danger { border-left-color: var(--danger); }
.stripe-neutral { border-left-color: var(--charcoal-soft); }

/* --- Stat tiles --- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat-tile { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px 18px; }
.stat-tile__label { font-size: 11.5px; color: var(--charcoal-soft); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 6px; }
.stat-tile__value { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--ink); }
.stat-tile__value.is-danger { color: var(--danger); }
.stat-tile__value.is-warn { color: var(--warning); }
.stat-tile__value.is-ok { color: var(--success); }

/* --- Tables --- */
.table-wrap { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 10px 14px; background: var(--paper); color: var(--charcoal-soft); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--line); }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.stripe-ok td:first-child { border-left: 3px solid var(--success); }
tr.stripe-warn td:first-child { border-left: 3px solid var(--warning); }
tr.stripe-danger td:first-child { border-left: 3px solid var(--danger); }

/* --- Badges --- */
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.badge-ok { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: var(--paper); color: var(--charcoal-soft); }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; border: none; cursor: pointer; }
.btn-primary { background: var(--ledger); color: #fff; }
.btn-primary:hover { background: var(--ledger-deep); }
.btn-primary:disabled { background: #B7C9C4; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1.5px solid var(--line); color: var(--charcoal); }
.btn-outline:hover { border-color: var(--charcoal-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-outline { background: transparent; border: 1.5px solid var(--danger); color: var(--danger); }
.btn-small { padding: 5px 11px; font-size: 12px; }

/* --- Forms --- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 12.5px; color: var(--ink); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper-raised); color: var(--charcoal); font-size: 13.5px; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--ledger); outline-offset: 1px; border-color: var(--ledger); }
.field-hint { font-size: 12px; color: var(--charcoal-soft); margin-top: 4px; }

/* --- Filters row --- */
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar select, .filter-bar input { padding: 7px 10px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; background: var(--paper-raised); }

/* --- Utility --- */
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.hidden { display: none !important; }
.state-block { text-align: center; padding: 48px 20px; color: var(--charcoal-soft); }
.state-block h3 { color: var(--ink); text-transform: none; letter-spacing: normal; font-size: 16px; margin-bottom: 6px; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--charcoal-soft); font-size: 12.5px; }

/* --- Toast --- */
#toast {
  position: fixed; right: 24px; bottom: 24px; background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(20,23,31,0.25); z-index: 50; transform: translateY(120%); transition: transform 0.2s ease;
  max-width: 360px;
}
#toast.is-visible { transform: translateY(0); }
#toast.is-error { background: var(--danger); }

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; overflow-x: auto; }
  .sidebar__nav { display: flex; padding: 8px; }
  .sidebar__brand, .sidebar__footer { display: none; }
}
