/* ═══════════════════════════════════════════════════════════
   KEVOO MATELEPHONE — UI
   Kevoo Electric #0057FF · Kevoo Deep #00227A · Kevoo Ink #0B1220
   Kevoo Soft #D6E3FF · Kevoo Warm #FF9E7A (decorative only) · Kevoo Sand #F4EDE4
   ═══════════════════════════════════════════════════════════ */

:root {
  /* ── Brand / Primary ── */
  --c-orange:       #0057FF;   /* Kevoo Electric — buttons, accents */
  --c-orange-dk:    #00227A;   /* Kevoo Deep — dark blue for text on light */
  --c-orange-lt:    #D6E3FF;   /* Kevoo Soft */
  --c-orange-mid:   #7ea3ff;   /* mid-tone blue, between Soft and Electric */

  /* ── Surfaces ── */
  --c-bg:           #fbfbfd;   /* background / surface */
  --c-card:         #ffffff;   /* surface-container-lowest */
  --c-surface-low:  #f4f6fb;   /* surface-container-low  → input bg */
  --c-surface:      #eef1f9;   /* surface-container      → hover bg */
  --c-surface-high: #e4e9f5;   /* surface-container-high → dividers */
  --c-surface-dim:  #d3dbee;   /* surface-dim */

  /* ── Text ── */
  --c-text:         #0B1220;   /* Kevoo Ink */
  --c-muted:        #445070;   /* on-surface-variant — muted blue-gray */
  --c-secondary:    #5f6b8a;   /* secondary */

  /* ── Borders ── */
  --c-border:       #d6e3ff;   /* Kevoo Soft */
  --c-outline:      #7a88ab;   /* outline */

  /* ── Sidebar ── */
  --sidebar-bg:     #0B1220;   /* Kevoo Ink */
  --sidebar-text:   #f2f4fa;   /* 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: 'Work Sans', -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);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: 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;
  background: #fff;
}

.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;
  min-height: 0;        /* lets flex child shrink so overflow kicks in */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
  overscroll-behavior: contain;
  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: 'Outfit', 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: 'Outfit', 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: 'Outfit', 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: 'Outfit', 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);
  touch-action: none; /* block page scroll through the overlay */
}
.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 ── */
/* An icon-only "rail" sidebar (no labels) used to live at this width —
   it crammed a two-line "Stock In"/"Stock Out" button above a column of
   unlabeled icons, which read as broken rather than compact. A tablet or a
   laptop with a browser window that isn't maximised both land in this
   range, so it's a lot of real usage, not an edge case. Tablets and small
   laptops now get the same clean off-canvas sidebar as phones (below),
   just merged into one breakpoint — never a squashed rail. */

/* ── Tablet & phone (≤ 1024px): off-canvas sidebar, hamburger button ──
   One consistent behaviour below the desktop breakpoint: the full,
   fully-labelled sidebar slides in over the content rather than living
   permanently on screen in a shrunk form. */
@media (max-width: 1024px) {
  .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-top: 72px; }
}

/* ── Mobile (≤ 768px): denser content layout on top of the off-canvas sidebar above ── */
@media (max-width: 768px) {
  .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; }
}

/* ── More mobile fixes ── */
@media (max-width: 768px) {

  /* Doc-type tabs: horizontal scroll, no wrap */
  .doc-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    gap: 6px;
    padding-bottom: 4px;
  }
  .doc-tab { white-space: nowrap; flex-shrink: 0; }

  /* Dashboard low-stock table: scroll */
  .card-section { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Dashboard alert cards: stack on very narrow */
  .alert-card { flex-direction: row; }

  /* Dup-card on mobile */
  .dup-row {
    grid-template-columns: 1fr auto !important;
    grid-template-rows: auto auto auto;
  }
  .dup-master-pick { grid-column: 2; grid-row: 1; }
  .dup-info        { grid-column: 1 / -1; grid-row: 2; }
  .dup-meta        { grid-column: 1; grid-row: 3; text-align: left !important; }
  .dup-del-pick    { grid-column: 2; grid-row: 3; }

  /* Reports: filter rows wrap */
  .row.g-3 .col-md-2,
  .row.g-3 .col-md-3,
  .row.g-3 .col-md-4 { width: 100%; }

  /* Expenses filter bar */
  .filter-bar { overflow-x: visible; }

  /* Customer view: doc table scrollable */
  .customers-doc-list { overflow-x: auto; }

  /* Stock movement table */
  .movements-table { min-width: 500px; }

  /* Import page: sections stack */
  .col-lg-6 { width: 100% !important; }

  /* View document: info grid stacks */
  .doc-preview-info { grid-template-columns: 1fr !important; }

  /* Batch results: stack */
  .result-grid { grid-template-columns: 1fr !important; }

  /* New document form: step labels */
  .step-label { font-size: 13px; }
  .payment-type-toggle { flex-direction: column; gap: 8px; }
  .payment-opt { width: 100%; justify-content: center; }

  /* Page sub text: truncate */
  .page-sub { font-size: 12px; }

  /* Button groups in headers: full width */
  .page-header .d-flex.gap-2 { flex-wrap: wrap; }
  .page-header .d-flex.gap-2 .btn { flex: 1 1 auto; min-width: 100px; }
}

