/* ============================================================
   AVALYX MOTOR DE CRÉDITO — Global Stylesheet
   Identidade Visual: Azul Marinho + Verde Avalyx
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

/* ── CSS VARIABLES ─────────────────────────────────────────── */
:root {
  --navy:          #1B2952;
  --navy-dark:     #131e3d;
  --navy-mid:      #243461;
  --navy-light:    #2d4080;
  --green:         #2EC27E;
  --green-dark:    #22a066;
  --green-light:   #d6f5e8;
  --green-glow:    rgba(46,194,126,0.18);
  --bg:            #F0F3FA;
  --bg-card:       #FFFFFF;
  --text-primary:  #1B2952;
  --text-secondary:#5a6a8a;
  --text-muted:    #9aaac5;
  --border:        #e2e8f5;
  --border-light:  #eef1f8;
  --danger:        #e53e3e;
  --danger-light:  #fff5f5;
  --warning:       #d97706;
  --warning-light: #fffbeb;
  --shadow-sm:     0 1px 3px rgba(27,41,82,.08), 0 1px 2px rgba(27,41,82,.04);
  --shadow-md:     0 4px 16px rgba(27,41,82,.10), 0 2px 4px rgba(27,41,82,.06);
  --shadow-lg:     0 10px 40px rgba(27,41,82,.14), 0 4px 12px rgba(27,41,82,.08);
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     16px;
  --font:          'Plus Jakarta Sans', sans-serif;
  --font-mono:     'DM Mono', monospace;
  --sidebar-w:     240px;
  --topbar-h:      64px;
  --transition:    all .22s cubic-bezier(.4,0,.2,1);
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: var(--font); }
ul { list-style: none; }

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

/* ============================================================
   LOGIN PAGE — index.html
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* Left panel — brand */
.login-brand {
  background: var(--navy);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(46,194,126,.18) 0%, transparent 70%);
  top: -100px; right: -100px;
  border-radius: 50%;
}

.login-brand::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(46,194,126,.12) 0%, transparent 70%);
  bottom: 60px; left: 20px;
  border-radius: 50%;
}

.brand-logo {
  margin-bottom: 48px;
  position: relative; z-index: 1;
}

.brand-logo img { height: 44px; filter: brightness(0) invert(1); }

.brand-headline {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
  margin-bottom: 20px;
  position: relative; z-index: 1;
}

.brand-headline span { color: var(--green); }

.brand-desc {
  font-size: .95rem;
  color: rgba(255,255,255,.65);
  line-height: 1.75;
  max-width: 380px;
  position: relative; z-index: 1;
}

.brand-features {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative; z-index: 1;
}

.brand-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,.8);
  font-size: .88rem;
  font-weight: 500;
}

