/* ================================================================
   STORE MANAGEMENT SYSTEM — app.css
   Design tokens + shared components + layout primitives
   ================================================================ */

/* ----------------------------------------------------------------
   1. DESIGN TOKENS
   ---------------------------------------------------------------- */
:root {
  /* Brand palette */
  --clr-primary:        #f7491f;   /* burnt orange — signature */
  --clr-primary-dark:    #ff9929;   /* darker orange for hover states */
  --clr-primary-light:  #F2E0D0;   /* very light tint for selected states */

  --clr-bg:             #FFF5E4;   /* warm beige — page background */
  --clr-surface:        #FFFFFF;   /* cards, panels, inputs */
  --clr-surface-2:      #FAF0E1;   /* slightly warmer surface for inner sections */

  --clr-sage:           #C1D8C3;   /* soft sage — highlight, tags, chips */
  --clr-teal:           #6A9C89;   /* deeper teal — success, paid status */
  --clr-teal-light:     #EAF2EE;   /* light teal tint */

  /* Text */
  --clr-text:           #1A1A1A;   /* near-black body text */
  --clr-text-2:         #4A4A4A;   /* secondary labels */
  --clr-text-3:         #7A7A7A;   /* muted / placeholder */
  --clr-text-inv:       #FFFFFF;   /* text on dark/orange backgrounds */

  /* Borders */
  --clr-border:         #DDD5C8;   /* beige-toned border */
  --clr-border-strong:  #B8AFA6;   /* stronger border */

  /* Status */
  --clr-danger:         #C0392B;
  --clr-danger-light:   #FDECEA;
  --clr-warning:        #D4811A;
  --clr-warning-light:  #FEF4E4;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Radius */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;

  /* Typography */
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.07);
  --shadow-lift: 0 2px 8px rgba(0,0,0,0.10);

  /* App chrome */
  --topbar-h:   56px;
  --bottomnav-h: 60px;
}

/* ----------------------------------------------------------------
   2. RESET & BASE
   ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-base);
  background-color: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.5;
  min-height: 100vh;
  padding-top: var(--topbar-h);
  padding-bottom: calc(var(--bottomnav-h) + 8px);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { display: block; max-width: 100%; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ----------------------------------------------------------------
   3. TYPOGRAPHY SCALE
   ---------------------------------------------------------------- */
.t-display  { font-size: 1.375rem; font-weight: 700; line-height: 1.25; color: var(--clr-text); }
.t-heading  { font-size: 1.125rem; font-weight: 600; line-height: 1.3;  color: var(--clr-text); }
.t-subhead  { font-size: 1rem;     font-weight: 600; line-height: 1.4;  color: var(--clr-text); }
.t-body     { font-size: 0.9375rem; font-weight: 400; line-height: 1.5; color: var(--clr-text); }
.t-label    { font-size: 0.8125rem; font-weight: 500; line-height: 1.4; color: var(--clr-text-2); }
.t-caption  { font-size: 0.75rem;  font-weight: 400; line-height: 1.4;  color: var(--clr-text-3); }
.t-mono     { font-family: var(--font-mono); font-size: 0.875rem; }

/* ----------------------------------------------------------------
   4. TOP APP BAR
   ---------------------------------------------------------------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  z-index: 100;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.topbar__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-text);
  letter-spacing: -0.01em;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.topbar__icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--clr-text-2);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}

.topbar__icon-btn:hover {
  background: var(--clr-primary-light);
  color: var(--clr-primary);
}

.topbar__icon-btn i { font-size: 1.25rem; }

.topbar__back {
  color: var(--clr-text);
}

/* ----------------------------------------------------------------
   5. BOTTOM NAVIGATION BAR
   ---------------------------------------------------------------- */
.bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottomnav-h);
  background: var(--clr-surface);
  border-top: 1px solid var(--clr-border);
  display: flex;
  align-items: stretch;
  z-index: 100;
}

.bottomnav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--clr-text-3);
  cursor: pointer;
  font-size: 0.6875rem;
  font-weight: 500;
  text-decoration: none;
  padding: var(--sp-2) 0;
  transition: color 0.15s;
  position: relative;
}

.bottomnav__item i { font-size: 1.25rem; line-height: 1; }