/* ── 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;
}

/* ═══════════════════════════════════════════════════════════
   STOCK-FIRST COMPONENTS
   ═══════════════════════════════════════════════════════════ */

/* ── Sidebar primary actions ──────────────────────────────── */
/* Stock In / Stock Out are the two things done all day, so they sit
   above the navigation as buttons rather than as menu items. */
.nav-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.nav-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: .01em;
  transition: transform .12s ease, filter .12s ease;
}
.nav-action i { font-size: 19px; }
.nav-action:hover { transform: translateY(-1px); filter: brightness(1.08); }
.nav-action-in  { background: var(--c-orange); color: #fff; }
.nav-action-out { background: rgba(255,255,255,.10); color: var(--sidebar-text);
                  border: 1px solid rgba(255,255,255,.18); }

.nav-badge {
  margin-left: auto;
  background: var(--c-warning);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  text-align: center;
}
.nav-link { display: flex; align-items: center; gap: 10px; }

/* ── Type-first product picker ────────────────────────────── */
.product-picker { position: relative; }
.picker-wrap { position: relative; }
.picker-input { padding-right: 40px; font-size: 16px; }
.picker-input.is-invalid { border-color: var(--c-error); }
.picker-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--c-muted); padding: 6px; line-height: 1;
}
.picker-results {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 300px; overflow-y: auto;
}
.picker-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 11px 14px; background: none; border: none;
  border-bottom: 1px solid var(--c-surface-high);
  text-align: left; cursor: pointer;
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover, .picker-item.is-active { background: var(--c-orange-lt); }
.picker-item-main { display: flex; flex-direction: column; min-width: 0; }
.picker-item-name { font-weight: 600; color: var(--c-text); }
.picker-item-meta { font-size: 12px; color: var(--c-muted); }
.picker-item-stock {
  flex-shrink: 0; font-size: 12px; font-weight: 600;
  color: var(--c-success); white-space: nowrap;
}
.picker-item-stock.is-out { color: var(--c-error); }
.picker-empty { padding: 14px; font-size: 13.5px; color: var(--c-muted); }
.picker-chosen {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding: 8px 12px;
  background: var(--c-orange-lt); border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600; color: var(--c-orange-dk);
}
.picker-chosen-stock { margin-left: auto; font-weight: 500; color: var(--c-muted); }

.field-hint { font-size: 12.5px; color: var(--c-muted); margin-top: 5px; }
.field-label.sm { font-size: 12px; }
.opt { font-weight: 400; color: var(--c-outline); font-size: 12px; }
.soft-rule { border: none; border-top: 1px solid var(--c-surface-high); margin: 22px 0; }
.text-in  { color: var(--c-success); }
.text-out { color: var(--c-error); }

/* ── Choice tiles (movement reason) ───────────────────────── */
.choice-tile { display: block; cursor: pointer; height: 100%; }
.choice-tile input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body {
  display: flex; flex-direction: column; gap: 2px; height: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--c-border); border-radius: var(--radius-md);
  transition: border-color .12s ease, background .12s ease;
}
.choice-body i { font-size: 17px; color: var(--c-muted); }
.choice-label { font-weight: 600; font-size: 14px; color: var(--c-text); }
.choice-desc  { font-size: 12px; color: var(--c-muted); line-height: 1.35; }
.choice-tile input:checked + .choice-body {
  border-color: var(--c-orange); background: var(--c-orange-lt);
}
.choice-tile input:checked + .choice-body i { color: var(--c-orange); }
.choice-tile input:focus-visible + .choice-body { outline: 2px solid var(--c-orange); outline-offset: 2px; }

