/* ==========================================================
   Ragreen — Design Tokens
   A surplus-food marketplace: the visual language borrows from
   produce-crate stamps, barcode labels, and hand-stacked market
   goods rather than generic "food app green".
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Public+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  /* Color */
  --forest:        #133625;   /* deep panel background - derived from the logo's green */
  --forest-2:      #153D2A;   /* subtle gradient partner */
  --paper:         #FBF8F2;   /* card / form background, warm not stark */
  --leaf:          #226343;   /* primary action green - exact color sampled from the Ragreen logo */
  --leaf-dark:     #1C5137;   /* hover state */
  --amber:         #E3A857;   /* harvest accent - used sparingly */
  --ink:           #1B2A1E;   /* primary text */
  --ink-muted:     #64756A;   /* secondary text */
  --line:          #E1DCCB;   /* hairline borders on paper */
  --line-dark:     rgba(255,255,255,0.14);
  --error:         #C1503E;

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Layout */
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------------- Auth Shell ---------------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: 240px; }
}

/* Left: brand panel */
.auth-brand {
  position: relative;
  background: linear-gradient(160deg, var(--forest) 0%, var(--forest-2) 100%);
  color: var(--paper);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.auth-brand::after {
  /* faint crate-slat texture in the corner, purely decorative */
  content: '';
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 320px;
  height: 320px;
  background: repeating-linear-gradient(
    115deg,
    rgba(255,255,255,0.035) 0px,
    rgba(255,255,255,0.035) 2px,
    transparent 2px,
    transparent 18px
  );
  border-radius: 50%;
  pointer-events: none;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.01em;
}

.brand-mark img { height: 40px; display: block; }
.app-nav .brand-mark img { height: 30px; }

.brand-mark .dot { color: var(--amber); }

.brand-copy {
  max-width: 380px;
  z-index: 1;
}

.brand-copy h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  margin: 0 0 16px;
}

.brand-copy p {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(251,248,242,0.75);
  margin: 0;
}

/* Signature element: a barcode strip that "scans" once on load */
.barcode-strip {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 40px;
  margin: 28px 0 10px;
  overflow: hidden;
}

.barcode-strip span {
  display: block;
  width: 3px;
  background: rgba(251,248,242,0.55);
}
.barcode-strip span:nth-child(3n) { height: 100%; background: var(--amber); }
.barcode-strip span:nth-child(5n) { height: 60%; }
.barcode-strip span:nth-child(7n) { height: 80%; }
.barcode-strip span:nth-child(2n) { height: 45%; }

.barcode-strip .scan-line {
  position: absolute;
  top: 0; left: -20%;
  width: 20%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: scan 2.6s ease-in-out 0.4s 1;
}

@keyframes scan {
  0%   { left: -20%; }
  60%  { left: 100%; }
  100% { left: 100%; }
}

.barcode-caption {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(251,248,242,0.5);
}

.freshness-stamp {
  align-self: flex-start;
  border: 1.5px solid rgba(251,248,242,0.4);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: rotate(-3deg);
  color: var(--amber);
}

/* Right: form panel */
.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--paper);
}

.auth-card {
  width: 100%;
  max-width: 380px;
}

.auth-card h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  margin: 0 0 6px;
}

.auth-card .subtitle {
  color: var(--ink-muted);
  font-size: 14px;
  margin: 0 0 28px;
}

.auth-card .subtitle a {
  color: var(--leaf-dark);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--leaf-dark);
}

/* Form elements */
.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.field input,
.field select {
  width: 100%;
  padding: 11px 13px;
  font-size: 14px;
  font-family: var(--font-body);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(76,140,74,0.15);
}

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

/* Account type toggle */
.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.type-toggle label {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-muted);
  transition: all 0.15s ease;
}

.type-toggle input { display: none; }

.type-toggle input:checked + span {
  color: var(--leaf-dark);
}

