/* ═══════════════════════════════════════════════════════════════
   ShopScreens POS — Main CSS
   Blue · White · Red — Day/Night theme system
═══════════════════════════════════════════════════════════════ */

/* ── Night (Dark) Theme — Default ──────────────────────────── */
:root, [data-theme="dark"] {
  --bg: #060d1a;
  --surface: #0d1b2e;
  --surface2: #142235;
  --surface3: #1c2e45;
  --border: rgba(33,150,243,0.15);
  --border2: rgba(33,150,243,0.25);
  --text: #d0e4f7;
  --text-strong: #eef5ff;
  --muted: #6a90b5;
  --muted2: #3d5a7a;
  --accent: #2196f3;
  --accent-dim: rgba(33,150,243,0.12);
  --accent-hover: #1976d2;
  --blue-light: #64b5f6;
  --blue-dark: #1565c0;
  --brand-red: #ef5350;
  --brand-red-dim: rgba(239,83,80,0.12);
  --danger: #ef5350;
  --danger-dim: rgba(239,83,80,0.1);
  --warning: #ffa726;
  --warning-dim: rgba(255,167,38,0.1);
  --info: #64b5f6;
  --info-dim: rgba(100,181,246,0.1);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.6);
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.4);
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --transition: 0.18s ease;
}

