/* ══════════════════════════════════════════════════
   Canteen ERP — Design System
   ══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── TOKENS ────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:          #f7f8fc;
  --bg-card:     #ffffff;
  --bg-sidebar:  #1a1d2e;
  --bg-hover:    rgba(99,102,241,0.06);
  --bg-active:   rgba(99,102,241,0.1);

  /* Brand */
  --brand:       #6366f1;
  --brand-dark:  #4f46e5;
  --brand-light: rgba(99,102,241,0.12);
  --brand-text:  #4f46e5;

  /* Semantic */
  --success:     #10b981;
  --success-bg:  rgba(16,185,129,0.1);
  --warning:     #f59e0b;
  --warning-bg:  rgba(245,158,11,0.1);
  --danger:      #ef4444;
  --danger-bg:   rgba(239,68,68,0.1);
  --info:        #3b82f6;
  --info-bg:     rgba(59,130,246,0.1);

  /* Text */
  --text-primary:   #111827;
  --text-secondary: #6b7280;
  --text-tertiary:  #9ca3af;
  --text-inverse:   #ffffff;
  --text-sidebar:   rgba(255,255,255,0.7);
  --text-sidebar-active: #ffffff;

  /* Borders */
  --border:      rgba(0,0,0,0.08);
  --border-md:   rgba(0,0,0,0.12);
  --border-strong: rgba(0,0,0,0.2);

  /* Sidebar specifics */
  --sidebar-w:   240px;
  --sidebar-border: rgba(255,255,255,0.07);
  --sidebar-text: rgba(255,255,255,0.65);
  --sidebar-active-bg: rgba(255,255,255,0.1);
  --sidebar-hover-bg: rgba(255,255,255,0.06);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.06);

  /* Font */
  --font:  'Inter', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', 'Fira Code', monospace;

  /* Transition */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 120ms;
  --t-base: 200ms;
}

/* ── DARK MODE ─────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #0f1117;
  --bg-card:     #181c27;
  --bg-hover:    rgba(99,102,241,0.08);
  --bg-active:   rgba(99,102,241,0.14);
  --text-primary:   #e8eaf0;
  --text-secondary: #8b90a0;
  --text-tertiary:  #555b6e;
  --border:      rgba(255,255,255,0.06);
  --border-md:   rgba(255,255,255,0.1);
  --border-strong: rgba(255,255,255,0.18);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.5);
  --bg-sidebar: #111420;
}

/* ── RESET ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text-primary); line-height: 1.6; transition: background var(--t-base) var(--ease), color var(--t-base) var(--ease); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font-family: var(--font); font-size: inherit; }

/* ── APP SHELL ─────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ───────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--t-base) var(--ease), transform var(--t-base) var(--ease);
  z-index: 100;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }

.sidebar-header { padding: 20px 18px 16px; border-bottom: 1px solid var(--sidebar-border); }

.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo-icon { font-size: 22px; line-height: 1; }
.sidebar-logo-name { font-size: 14px; font-weight: 600; color: #fff; letter-spacing: -0.01em; }
.sidebar-logo-inst { font-size: 11px; color: var(--sidebar-text); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }

.sidebar-nav { flex: 1; padding: 10px 10px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 14px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  margin-bottom: 1px;
  text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-hover-bg); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--sidebar-active-bg); color: #fff; font-weight: 500; }
.nav-item.active svg { stroke: var(--brand); }
.nav-item svg { flex-shrink: 0; opacity: 0.7; transition: opacity var(--t-fast); }
.nav-item:hover svg, .nav-item.active svg { opacity: 1; }

.sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--sidebar-border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 12px; font-weight: 500; color: #fff; }
.sidebar-user-role { font-size: 11px; color: var(--sidebar-text); text-transform: capitalize; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-logout { color: rgba(255,255,255,0.4); transition: color var(--t-fast); display: flex; align-items: center; }
.sidebar-logout:hover { color: #fff; text-decoration: none; }

/* ── MAIN AREA ─────────────────────────────────── */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── TOPBAR ────────────────────────────────────── */
.topbar {
  height: 52px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.topbar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.topbar-breadcrumb { display: flex; align-items: center; gap: 6px; flex: 1; font-size: 13px; overflow: hidden; }
.bc-link { color: var(--text-secondary); transition: color var(--t-fast); }
.bc-link:hover { color: var(--brand); text-decoration: none; }
.bc-sep { color: var(--text-tertiary); }
.bc-current { color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 7px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.topbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.topbar-notif { position: relative; padding: 7px; cursor: pointer; color: var(--text-secondary); border-radius: var(--r-sm); transition: background var(--t-fast); }
.topbar-notif:hover { background: var(--bg-hover); }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: var(--danger); border-radius: 50%; border: 2px solid var(--bg-card); }

/* ── PAGE CONTENT ──────────────────────────────── */
.page-content { flex: 1; overflow-y: auto; padding: 28px 32px 48px; }
.page-content::-webkit-scrollbar { width: 5px; }
.page-content::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 99px; }