.type-toggle label:has(input:checked) {
  border-color: var(--leaf);
  background: rgba(76,140,74,0.08);
  color: var(--leaf-dark);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 18px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary {
  background: var(--leaf);
  color: #fff;
}
.btn-primary:hover { background: var(--leaf-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-link {
  background: none;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  padding: 0;
  width: auto;
}

/* Alerts */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  display: none;
}
.alert-error { background: #FBE9E5; color: var(--error); border: 1px solid #F1C6BC; }
.alert-success { background: #E9F4E5; color: var(--leaf-dark); border: 1px solid #C9E4C1; }

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  margin-bottom: 18px;
}

.divider {
  text-align: center;
  color: var(--ink-muted);
  font-size: 12px;
  margin: 22px 0;
  position: relative;
}

/* ==========================================================
   App shell (nav + content) — used by product/marketplace pages
   ========================================================== */

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--forest);
  color: var(--paper);
  position: relative;
}

.app-nav .brand-mark { font-size: 18px; }

.app-nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 13px;
  font-weight: 600;
}

.app-nav-links a {
  text-decoration: none;
  color: rgba(251,248,242,0.75);
  transition: color 0.15s ease;
}
.app-nav-links a:hover,
.app-nav-links a.active { color: var(--paper); }

.app-nav-links .btn-nav {
  background: var(--leaf);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  transition: background 0.15s ease;
}
.app-nav-links .btn-nav:hover { background: var(--leaf-dark); color: #fff; }

/* Hamburger toggle - hidden on desktop, shown only under the breakpoint */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--paper);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }

  .app-nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--forest);
    border-top: 1px solid rgba(255,255,255,0.12);
    padding: 8px 0;
    z-index: 50;
    box-shadow: 0 12px 24px rgba(0,0,0,0.25);
  }

  .app-nav-links.open { display: flex; }

  .app-nav-links a {
    padding: 14px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .app-nav-links a:last-child { border-bottom: none; }

  .app-nav-links .btn-nav {
    border-radius: 0;
    text-align: center;
  }
}

.app-content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

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

.page-header h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 4px;
}
.page-header p { color: var(--ink-muted); margin: 0; font-size: 14px; }

/* Card panel used to wrap forms/sections outside the auth flow */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  overflow-x: auto; /* wide tables (admin panels especially) scroll within the card on mobile instead of breaking the page layout */
}

.panel + .panel { margin-top: 20px; }

.panel h3 {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 0 0 4px;
}
.panel .panel-hint { font-size: 13px; color: var(--ink-muted); margin: 0 0 18px; }

/* Two-column form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.form-grid .field.full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

textarea {
  width: 100%;
  padding: 11px 13px;
  font-size: 14px;
  font-family: var(--font-body);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 80px;
}
textarea:focus { outline: none; border-color: var(--leaf); box-shadow: 0 0 0 3px rgba(76,140,74,0.15); }

/* Barcode scan box */
.scan-box {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.scan-box.is-active { border-color: var(--leaf); background: rgba(76,140,74,0.05); }

#scanReader {
  width: 240px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: none;
}
#scanReader.active { display: block; }

.scan-manual {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 220px;
}
.scan-manual input { flex: 1; }
.scan-manual .btn { width: auto; padding: 11px 16px; white-space: nowrap; }

.scan-status {
  font-size: 13px;
  color: var(--leaf-dark);
  font-weight: 600;
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn-secondary:hover { border-color: var(--ink-muted); }

/* Image uploader */
.image-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.image-thumb {
  position: relative;
  width: 84px; height: 84px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
}
.image-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-thumb .remove-thumb {
  position: absolute; top: 3px; right: 3px;
  background: rgba(27,42,30,0.75); color: #fff;
  width: 20px; height: 20px; border-radius: 50%;
  border: none; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.image-add-btn {
  width: 84px; height: 84px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-muted);
  font-size: 24px;
  cursor: pointer;
  background: none;
}
.image-add-btn:hover { border-color: var(--leaf); color: var(--leaf); }

/* Product grid (marketplace + my listings) */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

#marketGridWrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#vendorGridWrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.product-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-card.featured-card {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber);
}

