/* ─── Force light theme — never follow OS dark mode ─────────────────────── */
html { color-scheme: light !important; }

/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:        #6D5EF7;
  --primary-dark:   #5748E8;
  --primary-light:  #EEEDFB;
  --primary-glow:   rgba(109, 94, 247, 0.18);
  --secondary:      #8B7EFF;

  /* Semantic */
  --success:        #22C55E;
  --success-bg:     #F0FDF4;
  --success-border: #BBF7D0;

  --warning:        #F59E0B;
  --warning-bg:     #FFFBEB;
  --warning-border: #FDE68A;

  --danger:         #EF4444;
  --danger-bg:      #FEF2F2;
  --danger-border:  #FECACA;

  --blue:           #3B82F6;
  --blue-bg:        #EFF6FF;
  --blue-border:    #BFDBFE;

  --violet:         #8B5CF6;
  --violet-bg:      #F5F3FF;
  --violet-border:  #DDD6FE;

  /* Legacy aliases (backward compat) */
  --brand:          var(--primary);
  --brand-dark:     var(--primary-dark);
  --brand-light:    var(--primary-light);
  --brand-glow:     var(--primary-glow);
  --green:          var(--success);
  --green-bg:       var(--success-bg);
  --green-border:   var(--success-border);
  --amber:          var(--warning);
  --amber-bg:       var(--warning-bg);
  --amber-border:   var(--warning-border);
  --rose:           var(--danger);
  --rose-bg:        var(--danger-bg);
  --rose-border:    var(--danger-border);

  /* Surfaces */
  --bg:             #F8FAFC;
  --surface:        #FFFFFF;
  --surface-2:      #F8FAFC;
  --border:         #E2E8F0;
  --border-light:   #F1F5F9;

  /* Text */
  --text:           #0F172A;
  --text-2:         #334155;
  --muted:          #64748B;
  --muted-light:    #94A3B8;

  /* Layout */
  --sidebar-bg:     #0A0820;
  --sidebar-w:      260px;
  --sidebar-w-collapsed: 72px;
  --header-h:       64px;

  /* Radius */
  --radius:    20px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow:    0 10px 40px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 40px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.14);

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, sans-serif;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.2s;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-light); }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  border: none;
  transition: all var(--duration) var(--ease);
  letter-spacing: .01em;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--duration) var(--ease);
}
.btn:hover::after { background: rgba(255,255,255,0.08); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary);
}
.btn-secondary:hover { background: #e4e2f9; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: var(--muted-light); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239,68,68,.25);
}

.btn-full  { width: 100%; justify-content: center; }
.btn-sm    { padding: 7px 14px; font-size: .8125rem; }
.btn-lg    { padding: 13px 28px; font-size: 1rem; border-radius: var(--radius-sm); }
.btn-icon  { padding: 9px; border-radius: var(--radius-xs); }

/* ─── Form controls ──────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.field, .form-group input, .form-group select, .form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  outline: none;
  -webkit-appearance: none;
}
.field:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.field::placeholder, .form-group input::placeholder { color: var(--muted-light); }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-error { background: var(--danger-bg); color: #991b1b; border: 1px solid var(--danger-border); }
.alert-success { background: var(--success-bg); color: #166534; border: 1px solid var(--success-border); }
.alert-warning { background: var(--warning-bg); color: #92400e; border: 1px solid var(--warning-border); }

/* ─── Toast notifications ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s var(--ease) forwards;
  pointer-events: all;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-success { background: #166534; }
.toast-error   { background: #991b1b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ─── App layout ─────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
  transition: width 0.28s var(--ease);
}
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(109,94,247,.4), transparent);
  pointer-events: none;
}

/* Collapsed state */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .sidebar-brand-name,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-details,
.sidebar.collapsed .logout-btn { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 18px 0; }
.sidebar.collapsed .sidebar-nav { padding: 14px 8px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-item .nav-badge { display: none; }
.sidebar.collapsed .sidebar-footer { justify-content: center; padding: 14px 8px; }
.sidebar.collapsed .user-info { justify-content: center; }
.sidebar.collapsed .sidebar-toggle-btn svg { transform: rotate(180deg); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-toggle-btn {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.3);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.8); }
.sidebar-toggle-btn svg { width: 16px; height: 16px; transition: transform 0.28s var(--ease); }

