/* ═══════════════════════════════════════════════════════════════════
   STOCKCONTROL PRO — DESIGN SYSTEM
   ═══════════════════════════════════════════════════════════════════ */

/* ── Google Fonts já carregado no HTML ── */

/* ── CSS Custom Properties ─────────────────────────────────────── */
:root {
  /* Brand */
  --brand-h: 220;
  --brand:      hsl(220, 90%, 56%);
  --brand-dark: hsl(220, 90%, 44%);
  --brand-glow: hsl(220, 90%, 56%, 0.35);

  /* Semantic */
  --success: hsl(142, 72%, 45%);
  --warning: hsl(38,  92%, 50%);
  --danger:  hsl(0,   80%, 58%);
  --info:    hsl(196, 85%, 50%);

  /* Neutral scale */
  --gray-50:  hsl(220, 20%, 97%);
  --gray-100: hsl(220, 16%, 93%);
  --gray-200: hsl(220, 14%, 86%);
  --gray-300: hsl(220, 12%, 70%);
  --gray-400: hsl(220, 10%, 56%);
  --gray-500: hsl(220, 10%, 42%);
  --gray-600: hsl(220, 12%, 30%);
  --gray-700: hsl(220, 14%, 22%);
  --gray-800: hsl(220, 16%, 15%);
  --gray-900: hsl(220, 20%, 10%);
  --gray-950: hsl(220, 24%, 7%);

  /* Layout */
  --sidebar-w:      240px;
  --sidebar-w-col:  64px;
  --topbar-h:       60px;
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  /* Transitions */
  --tr-fast:   150ms ease;
  --tr-normal: 250ms ease;
  --tr-slow:   400ms ease;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow:     0 4px 16px rgba(0,0,0,.18);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.24);
  --shadow-xl:  0 16px 64px rgba(0,0,0,.32);
}

/* ── Dark Theme (default) ──────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           hsl(220, 20%, 8%);
  --bg-surface:   hsl(220, 18%, 12%);
  --bg-card:      hsl(220, 16%, 15%);
  --bg-hover:     hsl(220, 16%, 19%);
  --bg-input:     hsl(220, 18%, 11%);
  --border:       hsl(220, 14%, 22%);
  --border-light: hsl(220, 12%, 26%);
  --text:         hsl(220, 16%, 92%);
  --text-muted:   hsl(220, 12%, 60%);
  --text-faint:   hsl(220, 10%, 40%);
  --sidebar-bg:   hsl(220, 22%, 10%);
  --topbar-bg:    hsl(220, 20%, 11%);
  color-scheme: dark;
}

/* ── Light Theme ───────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:           hsl(220, 20%, 96%);
  --bg-surface:   hsl(220, 18%, 99%);
  --bg-card:      #ffffff;
  --bg-hover:     hsl(220, 16%, 95%);
  --bg-input:     #ffffff;
  --border:       hsl(220, 14%, 88%);
  --border-light: hsl(220, 12%, 92%);
  --text:         hsl(220, 20%, 14%);
  --text-muted:   hsl(220, 14%, 44%);
  --text-faint:   hsl(220, 10%, 65%);
  --sidebar-bg:   #ffffff;
  --topbar-bg:    #ffffff;
  color-scheme: light;
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background var(--tr-slow), color var(--tr-slow);
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

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

/* ═══════════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════════════ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, hsl(220,90%,20%) 0%, hsl(220,24%,7%) 60%);
}
.login-bg::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle 400px at 20% 80%, hsl(260,70%,20%,0.4) 0%, transparent 70%),
    radial-gradient(circle 300px at 80% 20%, hsl(190,80%,20%,0.3) 0%, transparent 70%);
}

.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,.04);
  animation: fadeUp .5s ease;
}

.login-logo {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  margin-bottom: 32px;
}
.logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--brand), hsl(260,80%,60%));
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
  box-shadow: 0 4px 20px var(--brand-glow);
  margin-bottom: 4px;
}
.login-logo h1 { font-size: 20px; font-weight: 700; }
.login-logo p  { font-size: 12px; color: var(--text-muted); }

.login-form { display: flex; flex-direction: column; gap: 20px; }
#login-btn { margin-top: 26px; }

.login-error {
  background: hsl(0,80%,58%,0.12);
  border: 1px solid hsl(0,80%,58%,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--danger);
  font-size: 13px;
}

.login-hints {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}
.login-hints code { background: var(--bg-hover); padding: 2px 6px; border-radius: 4px; font-size: 11px; }

/* ═══════════════════════════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════════════════════════ */
#app { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
  transition: width var(--tr-normal);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-w-col); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .sidebar-logo { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 0 8px; }
