/* YMDC Pharmacy POS — Premium UI */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --navy: #003366;
  --navy-dark: #002244;
  --navy-hover: #004488;
  --gold: #C9A84C;
  --gold-dark: #B8962E;
  --bg: #F9FAFB;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --text: #111827;
  --text-body: #374151;
  --text-secondary: #6B7280;
  --text-label: #6B7280;
  --success: #10B981;
  --error: #EF4444;
  --error-bg: #FEF2F2;
  --error-border: #FECACA;
  --hover-bg: #F0F4FF;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ───────────────────────────────────────────────────── */
.page-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.page-header-row .page-title { margin-bottom: 0; }

/* ── Navbar ───────────────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.header-inner {
  max-width: 1100px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-text { min-width: 0; }

.brand h1 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand .short {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-link.active {
  background: var(--gold);
  color: var(--navy);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(201, 168, 76, 0.45);
}

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.user-email {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--gold);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 20px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.logout-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ── Footer ───────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--navy);
  background: var(--card);
  margin-top: auto;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.card-title-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: normal;
}

/* ── Forms ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label,
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.12);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--bg);
  color: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.75;
}

.input-lg {
  height: 48px;
  padding: 0 16px;
  font-size: 15px;
  border-radius: 10px;
}

.input-search {
  padding-left: 16px;
  font-family: inherit;
}

.input-search::placeholder {
  color: #9CA3AF;
  opacity: 1;
}

.input-search-wrap {
  position: relative;
}

.search-wrapper { position: relative; }

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
  display: none;
  box-shadow: var(--shadow-lg);
}

.search-dropdown.open { display: block; }

.search-dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background 0.12s ease;
}

.search-dropdown-item:last-child { border-bottom: none; }

.search-dropdown-item:hover,
.search-dropdown-item.highlighted { background: var(--hover-bg); }

.search-dropdown-item span:first-child {
  font-weight: 500;
  color: var(--text);
}

/* ── Category badges ──────────────────────────────────────────── */
.cat-badge, .pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.cat-badge.medicine, .pill-medicine {
  background: #DBEAFE;
  color: #1D4ED8;
}

.cat-badge.snack, .pill-snack {
  background: #D1FAE5;
  color: #047857;
}

.cat-badge.other, .pill-other {
  background: #F3F4F6;
  color: #6B7280;
}

.pill-pending {
  background: rgba(201, 168, 76, 0.16);
  color: var(--gold-dark);
}

.pill-fulfilled {
  background: #D1FAE5;
  color: #047857;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1.2;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 51, 102, 0.25);
}
.btn-primary:hover:not(:disabled) { background: var(--navy-dark); box-shadow: 0 4px 10px rgba(0, 51, 102, 0.3); }

.btn-secondary {
  background: #fff;
  color: var(--navy);
  border: 1.5px solid var(--navy);
}
.btn-secondary:hover:not(:disabled) { background: var(--hover-bg); }

.btn-gold {
  background: var(--gold);
  color: #fff;
  box-shadow: 0 1px 3px rgba(201, 168, 76, 0.35);
}
.btn-gold:hover:not(:disabled) { background: var(--gold-dark); box-shadow: 0 4px 10px rgba(201, 168, 76, 0.4); }

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}
.btn-danger:hover:not(:disabled) {
  background: var(--error);
  color: #fff;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius);
  font-size: 15px;
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-only:hover {
  background: var(--hover-bg);
  border-color: var(--navy);
  color: var(--navy);
}

.btn-icon-only.danger:hover {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error);
}

.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Tables ───────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

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

.data-table thead { background: var(--navy); color: #fff; }

.data-table th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-body);
}

.data-table tbody tr:nth-child(even) { background: var(--bg); }
.data-table tbody tr:hover { background: var(--hover-bg); }

.cart-table thead { display: none; }

