/* ═══════════════════════════════════════════════════════════
   SADAKALAWE ENTERPRISES — UI
   Design System: Pro-Sales Enterprise (Stitch)
   Primary: #F26522  ·  Surface: #fbf9f8  ·  Text: #1b1c1c
   ═══════════════════════════════════════════════════════════ */

:root {
  /* ── Brand / Primary ── */
  --c-orange:       #F26522;   /* primary-container — buttons, accents */
  --c-orange-dk:    #a63b00;   /* primary — dark orange for text on light */
  --c-orange-lt:    #ffdbce;   /* primary-fixed */
  --c-orange-mid:   #ffb599;   /* primary-fixed-dim */

  /* ── Surfaces (warm cream, not cold blue-gray) ── */
  --c-bg:           #fbf9f8;   /* background / surface */
  --c-card:         #ffffff;   /* surface-container-lowest */
  --c-surface-low:  #f5f3f3;   /* surface-container-low  → input bg */
  --c-surface:      #efeded;   /* surface-container      → hover bg */
  --c-surface-high: #e9e8e7;   /* surface-container-high → dividers */
  --c-surface-dim:  #dbdad9;   /* surface-dim */

  /* ── Text ── */
  --c-text:         #1b1c1c;   /* on-surface — warm charcoal */
  --c-muted:        #594138;   /* on-surface-variant — warm brown-gray */
  --c-secondary:    #5f5e5e;   /* secondary */

  /* ── Borders ── */
  --c-border:       #e1bfb3;   /* outline-variant — warm peach-gray */
  --c-outline:      #8d7166;   /* outline */

  /* ── Sidebar (warm dark, not cold navy) ── */
  --sidebar-bg:     #303031;   /* inverse-surface */
  --sidebar-text:   #f2f0f0;   /* inverse-on-surface */
  --sidebar-w:      224px;

  /* ── Status colors ── */
  --c-error:        #ba1a1a;
  --c-success:      #1a7a3a;
  --c-warning:      #b45309;

  /* ── Border radius (Stitch rounded tokens) ── */
  --radius-sm:   4px;      /* rounded-sm  0.25rem */
  --radius:      8px;      /* rounded     0.5rem  */
  --radius-md:   12px;     /* rounded-md  0.75rem */
  --radius-lg:   16px;     /* rounded-lg  1rem    */
  --radius-xl:   24px;     /* rounded-xl  1.5rem  */
  --radius-full: 9999px;

  /* ── Elevation (soft ambient, per Stitch) ── */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04);
  --shadow:    0 4px 20px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;        /* body-md */
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── LAYOUT ───────────────────────────────────────────────── */

.app-wrapper { display: flex; min-height: 100vh; }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.content-inner {
  padding: 32px 36px;
  width: 100%;
}

/* ── SIDEBAR ──────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

/* brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 16px 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.sidebar-logo {
  width: 100%;
  max-width: 178px;
  height: auto;
  display: block;
  border-radius: 8px;
}

.sidebar-brand-text { display: none; }
.brand-name {
  color: var(--sidebar-text);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .08em;
}
.brand-sub {
  color: rgba(242,240,240,.45);
  font-size: 9.5px;
  letter-spacing: .05em;
}

/* nav */
.sidebar-nav { flex: 1; padding: 10px 0 6px; }

.nav-section-label {
  padding: 6px 18px 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  color: rgba(242,240,240,.30);
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(242,240,240,.60) !important;
  border-left: 3px solid transparent;
  transition: background .13s, color .13s;
  white-space: nowrap;
  min-height: 42px;
}