.bottomnav__item--active {
  color: var(--clr-primary);
}

.bottomnav__item--active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--clr-primary);
  border-radius: 0 0 2px 2px;
}

.bottomnav__item--center {
  color: var(--clr-surface);
}

.bottomnav__item--center .bottomnav__fab {
  width: 44px;
  height: 44px;
  background: var(--clr-primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.bottomnav__item--center .bottomnav__fab i {
  color: #fff;
  font-size: 1.25rem;
}

.bottomnav__item--center span {
  color: var(--clr-text-3);
  font-size: 0.6875rem;
  font-weight: 500;
}

/* ----------------------------------------------------------------
   6. SIDE DRAWER (hamburger menu)
   ---------------------------------------------------------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  background: var(--clr-surface);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.drawer.open { transform: translateX(0); }

.drawer__header {
  padding: var(--sp-6) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--clr-border);
}

.drawer__store-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--clr-text);
}

.drawer__version {
  font-size: 0.75rem;
  color: var(--clr-text-3);
  margin-top: 2px;
}

.drawer__nav { padding: var(--sp-3) 0; }

.drawer__section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--clr-text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--sp-4) var(--sp-5) var(--sp-2);
}

.drawer__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 13px var(--sp-5);
  color: var(--clr-text);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background 0.12s;
  border: none;
  background: transparent;
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.drawer__item:hover { background: var(--clr-bg); }

.drawer__item i:first-child { font-size: 1.1rem; color: var(--clr-text-2); width: 20px; }
.drawer__item .drawer__item-chevron { margin-left: auto; color: var(--clr-text-3); font-size: 0.875rem; }

.drawer__separator {
  height: 1px;
  background: var(--clr-border);
  margin: var(--sp-2) 0;
}

/* ----------------------------------------------------------------
   7. PAGE CONTAINER
   ---------------------------------------------------------------- */
.page {
  padding: var(--sp-4);
  max-width: 600px;
  margin: 0 auto;
}

.page--flush { padding: 0; }

/* ----------------------------------------------------------------
   8. CARDS
   ---------------------------------------------------------------- */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card--flat { box-shadow: none; border-color: var(--clr-border); }
.card--lifted { box-shadow: var(--shadow-lift); border-color: transparent; }

.card__header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__body { padding: var(--sp-4) var(--sp-5); }
.card__body--tight { padding: var(--sp-3) var(--sp-4); }
.card__footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--clr-border);
  background: var(--clr-surface-2);
}

/* ----------------------------------------------------------------
   9. SECTION BLOCKS (used inside pages for visual grouping)
   ---------------------------------------------------------------- */
.section-block {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-4);
  overflow: hidden;
}

.section-block__title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--clr-text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: var(--sp-3) var(--sp-4) 0;
}

/* ----------------------------------------------------------------
   10. FORM ELEMENTS
   ---------------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-4);
}

.form-group:last-child { margin-bottom: 0; }

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--clr-text-2);
}

.form-label .required { color: var(--clr-primary); margin-left: 2px; }

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  height: 48px;
  padding: 0 var(--sp-3);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  color: var(--clr-text);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.form-textarea {
  height: auto;
  padding: var(--sp-3);
  resize: vertical;
  min-height: 72px;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A7A7A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(205, 92, 8, 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--clr-text-3); }

.form-input.is-error,
.form-textarea.is-error,
.form-select.is-error {
  border-color: var(--clr-danger);
}

.form-input.is-error:focus,
.form-textarea.is-error:focus {
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.form-error {
  font-size: 0.75rem;
  color: var(--clr-danger);
  margin-top: 2px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--clr-text-3);
  margin-top: 2px;
}

/* Read-only display (like invoice number) */
.form-readonly {
  width: 100%;
  height: 48px;
  padding: 0 var(--sp-3);
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  color: var(--clr-text-2);
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--clr-border);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-row__info { flex: 1; }
.toggle-row__label { font-size: 0.9375rem; font-weight: 500; color: var(--clr-text); }
.toggle-row__desc  { font-size: 0.8125rem; color: var(--clr-text-3); margin-top: 2px; line-height: 1.4; }

