/* ============================================================================
   billing-base.css
   ============================================================================
   Shared styles for every per-client billing page (DCL, Lasership, Airspace,
   Chemtrace, DTHX, TAT, ADCOM, Cavalier, SpotAI, DaVita, CryoWest, RxNovo, CNW).
   Each page redefines ~500 lines of identical CSS for hero / KPI tiles / orders
   table / pills — this file consolidates the common 80%, leaving each page to
   only define its own brand colors and any per-client quirks.

   Adoption pattern (do incrementally, one page at a time):
     1. Add  <link rel="stylesheet" href="billing-base.css" />  to a billing page
     2. Drop the matching local <style> blocks (hero, kpis, orders, pills)
     3. Override the brand color via CSS custom property:
          .my-page-scope { --bill-grad-from: #4f46e5; --bill-grad-to: #ec4899; }
     4. Test the page, then move on to the next.

   Designed so the pages still WORK if billing-base.css fails to load — they
   already have all the styles inline. This is purely for incremental adoption.
   ============================================================================ */

/* ---------- Brand variables — override per page ---------- */
:root {
  --bill-grad-from: #4f46e5;       /* default: indigo */
  --bill-grad-to:   #ec4899;       /* default: pink */
  --bill-eyebrow:   #4f46e5;
  --bill-cta-shadow: rgba(79, 70, 229, 0.32);
}

/* ============================================================================
   HERO — page header used by every billing page
   ============================================================================ */