.nav-link .bi { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.nav-link:hover {
  background: rgba(255,255,255,.06);
  color: var(--sidebar-text) !important;
}

.nav-link.active {
  color: #FFFFFF !important;
  background: rgba(242,101,34,.14);
  border-left-color: var(--c-orange);
}

.nav-link-cta {
  margin: 8px 14px 4px;
  padding: 10px 14px !important;
  border-left: 3px solid transparent !important;
  background: var(--c-orange) !important;
  color: #fff !important;
  border-radius: var(--radius) !important;
  font-weight: 700;
  font-size: 13.5px;
  justify-content: center;
  min-height: 44px !important;
  transition: background .15s !important;
}

.nav-link-cta:hover { background: var(--c-orange-dk) !important; }

/* user footer */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sidebar-user { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--c-orange);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name {
  color: var(--sidebar-text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role { color: rgba(242,240,240,.40); font-size: 10.5px; }

.sidebar-footer-link {
  color: rgba(242,240,240,.35);
  font-size: 16px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  transition: color .13s, background .13s;
}
.sidebar-footer-link:hover {
  color: var(--sidebar-text);
  background: rgba(255,255,255,.07);
}

/* ── PAGE HEADER ──────────────────────────────────────────── */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

.page-title {
  font-size: 24px;           /* headline-md */
  font-weight: 600;
  color: var(--c-text);
  letter-spacing: -.01em;
  line-height: 32px;
}

.page-sub {
  font-size: 14px;           /* label-lg */
  color: var(--c-muted);
  margin-top: 3px;
  font-weight: 400;
}

/* ── BUTTONS ──────────────────────────────────────────────── */

.btn {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--c-orange) !important;
  border-color: var(--c-orange) !important;
  color: #fff !important;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--c-orange-dk) !important;
  border-color: var(--c-orange-dk) !important;
}

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--c-border);
  color: var(--c-secondary);
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color .15s, color .15s, background .15s;
  min-height: 40px;
}
.btn-ghost:hover {
  border-color: var(--c-outline);
  color: var(--c-text);
  background: var(--c-surface-low);
}

.btn-xs {
  padding: 4px 10px !important;
  font-size: 12px !important;
  min-height: 28px !important;
  border-radius: var(--radius-sm) !important;
}

/* ── FORM CARDS ───────────────────────────────────────────── */

.form-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.field-label {
  display: block;
  font-size: 12px;           /* label-md */
  font-weight: 600;
  color: var(--c-muted);
  letter-spacing: .02em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.field-hint { font-size: 12px; color: var(--c-muted); margin-top: 5px; }

.form-control, .form-select {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  border-color: var(--c-border);
  border-radius: var(--radius);
  color: var(--c-text);
  background: var(--c-surface-low);   /* #F9F9F9-equivalent */
  min-height: 44px;
  padding: 10px 14px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--c-orange);
  background: var(--c-card);
  box-shadow: 0 0 0 3px rgba(242,101,34,.12);
  outline: none;
}
.form-control::placeholder { color: var(--c-outline); }
.form-select { padding-right: 36px; }

/* ── TOGGLE SWITCH ────────────────────────────────────────── */

.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle-label { font-size: 14px; font-weight: 600; color: var(--c-text); }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--c-surface-dim);
  border-radius: 26px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--c-orange); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── CUSTOMER PICKER ──────────────────────────────────────── */

.search-icon-wrap { position: relative; }
.search-icon {
  position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--c-outline); font-size: 14px;
  pointer-events: none;
}
.ps-search { padding-left: 40px !important; }

.ac-dropdown {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  max-height: 280px;
  overflow-y: auto;
}

.ac-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--c-surface-high);
  transition: background .12s;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: var(--c-surface-low); }
.ac-item__main { font-weight: 600; font-size: 15px; }
.ac-item__sub  { font-size: 12px; color: var(--c-muted); margin-top: 2px; }

.selected-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--c-orange-lt);
  border: 1.5px solid var(--c-orange-mid);
  border-radius: var(--radius-lg);
}

.selected-pill__avatar {
  width: 36px; height: 36px;
  background: var(--c-orange);
  color: #fff;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}

.selected-pill__info { flex: 1; min-width: 0; }
.selected-pill__name { font-weight: 700; font-size: 15px; display: block; }
.selected-pill__sub  { font-size: 12px; color: var(--c-muted); }
.selected-pill__clear {
  background: none; border: none;
  color: var(--c-muted); font-size: 16px;
  cursor: pointer; padding: 4px;
  border-radius: var(--radius-sm);
}
.selected-pill__clear:hover { background: var(--c-orange-mid); color: var(--c-orange-dk); }

/* ── ITEMS TABLE ──────────────────────────────────────────── */

.items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.btn-add-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--c-orange-lt);
  border: 1.5px solid var(--c-orange-mid);
  color: var(--c-orange-dk);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  min-height: 40px;
}
.btn-add-item:hover { background: var(--c-orange-mid); }