.brand-feature-icon {
  width: 32px; height: 32px;
  background: rgba(46,194,126,.2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

/* Right panel — forms */
.login-panel {
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 48px;
  position: relative;
}

.login-panel-inner { width: 100%; max-width: 420px; }

/* Tab switcher */
.login-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 36px;
  gap: 2px;
}

.login-tab {
  flex: 1;
  padding: 10px 12px;
  border-radius: calc(var(--radius) - 2px);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  transition: var(--transition);
  text-align: center;
  line-height: 1.3;
}

.login-tab.active {
  background: #fff;
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

.login-tab:hover:not(.active) { color: var(--navy); }

/* Form panel */
.login-form-panel { display: none; }
.login-form-panel.active { display: block; }

.login-form-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
}

.login-form-subtitle {
  font-size: .85rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

/* Mode badge */
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.mode-badge.dev { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.mode-badge.prod { background: var(--green-light); color: var(--green-dark); border: 1px solid var(--green); }

/* ── FORM ELEMENTS ──────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text-primary);
  background: #fff;
  transition: var(--transition);
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}

.form-control.error { border-color: var(--danger); }
.form-control.error:focus { box-shadow: 0 0 0 3px rgba(229,62,62,.14); }

.form-control::placeholder { color: var(--text-muted); }

.form-control-icon {
  position: relative;
}
.form-control-icon .form-control { padding-left: 40px; }
.form-control-icon .icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a6a8a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field-hint {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.field-error {
  font-size: .75rem;
  color: var(--danger);
  margin-top: 5px;
  display: none;
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 12px rgba(46,194,126,.35);
}
.btn-primary:hover { background: var(--green-dark); box-shadow: 0 6px 20px rgba(46,194,126,.45); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--navy); background: var(--bg); }

.btn-navy {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 12px rgba(27,41,82,.25);
}
.btn-navy:hover { background: var(--navy-dark); transform: translateY(-1px); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #c53030; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover { background: var(--bg); color: var(--navy); }

.btn-sm { padding: 7px 14px; font-size: .8rem; }
.btn-lg { padding: 13px 28px; font-size: .95rem; }
.btn-block { width: 100%; }

.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* Spinner in button */
.btn .spinner-border {
  width: 14px; height: 14px;
  border-width: 2px;
}

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: 18px;
  display: none;
  align-items: flex-start;
  gap: 10px;
}
.alert.show { display: flex; }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(229,62,62,.2); }
.alert-success { background: var(--green-light); color: var(--green-dark); border: 1px solid rgba(46,194,126,.2); }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(217,119,6,.2); }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid rgba(59,130,246,.2); }

/* ============================================================
   APP SHELL — app.html
   ============================================================ */

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo img {
  height: 34px;
  filter: brightness(0) invert(1);
}

.sidebar-user {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255,255,255,.06);
  border-radius: var(--radius-sm);
}

.sidebar-user-name {
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-empresa {
  font-size: .73rem;
  color: rgba(255,255,255,.5);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  background: var(--green-glow);
  border: 1px solid rgba(46,194,126,.35);
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--green);
}

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

.nav-section-label {
  font-size: .68rem;
  font-weight: 700;
  color: rgba(255,255,255,.3);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 6px;
  margin-top: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.65);
  font-size: .87rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  user-select: none;
}

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

.nav-item.active {
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 14px rgba(46,194,126,.35);
}

.nav-item .nav-icon {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: rgba(46,194,126,.2);
  color: var(--green);
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
}

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

.nav-item.logout {
  color: rgba(255,255,255,.45);
}
.nav-item.logout:hover {
  background: rgba(229,62,62,.15);
  color: #fc8181;
}

/* Session timer */
.session-timer {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.05);
  margin-bottom: 8px;
  font-size: .75rem;
  color: rgba(255,255,255,.5);
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-timer.warning {
  background: rgba(217,119,6,.2);
  color: #fcd34d;
  animation: pulse-warn 2s ease-in-out infinite;
}

@keyframes pulse-warn {
  0%, 100% { opacity: 1; }
  50% { opacity: .7; }
}

/* ── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 28px 0 calc(var(--sidebar-w) + 28px);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 99;
  box-shadow: var(--shadow-sm);
}

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

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

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

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

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--navy);
  font-size: 1.2rem;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}

/* ── MAIN CONTENT ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  padding: 28px;
  min-height: calc(100vh - var(--topbar-h));
}

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.card-subtitle {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body { padding: 24px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── PAGE HEADER ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
}

.page-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.navy::before { background: var(--navy); }
.stat-card.green::before { background: var(--green); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }

.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 14px;
}
.stat-icon.navy { background: rgba(27,41,82,.08); color: var(--navy); }
.stat-icon.green { background: var(--green-light); color: var(--green-dark); }
.stat-icon.warning { background: #fef3c7; color: var(--warning); }
.stat-icon.danger { background: #fee2e2; color: var(--danger); }

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}

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

.chart-container { position: relative; }

/* ── FORM PAGE ──────────────────────────────────────────────── */
.form-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  margin-bottom: 20px;
}

.form-section-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

/* Radio group */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-option {
  position: relative;
}