.cart-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cart-table tbody tr:nth-child(even) { background: #FAFBFC; }

td.num, th.num { text-align: right; }

/* ── Qty & price controls ─────────────────────────────────────── */
.qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--navy);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.qty-btn:hover {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.qty-controls input.qty-input {
  width: 44px;
  text-align: center;
  padding: 6px 4px;
  border-radius: 6px;
}

.qty-controls input.qty-input[readonly] {
  background: var(--bg);
  cursor: default;
  font-weight: 600;
  color: var(--text);
}

.qty-controls input.qty-input.input-error {
  color: var(--error);
  font-weight: 700;
}

.qty-controls .qty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.qty-controls .qty-btn:disabled:hover {
  background: #fff;
  color: var(--navy);
  border-color: var(--border);
}

/* ── Row actions (inventory table) ───────────────────────────────── */
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.row-actions .btn-delete {
  margin-left: 16px;
  position: relative;
}

.row-actions .btn-delete::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 20px;
  background: var(--border);
}

.price-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.price-prefix {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.price-input {
  width: 88px;
  text-align: right;
  padding: 8px 10px;
  border-radius: 6px;
}

/* ── Cart total ───────────────────────────────────────────────── */
.cart-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--navy);
  border-radius: var(--radius-lg);
  margin-top: 16px;
}

.cart-total-bar span:first-child {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  font-weight: 500;
}

.cart-total-bar .total-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
}

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.12s;
}

.modal-close:hover { background: var(--bg); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── History ──────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-bar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-summary {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-body);
}

.filter-summary strong {
  color: var(--navy);
}

.filter-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.preset-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-pill:hover,
.preset-pill.active {
  background: var(--hover-bg);
  border-color: var(--navy);
  color: var(--navy);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-body);
  cursor: pointer;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--navy);
  cursor: pointer;
}

.modal-footer-spread {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: color 0.15s ease;
}

.btn-text:hover { color: var(--navy); }

.modal-footer-actions {
  display: flex;
  gap: 8px;
}

.filter-modal .modal { max-width: 520px; }

.edit-modal .modal { max-width: 640px; }

.invoice-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.invoice-card:hover { box-shadow: var(--shadow-md); }

.invoice-card.expanded {
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
}

.invoice-card-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.invoice-card-header:hover { background: var(--hover-bg); }

.invoice-card.expanded .invoice-card-header {
  background: #FAFBFC;
  border-bottom: 1px solid var(--border);
}

.invoice-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}

.invoice-card-no {
  font-weight: 700;
  color: var(--navy);
  font-size: 15px;
}

.invoice-card-field {
  font-size: 13px;
  color: var(--text-secondary);
}

.invoice-card-field strong {
  color: var(--text-body);
  font-weight: 500;
}

.invoice-card-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.invoice-card-total {
  font-weight: 700;
  color: var(--gold);
  font-size: 16px;
  white-space: nowrap;
  text-align: right;
}

.btn-delete-invoice {
  flex-shrink: 0;
}

.invoice-card-body {
  padding: 16px 22px 20px 32px;
  background: #F9FAFB;
}

.invoice-card-body table {
  font-size: 13px;
}

.invoice-card-body th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.invoice-card-body td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-body);
}

/* ── States ───────────────────────────────────────────────────── */
.field-error {
  display: none;
  color: var(--error);
  font-size: 12px;
  margin-top: 6px;
  font-weight: 500;
}

.field-error.visible { display: block; }

input.input-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.loading {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
}

.empty-state small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #9CA3AF;
}

/* ── Low stock banner ────────────────────────────────────────────── */
.low-stock-banner {
  background: rgba(201, 168, 76, 0.1);
  border: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-body);
  line-height: 1.5;
}

.low-stock-banner strong {
  color: var(--gold-dark);
}

/* ── Auth ─────────────────────────────────────────────────────── */
.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  padding: 20px 0;
}