.items-scroll { overflow-x: auto; }

.items-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.items-tbl thead th {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-muted);
  border-bottom: 2px solid var(--c-border);
  text-align: left;
  white-space: nowrap;
}

.items-tbl td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--c-surface-high);
  vertical-align: middle;
}

.items-tbl tbody tr:last-child td { border-bottom: none; }

.items-tbl td input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--c-text);
  background: var(--c-surface-low);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-height: 40px;
}
.items-tbl td input:focus {
  border-color: var(--c-orange);
  background: var(--c-card);
  box-shadow: 0 0 0 3px rgba(242,101,34,.10);
}

.items-tbl .row-num { text-align: center; color: var(--c-muted); font-size: 12px; }
.items-tbl .line-total { text-align: right; font-weight: 700; padding-right: 8px; color: var(--c-text); }
.items-tbl .btn-row-del {
  background: none; border: none;
  color: var(--c-surface-dim);
  cursor: pointer; font-size: 15px;
  padding: 6px; border-radius: var(--radius-sm);
  transition: color .13s, background .13s;
}
.items-tbl .btn-row-del:hover { color: var(--c-error); background: #ffdad6; }

/* ── TOTALS PANEL ─────────────────────────────────────────── */

.totals-panel {
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 18px;
  font-size: 15px;
  border-bottom: 1px solid var(--c-surface-high);
}
.totals-row:last-child { border-bottom: none; }

.totals-grand {
  background: var(--c-orange);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

/* generate button */
.btn-generate {
  width: 100%;
  padding: 16px;
  background: var(--c-orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;          /* large variant per Stitch */
  transition: background .15s, transform .1s;
  letter-spacing: .01em;
}
.btn-generate:hover { background: var(--c-orange-dk); }
.btn-generate:active { transform: scale(.99); }

/* ── CARD SECTION ─────────────────────────────────────────── */

.card-section {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}

.section-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── DASHBOARD STAT CARDS ─────────────────────────────────── */

.stat-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--c-surface-dim);
}

.stat-card-accent::before { background: var(--c-orange); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
  margin-bottom: 10px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -.02em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-count { font-size: 13px; color: var(--c-muted); margin-top: 6px; }

/* ── TABLES ───────────────────────────────────────────────── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead th {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
  border-bottom: 2px solid var(--c-border);
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 14px 12px;       /* 64px row height approx (14+14+font) */
  border-bottom: 1px solid var(--c-surface-high);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--c-surface-low); }

/* ── BADGES ───────────────────────────────────────────────── */

.badge-doctype {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
}
.badge-invoice       { background: #dce8ff; color: #1a3d8f; }
.badge-proforma      { background: #ddf2e8; color: #155232; }
.badge-delivery_note { background: #fff0e0; color: #7a3010; }

.badge-branch {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  background: var(--c-orange-lt);
  color: var(--c-orange-dk);
  letter-spacing: .02em;
}

.badge-category {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--c-surface);
  color: var(--c-secondary);
}

.doc-link {
  color: var(--c-orange-dk);
  font-weight: 700;
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  font-size: 13px;
}
.doc-link:hover { color: var(--c-orange); text-decoration: underline; }

/* ── DETAIL LIST ──────────────────────────────────────────── */

.detail-list {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 14px;
}

.detail-list dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-muted);
  padding-top: 2px;
}

.detail-list dd { margin: 0; font-size: 15px; color: var(--c-text); }

/* ── ALERTS ───────────────────────────────────────────────── */

.alert {
  font-size: 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

/* ── RESULT PAGE GRID ─────────────────────────────────────── */

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 12px;
}

@media (max-width: 900px) { .result-grid { grid-template-columns: 1fr; } }

.result-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.result-card__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--c-border);
}