.bill-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
  margin: 6px 0 22px;
}
.bill-hero .eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bill-eyebrow);
  margin-bottom: 6px;
}
.bill-hero h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.05;
}
.bill-hero h1 .grad {
  background: linear-gradient(135deg, var(--bill-grad-from) 0%, var(--bill-grad-to) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
.bill-hero .sub {
  color: var(--text-faint);
  font-size: 13.5px;
  margin-top: 6px;
  max-width: 600px;
  line-height: 1.5;
}
.bill-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bill-grad-from), var(--bill-grad-to));
  color: #fff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 12px 28px -6px var(--bill-cta-shadow);
  transition: transform 0.18s ease, filter 0.18s ease;
}
.bill-cta:hover { transform: translateY(-1px); filter: brightness(1.06); }
.bill-cta svg   { width: 14px; height: 14px; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================================
   KPI TILES
   ============================================================================ */
.bill-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
@media (max-width: 1080px) { .bill-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .bill-kpis { grid-template-columns: 1fr; } }
.bill-kpi {
  position: relative;
  padding: 16px 20px;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.bill-kpi:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.bill-kpi .lbl {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.bill-kpi .val {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 8px 0 4px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--bill-grad-from), var(--bill-grad-to));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
.bill-kpi .meta { font-size: 11.5px; color: var(--text-faint); }

/* ============================================================================
   CARD CONTAINER — generic surface for orders table, breakdown, etc.
   ============================================================================ */
.bill-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.bill-card .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.bill-card .head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.bill-card .body { padding: 16px 22px; }

/* ============================================================================
   ORDERS TABLE — common across DCL, Lasership, etc.
   ============================================================================ */
.bill-orders {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.bill-orders thead th {
  text-align: left;
  padding: 11px 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  background: var(--surface-1, #fafafa);
  white-space: nowrap;
}
.bill-orders thead th.num    { text-align: right; }
.bill-orders thead th.center { text-align: center; }
.bill-orders tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
}
.bill-orders tbody td.num    { text-align: right; font-variant-numeric: tabular-nums; }
.bill-orders tbody td.center { text-align: center; }
.bill-orders tbody tr:hover td { background: rgba(99, 102, 241, 0.04); }
.bill-orders .empty {
  text-align: center;
  color: var(--text-faint);
  font-style: italic;
  padding: 28px 16px;
}
.bill-orders .totals td {
  background: var(--surface-1, #f8fafc);
  font-weight: 800;
  border-top: 1.5px solid var(--text-faint);
  border-bottom: 0;
}

/* Order # / mono-style identifiers */
.bill-orders .ord-id {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(99, 102, 241, 0.10);
  color: #4338ca;
}

/* ============================================================================
   STATUS PILLS — Open / Invoiced / Paid / Yes / No / etc.
   ============================================================================ */
.bill-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.bill-pill.open    { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.32); }
.bill-pill.sent    { background: rgba(99,  102, 241, 0.12); color: #4338ca; border-color: rgba(99,  102, 241, 0.32); }
.bill-pill.paid    { background: rgba(16,  185, 129, 0.12); color: #047857; border-color: rgba(16,  185, 129, 0.32); }
.bill-pill.yes     { background: rgba(16,  185, 129, 0.12); color: #047857; border-color: rgba(16,  185, 129, 0.32); }
.bill-pill.no      { background: rgba(148, 163, 184, 0.16); color: #64748b; border-color: rgba(148, 163, 184, 0.32); }
.bill-pill.danger  { background: rgba(225,  29,  72, 0.10); color: #be123c; border-color: rgba(225,  29,  72, 0.30); }

/* ============================================================================
   BUTTONS — sm / primary / ghost / danger
   ============================================================================ */
.bill-btn-sm {
  padding: 5px 11px;
  border-radius: 7px;
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.bill-btn-sm:hover { border-color: var(--text-faint); color: var(--text); }
.bill-btn-sm.primary {
  background: linear-gradient(135deg, var(--bill-grad-from), var(--bill-grad-to));
  color: #fff;
  border-color: transparent;
}
.bill-btn-sm.primary:hover { filter: brightness(1.06); }
.bill-btn-sm.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-color: transparent;
}
.bill-btn-sm.danger {
  color: #b91c1c;
  border-color: rgba(225, 29, 72, 0.32);
}
.bill-btn-sm.danger:hover { background: rgba(225, 29, 72, 0.06); }

/* ============================================================================
   MODAL — used by every "Add order" / "Edit order" form
   ============================================================================ */
.bill-modal-bg {
  position: fixed; inset: 0;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.bill-modal-bg.open { display: flex; }
.bill-modal {
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 32px 80px -20px rgba(0, 0, 0, 0.40);
}
.bill-modal-head {
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.04), transparent);
}
.bill-modal-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.bill-modal-head .desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.5;
}
.bill-modal-body {
  padding: 20px 26px;
  overflow-y: auto;
  flex: 1;
}
.bill-modal-foot {
  padding: 14px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface-1, #fafafa);
}

/* ============================================================================
   FORM GRID — used inside .bill-modal-body
   ============================================================================ */
.bill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.bill-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.bill-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) {
  .bill-grid, .bill-grid.cols-3, .bill-grid.cols-4 { grid-template-columns: 1fr; }
}
.bill-field { display: flex; flex-direction: column; gap: 5px; }
.bill-field.full { grid-column: 1 / -1; }
.bill-field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.bill-field input,
.bill-field select,
.bill-field textarea {
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface-0);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bill-field input:focus,
.bill-field select:focus,
.bill-field textarea:focus {
  border-color: var(--bill-grad-from);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.bill-field textarea { min-height: 70px; resize: vertical; }
.bill-field .hint {
  font-size: 11px;
  color: var(--text-faint);
  font-style: italic;
}

/* ============================================================================
   LIVE CHARGE BREAKDOWN — used by DCL, Lasership, Airspace
   ============================================================================ */
.bill-breakdown {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.06), transparent);
  border: 1px solid rgba(245, 158, 11, 0.22);
}
.bill-breakdown h4 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b45309;
}
.bill-breakdown .item {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  font-size: 12.5px;
}
.bill-breakdown .item .v {
  font-weight: 700;
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.bill-breakdown .total {
  display: flex; justify-content: space-between;
  padding: 8px 0 0;
  margin-top: 4px;
  border-top: 1px solid rgba(245, 158, 11, 0.32);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.10em;
}
.bill-breakdown .total .v {
  color: #b45309;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 16px;
  letter-spacing: 0;
}