.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  margin-top: 2px;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle__track {
  position: absolute;
  inset: 0;
  background: var(--clr-border-strong);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle__track {
  background: var(--clr-primary);
}

.toggle input:checked + .toggle__track::after {
  transform: translateX(18px);
}

/* ----------------------------------------------------------------
   11. BUTTONS
   ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 48px;
  padding: 0 var(--sp-5);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  text-decoration: none;
  -webkit-appearance: none;
}

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

.btn--primary {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary);
}

.btn--primary:hover:not(:disabled) {
  background: var(--clr-primary-dark);
  border-color: var(--clr-primary-dark);
}

.btn--outline {
  background: transparent;
  color: var(--clr-primary);
  border-color: var(--clr-primary);
}

.btn--outline:hover:not(:disabled) {
  background: var(--clr-primary-light);
}

.btn--ghost {
  background: transparent;
  color: var(--clr-text-2);
  border-color: var(--clr-border);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--clr-bg);
  border-color: var(--clr-border-strong);
}

.btn--danger {
  background: var(--clr-danger);
  color: #fff;
  border-color: var(--clr-danger);
}

.btn--sm {
  height: 36px;
  padding: 0 var(--sp-3);
  font-size: 0.8125rem;
}

.btn--full { width: 100%; }

.btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius);
}

.btn--loading .btn__text { opacity: 0; }
.btn--loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ----------------------------------------------------------------
   12. BADGE / STATUS CHIPS
   ---------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge--paid    { background: var(--clr-teal-light); color: var(--clr-teal); }
.badge--unpaid  { background: var(--clr-danger-light); color: var(--clr-danger); }
.badge--neutral { background: var(--clr-bg); color: var(--clr-text-3); border: 1px solid var(--clr-border); }

/* ----------------------------------------------------------------
   13. KPI CARDS (dashboard)
   ---------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.kpi-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}

.kpi-card__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--clr-text-3);
  margin-bottom: var(--sp-2);
}

.kpi-card__value {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--clr-text);
  line-height: 1.1;
}

.kpi-card__sub {
  font-size: 0.75rem;
  color: var(--clr-text-3);
  margin-top: var(--sp-1);
}

.kpi-card--accent {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
}

.kpi-card--accent .kpi-card__label,
.kpi-card--accent .kpi-card__value,
.kpi-card--accent .kpi-card__sub {
  color: rgba(255,255,255,0.9);
}

.kpi-card--accent .kpi-card__value { color: #fff; }

/* ----------------------------------------------------------------
   14. INVOICE LIST CARDS
   ---------------------------------------------------------------- */
.invoice-list { display: flex; flex-direction: column; gap: var(--sp-2); }

.invoice-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.invoice-card:hover {
  border-color: var(--clr-primary);
  box-shadow: var(--shadow-card);
  text-decoration: none;
}

.invoice-card__accent {
  width: 3px;
  align-self: stretch;
  border-radius: 2px;
  background: var(--clr-border);
  flex-shrink: 0;
}

.invoice-card--paid   .invoice-card__accent { background: var(--clr-teal); }
.invoice-card--unpaid .invoice-card__accent { background: var(--clr-danger); }

.invoice-card__body { flex: 1; min-width: 0; }

.invoice-card__number {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--clr-primary);
  font-family: var(--font-mono);
}

.invoice-card__customer {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--clr-text);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-card__meta {
  font-size: 0.75rem;
  color: var(--clr-text-3);
  margin-top: 2px;
}

.invoice-card__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-1);
  flex-shrink: 0;
}

.invoice-card__total {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--clr-text);
}

.invoice-card__pdf-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  color: var(--clr-text-3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.invoice-card__pdf-btn:hover {
  background: var(--clr-primary-light);
  color: var(--clr-primary);
  border-color: var(--clr-primary);
}

/* ----------------------------------------------------------------
   15. FILTER / SEARCH BAR
   ---------------------------------------------------------------- */
.search-bar {
  position: relative;
  margin-bottom: var(--sp-3);
}

.search-bar i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-text-3);
  font-size: 1rem;
  pointer-events: none;
}

.search-bar input {
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-3) 0 40px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  color: var(--clr-text);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-bar input:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(205, 92, 8, 0.12);
}

.filter-chips {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  scrollbar-width: none;
  margin-bottom: var(--sp-3);
}