/* ── PAGE HEADER ───────────────────────────────── */
.page-hd { margin-bottom: 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-hd-left {}
.page-eyebrow { font-size: 11px; font-weight: 500; color: var(--brand); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.page-title { font-size: 22px; font-weight: 600; color: var(--text-primary); line-height: 1.2; letter-spacing: -0.02em; }
.page-sub { font-size: 13px; color: var(--text-secondary); margin-top: 4px; max-width: 560px; line-height: 1.5; }
.page-hd-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── CARDS ─────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  transition: box-shadow var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.card-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ── STAT CARDS ────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.purple { background: rgba(99,102,241,0.12); color: var(--brand); }
.stat-icon.teal   { background: rgba(16,185,129,0.12); color: var(--success); }
.stat-icon.amber  { background: rgba(245,158,11,0.12);  color: var(--warning); }
.stat-icon.blue   { background: rgba(59,130,246,0.12);  color: var(--info); }
.stat-icon.red    { background: rgba(239,68,68,0.12);   color: var(--danger); }
.stat-body {}
.stat-value { font-size: 24px; font-weight: 600; color: var(--text-primary); line-height: 1; letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat-delta { font-size: 11px; margin-top: 4px; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ── GRID CARDS ────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.grid-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-base), transform var(--t-base);
  text-decoration: none;
  display: block;
  color: inherit;
}
.grid-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; color: inherit; }
.grid-card-icon { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--brand-light); color: var(--brand); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.grid-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.grid-card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* ── BUTTONS ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
  line-height: 1.4;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand-dark); }
.btn-primary:hover { background: var(--brand-dark); box-shadow: 0 2px 8px rgba(99,102,241,0.35); color: #fff; }

.btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-md); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text-primary); }

.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success { background: var(--success-bg); color: var(--success); border-color: rgba(16,185,129,0.2); }
.btn-success:hover { background: var(--success); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon { padding: 7px; border-radius: var(--r-sm); }
.btn-icon svg { width: 16px; height: 16px; }

/* ── TABLES ────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--bg-card); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table .col-actions { text-align: right; white-space: nowrap; }
.data-table .col-actions .btn { margin-left: 4px; }
.table-empty { padding: 40px 20px; text-align: center; color: var(--text-tertiary); }
.table-empty svg { width: 36px; height: 36px; margin-bottom: 10px; opacity: 0.3; }
.table-empty-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.table-empty-sub { font-size: 12px; color: var(--text-tertiary); }

/* ── TABLE TOOLBAR ─────────────────────────────── */
.table-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.table-toolbar .search-box { position: relative; }
.table-toolbar .search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-tertiary); pointer-events: none; }
.table-toolbar .search-input { padding: 8px 12px 8px 32px; border: 1px solid var(--border-md); border-radius: var(--r-md); background: var(--bg-card); color: var(--text-primary); font-size: 13px; width: 220px; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.table-toolbar .search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.table-toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* ── FORMS ─────────────────────────────────────── */
.form-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.form-section { padding: 22px 26px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: none; }
.form-section-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.form-section-title svg { width: 15px; height: 15px; color: var(--brand); }
.form-footer { padding: 16px 26px; background: var(--bg); border-top: 1px solid var(--border); border-radius: 0 0 var(--r-lg) var(--r-lg); display: flex; gap: 10px; align-items: center; }

.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group {}
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  line-height: 1.5;
}
.form-control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }
.form-control::placeholder { color: var(--text-tertiary); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }

/* ── TOGGLES / CHECKBOXES ──────────────────────── */
.check-group { display: flex; flex-direction: column; gap: 8px; }
.check-item { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.check-item input[type="checkbox"] { display: none; }
.check-box {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-md);
  border-radius: 5px;
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast), border-color var(--t-fast);
  flex-shrink: 0;
}
.check-item input:checked + .check-box { background: var(--brand); border-color: var(--brand); }
.check-box svg { width: 11px; height: 11px; stroke: #fff; opacity: 0; transition: opacity var(--t-fast); }
.check-item input:checked + .check-box svg { opacity: 1; }
.check-label { font-size: 13px; color: var(--text-primary); }
.check-sub { font-size: 11px; color: var(--text-secondary); }

/* Big toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 40px; height: 22px; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border-md);
  border-radius: 99px;
  transition: background var(--t-base);
  cursor: pointer;
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--t-base), box-shadow var(--t-base);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  pointer-events: none;
}
.toggle input:checked ~ .toggle-track { background: var(--brand); }
.toggle input:checked ~ .toggle-thumb { transform: translateX(18px); }
.toggle-label { font-size: 13px; font-weight: 500; color: var(--text-primary); }

/* Radio group */
.radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-card {
  border: 1.5px solid var(--border-md);
  border-radius: var(--r-md);
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  user-select: none;
}
.radio-card input { display: none; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-light); color: var(--brand-text); font-weight: 500; }
.radio-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color var(--t-fast);
}
.radio-card:has(input:checked) .radio-dot { border-color: var(--brand); }
.radio-dot-inner { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); opacity: 0; transition: opacity var(--t-fast); }
.radio-card:has(input:checked) .radio-dot-inner { opacity: 1; }

/* ── BADGES ────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-purple { background: rgba(99,102,241,0.1);  color: #6366f1; border-color: rgba(99,102,241,0.25); }
.badge-teal   { background: rgba(16,185,129,0.1);  color: #059669; border-color: rgba(16,185,129,0.25); }
.badge-amber  { background: rgba(245,158,11,0.1);  color: #d97706; border-color: rgba(245,158,11,0.25); }
.badge-red    { background: rgba(239,68,68,0.1);   color: #dc2626; border-color: rgba(239,68,68,0.25); }
.badge-blue   { background: rgba(59,130,246,0.1);  color: #2563eb; border-color: rgba(59,130,246,0.25); }
.badge-gray   { background: rgba(107,114,128,0.1); color: #6b7280; border-color: rgba(107,114,128,0.2); }

/* ── FLASH MESSAGES ────────────────────────────── */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 18px;
  border: 1px solid;
}
.flash svg { flex-shrink: 0; }
.flash-close { background: none; border: none; cursor: pointer; margin-left: auto; opacity: 0.5; font-size: 16px; transition: opacity var(--t-fast); line-height: 1; }
.flash-close:hover { opacity: 1; }
.flash-success { background: var(--success-bg); color: var(--success); border-color: rgba(16,185,129,0.2); }
.flash-error   { background: var(--danger-bg);  color: var(--danger);  border-color: rgba(239,68,68,0.2); }
.flash-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(245,158,11,0.2); }

/* ── TABS ──────────────────────────────────────── */
.tab-bar { display: flex; gap: 2px; background: var(--bg); border-radius: var(--r-md); padding: 3px; margin-bottom: 20px; width: fit-content; border: 1px solid var(--border); }
.tab-btn { padding: 7px 14px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; cursor: pointer; border: none; background: none; color: var(--text-secondary); transition: background var(--t-fast), color var(--t-fast); }
.tab-btn.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.tab-btn:hover:not(.active) { color: var(--text-primary); }

/* ── ORDER CALENDAR ────────────────────────────── */
.order-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin: 12px 0; }
.cal-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  user-select: none;
  position: relative;
}
.cal-day:hover:not(.disabled):not(.holiday) { border-color: var(--brand); background: var(--brand-light); color: var(--brand-text); }
.cal-day.selected { background: var(--brand); border-color: var(--brand-dark); color: #fff; }
.cal-day.holiday { background: var(--danger-bg); border-color: rgba(239,68,68,0.2); color: var(--danger); cursor: not-allowed; }
.cal-day.disabled { opacity: 0.35; cursor: not-allowed; }
.cal-day.today { border-color: var(--warning); }
.cal-day-header { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--text-tertiary); text-align: center; padding: 4px 0; letter-spacing: .06em; }

/* ── WALLET CARD ───────────────────────────────── */
.wallet-card {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border-radius: var(--r-xl);
  padding: 24px 26px;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}
