/* ============================================================
   Hope SMS — Professional Design System
   ============================================================ */

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

:root {
  --brand: #1a1a1a;
  --brand-mid: #2a2a2a;
  --brand-light: #3a3a3a;
  --accent: #1a1a1a;
  --accent-hover: #333333;
  --green: #10b981;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --orange: #f59e0b;
  --red: #ef4444;
  --bg: #f0f2f5;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a1a1a;
  --muted: #64748b;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .04);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .12);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* ============================================================
   AUTH / LOGIN
   ============================================================ */
.auth-screen {
  display: flex;
  min-height: 100vh;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--brand);
}

#main-app {
  display: none;
}

.auth-bg-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, .04) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, .03) 0%, transparent 40%);
  pointer-events: none;
}

.auth-brand-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px;
  color: white;
  position: relative;
}

.auth-brand-logo {
  width: 88px;
  height: 72px;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(255, 255, 255, .1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
  margin-bottom: 24px;
  padding: 12px;
}

.auth-brand-name {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.auth-brand-tagline {
  font-size: 1rem;
  color: rgba(255, 255, 255, .5);
  margin-bottom: 40px;
}

.auth-brand-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .25);
}

.dot-active {
  background: var(--accent);
  width: 24px;
  border-radius: 4px;
}

.auth-form-panel {
  width: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg);
  border-radius: 24px 0 0 24px;
}

.auth-card {
  width: 100%;
}

.auth-card-header {
  margin-bottom: 28px;
}

.auth-card-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-card-header p {
  color: var(--muted);
  font-size: .9rem;
}

/* Role Tabs */
.role-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 6px;
  background: #f1f5f9;
  border-radius: 12px;
}

.role-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  transition: .2s;
}

.role-tab-icon {
  font-size: 1.1rem;
}

.role-tab.active {
  background: var(--brand);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}

/* Form Fields */
.form-field {
  margin-bottom: 16px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.field-label-badge {
  font-size: .65rem;
  font-weight: 600;
  color: var(--orange);
  background: #fef9ee;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #fde68a;
  text-transform: none;
  letter-spacing: 0;
}

.field-input-wrapper {
  position: relative;
}

.field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  width: 16px;
  pointer-events: none;
}

.field-input {
  width: 100%;
  padding: 11px 14px;
  padding-left: 40px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: white;
  font-size: .95rem;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.field-input:not(.field-input-wrapper .field-input) {
  padding-left: 14px;
}

.field-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 26, 26, .08);
}

select.field-input {
  cursor: pointer;
}

.auto-field {
  background: #f8fafc !important;
  color: var(--muted) !important;
  cursor: not-allowed;
  font-style: italic;
  font-size: .875rem;
}

.price-field {
  background: #fefce8 !important;
  color: #92400e !important;
  font-weight: 700;
  cursor: not-allowed;
  border-color: #fde68a !important;
}

.btn-login {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 9px;
  background: var(--brand);
  color: white;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: .2s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: .8rem;
  color: var(--muted);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: white;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text);
  transition: .2s;
}

.btn-google:hover {
  border-color: #94a3b8;
  box-shadow: var(--shadow);
}

.auth-footer-note {
  text-align: center;
  font-size: .75rem;
  color: var(--muted);
  margin-top: 20px;
}

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

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--brand);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  box-shadow: 2px 0 20px rgba(0, 0, 0, .15);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.sidebar-logo {
  width: 44px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.sidebar-brand-name {
  font-weight: 800;
  font-size: 1rem;
  color: white;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: .72rem;
  color: rgba(255, 255, 255, .4);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, .3);
  padding: 6px 12px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 2px;
  color: rgba(255, 255, 255, .55);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: .15s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .85);
}

.nav-item.active {
  background: rgba(255, 255, 255, .12);
  color: white;
  font-weight: 600;
  border-left: 3px solid white;
}