.result-card__icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.result-card--invoice       .result-card__icon { background: #dce8ff; color: #1a3d8f; }
.result-card--proforma      .result-card__icon { background: #ddf2e8; color: #155232; }
.result-card--delivery_note .result-card__icon { background: #fff0e0; color: #7a3010; }

.result-card__type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
}

.result-card__num {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
  font-family: 'SFMono-Regular', monospace;
  margin-top: 2px;
}

.result-card__body {
  padding: 18px 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.result-info-label { color: var(--c-muted); font-weight: 500; }

.result-card__footer {
  padding: 16px 22px 20px;
  border-top: 1px solid var(--c-border);
}

/* ── LOGIN PAGE ───────────────────────────────────────────── */

.login-body {
  background: var(--sidebar-bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrapper { width: 100%; max-width: 420px; padding: 16px; }

.login-card {
  background: var(--c-card);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
}

.login-brand { text-align: center; margin-bottom: 32px; }

.login-logo {
  width: 68px; height: 68px;
  object-fit: contain;
  display: block;
  margin: 0 auto 14px;
}

.login-title { font-size: 20px; font-weight: 700; letter-spacing: .02em; color: var(--c-text); }
.login-subtitle { font-size: 14px; color: var(--c-muted); margin-top: 4px; }
.login-footer { text-align: center; font-size: 11px; color: rgba(242,240,240,.35); margin-top: 26px; }

/* ── DOCUMENT PREVIEW (view.html) ─────────────────────────── */

.doc-preview {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  max-width: 820px;
  box-shadow: var(--shadow);
}

.doc-preview-header {
  background: var(--c-orange);
  color: #fff;
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.doc-preview-brand { display: flex; align-items: center; gap: 12px; }
.doc-preview-brand img { border-radius: var(--radius); padding: 2px; background: rgba(255,255,255,.15); }
.doc-type-label { font-size: 22px; font-weight: 700; letter-spacing: .03em; }

.doc-preview-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 22px 30px;
  border-bottom: 1px solid var(--c-border);
}

.doc-preview-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-orange-dk);
  margin-bottom: 8px;
}

.doc-info-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-info-table th { text-align: left; color: var(--c-muted); font-weight: 500; padding: 3px 12px 3px 0; width: 110px; }
.doc-info-table td { color: var(--c-text); font-weight: 600; padding: 3px 0; }

.proforma-notice {
  background: #ffdad6;
  color: #93000a;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 30px;
  border-bottom: 1px solid #ffb4ab;
}

.doc-items-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-items-table thead tr { background: var(--c-orange); color: #fff; }
.doc-items-table th { padding: 11px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; text-align: left; }
.doc-items-table td { padding: 12px 14px; border-bottom: 1px solid var(--c-border); }
.doc-items-table .row-alt td { background: var(--c-surface-low); }

.doc-totals { display: flex; justify-content: flex-end; padding: 18px 30px; }
.doc-totals-inner { width: 280px; }
.doc-totals-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--c-surface-high); }
.doc-totals-row:last-child { border-bottom: none; }
.doc-total-final { background: var(--c-orange); color: #fff; font-weight: 700; font-size: 16px; padding: 11px 14px; border-radius: var(--radius); margin-top: 4px; }

.doc-notes { padding: 14px 30px; font-size: 14px; color: var(--c-muted); border-top: 1px solid var(--c-border); }

.doc-signature-area { display: flex; gap: 60px; padding: 24px 30px 14px; }
.signature-line { flex: 1; }
.sig-line { height: 1px; background: var(--c-outline); margin-bottom: 6px; }
.sig-label { font-size: 12px; color: var(--c-muted); }

.doc-preview-footer {
  background: var(--c-surface-low);
  border-top: 3px solid var(--c-orange);
  padding: 11px 30px;
  font-size: 12px;
  color: var(--c-muted);
  text-align: center;
}

/* ── STEP LABELS (doc creator) ────────────────────────────── */

.step-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 2px;
}

.step-num {
  width: 24px; height: 24px;
  border-radius: var(--radius-full);
  background: var(--c-orange);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── PAYMENT TYPE TOGGLE ──────────────────────────────────── */

.payment-type-toggle { display: flex; gap: 8px; }

.payment-opt {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-muted);
  transition: border-color .15s, background .15s, color .15s;
  user-select: none;
  min-height: 48px;
}

.payment-opt input[type="radio"] { display: none; }

.payment-opt:hover {
  border-color: var(--c-outline);
  color: var(--c-text);
}

.payment-opt.active.payment-opt--cash {
  border-color: #2e7d32;
  background: #e8f5e9;
  color: #1b5e20;
}

.payment-opt.active.payment-opt--credit {
  border-color: var(--c-orange);
  background: var(--c-orange-lt);
  color: var(--c-orange-dk);
}

/* ── PAYMENT METHOD GRID ──────────────────────────────────── */

.pay-method-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--c-border);
}