.featured-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  background: var(--amber);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.product-card.ad-card .thumb img { object-fit: cover; }
.product-card.ad-card .body { text-align: center; }

.ad-slot-wrap {
  margin: 20px auto;
  text-align: center;
}
.ad-slot-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.product-card .thumb {
  aspect-ratio: 4/3;
  background: #EFEBDE;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-muted);
  font-size: 12px;
  position: relative;
  overflow: hidden;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb img.no-photo, .product-card .thumb img.no-photo {
  object-fit: contain;
  padding: 22%;
  background: #EFEBDE;
}

.product-card .body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.product-card .name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.product-card .price { color: var(--leaf-dark); font-weight: 700; font-size: 15px; }
.product-card .price .original { color: var(--ink-muted); font-weight: 400; text-decoration: line-through; font-size: 12px; margin-left: 6px; }
.product-card .meta { font-size: 12px; color: var(--ink-muted); }

.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  align-self: flex-start;
}
.status-active { background: rgba(76,140,74,0.12); color: var(--leaf-dark); }
.status-inactive { background: rgba(100,117,106,0.12); color: var(--ink-muted); }
.status-sold { background: rgba(227,168,87,0.18); color: #93641f; }
.status-expired { background: rgba(193,80,62,0.12); color: var(--error); }

.card-actions {
  display: flex; gap: 8px; padding: 0 14px 14px;
}
.card-actions button {
  flex: 1;
  font-size: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}
.card-actions button.danger { color: var(--error); border-color: #F1C6BC; }
.card-actions button:hover { border-color: var(--ink-muted); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-muted);
}
.empty-state h3 { font-family: var(--font-display); color: var(--ink); margin: 0 0 6px; }

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.filter-bar input, .filter-bar select {
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
}
.filter-bar input[type="text"] { flex: 1; min-width: 180px; }

/* ==========================================================
   Cart & checkout
   ========================================================== */

.cart-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 760px) { .cart-layout { grid-template-columns: 1fr; } }