.nav-item.active .nav-icon {
  stroke: white;
}

.nav-danger.active {
  background: rgba(239, 68, 68, .15);
}

.nav-danger.active .nav-icon {
  stroke: var(--red);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .07);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  width: 100%;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: white;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.15);
}

.user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.user-name {
  font-weight: 700;
  font-size: .84rem;
  color: white;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-id {
  font-size: .68rem;
  color: rgba(255, 255, 255, .38);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-badge {
  display: inline-block;
  align-self: flex-start;
  margin-top: 4px;
  font-size: .58rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(255, 255, 255, .13);
  color: rgba(255, 255, 255, .75);
  letter-spacing: .6px;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.1);
}

.sidebar-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-clock {
  font-size: .78rem;
  color: rgba(255, 255, 255, .35);
  font-family: 'Monaco', monospace;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .5);
  border-radius: 7px;
  font-size: .78rem;
  cursor: pointer;
  transition: .15s;
  font-family: 'Inter', sans-serif;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, .15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, .3);
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.topbar-breadcrumb {
  font-size: .75rem;
  color: var(--muted);
  margin-top: 1px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-date {
  font-size: .8rem;
  color: var(--muted);
}

.topbar-user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

/* ── PAGE SECTIONS ── */
.page-section {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

.page-section.active {
  display: block;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.page-subtitle {
  font-size: .875rem;
  color: var(--muted);
  margin-top: 4px;
}

.text-accent {
  color: var(--accent);
}

.text-danger {
  color: var(--red);
}

/* ── KPI CARDS ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .2s, box-shadow .2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.kpi-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon-green {
  background: #d1fae5;
  color: var(--green);
}

.kpi-icon-blue {
  background: #dbeafe;
  color: var(--blue);
}

.kpi-icon-purple {
  background: #ede9fe;
  color: var(--purple);
}

.kpi-icon-orange {
  background: #fef3c7;
  color: var(--orange);
}

.kpi-icon-wrap svg {
  stroke: currentColor;
}

.kpi-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  margin: 4px 0 2px;
}

.kpi-sub {
  font-size: .72rem;
  color: var(--muted);
}

/* ── CONTENT CARDS ── */
.content-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

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

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.card-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.btn-text {
  font-size: .82rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: .15s;
}

.btn-text:hover {
  background: #eef2ff;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 14px 16px;
  font-size: .875rem;
  border-bottom: 1px solid #f1f5f9;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: #f8fafc;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.sales-no-cell {
  font-weight: 700;
  color: var(--accent);
  font-size: .85rem;
}

.amount-cell {
  font-weight: 700;
  color: var(--text);
}

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 40px;
  font-size: .875rem;
}

/* ── FILTERS BAR ── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: .875rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  background: var(--surface);
  transition: .2s;
}

.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 26, 26, .08);
}

.filter-select {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: .875rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  background: var(--surface);
  cursor: pointer;
}

.record-badge {
  margin-left: auto;
  font-size: .78rem;
  font-weight: 700;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}

/* ── CHARTS ── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.chart-card-tall {}

.chart-box {
  padding: 20px;
  height: 320px;
}

.chart-box canvas {
  max-height: 280px;
}

/* ── ACTION BUTTONS (TABLE) ── */
.action-btn {
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  background: white;
  transition: .15s;
  font-family: 'Inter', sans-serif;
  margin: 0 2px;
}

.action-btn:hover {
  background: var(--bg);
}

.action-btn-danger {
  border-color: #fecaca;
  color: var(--red);
}

.action-btn-danger:hover {
  background: #fef2f2;
  border-color: var(--red);
}

.action-btn-warn {
  border-color: #fde68a;
  color: #92400e;
  background: #fefce8;
}

.action-btn-warn:hover {
  background: #fef9c3;
}

/* ── DELETED TAB BAR ── */
.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab-pill {
  padding: 8px 20px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: .15s;
}

.tab-pill.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-sub {
  font-size: .85rem;
  color: var(--muted);
}

/* ── MODAL ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 4000;
}

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

.modal-box {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, .2);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(.95)
  }

  to {
    opacity: 1;
    transform: scale(1)
  }
}

.modal-box-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 24px 0;
}

.modal-box-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.modal-box-sub {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 3px;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box-body {
  padding: 20px 24px;
}

.modal-form-row {
  margin-bottom: 4px;
}

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

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

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border: none;
  border-radius: 9px;
  background: var(--brand);
  color: white;
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  transition: .2s;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}

.btn-secondary {
  padding: 10px 20px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  font-family: 'Inter', sans-serif;
}

.btn-secondary:hover {
  background: var(--bg);
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--brand);
  color: white;
  border-radius: 10px;
  font-size: .85rem;
  font-weight: 600;
  z-index: 9999;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: .3s;
  box-shadow: var(--shadow-lg);
}

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

.toast.toast-success {
  background: #065f46;
}

.toast.toast-error {
  background: #991b1b;
}

/* ============================================================
   RESPONSIVE — MOBILE FIRST
   ============================================================ */

/* ── Hamburger button (hidden on desktop) ── */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text);
  transition: .15s;
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: var(--bg);
}