/* ── Day (Light) Theme ─────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f0f4fb;
  --surface: #ffffff;
  --surface2: #e4ecf7;
  --surface3: #d0dcef;
  --border: rgba(21,101,192,0.14);
  --border2: rgba(21,101,192,0.26);
  --text: #1a2840;
  --text-strong: #0d1830;
  --muted: #5a7598;
  --muted2: #8ba0be;
  --accent: #1565c0;
  --accent-dim: rgba(21,101,192,0.1);
  --accent-hover: #0d47a1;
  --blue-light: #1e88e5;
  --blue-dark: #0d47a1;
  --brand-red: #c62828;
  --brand-red-dim: rgba(198,40,40,0.1);
  --danger: #c62828;
  --danger-dim: rgba(198,40,40,0.1);
  --warning: #e65100;
  --warning-dim: rgba(230,81,0,0.1);
  --info: #0277bd;
  --info-dim: rgba(2,119,189,0.1);
  --shadow: 0 4px 20px rgba(21,101,192,0.14);
  --shadow-sm: 0 2px 8px rgba(21,101,192,0.08);
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem .875rem;
  color: var(--text);
  transition: border-color var(--transition);
  width: 100%;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,208,122,0.12);
}
input::placeholder, textarea::placeholder { color: var(--muted2); }
input[disabled], .disabled-input {
  opacity: 0.5;
  cursor: not-allowed;
}
select { cursor: pointer; }
select option { background: var(--surface2); }

textarea { resize: vertical; min-height: 80px; }

/* ── Layout ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 1.25rem 1rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--text-strong);
  text-decoration: none;
  font-weight: 700;
}
.brand-icon {
  font-size: 1.4rem;
  color: var(--accent);
  line-height: 1;
}
.brand-logo {
  width: 30px;
  height: 30px;
  object-fit: cover;
  object-position: 30% 50%;
  border-radius: 6px;
  flex-shrink: 0;
  background: #000;
}
.brand-name { font-size: .95rem; letter-spacing: -.01em; }
.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: .25rem;
}

.sidebar-shop {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.shop-avatar {
  width: 36px; height: 36px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.shop-name { font-size: .9rem; font-weight: 600; color: var(--text-strong); }
.shop-role { font-size: .75rem; color: var(--muted); }

.sidebar-nav {
  flex: 1;
  padding: .75rem 0;
  display: flex;
  flex-direction: column;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin: 1px .5rem;
  font-size: .9rem;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item.nav-logout { color: var(--danger); margin-top: auto; }
.nav-item.nav-logout:hover { background: var(--danger-dim); }
.nav-icon { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-label { font-weight: 500; }
.nav-divider { border-top: 1px solid var(--border); margin: .5rem 1rem; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 199;
}

.main-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.main-wrapper.with-sidebar {
  margin-left: var(--sidebar-width);
}

.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .25rem;
}
.hamburger span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}
.topbar-title { flex: 1; font-size: .9rem; color: var(--muted); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.user-name { font-size: .875rem; color: var(--muted); }

.offline-badge {
  background: var(--warning);
  color: #000;
  font-size: .7rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 4px;
  letter-spacing: .08em;
}

.content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ── Flash Messages ───────────────────────────────────────── */
.flash-container {
  padding: .75rem 1.5rem 0;
}
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
  font-size: .875rem;
  animation: slideDown .2s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.flash-success { background: rgba(33,150,243,.12); border: 1px solid rgba(33,150,243,.25); color: #90caf9; }
.flash-danger { background: rgba(239,83,80,.12); border: 1px solid rgba(239,83,80,.25); color: #ef9a9a; }
/* flash-danger handled by brand-red in rules above */
.flash-warning { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.25); color: #fcd34d; }
.flash-info { background: rgba(79,142,247,.12); border: 1px solid rgba(79,142,247,.25); color: #93c5fd; }
.flash-close {
  background: none; border: none; cursor: pointer;
  color: inherit; opacity: .6; font-size: 1rem;
}
.flash-close:hover { opacity: 1; }

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.2;
}
.page-sub { color: var(--muted); font-size: .9rem; margin-top: .2rem; }
.back-link { color: var(--muted); font-size: .875rem; display: block; margin-bottom: .4rem; }
.back-link:hover { color: var(--accent); }
.header-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card.mt-2 { margin-top: 1.5rem; }
.card.mt-3 { margin-top: 2rem; }
.card.mb-2 { margin-bottom: 1.5rem; }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--text-strong); }
.card-sub { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.card-body { padding: 1.25rem; }
.card-body.p0 { padding: 0; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .75rem; }
.card-footer-actions { padding: 1rem 1.25rem; display: flex; justify-content: flex-end; gap: .75rem; }

/* ── Stats Grid ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-card.stat-warning { border-color: rgba(245,158,11,.3); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-body { flex: 1; min-width: 0; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-strong); line-height: 1.2; }
.stat-label { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.stat-sub { font-size: .8rem; color: var(--muted2); margin-top: .2rem; }

/* ── Content Grid ─────────────────────────────────────────── */
.content-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-accent { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border2);
}
.btn-ghost:hover { background: var(--surface2); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { opacity: .85; }
.btn-danger-ghost { background: transparent; color: var(--danger); border: 1px solid rgba(230,57,70,.3); }
.btn-danger-ghost:hover { background: var(--danger-dim); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  padding: .4rem .6rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }
.btn-icon.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.btn-icon.btn-danger { color: var(--danger); }
.btn-group { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── Tables ───────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tfoot td { border-top: 1px solid var(--border); font-weight: 600; }
.table tr:hover td { background: rgba(255,255,255,0.02); }
.table .row-void td { opacity: .5; }
.cell-main { font-weight: 500; color: var(--text-strong); }
.cell-sub { font-size: .8rem; color: var(--muted); margin-top: .15rem; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-success { background: rgba(33,150,243,.15); color: #2196f3; }
.badge-danger { background: rgba(230,57,70,.15); color: #e63946; }
.badge-warning { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-info { background: rgba(79,142,247,.15); color: #4f8ef7; }
.badge-muted { background: rgba(255,255,255,.06); color: var(--muted); }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: .35rem;
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-section-title {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--blue-light);
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.form-check { display: flex; align-items: center; gap: .5rem; }
.form-check input { width: auto; }
.form-check label { margin: 0; color: var(--text); font-size: .875rem; }
.form-hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; }
.mt-2 { margin-top: 1.5rem; }
.mt-3 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1.5rem; }
.mb-3 { margin-bottom: 2rem; }
.py-4 { padding-top: 2rem; padding-bottom: 2rem; }
.p-2 { padding: 1rem; }

.radio-group { display: flex; gap: 1.5rem; }
.radio-label { display: flex; align-items: center; gap: .4rem; font-size: .875rem; cursor: pointer; color: var(--text); }
.radio-label input { width: auto; }

.color-input-wrap { display: flex; align-items: center; gap: .75rem; }
.color-input-wrap input[type="color"] {
  width: 48px; height: 36px;
  padding: 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ── Filter Bar ───────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.filter-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.filter-input { max-width: 260px; }
.filter-select { max-width: 180px; }
.result-count { font-size: .875rem; color: var(--muted); white-space: nowrap; }
.filter-pills { display: flex; gap: .5rem; flex-wrap: wrap; }

.filter-form-inline { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.form-group-inline { display: flex; flex-direction: column; gap: .3rem; }
.form-group-inline label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.form-group-inline input,
.form-group-inline select { width: auto; min-width: 140px; }

/* ── Pills ────────────────────────────────────────────────── */
.pill {
  padding: .35rem .875rem;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.pill:hover { background: var(--surface3); color: var(--text); text-decoration: none; }
.pill.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(33,150,243,.2); }

/* ── Modals ───────────────────────────────────────────────── */
.modal { display: none; position: fixed; inset: 0; z-index: 500; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(2px);
}
.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalIn .2s ease;
}
.modal-lg { max-width: 680px; }
.modal-receipt { max-width: 380px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 600; color: var(--text-strong); }
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: .25rem;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
}

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab {
  padding: .65rem 1.1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Feature Cards ────────────────────────────────────────── */
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.feature-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.feature-card.enabled { border-color: rgba(33,150,243,.2); }
.feature-header { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; }
.feature-name { font-weight: 600; font-size: .9rem; color: var(--text-strong); }
.feature-desc { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.feature-cost { font-size: .82rem; color: var(--muted); display: flex; align-items: center; gap: .5rem; }

/* Toggle Switch */
.toggle-btn {
  position: relative;
  width: 40px; height: 22px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.toggle-btn.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px rgba(33,150,243,.4); }
.toggle-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle-btn.on .toggle-knob { left: calc(100% - 18px); }

/* ── Billing Summary ──────────────────────────────────────── */
.billing-summary { margin-top: .5rem; }
.billing-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem 0;
  font-size: .875rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.billing-row:last-child { border-bottom: none; }
.billing-total {
  font-weight: 700;
  color: var(--text-strong);
  font-size: 1rem;
  padding-top: .75rem;
  margin-top: .25rem;
  border-top: 1px solid var(--border2);
  border-bottom: none;
}

/* ── Detail Rows ──────────────────────────────────────────── */
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.detail-row span { color: var(--muted); }
.detail-row strong { color: var(--text-strong); }
.detail-row:last-child { border-bottom: none; }

/* ── Action Grid ──────────────────────────────────────────── */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
  transition: var(--transition);
  text-align: center;
}
.action-btn:hover { background: var(--surface3); color: var(--text); text-decoration: none; }
.action-btn.accent { background: var(--accent-dim); color: var(--accent); border-color: rgba(33,150,243,.2); }
.action-icon { font-size: 1.5rem; }

/* ── Report Cards ─────────────────────────────────────────── */
.report-links { display: flex; flex-direction: column; gap: .75rem; margin-top: 1.5rem; }
.report-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
}
.report-card:hover { border-color: var(--accent); background: var(--surface2); text-decoration: none; box-shadow: 0 0 12px rgba(33,150,243,.15); }
.report-card.locked { opacity: .6; cursor: default; }
.report-icon { font-size: 1.5rem; width: 36px; text-align: center; }
.report-info { flex: 1; }
.report-name { font-weight: 600; font-size: .9rem; }
.report-desc { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.report-arrow { color: var(--muted); font-size: 1.1rem; }

/* ── P&L Report ───────────────────────────────────────────── */
.pnl-section { margin-bottom: 1rem; }
.pnl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem 0;
  font-size: .9rem;
  border-bottom: 1px solid var(--border);
}
.pnl-row:last-child { border-bottom: none; }
.pnl-row.revenue { color: var(--blue-light); }
.pnl-row.cogs { color: var(--danger); }
.pnl-row.gross { font-size: 1rem; font-weight: 700; color: var(--text-strong); }
.pnl-row.net.profit { font-size: 1.1rem; font-weight: 700; color: var(--blue-light); }
.pnl-row.net.loss { font-size: 1.1rem; font-weight: 700; color: var(--danger); }
.pnl-row.margin { color: var(--info); }
.pnl-row.expenses { color: var(--warning); }
.pnl-divider { border-top: 1px solid var(--border2); margin: .75rem 0; }
.pnl-footer { font-size: .78rem; color: var(--muted); margin-top: 1rem; }

/* ── Breakdown ────────────────────────────────────────────── */
.breakdown-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.breakdown-item {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  min-width: 120px;
}
.breakdown-method { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.breakdown-amount { font-size: 1rem; font-weight: 700; color: var(--blue-light); }

/* ── Product Thumb ────────────────────────────────────────── */
.product-thumb {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}
.product-thumb-placeholder {
  width: 40px; height: 40px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 700;
}
.image-preview {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.image-preview-placeholder {
  width: 100%; height: 180px;
  background: var(--surface2);
  border: 1px dashed var(--border2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

/* ── Categories Grid ──────────────────────────────────────── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.category-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.category-color-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.category-name { font-weight: 600; flex: 1; }
.category-count { font-size: .8rem; color: var(--muted); }

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}
.page-info { color: var(--muted); font-size: .875rem; }

/* ── Error Page ───────────────────────────────────────────── */
.error-page {
  text-align: center;
  padding: 4rem 2rem;
}
.error-code { font-size: 5rem; font-weight: 800; color: var(--blue-light); line-height: 1; }
.error-message { font-size: 1.5rem; font-weight: 600; color: var(--text-strong); margin: .5rem 0; }

/* ── Text Utilities ───────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }
.text-sm { font-size: .82rem; }
.fw-bold { font-weight: 700; }
code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--surface2);
  padding: .15rem .4rem;
  border-radius: 4px;
  font-size: .85em;
  color: var(--accent);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .content-grid-2 { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }
  .sidebar-close { display: flex; }
  .sidebar-overlay.open { display: block; }
  .main-wrapper.with-sidebar { margin-left: 0; }
  .hamburger { display: flex; }

  .content { padding: 1rem; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .header-actions { width: 100%; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 1rem; }
  .stat-value { font-size: 1.2rem; }

  .table { font-size: .82rem; }
  .table th, .table td { padding: .6rem .75rem; }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-form { flex-direction: column; }
  .filter-input, .filter-select { max-width: 100%; }

  .action-grid { grid-template-columns: 1fr 1fr; }
}

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

/* ── Day-mode component overrides ─────────────────────────── */
[data-theme="light"] .flash-success { background: rgba(21,101,192,.08); border-color: rgba(21,101,192,.2); color: #1565c0; }
[data-theme="light"] .badge-success { background: rgba(21,101,192,.12); color: #1565c0; }
[data-theme="light"] .badge-danger { background: rgba(198,40,40,.12); color: #c62828; }
[data-theme="light"] .btn-accent { color: #fff; }
[data-theme="light"] .nav-item.active { background: rgba(21,101,192,.12); color: #1565c0; }
[data-theme="light"] .pill.active { background: rgba(21,101,192,.1); color: #1565c0; border-color: rgba(21,101,192,.2); }
[data-theme="light"] .tab.active { color: #1565c0; border-bottom-color: #1565c0; }
[data-theme="light"] a { color: var(--accent); }
[data-theme="light"] code { color: var(--accent); }
[data-theme="light"] .pnl-row.revenue { color: #1565c0; }
[data-theme="light"] .pnl-row.net.profit { color: #1565c0; }
[data-theme="light"] .breakdown-amount { color: #1565c0; }
[data-theme="light"] .text-accent { color: #1565c0; }
[data-theme="light"] .error-code { color: #1565c0; }

/* ── Theme Toggle Button ───────────────────────────────────── */
.theme-toggle-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  padding: .35rem .55rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.theme-toggle-btn:hover { background: var(--surface3); color: var(--text); }

/* ── Notification Bell ─────────────────────────────────────── */
.notif-wrap { position: relative; }
.notif-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  padding: .35rem .55rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: var(--transition);
  position: relative;
  display: flex;
  align-items: center;
}
.notif-btn:hover { background: var(--surface3); color: var(--text); }
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--brand-red);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 400;
  overflow: hidden;
  animation: modalIn .15s ease;
}
.notif-header {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-strong);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition);
}
.notif-item:hover { background: var(--surface2); text-decoration: none; }
.notif-item:last-child { border-bottom: none; }
.notif-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: .1rem; }
.notif-title { font-size: .85rem; font-weight: 600; color: var(--text-strong); }
.notif-detail { font-size: .75rem; color: var(--muted); margin-top: .1rem; }
.notif-item.danger .notif-title { color: var(--danger); }
.notif-item.warning .notif-title { color: var(--warning); }
.notif-empty { padding: 1.5rem 1rem; text-align: center; color: var(--muted); font-size: .875rem; }

/* ── Brand Red usages ──────────────────────────────────────── */
.brand-red { color: var(--brand-red); }
.stat-icon.red { background: var(--brand-red-dim); color: var(--brand-red); }