.pay-method-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-muted);
  margin-bottom: 10px;
}

.pay-method-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pay-method-opt {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1.5px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-secondary);
  transition: border-color .14s, background .14s, color .14s;
  user-select: none;
  white-space: nowrap;
}

.pay-method-opt input[type="radio"] { display: none; }

.pay-method-opt:hover {
  border-color: var(--c-outline);
  color: var(--c-text);
}

.pay-method-opt.active {
  border-color: var(--c-orange);
  background: var(--c-orange-lt);
  color: var(--c-orange-dk);
  font-weight: 600;
}

.pay-method-opt .method-icon {
  font-size: 15px;
  flex-shrink: 0;
}

/* ── ALERT CARDS (dashboard) ──────────────────────────────── */

.alert-card-link { text-decoration: none; color: inherit; display: block; }

.alert-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: var(--c-card);
  border: 1.5px solid var(--c-border);
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .12s;
}
.alert-card-link:hover .alert-card {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.alert-card__icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.alert-card__body { flex: 1; min-width: 0; }
.alert-card__title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); }
.alert-card__value { font-size: 20px; font-weight: 700; color: var(--c-text); margin: 3px 0 2px; }
.alert-card__sub   { font-size: 12px; color: var(--c-muted); }
.alert-card__arrow { color: var(--c-muted); font-size: 16px; }

.alert-card--info    .alert-card__icon { background: #dce8ff; color: #1a3d8f; }
.alert-card--danger  .alert-card__icon { background: #ffdad6; color: #93000a; }
.alert-card--warning .alert-card__icon { background: #fff0e0; color: #7a3010; }
.alert-card--ok      .alert-card__icon { background: #ddf2e8; color: #155232; }

/* ── TOP CUSTOMER ROW ─────────────────────────────────────── */

.top-customer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--c-surface-high);
  text-decoration: none;
  color: inherit;
  transition: background .12s;
  border-radius: var(--radius);
}
.top-customer-row:last-child { border-bottom: none; }
.top-customer-row:hover { background: var(--c-surface-low); }

.top-customer-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--c-orange-lt);
  color: var(--c-orange-dk);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}

/* ── STATUS BADGES ────────────────────────────────────────── */

.badge-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}