.hamburger-btn svg {
  width: 22px;
  height: 22px;
  stroke: var(--text);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}

/* ── Sidebar overlay (mobile only) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 990;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
}

/* ── TABLET: 1024px ── */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  :root {
    --sidebar-w: 240px;
  }
}

/* ── MOBILE: 768px ── */
@media (max-width: 768px) {
  body {
    overflow: auto;
  }

  /* ── App shell ── */
  .app-shell {
    flex-direction: row;
    position: relative;
  }

  /* ── Sidebar becomes slide-in drawer ── */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px !important;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 32px rgba(0,0,0,.25);
  }

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

  /* ── Hamburger visible on mobile ── */
  .hamburger-btn {
    display: flex;
  }

  /* ── Topbar adjustments ── */
  .topbar {
    padding: 0 16px;
    gap: 8px;
  }

  .topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .topbar-title {
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-breadcrumb {
    display: none;
  }

  .topbar-date {
    display: none;
  }

  /* ── Main content full width ── */
  .main-content {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  /* ── Page sections ── */
  .page-section {
    padding: 16px;
    overflow-x: hidden;
  }

  /* ── Page header ── */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }

  /* ── KPI Grid ── */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }

  .kpi-card {
    padding: 14px;
    gap: 10px;
  }

  .kpi-value {
    font-size: 1.4rem;
  }

  .kpi-icon-wrap {
    width: 38px;
    height: 38px;
  }

  /* ── Charts ── */
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .chart-box {
    height: 260px;
    padding: 12px;
  }

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

  .data-table thead th,
  .data-table tbody td {
    padding: 10px 12px;
    font-size: .8rem;
  }

  /* Hide timestamp column on mobile */
  .col-stamp {
    display: none;
  }

  /* ── Filters bar ── */
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    min-width: unset;
    width: 100%;
  }

  .filter-select {
    width: 100%;
  }

  .record-badge {
    align-self: flex-start;
    margin-left: 0;
  }

  /* ── Date filter ── */
  .date-filter-bar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .date-filter-btn {
    font-size: .75rem;
    padding: 5px 12px;
  }

  /* ── Modal ── */
  .modal-box {
    max-width: calc(100vw - 24px);
    margin: 12px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .modal-box-header {
    padding: 18px 18px 0;
  }

  .modal-box-body {
    padding: 16px 18px;
  }

  .modal-box-footer {
    padding: 12px 18px;
    flex-direction: column;
  }

  .modal-box-footer .btn-primary,
  .modal-box-footer .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  /* ── Auth / Login ── */
  .auth-screen {
    flex-direction: column;
  }

  .auth-brand-panel {
    padding: 32px 24px 24px;
    flex: 0 0 auto;
  }

  .auth-brand-name {
    font-size: 2rem;
  }

  .auth-brand-logo {
    width: 70px;
    height: 58px;
    margin-bottom: 16px;
  }

  .auth-form-panel {
    width: 100%;
    flex: 1;
    border-radius: 24px 24px 0 0;
    padding: 28px 20px;
    min-height: 0;
  }

  /* ── Toast ── */
  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    text-align: center;
  }

  /* ── Page action button ── */
  .btn-primary {
    white-space: nowrap;
  }
}