.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 var(--sp-3);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--clr-text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  flex-shrink: 0;
}

.chip:hover { border-color: var(--clr-primary); color: var(--clr-primary); }

.chip--active {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: #fff;
}

/* ----------------------------------------------------------------
   16. PRODUCT ROW (create invoice form)
   ---------------------------------------------------------------- */
.product-row {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-3);
  position: relative;
}

.product-row__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.product-row__num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--clr-text-3);
  font-family: var(--font-mono);
}

.product-row__remove {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--clr-text-3);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
}

.product-row__remove:hover { background: var(--clr-danger-light); color: var(--clr-danger); }

.product-row__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.product-row__total-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--clr-border);
}

.product-row__total-label { font-size: 0.8125rem; color: var(--clr-text-3); font-weight: 500; }
.product-row__total-value { font-size: 1rem; font-weight: 700; color: var(--clr-text); }

/* ----------------------------------------------------------------
   17. TOTALS BLOCK (invoice form + view)
   ---------------------------------------------------------------- */
.totals-block {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--sp-4);
}

.totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--clr-border);
}

.totals-row:last-child { border-bottom: none; }

.totals-row__label { font-size: 0.875rem; color: var(--clr-text-2); font-weight: 500; }
.totals-row__value { font-size: 0.9375rem; font-weight: 600; color: var(--clr-text); font-family: var(--font-mono); }

.totals-row--grand .totals-row__label { font-size: 1rem; font-weight: 700; color: var(--clr-text); }
.totals-row--grand .totals-row__value { font-size: 1.125rem; font-weight: 700; color: var(--clr-primary); }

/* ----------------------------------------------------------------
   18. BOTTOM SHEET MODAL
   ---------------------------------------------------------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.sheet-backdrop.open { opacity: 1; pointer-events: all; }

.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--clr-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 301;
  padding: var(--sp-5);
  padding-bottom: calc(var(--sp-5) + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 600px;
  margin: 0 auto;
}

.sheet.open { transform: translateY(0); }

.sheet__handle {
  width: 36px;
  height: 4px;
  background: var(--clr-border);
  border-radius: 2px;
  margin: 0 auto var(--sp-5);
}

.sheet__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--clr-text);
  margin-bottom: var(--sp-2);
}

.sheet__subtitle {
  font-size: 0.875rem;
  color: var(--clr-text-3);
  margin-bottom: var(--sp-5);
}

.sheet__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.sheet__dismiss {
  text-align: center;
  font-size: 0.875rem;
  color: var(--clr-text-3);
  cursor: pointer;
  padding: var(--sp-2);
  text-decoration: underline;
  background: none;
  border: none;
}

/* ----------------------------------------------------------------
   19. TOAST NOTIFICATIONS
   ---------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + var(--sp-3));
  left: var(--sp-4);
  right: var(--sp-4);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
  max-width: 568px;
  margin: 0 auto;
}

.toast {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  box-shadow: var(--shadow-lift);
  pointer-events: all;
  animation: toastIn 0.25s ease;
  border-left-width: 4px;
}

.toast--success { border-left-color: var(--clr-teal); }
.toast--error   { border-left-color: var(--clr-danger); }
.toast--info    { border-left-color: var(--clr-primary); }

.toast__text { font-size: 0.875rem; font-weight: 500; color: var(--clr-text); flex: 1; }

.toast.removing { animation: toastOut 0.2s ease forwards; }

/* ----------------------------------------------------------------
   20. EMPTY STATE
   ---------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--clr-text-3);
}

.empty-state i {
  font-size: 2.5rem;
  display: block;
  margin-bottom: var(--sp-3);
  color: var(--clr-border-strong);
}

.empty-state__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--clr-text-2);
  margin-bottom: var(--sp-2);
}

.empty-state__body {
  font-size: 0.875rem;
  color: var(--clr-text-3);
  margin-bottom: var(--sp-5);
}

/* ----------------------------------------------------------------
   21. SKELETON LOADERS
   ---------------------------------------------------------------- */