.wallet-card::before { content: ''; position: absolute; top: -40px; right: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,0.06); }
.wallet-card::after  { content: ''; position: absolute; bottom: -60px; right: 30px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,0.04); }
.wallet-label { font-size: 12px; font-weight: 500; opacity: 0.75; letter-spacing: .06em; text-transform: uppercase; }
.wallet-balance { font-size: 36px; font-weight: 600; letter-spacing: -0.03em; margin: 6px 0 4px; }
.wallet-name { font-size: 13px; opacity: 0.8; }
.wallet-actions { display: flex; gap: 10px; margin-top: 18px; position: relative; z-index: 1; }
.wallet-action-btn { background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.25); color: #fff; padding: 8px 16px; border-radius: var(--r-md); font-size: 13px; font-weight: 500; cursor: pointer; transition: background var(--t-fast); display: flex; align-items: center; gap: 6px; }
.wallet-action-btn:hover { background: rgba(255,255,255,0.28); }
.wallet-action-btn svg { width: 15px; height: 15px; }

/* ── TXNS LIST ─────────────────────────────────── */
.txn-list { display: flex; flex-direction: column; gap: 1px; }
.txn-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--bg-card); border-bottom: 1px solid var(--border); transition: background var(--t-fast); }
.txn-item:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.txn-item:last-child  { border-radius: 0 0 var(--r-md) var(--r-md); border-bottom: none; }
.txn-item:hover { background: var(--bg-hover); }
.txn-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.txn-icon.credit { background: var(--success-bg); color: var(--success); }
.txn-icon.debit  { background: var(--danger-bg);  color: var(--danger); }
.txn-icon svg { width: 16px; height: 16px; }
.txn-info { flex: 1; min-width: 0; }
.txn-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.txn-date  { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
.txn-amount { font-size: 14px; font-weight: 600; }
.txn-amount.credit { color: var(--success); }
.txn-amount.debit  { color: var(--danger); }

/* ── PAGINATION ────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; padding-top: 16px; }
.page-link { padding: 6px 11px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; color: var(--text-secondary); border: 1px solid transparent; cursor: pointer; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); text-decoration: none; }
.page-link:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.page-link.active { background: var(--brand); color: #fff; border-color: var(--brand-dark); }
.page-link.disabled { opacity: 0.4; pointer-events: none; }

/* ── SECTION LABEL ─────────────────────────────── */
.section-lbl { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-tertiary); margin: 20px 0 8px; }

/* ── DIVIDER ───────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── SIDEBAR COLLAPSED ─────────────────────────── */
.sidebar-collapsed .sidebar { width: 56px; }
.sidebar-collapsed .sidebar-logo-name,
.sidebar-collapsed .sidebar-logo-inst,
.sidebar-collapsed .nav-section-label,
.sidebar-collapsed .nav-item span,
.sidebar-collapsed .sidebar-user-info,
.sidebar-collapsed .sidebar-logout { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar-collapsed .sidebar-logo { justify-content: center; }
.sidebar-collapsed .sidebar-user { justify-content: center; }

/* ── RESPONSIVE ────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); height: 100vh; z-index: 200; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-area { width: 100%; }
  .page-content { padding: 18px 16px 40px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .page-hd { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .table-toolbar { flex-wrap: wrap; }
  .table-toolbar .search-input { width: 100%; }
}

/* ── UTILITIES ─────────────────────────────────── */
.text-muted { color: var(--text-secondary); }
.text-sm    { font-size: 12px; }
.text-xs    { font-size: 11px; }
.text-mono  { font-family: var(--mono); }
.fw-500     { font-weight: 500; }
.fw-600     { font-weight: 600; }
.d-flex     { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-auto { margin-top: auto; }
.ml-auto { margin-left: auto; }

/* ── LOADING SHIMMER ───────────────────────────── */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.shimmer {
  background: linear-gradient(90deg, var(--border) 25%, var(--border-md) 50%, var(--border) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-sm);
}

/* ── MODAL ─────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 400; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: var(--bg-card); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.modal-close { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; border-radius: var(--r-sm); transition: background var(--t-fast); font-size: 18px; line-height: 1; }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── CODE ──────────────────────────────────────── */
code, .code { font-family: var(--mono); font-size: 12px; background: var(--bg); color: var(--brand-text); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