/* ── SMALL PHONE: 480px ── */
@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .kpi-value {
    font-size: 1.2rem;
  }

  .kpi-label {
    font-size: .65rem;
  }

  .page-header {
    margin-bottom: 12px;
  }

  .page-header h1 {
    font-size: 1.2rem;
  }

  .page-section {
    padding: 12px;
  }

  .topbar {
    height: 56px;
  }

  .auth-brand-panel {
    padding: 24px 16px 16px;
  }

  .auth-brand-name {
    font-size: 1.6rem;
  }
}

/* ── Topbar global filter group ─────────────────────────────── */
.topbar-filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}

.topbar-filter-group .date-filter-btn {
  padding: 5px 10px;
  font-size: .75rem;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}

.topbar-filter-group .date-filter-btn:hover {
  background: white;
  color: var(--text);
}

.topbar-filter-group .date-filter-btn.active {
  background: var(--brand);
  color: white;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

/* ── Custom date range picker ───────────────────────────────── */
.custom-range-picker {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 10px;
  animation: fadeIn .15s ease;
}

.custom-range-picker.active {
  display: flex;
}

.range-input {
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: .78rem;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: white;
  outline: none;
  cursor: pointer;
}

.range-input:focus {
  border-color: var(--brand);
}

.range-sep {
  color: var(--muted);
  font-size: .8rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hide filter group on very small mobile (show only inside topbar-right on scroll) */
@media (max-width: 600px) {
  .topbar-filter-group {
    display: none;
  }
  .custom-range-picker {
    display: none !important;
  }
}

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

.date-filter-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  font-family: 'Inter', sans-serif;
}

.date-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.date-filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ── Rank Badge (Top Products) ────────────────────────── */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
}

tr:nth-child(1) .rank-badge {
  background: #f59e0b;
}

tr:nth-child(2) .rank-badge {
  background: #94a3b8;
}

tr:nth-child(3) .rank-badge {
  background: #cd7c2f;
}

/* ── New action buttons ───────────────────────────────── */
.btn-icon-danger {
  padding: 4px 10px;
  border: none;
  border-radius: 8px;
  background: #fee2e2;
  color: #ef4444;
  cursor: pointer;
  font-size: .8rem;
  transition: .15s;
}

.btn-icon-danger:hover {
  background: #fecaca;
}

.btn-recover {
  padding: 4px 12px;
  border: none;
  border-radius: 8px;
  background: #d1fae5;
  color: #059669;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 600;
  transition: .15s;
}

.btn-recover:hover {
  background: #a7f3d0;
}

.btn-toggle {
  padding: 4px 12px;
  border: none;
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}

.btn-deactivate {
  background: #fee2e2;
  color: #dc2626;
}

.btn-deactivate:hover {
  background: #fecaca;
}

.btn-activate {
  background: #d1fae5;
  color: #059669;
}

.btn-activate:hover {
  background: #a7f3d0;
}

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.status-active {
  background: #d1fae5;
  color: #065f46;
}

.status-inactive {
  background: #fee2e2;
  color: #991b1b;
}

.td {
  padding: 10px 14px;
  font-size: .875rem;
  color: var(--text);
  border-top: 1px solid var(--border);
}

.lookup-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.muted {
  color: var(--muted);
  font-size: .8rem;
}