.sidebar.collapsed .sidebar-toggle { display: inline-flex; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon-sm {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--brand), hsl(260,80%,60%));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff; flex-shrink: 0;
}
.logo-text { font-size: 15px; font-weight: 700; white-space: nowrap; }

.sidebar-toggle {
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--tr-fast), color var(--tr-fast);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text); }

.sidebar-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
}

.nav-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-faint);
  padding: 12px 10px 4px; white-space: nowrap;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
  transition: background var(--tr-fast), color var(--tr-fast);
  white-space: nowrap;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active {
  background: hsl(var(--brand-h),90%,56%,0.15);
  color: var(--brand);
}
.nav-icon { font-size: 16px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px; border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--tr-fast);
}
.sidebar-user:hover { background: var(--bg-hover); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), hsl(260,80%,60%));
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; }
.user-role { font-size: 10px; }

/* ── Main wrapper ──────────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--tr-normal);
}
.main-wrapper.collapsed { margin-left: var(--sidebar-w-col); }

/* ── Topbar ────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 90;
  gap: 16px;
  transition: background var(--tr-slow);
}
#menu-toggle { display: none; }
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.breadcrumb { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Topbar user chip ──────────────────────────────────────────── */
.topbar-user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 12px 0 6px;
  border-radius: 40px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  transition: background var(--tr-fast), border-color var(--tr-fast), box-shadow var(--tr-fast);
  user-select: none;
  flex-shrink: 0;
}
.topbar-user-chip:hover {
  background: var(--bg-hover);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.topbar-user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), hsl(260,80%,60%));
  color: #fff; font-weight: 700; font-size: 11px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.topbar-user-info {
  display: flex; flex-direction: column; justify-content: center; line-height: 1.15;
}
.topbar-user-name {
  font-size: 12px; font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.topbar-user-role {
  font-size: 10px; font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
/* Ocultar em telas muito pequenas */
@media (max-width: 600px) {
  .topbar-user-chip .topbar-user-info { display: none; }
  .topbar-user-chip { padding: 0 6px; }
}


/* ── Page content ──────────────────────────────────────────────── */
.page-content {
  flex: 1; padding: 28px;
  animation: fadeIn .25s ease;
}

/* ─── Page Header ───────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 22px; font-weight: 700; }
.page-header p  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-actions   { display: flex; gap: 10px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════════
   ALERTS PANEL
   ═══════════════════════════════════════════════════════════════════ */
.alert-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 0 24px 0;
  padding: 16px;
  box-shadow: var(--shadow);
  animation: slideDown .2s ease;
}

/* ═══════════════════════════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  flex: 1 1 220px;
  max-width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform var(--tr-fast), box-shadow var(--tr-fast), opacity var(--tr-fast);
  position: relative;
  overflow: hidden; /* clip correto da barra colorida */
  cursor: default;
}
.kpi-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--kpi-color, var(--brand));
}
.kpi-card:not(.dash-dragging):hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.kpi-icon {
  width: 40px; height: 40px;
  background: var(--kpi-color, var(--brand));
  opacity: 0.15;
  border-radius: var(--radius-sm);
  position: absolute; right: 16px; top: 16px;
  display: flex; align-items: center; justify-content: center;
}

.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 28px; font-weight: 800; line-height: 1; }
.kpi-sub   { font-size: 12px; color: var(--text-muted); }
.kpi-card.danger  { --kpi-color: var(--danger); }
.kpi-card.warning { --kpi-color: var(--warning); }
.kpi-card.success { --kpi-color: var(--success); }
.kpi-card.info    { --kpi-color: var(--info); }