.radio-option input[type=radio] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  user-select: none;
}

.radio-label .radio-dot {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}

.radio-option input:checked + .radio-label {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--navy);
}

.radio-option input:checked + .radio-label .radio-dot {
  border-color: var(--green);
  background: var(--green);
}

.radio-option input:checked + .radio-label .radio-dot::after {
  content: '';
  width: 6px; height: 6px;
  background: #fff;
  border-radius: 50%;
}

/* ── RESULT PANEL ───────────────────────────────────────────── */
.result-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: none;
}

.result-panel.show { display: block; animation: slideUp .3s ease; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  padding: 20px 24px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-title {
  font-size: 1rem;
  font-weight: 700;
}

.result-iframe-wrap {
  background: #f8f9fc;
}

.result-iframe {
  width: 100%;
  border: none;
  display: block;
  min-height: 400px;
}

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

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
}

table.data-table th {
  padding: 11px 14px;
  background: var(--bg);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

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

table.data-table tr:hover td { background: var(--bg); }

.font-mono { font-family: var(--font-mono); font-size: .82rem; }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}

.badge-paga-dia { background: var(--green-light); color: var(--green-dark); }
.badge-primeira { background: #eff6ff; color: #1e40af; }
.badge-atraso   { background: #fee2e2; color: #b91c1c; }
.badge-info     { background: #f0f9ff; color: #0369a1; }

/* ── PAGINATION ─────────────────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
  flex-wrap: wrap;
  gap: 10px;
}

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

.pagination-btns { display: flex; gap: 6px; }

.page-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: .82rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.page-btn:hover { border-color: var(--navy); color: var(--navy); }
.page-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── FILTERS ────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  align-items: flex-end;
}

.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-label { font-size: .72rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }
.filter-input {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .83rem;
  color: var(--text-primary);
  background: #fff;
  min-width: 140px;
  transition: var(--transition);
}
.filter-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-glow); }

/* ── LOADING SPINNER ────────────────────────────────────────── */
.spinner-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 14px;
}

.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-text { font-size: .85rem; color: var(--text-muted); font-weight: 500; }

/* Inline spinner */
.spinner-sm {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-icon { font-size: 3rem; margin-bottom: 14px; opacity: .4; }
.empty-title { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.empty-desc { font-size: .85rem; color: var(--text-muted); }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  animation: scaleIn .25s cubic-bezier(.34,1.56,.64,1);
  text-align: center;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(.88); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-icon { font-size: 2.5rem; margin-bottom: 14px; }
.modal-title { font-size: 1.2rem; font-weight: 800; color: var(--navy); margin-bottom: 8px; }
.modal-desc { font-size: .88rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* Session expiry */
.session-modal .modal-icon { color: var(--warning); }

/* ── TOAST ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px; right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 13px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 280px;
  max-width: 380px;
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1);
  border-left: 3px solid var(--green);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast-icon { font-size: 1.1rem; margin-top: 1px; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-title { font-size: .83rem; font-weight: 700; color: var(--navy); }
.toast-msg { font-size: .78rem; color: var(--text-secondary); margin-top: 2px; }

/* ── TABS ───────────────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0 20px;
  overflow-x: auto;
}

.tab-btn {
  padding: 14px 20px;
  font-size: .87rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}

.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--navy); border-bottom-color: var(--green); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── DETAIL CARDS ───────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 24px;
}

.detail-item {}
.detail-item-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}
.detail-item-value {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { padding: 40px 28px; }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.show { display: block; }

  .hamburger { display: flex; }

  .topbar {
    padding-left: 20px;
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .charts-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; }
  .filter-input { min-width: unset; width: 100%; }
}

/* ── UTILITIES ──────────────────────────────────────────────── */
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-navy { color: var(--navy); }
.text-danger { color: var(--danger); }
.fw-700 { font-weight: 700; }
.fs-sm { font-size: .8rem; }
.w-100 { width: 100%; }