@keyframes shimmer {
  from { background-position: -300px 0; }
  to   { background-position: 300px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #ede4d6 25%, #f5ece0 50%, #ede4d6 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}

.skeleton-line { height: 14px; margin-bottom: var(--sp-2); }
.skeleton-line--short { width: 40%; }
.skeleton-line--mid   { width: 65%; }
.skeleton-line--full  { width: 100%; }
.skeleton-card { height: 76px; border-radius: var(--radius-lg); margin-bottom: var(--sp-2); }

/* ----------------------------------------------------------------
   22. SETTINGS ROWS
   ---------------------------------------------------------------- */
.settings-section {
  margin-bottom: var(--sp-4);
}

.settings-section__label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--clr-text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0 var(--sp-4) var(--sp-2);
}

.settings-list {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px var(--sp-4);
  border-bottom: 1px solid var(--clr-border);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.12s;
  background: transparent;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--clr-border);
  text-align: left;
}

.settings-row:last-child { border-bottom: none; }
.settings-row:hover { background: var(--clr-bg); }

.settings-row__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--clr-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-primary);
  flex-shrink: 0;
}

.settings-row__icon i { font-size: 1rem; }

.settings-row__body { flex: 1; min-width: 0; }
.settings-row__title { font-size: 0.9375rem; font-weight: 500; color: var(--clr-text); }
.settings-row__desc  { font-size: 0.8125rem; color: var(--clr-text-3); margin-top: 1px; }

.settings-row__right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--clr-text-3);
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* ----------------------------------------------------------------
   23. CHART WRAPPER
   ---------------------------------------------------------------- */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 180px;
}

/* ----------------------------------------------------------------
   24. ITEM COUNTER BADGE
   ---------------------------------------------------------------- */
.item-counter {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--clr-text-3);
  padding: var(--sp-1) var(--sp-2);
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
}

.item-counter--warn { color: var(--clr-warning); border-color: var(--clr-warning-light); background: var(--clr-warning-light); }
.item-counter--full { color: var(--clr-danger);  border-color: var(--clr-danger-light);  background: var(--clr-danger-light); }

/* ----------------------------------------------------------------
   25. DIVIDER
   ---------------------------------------------------------------- */
.divider {
  height: 1px;
  background: var(--clr-border);
  margin: var(--sp-4) 0;
}

.divider--dashed {
  border: none;
  border-top: 1px dashed var(--clr-border);
  background: transparent;
}

/* ----------------------------------------------------------------
   26. PAGE SECTION HEADER
   ---------------------------------------------------------------- */
.page-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.page-section__title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--clr-text-2);
}

/* ----------------------------------------------------------------
   27. BRANCH TAG
   ---------------------------------------------------------------- */
.branch-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 20px;
  padding: 0 var(--sp-2);
  background: var(--clr-sage);
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  color: #2a4a3e;
}

/* ----------------------------------------------------------------
   28. LOGIN PAGE
   ---------------------------------------------------------------- */
body.login-page {
  background: var(--clr-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--sp-6) var(--sp-4);
  padding-top: var(--sp-6);
  padding-bottom: var(--sp-6);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-6);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-8);
}

.login-logo__mark {
  width: 52px;
  height: 52px;
  background: var(--clr-primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo__mark i { color: #fff; font-size: 1.5rem; }

.login-logo__name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--clr-text);
}

.login-logo__tagline {
  font-size: 0.8125rem;
  color: var(--clr-text-3);
  text-align: center;
}

/* ----------------------------------------------------------------
   29. STICKY ACTION BAR (form submit, view actions)
   ---------------------------------------------------------------- */
.sticky-bar {
  position: fixed;
  bottom: var(--bottomnav-h);
  left: 0;
  right: 0;
  background: var(--clr-surface);
  border-top: 1px solid var(--clr-border);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  gap: var(--sp-3);
  z-index: 90;
  max-width: 600px;
  margin: 0 auto;
}

body.no-bottomnav .sticky-bar {
  bottom: 0;
  padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom, 0px));
}

/* ----------------------------------------------------------------
   30. ANIMATIONS
   ---------------------------------------------------------------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

/* ----------------------------------------------------------------
   31. SCROLLBAR STYLING
   ---------------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--clr-border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--clr-text-3); }

/* ----------------------------------------------------------------
   32. REDUCED MOTION
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ----------------------------------------------------------------
   33. UTILITY CLASSES
   ---------------------------------------------------------------- */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.text-right { text-align: right; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