.brand-icon { width: 34px; height: 34px; flex-shrink: 0; }
.sidebar-brand-name {
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #e0e7ff, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  color: rgba(255,255,255,.25);
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: 14px 10px 5px;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  font-size: .875rem;
  font-weight: 500;
  color: rgba(255,255,255,.5);
  transition: all var(--duration) var(--ease);
  position: relative;
  white-space: nowrap;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; transition: color var(--duration); }
.nav-label { flex: 1; }
.nav-badge {
  font-size: .68rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: 2px 7px;
  border-radius: 99px;
  flex-shrink: 0;
}
.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.88);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(109,94,247,.3), rgba(139,126,255,.2));
  color: #fff;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: linear-gradient(to bottom, var(--primary), var(--secondary));
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: .85rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 10px var(--primary-glow);
}
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgba(255,255,255,.9); }
.user-role { font-size: .72rem; color: rgba(255,255,255,.35); white-space: nowrap; }
.logout-btn {
  color: rgba(255,255,255,.3);
  padding: 6px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}
.logout-btn:hover { color: #fca5a5; background: rgba(239,68,68,.15); }
.logout-btn svg { width: 17px; height: 17px; }

/* ─── Sidebar accordion / submenu ────────────────────────────────────────── */
.nav-group { display: flex; flex-direction: column; }
.nav-group-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-xs);
  font-size: .875rem; font-weight: 500;
  color: rgba(255,255,255,.5);
  transition: all var(--duration) var(--ease);
  background: none; border: none; width: 100%; cursor: pointer;
  white-space: nowrap; text-align: left;
}
.nav-group-toggle > svg:first-child { width: 18px; height: 18px; flex-shrink: 0; }
.nav-group-toggle .nav-label { flex: 1; }
.nav-group-toggle .nav-chevron { width: 14px; height: 14px; flex-shrink: 0; transition: transform 0.22s var(--ease); }
.nav-group-toggle:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.88); }
.nav-group-toggle.group-active { color: rgba(255,255,255,.88); }
.nav-group-toggle.open .nav-chevron { transform: rotate(90deg); }

.nav-submenu {
  display: none; flex-direction: column; gap: 1px;
  padding-left: 28px; padding-right: 4px;
}
.nav-submenu.open { display: flex; }
.nav-subitem {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-xs);
  font-size: .84rem; font-weight: 500;
  color: rgba(255,255,255,.4);
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}
.nav-subitem::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255,255,255,.25); flex-shrink: 0;
}
.nav-subitem:hover { color: rgba(255,255,255,.8); background: rgba(255,255,255,.05); }
.nav-subitem.active { color: #fff; }
.nav-subitem.active::before { background: var(--primary); box-shadow: 0 0 6px var(--primary); }

.sidebar.collapsed .nav-group-toggle .nav-label,
.sidebar.collapsed .nav-group-toggle .nav-chevron,
.sidebar.collapsed .nav-submenu { display: none; }
.sidebar.collapsed .nav-group-toggle { justify-content: center; padding: 10px; }

/* ─── Main area ──────────────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  transition: all 0.28s var(--ease);
}

.app-header {
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  padding: 7px;
  border-radius: var(--radius-xs);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.mobile-menu-btn:hover { background: var(--bg); color: var(--text); }
.mobile-menu-btn svg { width: 20px; height: 20px; }
/* Legacy alias */
.sidebar-toggle { display: none; background: none; border: none; padding: 7px; border-radius: var(--radius-xs); color: var(--muted); cursor: pointer; transition: all var(--duration) var(--ease); }
.sidebar-toggle:hover { background: var(--bg); }
.sidebar-toggle svg { width: 20px; height: 20px; }

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.breadcrumb-root {
  font-size: .8rem;
  color: var(--muted-light);
  white-space: nowrap;
  display: none; /* shown on tablet+ */
}
.breadcrumb-sep {
  color: var(--border);
  font-size: .75rem;
  display: none;
}
.page-title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: .875rem;
  color: var(--muted);
  transition: all var(--duration) var(--ease);
  cursor: pointer;
  min-width: 200px;
}
.header-search:hover { border-color: var(--primary); background: var(--surface); }
.header-search svg { width: 15px; height: 15px; flex-shrink: 0; }
.header-search-hint { flex: 1; font-size: .8rem; color: var(--muted-light); white-space: nowrap; }
.header-search kbd {
  font-size: .7rem;
  background: var(--border);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--muted);
}

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.header-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: none;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  position: relative;
}
.header-btn:hover { background: var(--bg); color: var(--text); }
.header-btn svg { width: 18px; height: 18px; }
.header-btn-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid var(--surface);
}