.cart-line {
  display: grid;
  grid-template-columns: 64px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.cart-line:last-child { border-bottom: none; }

.cart-line .thumb {
  width: 64px; height: 64px; border-radius: var(--radius-sm);
  background: #EFEBDE; overflow: hidden; display:flex; align-items:center; justify-content:center;
  color: var(--ink-muted); font-size: 10px;
}
.cart-line .thumb img { width:100%; height:100%; object-fit:cover; }
.cart-line .thumb img.no-photo { object-fit: contain; padding: 18%; background: #EFEBDE; }

.cart-line .info .name { font-weight: 700; font-size: 14px; }
.cart-line .info .unit-price { font-size: 12px; color: var(--ink-muted); }
.cart-line .info .warn { font-size: 12px; color: var(--error); font-weight: 600; margin-top: 3px; }

.qty-stepper {
  display: flex; align-items: center; gap: 8px;
}
.qty-stepper button {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--line); background: #fff; cursor: pointer;
  font-size: 14px; line-height: 1; display:flex; align-items:center; justify-content:center;
}
.qty-stepper span { min-width: 18px; text-align: center; font-weight: 600; font-size: 14px; }

.line-total { font-weight: 700; font-size: 14px; min-width: 64px; text-align: right; }
.remove-line { background:none; border:none; color: var(--ink-muted); cursor:pointer; font-size: 18px; padding: 0 4px; }
.remove-line:hover { color: var(--error); }

.summary-row {
  display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 10px; color: var(--ink-muted);
}
.summary-row.total { font-weight: 700; color: var(--ink); font-size: 17px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }

.order-item-row {
  display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.order-item-row:last-child { border-bottom: none; }
.order-item-row .thumb { width: 52px; height: 52px; border-radius: var(--radius-sm); background:#EFEBDE; overflow:hidden; }
.order-item-row .thumb img { width:100%; height:100%; object-fit:cover; }
.order-item-row .thumb img.no-photo { object-fit: contain; padding: 10%; background: #EFEBDE; }
.order-item-row .name { font-weight: 600; font-size: 14px; flex: 1; }
.order-item-row .qty { font-size: 13px; color: var(--ink-muted); }
.order-item-row .line-total { font-weight: 700; font-size: 14px; }

.qty-select {
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ==========================================================
   Pantry & Loyalty
   ========================================================== */

.pantry-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.pantry-row:last-child { border-bottom: none; }
.pantry-row .name { font-weight: 700; font-size: 14px; }
.pantry-row .qty-label { font-size: 12px; color: var(--ink-muted); }

.expiry-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 999px;
}
.expiry-expired { background: rgba(193,80,62,0.12); color: var(--error); }
.expiry-soon { background: rgba(227,168,87,0.18); color: #93641f; }
.expiry-ok { background: rgba(76,140,74,0.1); color: var(--leaf-dark); }
.expiry-none { background: rgba(100,117,106,0.1); color: var(--ink-muted); }

.icon-btn {
  background: none; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  width: 30px; height: 30px; cursor: pointer; font-size: 13px;
  display:flex; align-items:center; justify-content:center;
}
.icon-btn:hover { border-color: var(--ink-muted); }
.icon-btn.danger { color: var(--error); border-color: #F1C6BC; }

.quick-add-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}
@media (max-width: 640px) { .quick-add-form { grid-template-columns: 1fr; } }
.quick-add-form .field { margin-bottom: 0; }

.points-hero {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.points-hero .num {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 600;
  color: var(--leaf-dark);
}
.points-hero .label { color: var(--ink-muted); font-size: 14px; }

.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.tier-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.tier-card .pts { font-family: var(--font-mono); font-weight: 600; color: var(--amber); }
.tier-card .desc { font-size: 12px; color: var(--ink-muted); margin-top: 4px; }

.tx-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.tx-row:last-child { border-bottom: none; }
.tx-row .reason { color: var(--ink); }
.tx-row .date { color: var(--ink-muted); font-size: 12px; }
.tx-row .points { font-weight: 700; }
.tx-row .points.positive { color: var(--leaf-dark); }
.tx-row .points.negative { color: var(--error); }

/* ==========================================================
   Business dashboard & Admin panel
   ========================================================== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-card .num { font-family: var(--font-display); font-size: 30px; font-weight: 600; }
.stat-card .label { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.stat-card.warn .num { color: #93641f; }

.kpi-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.kpi-chart-card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 4px;
}
.kpi-chart-card canvas { max-height: 280px; }
.kpi-chart-wide { grid-column: 1 / -1; }

@media (max-width: 760px) {
  .kpi-chart-grid { grid-template-columns: 1fr; }
}

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-muted); padding: 8px 10px; border-bottom: 1.5px solid var(--line);
}
.data-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }

.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1.5px solid var(--line);
  margin-bottom: 22px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tab-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab-btn.active { color: var(--leaf-dark); border-bottom-color: var(--leaf); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.pill-select { padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 999px; font-size: 12px; }

.mini-btn {
  font-size: 12px; font-weight: 600; padding: 6px 12px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: #fff; cursor: pointer;
}
.mini-btn:hover { border-color: var(--ink-muted); }
.mini-btn.danger { color: var(--error); border-color: #F1C6BC; }
.mini-btn.primary { background: var(--leaf); color: #fff; border-color: var(--leaf); }

/* ==========================================================
   Notifications
   ========================================================== */

.notif-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.notif-row:last-child { border-bottom: none; }
.notif-row.unread { background: rgba(76,140,74,0.04); margin: 0 -14px; padding: 14px; border-radius: var(--radius-sm); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); margin-top: 6px; flex-shrink: 0; }
.notif-row.read .notif-dot { visibility: hidden; }
.notif-row .message { font-size: 14px; flex: 1; }
.notif-row .date { font-size: 12px; color: var(--ink-muted); margin-top: 3px; }

#navBell { position: relative; }
.bell-badge {
  background: var(--amber); color: #1B2A1E; font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 1px 6px; margin-left: 4px;
}