/* ═══════════════════════════════════════════════════════════════════
   CARDS & PANELS
   ═══════════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: visible; /* permite drag-handle posicionado fora dos limites */
}
/* Conteúdo interno do card com clip para não vazar */
.card > .card-body,
.card > .card-header { overflow: hidden; }
.card > .table-wrap,
.card > .card-body.table-wrap { overflow: hidden; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

/* ═══════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
thead th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer; user-select: none;
}
thead th:hover { color: var(--text); }
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--tr-fast); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: 11px 14px; vertical-align: middle; }

.empty-state {
  padding: 60px 20px; text-align: center; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-state span[class*="icon"] { font-size: 48px; opacity: .3; }
.empty-state p { font-size: 15px; font-weight: 500; }
.empty-state small { font-size: 13px; }

/* ═══════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"],
select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13.5px;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }

.input-icon-wrap { position: relative; }
.input-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; font-size: 15px; }
.input-icon-wrap input { padding-left: 36px; }
.btn-toggle-pass { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); padding: 4px; }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.filter-bar .form-group { min-width: 160px; }
.filter-bar label { font-size: 11px; }

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  transition: all var(--tr-fast);
  white-space: nowrap; cursor: pointer;
  border: 1px solid transparent;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm  { padding: 0 12px; font-size: 12px; height: 36px; }
.btn-lg  { padding: 11px 22px; font-size: 14px; }
.btn-full { width: 100%; justify-content: center; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); box-shadow: 0 4px 14px var(--brand-glow); transform: translateY(-1px); }

.btn-secondary { background: var(--bg-hover); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-card); border-color: var(--brand); color: var(--brand); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); }

.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }

.btn-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 16px;
  transition: background var(--tr-fast), color var(--tr-fast);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }

.btn-outline-primary { border: 1px solid var(--brand); color: var(--brand); background: transparent; }
.btn-outline-primary:hover { background: hsl(var(--brand-h),90%,56%,0.1); }

/* ═══════════════════════════════════════════════════════════════════
   BADGES & TAGS
   ═══════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.badge-blue    { background: hsl(220,90%,56%,.15); color: var(--brand); }
.badge-green   { background: hsl(142,72%,45%,.15); color: var(--success); }
.badge-yellow  { background: hsl(38,92%,50%,.15);  color: var(--warning); }
.badge-red     { background: hsl(0,80%,58%,.15);   color: var(--danger); }
.badge-gray    { background: var(--bg-hover);       color: var(--text-muted); }

.badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--topbar-bg);
}

.pos-relative { position: relative; }

/* ═══════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 640px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: slideUp .25s ease;
}
.modal.modal-lg { max-width: 900px; }
.modal.modal-xl { max-width: 1100px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ═══════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 12px;
  min-width: 280px; max-width: 380px;
  animation: slideLeft .3s ease;
  border-left: 4px solid var(--toast-color, var(--brand));
}
.toast.success { --toast-color: var(--success); }
.toast.error   { --toast-color: var(--danger);  }
.toast.warning { --toast-color: var(--warning); }
.toast-icon { font-size: 18px; flex-shrink: 0; color: var(--toast-color, var(--brand)); }
.toast-msg  { font-size: 13px; font-weight: 500; flex: 1; }
.toast.fade-out { opacity: 0; transform: translateX(20px); transition: all .3s ease; }

/* ═══════════════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════════════ */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid var(--border);
  flex-wrap: wrap; gap: 10px;
}
.pagination-info { font-size: 12px; color: var(--text-muted); }
.pagination-btns { display: flex; gap: 4px; }
.page-btn {
  min-width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  transition: background var(--tr-fast), color var(--tr-fast);
  border: 1px solid transparent;
}
.page-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════════════════════════════ */
.loading-spinner {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; padding: 80px 20px;
  color: var(--text-muted);
}
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }

/* ═══════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════ */
@keyframes fadeIn    { from{opacity:0} to{opacity:1} }
@keyframes fadeUp    { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideUp   { from{opacity:0;transform:translateY(30px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideDown { from{opacity:0;transform:translateY(-10px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideLeft { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
@keyframes spin      { to{transform:rotate(360deg)} }

/* ═══════════════════════════════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════════════════════════════ */
.progress-bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--brand); transition: width .5s ease; }
.progress-fill.danger  { background: var(--danger);  }
.progress-fill.warning { background: var(--warning); }
.progress-fill.success { background: var(--success); }

/* ═══════════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════════ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--tr-fast), border-color var(--tr-fast);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .2s ease; }

/* ═══════════════════════════════════════════════════════════════════
   CHART CONTAINERS
   ═══════════════════════════════════════════════════════════════════ */
.chart-wrap { position: relative; padding: 16px; }
.chart-wrap canvas { max-height: 260px; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  #menu-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}
@media (max-width: 560px) {
  .login-card { padding: 28px 20px; }
}