/* ── Info panel ───────────────────────────────────────────── */
.info-panel { background: var(--c-surface-low); }
.info-panel p { font-size: 14px; color: var(--c-muted); margin-bottom: 12px; }
.panel-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--c-text); }
.panel-title i { color: var(--c-orange); }

/* ── Profit & Loss statement ──────────────────────────────── */
.pl-summary {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 24px;
}
.pl-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--c-surface-high);
}
.pl-row:last-child { border-bottom: none; }
.pl-label { font-weight: 600; color: var(--c-text); }
.pl-label em { display: block; font-style: normal; font-weight: 400;
               font-size: 12.5px; color: var(--c-muted); }
.pl-value { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.pl-value small { display: block; font-weight: 500; color: var(--c-muted); text-align: right; }
.pl-subtotal { background: var(--c-surface-low); }
.pl-subtotal .pl-value { font-size: 18px; }
.pl-total { background: var(--c-text); color: #fff; }
.pl-total .pl-label { color: #fff; letter-spacing: .04em; }
.pl-total .pl-value { font-size: 24px; font-weight: 800; }
.pl-total.is-profit .pl-value { color: #6ee7a8; }
.pl-total.is-loss   .pl-value { color: #ff9b9b; }
.pos { color: var(--c-success); }
.neg { color: var(--c-error); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Pills ────────────────────────────────────────────────── */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: var(--radius-full);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.pill-in   { background: #dcfce7; color: #166534; }
.pill-out  { background: #fee2e2; color: #991b1b; }
.pill-warn { background: #fef3c7; color: #92400e; }

/* ── Shared bits ──────────────────────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  margin-bottom: 20px; padding: 14px 16px;
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
}
.filter-bar .form-control, .filter-bar .form-select { min-width: 150px; }
.search-field { position: relative; flex: 1 1 220px; }
.search-field i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
                  color: var(--c-outline); }
.search-field .form-control { padding-left: 36px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.link-strong { font-weight: 600; color: var(--c-text); text-decoration: none; display: block; }
.link-strong:hover { color: var(--c-orange); }
.muted-sm { display: block; font-size: 12px; color: var(--c-muted); }
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.row-actions { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stat-grid {
  display: grid; gap: 16px; margin-bottom: 24px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.empty-state {
  text-align: center; padding: 56px 24px;
  background: var(--c-card); border: 1px dashed var(--c-border);
  border-radius: var(--radius-lg);
}
.empty-state i { font-size: 40px; color: var(--c-orange-mid); }
.empty-state h3 { font-size: 18px; margin: 14px 0 8px; }
.empty-state p { color: var(--c-muted); max-width: 460px; margin: 0 auto 20px; font-size: 14px; }
.empty-state.compact { padding: 32px 20px; border: none; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   The shop uses a desktop Mac, but the owner checks stock from a phone.
   Below 768px each table row becomes a stacked card, using the data-label
   attribute on each cell as its heading — no horizontal scrolling.
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
  .nav-actions { grid-template-columns: 1fr 1fr; }
  .pl-total .pl-value { font-size: 20px; }
}

@media (max-width: 768px) {
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header .btn, .header-actions { width: 100%; }
  .header-actions .btn { flex: 1; justify-content: center; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-control, .filter-bar .form-select,
  .filter-bar .btn { width: 100%; min-width: 0; }

  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    margin-bottom: 12px; padding: 6px 0;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
  }
  .data-table td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
    padding: 8px 14px; border: none; text-align: left;
  }
  .data-table td::before {
    content: attr(data-label);
    font-size: 12px; font-weight: 600; color: var(--c-muted);
    flex-shrink: 0;
  }
  .data-table td:not([data-label]) { justify-content: flex-end; }
  .data-table td.num { text-align: right; }
  .data-table .row-actions { justify-content: flex-end; }

  .pl-row { flex-direction: column; gap: 4px; }
  .pl-value, .pl-value small { text-align: left; }
  .stat-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .nav-actions { grid-template-columns: 1fr; }
  .choice-body { padding: 10px 12px; }
}