.header-company {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border);
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  background: var(--surface);
}
.header-company:hover { border-color: var(--primary); color: var(--primary); }
.header-company svg { width: 14px; height: 14px; color: var(--muted-light); }
.header-company-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  flex-shrink: 0;
}

.demo-badge {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  font-size: .7rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid var(--warning-border);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ─── Page header (inside content) ──────────────────────────────────────── */
.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.content-header-left h2 {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: 4px;
}
.content-header-left p {
  font-size: .875rem;
  color: var(--muted);
}
.content-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ─── Filter bar ─────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-xs);
}
.filter-bar label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
.filter-bar select,
.filter-bar input[type="month"],
.filter-bar input[type="date"],
.filter-bar input[type="text"] {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: .875rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  -webkit-appearance: none;
  cursor: pointer;
}
.filter-bar select:focus,
.filter-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.filter-bar .filter-sep { width: 1px; height: 24px; background: var(--border); }
.filter-bar .filter-label { font-weight: 700; color: var(--text); font-size: .8125rem; }

/* ─── Metric / KPI cards ─────────────────────────────────────────────────── */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.04);
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  opacity: .4;
}
.metric-card:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,.09); }

/* Colored variants — tinted background */
.metric-card.c-indigo { background: linear-gradient(145deg, #F5F3FF 0%, #EEE8FF 100%); border-color: rgba(109,94,247,.2); border-top: 3px solid var(--primary); }
.metric-card.c-indigo::before, .metric-card.accent::before { display: none; }
.metric-card.accent   { background: linear-gradient(145deg, #F5F3FF 0%, #EEE8FF 100%); border-color: rgba(109,94,247,.2); border-top: 3px solid var(--primary); }

.metric-card.c-green  { background: linear-gradient(145deg, #F0FDF4 0%, #DCFCE7 100%); border-color: rgba(34,197,94,.2); border-top: 3px solid var(--success); }
.metric-card.c-green::before { display: none; }

.metric-card.c-amber  { background: linear-gradient(145deg, #FFFCF0 0%, #FEF3C7 100%); border-color: rgba(245,158,11,.2); border-top: 3px solid var(--warning); }
.metric-card.c-amber::before { display: none; }

.metric-card.c-rose   { background: linear-gradient(145deg, #FFF2F2 0%, #FFE4E6 100%); border-color: rgba(239,68,68,.2); border-top: 3px solid var(--danger); }
.metric-card.c-rose::before { display: none; }

.metric-card.c-violet { background: linear-gradient(145deg, #F6F4FF 0%, #EDE9FE 100%); border-color: rgba(139,92,246,.2); border-top: 3px solid var(--violet); }
.metric-card.c-violet::before { display: none; }

.metric-card.c-blue   { background: linear-gradient(145deg, #EFF6FF 0%, #DBEAFE 100%); border-color: rgba(59,130,246,.2); border-top: 3px solid var(--blue); }
.metric-card.c-blue::before { display: none; }

/* Value coloring per variant */
.metric-card.c-indigo .metric-value, .metric-card.accent .metric-value { color: #4338CA; }
.metric-card.c-green  .metric-value { color: #15803D; }
.metric-card.c-amber  .metric-value { color: #B45309; }
.metric-card.c-rose   .metric-value { color: #B91C1C; }
.metric-card.c-violet .metric-value { color: #6D28D9; }
.metric-card.c-blue   .metric-value { color: #1D4ED8; }

/* Card gradient variants */
.metric-card.grad-indigo {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  color: #fff;
}
.metric-card.grad-indigo .metric-label { color: rgba(255,255,255,.7); }
.metric-card.grad-indigo .metric-value { color: #fff; }
.metric-card.grad-indigo .metric-sub   { color: rgba(255,255,255,.6); }
.metric-card.grad-indigo .metric-icon  { background: rgba(255,255,255,.15); color: #fff; }

.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.metric-icon svg { width: 18px; height: 18px; }
.metric-icon.indigo { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; box-shadow: 0 4px 12px rgba(109,94,247,.3); }
.metric-icon.green  { background: linear-gradient(135deg, #22C55E, #16A34A); color: #fff; box-shadow: 0 4px 12px rgba(34,197,94,.25); }
.metric-icon.amber  { background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff; box-shadow: 0 4px 12px rgba(245,158,11,.25); }
.metric-icon.rose   { background: linear-gradient(135deg, #EF4444, #DC2626); color: #fff; box-shadow: 0 4px 12px rgba(239,68,68,.25); }
.metric-icon.violet { background: linear-gradient(135deg, #8B5CF6, #7C3AED); color: #fff; box-shadow: 0 4px 12px rgba(139,92,246,.25); }
.metric-icon.blue   { background: linear-gradient(135deg, #3B82F6, #1D4ED8); color: #fff; box-shadow: 0 4px 12px rgba(59,130,246,.25); }

.metric-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.metric-value { font-size: 1.75rem; font-weight: 800; color: var(--text); letter-spacing: -.03em; line-height: 1.1; margin: 4px 0 2px; }
.metric-sub   { font-size: .8rem; color: var(--muted-light); }
.metric-trend-up   { font-size: .78rem; color: var(--success); font-weight: 700; display: flex; align-items: center; gap: 3px; }
.metric-trend-down { font-size: .78rem; color: var(--danger);  font-weight: 700; display: flex; align-items: center; gap: 3px; }

/* Mini sparkline area */
.metric-chart { height: 40px; margin-top: 10px; opacity: 0.6; }

/* ─── Panels / cards ─────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
}
.panel-title { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.panel-subtitle { font-size: .8rem; color: var(--muted-light); margin-left: auto; }
.panel-actions { display: flex; align-items: center; gap: 6px; }
.panel-body { padding: 18px 22px; }
.panel-footer { padding: 14px 22px; border-top: 1px solid var(--border-light); display: flex; align-items: center; gap: 10px; }

/* Panel grid layout */
.panels-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panels-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.panel-full { grid-column: 1 / -1; }

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tbl thead tr { background: var(--bg); }
.tbl th {
  text-align: left;
  padding: 10px 16px;
  font-size: .7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl th.r, .tbl td.r { text-align: right; }
.tbl th.c, .tbl td.c { text-align: center; }
.tbl td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-2);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background var(--duration) var(--ease); }
.tbl tbody tr:hover td { background: var(--bg); }
.tbl .bold  { font-weight: 600; color: var(--text); }
.tbl .brand { color: var(--primary); font-weight: 700; }
.tbl .green { color: var(--success); font-weight: 600; }
.tbl .muted { color: var(--muted); }
.tbl .number { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* Ranked table decoration */
.tbl .rank-1 { font-weight: 800; color: #B45309; }
.tbl .rank-2 { font-weight: 700; color: var(--muted); }
.tbl .rank-3 { font-weight: 700; color: #92400e; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .02em;
}
.badge::before { content: '●'; font-size: .55rem; }
.badge-no-dot::before { display: none; }

.badge-green  { background: var(--success-bg);  color: #166534; border: 1px solid var(--success-border); }
.badge-green::before  { color: var(--success); }
.badge-amber  { background: var(--warning-bg);  color: #92400e; border: 1px solid var(--warning-border); }
.badge-amber::before  { color: var(--warning); }
.badge-rose   { background: var(--danger-bg);   color: #991b1b; border: 1px solid var(--danger-border); }
.badge-rose::before   { color: var(--danger); }
.badge-blue   { background: var(--blue-bg);     color: #1e40af; border: 1px solid var(--blue-border); }
.badge-blue::before   { color: var(--blue); }
.badge-violet { background: var(--violet-bg);   color: #5b21b6; border: 1px solid var(--violet-border); }
.badge-violet::before { color: var(--violet); }
.badge-gray   { background: var(--bg);           color: var(--muted); border: 1px solid var(--border); }
.badge-gray::before   { color: var(--muted-light); }

/* ─── Skeleton loading ───────────────────────────────────────────────────── */
@keyframes shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

.loading-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }

.skeleton-card {
  height: 116px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 300% 100%;
  animation: shimmer 1.5s ease infinite;
}
.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 300% 100%;
  animation: shimmer 1.5s ease infinite;
}
.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-50 { width: 50%; }

/* ─── Empty states ───────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 32px;
  text-align: center;
  color: var(--muted);
}
.empty-state-icon {
  width: 52px;
  height: 52px;
  background: var(--bg);
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  color: var(--muted-light);
}
.empty-state-icon svg { width: 24px; height: 24px; }
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: .875rem; max-width: 320px; line-height: 1.65; }

/* ─── Dashboard sections ─────────────────────────────────────────────────── */
.dashboard-section { margin-bottom: 28px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: linear-gradient(to bottom, var(--primary), var(--secondary));
  border-radius: 2px;
}
.section-action { font-size: .8rem; color: var(--primary); font-weight: 600; cursor: pointer; }
.section-action:hover { text-decoration: underline; }

/* Dashboard grid */
.dashboard-grid { display: flex; flex-direction: column; gap: 8px; }

/* Loja cards */
.lojas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }

.loja-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.loja-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.loja-nome {
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.loja-nome::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  flex-shrink: 0;
}
.loja-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: .875rem;
  border-bottom: 1px solid var(--border-light);
}
.loja-row:last-child { border-bottom: none; }
.loja-row span:first-child { color: var(--muted); font-size: .8125rem; }
.loja-row span:last-child { font-weight: 500; color: var(--text-2); }
.loja-row.highlight span:last-child { color: var(--primary); font-weight: 800; font-size: 1.05rem; }

/* Activity feed */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.activity-dot.green  { background: var(--success); }
.activity-dot.amber  { background: var(--warning); }
.activity-dot.rose   { background: var(--danger); }
.activity-dot.indigo { background: var(--primary); }
.activity-content { flex: 1; min-width: 0; }
.activity-title { font-size: .875rem; font-weight: 500; color: var(--text); line-height: 1.4; }
.activity-time  { font-size: .76rem; color: var(--muted-light); margin-top: 2px; }

/* Progress bar */
.progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.progress-label { display: flex; justify-content: space-between; font-size: .8rem; }
.progress-label span:first-child { color: var(--text-2); font-weight: 500; }
.progress-label span:last-child  { color: var(--muted); }
.progress-bar { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width 0.8s var(--ease); }
.progress-fill.green  { background: var(--success); }
.progress-fill.amber  { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }

/* ─── Chat ───────────────────────────────────────────────────────────────── */
.chat-wrap { display: flex; flex-direction: column; height: 100%; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}
.chat-empty-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary-light), #e4e2f9);
  border-radius: 18px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  color: var(--primary);
}
.chat-empty-icon svg { width: 26px; height: 26px; }
.chat-empty h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 10px; letter-spacing: -.02em; }
.chat-empty p  { color: var(--muted); font-size: .9rem; max-width: 400px; margin-bottom: 28px; line-height: 1.7; }
.chat-empty-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 5px 14px;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: 24px;
}
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 620px; }
.suggestion {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: .84rem;
  color: var(--text-2);
  transition: all var(--duration) var(--ease);
  cursor: pointer;
}
.suggestion:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.message { display: flex; align-items: flex-start; gap: 12px; max-width: 820px; }
.message-user { flex-direction: row-reverse; align-self: flex-end; }
.message-ai   { align-self: flex-start; }
.message-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: .8rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 10px var(--primary-glow);
}
.message-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 18px;
  font-size: .9rem;
  line-height: 1.7;
  max-width: 680px;
  box-shadow: var(--shadow-xs);
}
.message-user .message-bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px var(--primary-glow);
  border-radius: var(--radius);
}
.message-text { white-space: normal; word-break: break-word; }
.message-text .msg-list { margin: 8px 0 8px 16px; padding: 0; list-style: decimal; display: flex; flex-direction: column; gap: 4px; }
.message-text .msg-list li { line-height: 1.6; padding-left: 4px; }
.message-text strong { font-weight: 700; }

.typing-dots { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.typing-dots span { width: 6px; height: 6px; background: var(--muted-light); border-radius: 50%; animation: blink 1.2s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .2 } 40% { opacity: 1 } }

.chat-input-area {
  padding: 14px 28px 20px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
}
.chat-input-box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--bg);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.chat-input-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); background: var(--surface); }
.chat-input-box textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: .95rem;
  line-height: 1.5;
  color: var(--text);
  outline: none;
  max-height: 180px;
  overflow-y: auto;
}
.chat-input-box textarea::placeholder { color: var(--muted-light); }

#send-btn, #stop-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--duration) var(--ease);
}
#send-btn { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 2px 8px var(--primary-glow); }
#send-btn:hover { transform: scale(1.06); box-shadow: 0 4px 16px var(--primary-glow); }
#send-btn:disabled { background: var(--border); color: var(--muted-light); cursor: not-allowed; box-shadow: none; transform: none; }
#stop-btn { background: var(--danger-bg); color: var(--danger); }
#stop-btn:hover { background: #fecaca; }
#send-btn svg, #stop-btn svg { width: 17px; height: 17px; }
.chat-disclaimer { font-size: .72rem; color: var(--muted-light); text-align: center; margin-top: 8px; }

/* ─── Landing ────────────────────────────────────────────────────────────── */
.landing { min-height: 100vh; position: relative; overflow: hidden; background: #FAFBFF; }
.landing-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(100px); opacity: .22; }
.blob-1 { width: 700px; height: 700px; top: -200px; right: -120px; background: radial-gradient(circle, var(--secondary), var(--primary)); }
.blob-2 { width: 600px; height: 600px; bottom: -150px; left: -100px; background: radial-gradient(circle, #a78bfa, #7c3aed); }
.landing-content { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.landing-header { display: flex; align-items: center; justify-content: space-between; padding: 28px 0; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 700; }
.logo-icon, .brand-icon { width: 36px; height: 36px; }
.logo-name { background: linear-gradient(135deg, var(--text), var(--text-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero { text-align: center; padding: 96px 0 80px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary-light), #f0efff);
  color: var(--primary);
  padding: 5px 16px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: 28px;
  border: 1px solid rgba(109,94,247,.2);
}
.hero-badge-dot { width: 6px; height: 6px; background: var(--primary); border-radius: 50%; animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1 } 50% { opacity: 0.4 } }
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.8rem); font-weight: 800; line-height: 1.1; margin-bottom: 22px; letter-spacing: -.02em; }
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p { font-size: 1.1rem; color: var(--muted); max-width: 520px; margin: 0 auto 40px; line-height: 1.75; }
.hero-actions { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; padding-bottom: 90px; }
.feature-card {
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  box-shadow: 0 4px 20px rgba(109,94,247,.06);
}
.feature-card:hover { transform: translateY(-5px); box-shadow: 0 16px 40px rgba(109,94,247,.14); }
.feature-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary-light), #e4e2f9);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.feature-card p { font-size: .875rem; color: var(--muted); line-height: 1.65; }
.landing-footer { text-align: center; padding: 28px 0; font-size: .8rem; color: var(--muted-light); }

/* ─── Login ──────────────────────────────────────────────────────────────── */
.login-layout { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login-brand {
  background: linear-gradient(150deg, #0C0A1E 0%, #1a1640 50%, #2d1f7a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 60% at 80% 20%, rgba(109,94,247,.25) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 20% 80%, rgba(139,126,255,.15) 0%, transparent 60%);
}
.login-brand-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 48px 48px;
}
.login-brand-content { max-width: 380px; position: relative; z-index: 1; }
.login-logo { display: flex; align-items: center; gap: 12px; font-size: 1.25rem; font-weight: 700; margin-bottom: 52px; }
.login-logo svg { width: 42px; height: 42px; }
.login-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(109,94,247,.2);
  border: 1px solid rgba(109,94,247,.4);
  color: #c4b5fd;
  padding: 4px 14px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: 20px;
}
.login-brand h2 { font-size: 2.2rem; font-weight: 800; line-height: 1.15; margin-bottom: 18px; letter-spacing: -.02em; }
.login-brand p { opacity: .65; line-height: 1.75; font-size: .95rem; max-width: 300px; }
.login-brand-features { display: flex; flex-direction: column; gap: 12px; margin-top: 40px; }
.login-feature-item { display: flex; align-items: center; gap: 10px; font-size: .875rem; opacity: .8; }
.login-feature-item svg { width: 18px; height: 18px; color: #c4b5fd; flex-shrink: 0; }

.login-form-side { display: flex; align-items: center; justify-content: center; padding: 48px; background: var(--surface); }
.login-box { width: 100%; max-width: 400px; }
.login-box-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 48px; }
.login-box-logo svg { width: 34px; height: 34px; }
.login-box-logo span { font-size: 1rem; font-weight: 700; color: var(--text); }
.login-box h1 { font-size: 2rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -.02em; }
.login-subtitle { color: var(--muted); font-size: .9rem; margin-bottom: 36px; }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 4px 0; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-divider span { font-size: .78rem; color: var(--muted-light); white-space: nowrap; }

@media (max-width: 640px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }

.animate-fade-in { animation: fade-in 0.3s var(--ease) both; }
.animate-fade-in-up { animation: fade-in-up 0.4s var(--ease) both; }

/* Stagger children */
.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .10s; }
.stagger > *:nth-child(3) { animation-delay: .15s; }
.stagger > *:nth-child(4) { animation-delay: .20s; }
.stagger > *:nth-child(5) { animation-delay: .25s; }
.stagger > *:nth-child(6) { animation-delay: .30s; }

/* ─── Overlay ────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) var(--ease);
  backdrop-filter: blur(2px);
}
.overlay.show { opacity: 1; pointer-events: all; }

/* ─── Dropdown menu ──────────────────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 100;
  overflow: hidden;
  animation: scale-in 0.15s var(--ease);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: .875rem;
  color: var(--text-2);
  transition: background var(--duration);
  cursor: pointer;
}
.dropdown-item:hover { background: var(--bg); color: var(--text); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--muted); }
.dropdown-sep { height: 1px; background: var(--border-light); margin: 4px 0; }

/* ─── Overflow guards ────────────────────────────────────────────────────── */
.panel-body { overflow-x: auto; }
.tbl-wrap   { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (min-width: 1280px) {
  .breadcrumb-root, .breadcrumb-sep { display: flex; }
}

/* ── Tablet landscape  1024px ── sidebar vira overlay ───────────────────── */
@media (max-width: 1280px) {
  .header-search { display: none; }
}

@media (max-width: 1024px) {
  /* Sidebar becomes overlay — hamburger shows */
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    z-index: 200;
    transition: left 0.28s var(--ease);
    box-shadow: var(--shadow-lg);
    /* reset any collapsed state */
    width: var(--sidebar-w) !important;
  }
  .sidebar.open { left: 0; }
  /* Undo collapsed text-hiding — sidebar is full-width overlay here */
  .sidebar.collapsed .sidebar-brand-name { display: block; }
  .sidebar.collapsed .nav-label { display: block; flex: 1; }
  .sidebar.collapsed .nav-section-label { display: block; }
  .sidebar.collapsed .user-details { display: flex; }
  .sidebar.collapsed .logout-btn { display: grid; }
  .sidebar.collapsed .sidebar-brand { justify-content: flex-start; padding: 20px 18px 16px; }
  .sidebar.collapsed .sidebar-nav { padding: 14px 10px; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 10px 12px; }
  .sidebar.collapsed .nav-item .nav-badge { display: inline-flex; }
  .sidebar.collapsed .sidebar-footer { justify-content: flex-start; padding: 14px; }
  .sidebar.collapsed .user-info { justify-content: flex-start; }
  /* Hide the desktop collapse toggle — not useful in overlay mode */
  .sidebar-toggle-btn { display: none; }

  .sidebar-toggle, .mobile-menu-btn { display: grid !important; }
  .app-main { width: 100%; }
  .header-company { display: none; }

  .panels-3 { grid-template-columns: 1fr 1fr; }
  .lojas-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Small tablet / large phone  768px ─────────────────────────────────── */
@media (max-width: 768px) {
  .app-content { padding: 16px; }
  .app-header { padding: 0 16px; gap: 8px; }

  .filter-bar {
    flex-wrap: wrap;
    padding: 12px 14px;
    gap: 8px;
  }
  .filter-bar select,
  .filter-bar input[type="month"],
  .filter-bar input[type="date"],
  .filter-bar input[type="text"] { min-width: 130px; }
  .filter-bar .filter-sep { display: none; }

  .panels-2, .panels-3 { grid-template-columns: 1fr; }
  .dashboard-cards { grid-template-columns: repeat(2, 1fr); }
  .metric-value { font-size: 1.45rem; }
  .lojas-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .dashboard-cards { grid-template-columns: 1fr; }
  .content-header { flex-direction: column; gap: 12px; }
  .content-header-actions { align-self: flex-start; }
}

/* ─── Utility ────────────────────────────────────────────────────────────── */
.flex    { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 24px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-muted { color: var(--muted); }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .78rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