.auth-card {
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.auth-brand .brand-logo {
  margin: 0 auto 14px;
  display: block;
  border-radius: 10px;
}

.auth-brand h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

#login-error { margin-bottom: 6px; }

/* ── Hub — profit banner, stat tiles, charts ──────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.chart-row .card {
  margin-bottom: 0;
}

.stat-card {
  position: relative;
  padding-top: 22px;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--navy));
}

.stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.stat-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 32px;
  height: 220px;
  padding: 20px 4px 0;
  overflow-x: auto;
  border-bottom: 2px solid var(--border);
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 76px;
  flex: 0 0 auto;
  height: 100%;
}

.bar-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
  white-space: nowrap;
}

.bar {
  width: 100%;
  max-width: 44px;
  min-height: 3px;
  background: rgba(201, 168, 76, 0.45);
  border-radius: 6px 6px 0 0;
  transition: height 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.bar.bar-current {
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.3), 0 6px 16px rgba(201, 168, 76, 0.45);
}

.bar-label {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.bar-col-current .bar-label,
.bar-col-current .bar-value {
  color: var(--gold-dark);
  font-weight: 700;
}

.pie-chart-row {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.pie-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.pie-legend-label {
  font-weight: 500;
  color: var(--text-body);
  min-width: 70px;
}

.pie-legend-value {
  color: var(--text-secondary);
  white-space: nowrap;
}

.two-col-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.ranked-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ranked-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.ranked-list-item:last-child { border-bottom: none; }

.ranked-list-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--hover-bg);
  color: var(--navy);
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.ranked-list-name {
  flex: 1;
  color: var(--text-body);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranked-list-value {
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.payment-breakdown {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.payment-breakdown-item {
  flex: 1;
  min-width: 140px;
}

.payment-breakdown-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  margin-bottom: 6px;
}

.payment-breakdown-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--bg);
  overflow: hidden;
}

.payment-breakdown-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.payment-breakdown-bar-fill.cash { background: var(--navy); }
.payment-breakdown-bar-fill.bank { background: var(--gold); }

/* ── Toast ────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 18px;
  border-radius: var(--radius);
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--navy);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: 360px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-info { border-left-color: var(--navy); }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--error); }
.toast-warning { border-left-color: var(--gold); }

/* ── Needs-reorder (admin inventory) ─────────────────────────────── */
.stock-breakdown {
  width: 100%;
  max-width: 560px;
  border-collapse: collapse;
  font-size: 13px;
}

.stock-breakdown th,
.stock-breakdown td {
  padding: 6px 12px 6px 0;
  text-align: left;
  white-space: nowrap;
}

.stock-breakdown th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(201, 168, 76, 0.55);
}

.stock-breakdown th.num,
.stock-breakdown td.num { text-align: right; }

.stock-breakdown-total td {
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid rgba(201, 168, 76, 0.55);
}

.stock-num-out,
.stock-breakdown-total td.stock-num-out { color: var(--error); font-weight: 700; }
.stock-num-low,
.stock-breakdown-total td.stock-num-low { color: var(--gold-dark); font-weight: 700; }
.stock-num-zero { color: var(--text-secondary); }