.badge-paid    { background: #ddf2e8; color: #155232; }
.badge-credit  { background: #fff0e0; color: #7a3010; }
.badge-partial { background: var(--c-surface); color: var(--c-secondary); }
.badge-danger  { background: #ffdad6; color: #93000a; }
.badge-warning { background: #fff0e0; color: #7a3010; }
.badge-success { background: #ddf2e8; color: #155232; }

.text-warning-dark { color: #7a3010; }

/* ── MOVEMENT TYPE BADGES ─────────────────────────────────── */

.badge-movement {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}
.badge-movement--in  { background: #ddf2e8; color: #155232; }
.badge-movement--out { background: #ffdad6; color: #93000a; }

/* ── TABLE ROW STATES ─────────────────────────────────────── */

.row-overdue td     { background: #fff8f7 !important; }
.row-low-stock td   { background: #fffcf0 !important; }
.row-out-of-stock td{ background: #fff8f7 !important; }

/* ── EMPTY STATE ──────────────────────────────────────────── */

.empty-state { text-align: center; padding: 64px 20px; }

/* ── MOVEMENT TYPE CARDS (stock adjust) ───────────────────── */

.movement-type-card { display: block; cursor: pointer; }
.movement-type-card input[type="radio"] { display: none; }

.movement-type-card__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color .15s, background .15s;
  min-height: 48px;
}

.movement-type-card__inner .bi {
  font-size: 20px;
  color: var(--c-muted);
  flex-shrink: 0;
}

.movement-type-card input:checked + .movement-type-card__inner {
  border-color: var(--c-orange);
  background: var(--c-orange-lt);
}
.movement-type-card input:checked + .movement-type-card__inner .bi {
  color: var(--c-orange-dk);
}

/* ── DOC TYPE FILTER TABS ─────────────────────────────────── */

.doc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.doc-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--c-border);
  background: var(--c-bg);
  font-size: 13px;
  font-weight: 500;
  color: var(--c-secondary);
  transition: all .14s;
  white-space: nowrap;
}
.doc-tab:hover { border-color: var(--c-outline); color: var(--c-text); }
.doc-tab.active { background: var(--c-text); color: var(--c-bg); border-color: var(--c-text); font-weight: 600; }
.doc-tab--invoice.active  { background: #1a4e8a; border-color: #1a4e8a; color:#fff; }
.doc-tab--proforma.active { background: #6b4c9a; border-color: #6b4c9a; color:#fff; }
.doc-tab--dn.active       { background: #1a7a3a; border-color: #1a7a3a; color:#fff; }
.doc-tab--paid.active     { background: #1a7a3a; border-color: #1a7a3a; color:#fff; }
.doc-tab--credit.active   { background: var(--c-orange); border-color: var(--c-orange); color:#fff; }

/* ── SIBLING DOCS STRIP (view.html) ───────────────────────── */

.sibling-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--c-surface-low);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  font-size: 13px;
}
.sibling-label { color: var(--c-muted); font-size: 12px; }
.sibling-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--c-text);
  transition: border-color .12s;
}
.sibling-pill:hover { border-color: var(--c-orange); color: var(--c-orange-dk); }

/* ── MISC UTILITY ─────────────────────────────────────────── */

.fw-600 { font-weight: 600; }
.min-width-0 { min-width: 0; }

/* ═══════════════════════════════════════════════════════════
   SHARE BUTTONS (result page)
   ═══════════════════════════════════════════════════════════ */

.share-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  flex: 1;
  justify-content: center;
  white-space: nowrap;
}

.btn-share--wa {
  background: #25D366;
  color: #fff;
}
.btn-share--wa:hover { background: #1fb455; color: #fff; }

.btn-share--email {
  background: var(--c-surface-low);
  color: var(--c-text);
  border: 1.5px solid var(--c-border);
  flex: 1;
}
.btn-share--email:hover { background: var(--c-surface); }

.btn-share--copy {
  background: var(--c-surface-low);
  color: var(--c-muted);
  border: 1.5px solid var(--c-border);
  flex: 0 0 36px;
  padding: 7px;
}
.btn-share--copy:hover { background: var(--c-surface); color: var(--c-text); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE SIDEBAR + LAYOUT
   ═══════════════════════════════════════════════════════════ */

/* Hamburger toggle — hidden on desktop */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1010;
  background: var(--c-orange);
  border: none;
  border-radius: 10px;
  width: 46px;
  height: 46px;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(242,101,34,.35);
}

/* Dark overlay when sidebar is open on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ── Large screens (≥ 1440px): wider sidebar + more breathing room ── */
@media (min-width: 1440px) {
  :root { --sidebar-w: 256px; }
  .content-inner { padding: 36px 48px; }
  .stat-value { font-size: 22px; }
  .page-title { font-size: 26px; }
}

@media (min-width: 1920px) {
  :root { --sidebar-w: 280px; }
  .content-inner { padding: 40px 64px; }
  .stat-value { font-size: 26px; }
  .stat-card { padding: 24px 28px; }
  .data-table { font-size: 15px; }
  .data-table td { padding: 16px 14px; }
  .data-table thead th { font-size: 12px; }
  .card-section { padding: 24px 30px; }
  .alert-card { padding: 24px 26px; }
  .alert-card__value { font-size: 22px; }
}

/* ── Tablet (≤ 1024px): collapse sidebar to narrow icon rail ── */
@media (max-width: 1024px) and (min-width: 769px) {
  :root { --sidebar-w: 64px; }

  .sidebar-logo { display: none; }
  .sidebar-brand { justify-content: center; padding: 14px 0; }

  .nav-section-label { display: none; }

  .nav-link {
    justify-content: center;
    padding: 10px 0;
    border-radius: 0;
    font-size: 0;        /* hide text */
  }
  .nav-link i { font-size: 20px; margin: 0; }
  .nav-link-cta { font-size: 0; justify-content: center; padding: 10px 0; }
  .nav-link-cta i { font-size: 20px; margin: 0; }

  .sidebar-user { display: none; }
  .sidebar-footer { justify-content: center; gap: 0; flex-direction: column; padding: 10px 0; }
  .sidebar-footer-link { font-size: 18px; padding: 8px; }

  .content-inner { padding: 24px 20px; width: 100%; }
}

/* ── Mobile (≤ 768px): hidden sidebar, hamburger button ── */
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }

  .sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-w));
    top: 0; bottom: 0;
    transition: left 0.25s ease;
    z-index: 1000;
    width: var(--sidebar-w);
  }

  .sidebar.open { left: 0; }

  .main-content { margin-left: 0; }

  .content-inner {
    padding: 72px 14px 28px;
  }

  /* Page headers stack on mobile */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-header > div:last-child { width: 100%; }
  .page-header .btn, .page-header .d-flex { width: 100%; }
  .page-header .d-flex { flex-wrap: wrap; }
  .page-header .d-flex .btn { flex: 1; min-width: 120px; }

  /* Stat cards: 2 columns on mobile */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.3rem; }

  /* Form cards full width */
  .form-card { padding: 16px; }

  /* Tables: horizontal scroll */
  .data-table-wrap,
  .card-section { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  table.data-table { min-width: 580px; }

  /* Items table in doc creator */
  .items-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .items-tbl { min-width: 560px; }

  /* Result grid: 1 column */
  .result-grid { grid-template-columns: 1fr; gap: 14px; }

  /* Filter bar: wrap */
  .filter-bar .row { flex-direction: column; }
  .filter-bar .col-auto { width: 100%; }
  .filter-bar select,
  .filter-bar input { width: 100% !important; }

  /* Doc preview: simplify for small screens */
  .doc-preview { max-width: 100%; }
  .doc-preview-header { flex-direction: column; gap: 12px; align-items: flex-start; padding: 16px; }
  .doc-preview-info { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
  .doc-preview-footer { font-size: 10px; text-align: center; }
  .doc-totals { padding: 14px 16px; }
  .doc-totals-inner { width: 100%; }
  .doc-signature-area { flex-direction: column; gap: 24px; padding: 16px; }
  .doc-notes { padding: 12px 16px; }

  /* Credit detail: stack columns */
  .col-lg-5, .col-lg-7 { width: 100%; }

  /* Payment method grid: wrap tighter */
  .pay-method-grid { gap: 6px; }
  .pay-method-opt { font-size: 12px; padding: 7px 10px; }

  /* Totals panel */
  .totals-panel { padding: 14px; }

  /* Buttons */
  .btn-generate { font-size: 15px; padding: 14px; }

  /* Dashboard alert cards */
  .alert-card { padding: 14px 16px; gap: 12px; }

  /* Share row */
  .share-row { flex-wrap: wrap; }
  .btn-share { font-size: 12px; padding: 7px 8px; }
}

/* ── Very small (≤ 400px) ── */
@media (max-width: 400px) {
  .content-inner { padding: 68px 10px 20px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.1rem; }
  .page-title { font-size: 1.2rem; }
  .pay-method-grid { gap: 5px; }
  .pay-method-opt { font-size: 11px; padding: 6px 8px; }
}

/* ── Touch-friendly minimum tap targets ── */
@media (hover: none) {
  .btn, .nav-link, .pay-method-opt, .payment-opt {
    min-height: 44px;
  }
  input, select, textarea {
    font-size: 16px; /* prevents iOS zoom on focus */
  }
}

/* ── Permission count badge (user list) ── */
.perm-count {
  font-size: 0.78rem;
  color: var(--c-orange);
  font-weight: 600;
}

/* ── Permission cards (user form) ── */
.perm-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  height: 100%;
}
.perm-card__header {
  background: #f8f9fa;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #374151;
}
.perm-card__body {
  padding: 12px 14px;
}
.perm-card__body .form-check-input:checked {
  background-color: var(--c-orange);
  border-color: var(--c-orange);
}
.perm-card__body .form-check-label {
  color: #374151;
  cursor: pointer;
}