button.stock-num {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.btn-danger-outline {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
}
.btn-danger-outline:hover:not(:disabled) {
  background: var(--error-bg);
}

.low-stock-admin-link {
  display: inline-block;
  margin-top: 6px;
  font-weight: 700;
  color: var(--navy);
  text-decoration: underline;
}

.low-stock-admin-link:hover { color: var(--navy-hover); }

/* Category tabs (Inventory + Request Stock vendor lists) */
.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.cat-tab {
  padding: 9px 16px;
  margin-bottom: -1px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.cat-tab:hover { color: var(--navy); }

.cat-tab.active {
  color: var(--navy);
  border-bottom-color: var(--gold);
}

.cat-tab-count { font-weight: 500; }

/* Vendor order lists (Request Stock, admin) */
.vendor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.group-row td {
  background: var(--bg);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
}

.group-row .group-row-count {
  font-weight: 500;
  color: var(--text-secondary);
}

.reorder-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.reorder-controls .preset-pills { margin-bottom: 0; }

.reorder-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.reorder-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.reorder-row-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reorder-row-qty {
  min-width: 36px;
  text-align: right;
  font-weight: 700;
  color: var(--text-body);
}

.reorder-row-qty.zero { color: var(--error); }

.reorder-names {
  min-height: 130px;
  resize: vertical;
  line-height: 1.5;
  background: var(--bg);
}

/* ── Analytics ───────────────────────────────────────────────────── */
.card-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.card-title-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  white-space: nowrap;
}

.card-title-link:hover { text-decoration: underline; }

.stat-value.stat-value-name {
  font-size: 18px;
  line-height: 1.3;
  word-break: break-word;
}

.stat-sub {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.analytics-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.analytics-toolbar .preset-pills { margin-bottom: 0; }

.analytics-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table th.sortable:hover { background: var(--navy-hover); }

.sort-ind {
  display: inline-block;
  width: 10px;
  margin-left: 4px;
  font-size: 9px;
  color: var(--gold);
}

.data-table tfoot td {
  font-weight: 700;
  color: var(--navy);
  background: #FAFBFC;
  border-top: 2px solid var(--navy);
  border-bottom: none;
}

.analytics-note {
  padding: 14px 20px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}

/* ── Finance cards (Hub) + Expenses page ──────────────────────────── */
.fin-breakdown {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.fin-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 1px 0;
}

.fin-breakdown-row strong { color: var(--text-body); font-weight: 600; }

.fin-note { font-size: 11px; line-height: 1.4; }

.stat-value.fin-positive { color: var(--success); }
.stat-value.fin-negative { color: var(--error); }

.expense-form {
  display: grid;
  grid-template-columns: 180px 1fr 180px;
  gap: 16px;
  align-items: start;
}

.expense-form .span-all { grid-column: 1 / -1; }

.expense-form .preset-pills { margin-bottom: 0; }

.cat-badge.beverage, .pill-beverage {
  background: #FEF3C7;
  color: #B45309;
}

.cat-badge.ice-cream, .pill-ice-cream {
  background: #FCE7F3;
  color: #BE185D;
}

.expense-note-cell { max-width: 320px; white-space: normal; word-break: break-word; }

.card-grid.expense-summary { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

@media (max-width: 768px) {
  .expense-form { grid-template-columns: 1fr; }
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-inner { padding: 0 12px; }
  .brand h1 { font-size: 13px; max-width: 160px; }
  .main-nav { gap: 2px; }
  .nav-link { padding: 6px 10px; font-size: 12px; }
  .main-content { padding: 20px 12px 32px; }
  .card { padding: 18px; }
  .invoice-card-header { grid-template-columns: 1fr; }
  .invoice-card-total { text-align: left; }
  .cart-total-bar { flex-direction: column; gap: 8px; text-align: center; }
  .header-right { gap: 10px; }
  .user-email { display: none; }
  .user-area { padding-left: 8px; gap: 4px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-row { grid-template-columns: 1fr; }
  .two-col-lists { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .brand-logo { width: 36px; height: 36px; }
}

/* ── Daily report / print ─────────────────────────────────────── */
.report-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.report-sheet {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 32px;
}

.report-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--navy);
  margin-bottom: 20px;
}

.report-logo {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.report-header h1 {
  font-size: 18px;
  color: var(--navy);
  font-weight: 700;
}

.report-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.report-date {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

.report-invoice-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  page-break-inside: avoid;
}

.report-invoice-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 12px 16px;
  background: #FAFBFC;
  border-bottom: 1px solid var(--border);
}

.report-totals {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 2px solid var(--navy);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.report-totals-item {
  text-align: center;
}

.report-totals-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.report-totals-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body { background: #fff; }
  .main-content { max-width: none; padding: 0; margin: 0; }
  .report-sheet { box-shadow: none; border: none; padding: 0; }
  .report-invoice-block { page-break-inside: avoid; }
}
