/* ═══════════════════════════════════════════════════
   MAGNALEX CRM — STYLESHEET
   Paleta: #181f36 (navy), #c2a25b (gold), #f3ebe0 (cream)
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=DM+Sans:wght@300;400;500&display=swap');

/* ─── CSS VARIABLES ─── */
:root {
  --navy:       #181f36;
  --navy-light: #232c4a;
  --navy-mid:   #1e2640;
  --gold:       #c2a25b;
  --gold-light: #d4b878;
  --gold-dim:   rgba(194, 162, 91, 0.15);
  --cream:      #f3ebe0;
  --cream-dim:  rgba(243, 235, 224, 0.06);
  --cream-soft: rgba(243, 235, 224, 0.55);
  --white:      #ffffff;
  --text-main:  #f3ebe0;
  --text-muted: rgba(243, 235, 224, 0.5);
  --text-dim:   rgba(243, 235, 224, 0.3);
  --border:     rgba(194, 162, 91, 0.15);
  --border-soft: rgba(243, 235, 224, 0.08);
  --success:    #5cb88a;
  --warning:    #e8a44b;
  --danger:     #e05c5c;

  --sidebar-w:     240px;
  --sidebar-w-col: 68px;
  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 4px 24px rgba(0,0,0,0.3);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.2);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'DM Sans', sans-serif;

  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font-body);
  background: var(--navy);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea { font-family: inherit; }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy-mid);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--transition);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-w-col);
}

/* SIDEBAR HEADER */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  position: relative;
}

.logo-mark { flex-shrink: 0; display: flex; }

.logo-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition), width var(--transition);
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar-toggle {
  margin-left: auto;
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--gold); background: var(--gold-dim); }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }

/* SIDEBAR NAV */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
  position: relative;
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--cream);
  background: var(--cream-dim);
}

.nav-item.active {
  color: var(--gold);
  background: var(--gold-dim);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
}

.nav-label {
  font-size: 0.875rem;
  font-weight: 400;
  transition: opacity var(--transition);
  overflow: hidden;
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* Tooltip when collapsed */
.sidebar.collapsed .nav-item[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-w-col) - 10px);
  top: 50%; transform: translateY(-50%);
  background: var(--navy-light);
  color: var(--cream);
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}

.nav-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 10px 4px;
}

/* SIDEBAR FOOTER */
.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

.user-info {
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: opacity var(--transition);
}

.sidebar.collapsed .user-info { opacity: 0; }

.user-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  transition: margin-left var(--transition);
  overflow: hidden;
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-w-col);
}

/* ─── TOPBAR ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--navy);
  flex-shrink: 0;
}

.topbar-left { display: flex; flex-direction: column; gap: 1px; }

.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--cream);
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.page-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 300;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  color: var(--text-muted);
  transition: border-color var(--transition);
}

.search-box:focus-within {
  border-color: var(--gold);
  color: var(--gold);
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--cream);
  font-size: 0.82rem;
  width: 160px;
}

.search-box input::placeholder { color: var(--text-dim); }

.search-box--large {
  border-radius: var(--radius-sm);
  padding: 9px 14px;
}

.search-box--large input { width: 260px; font-size: 0.85rem; }

.btn-notification {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: var(--navy-light);
  border: 1px solid var(--border);
  position: relative;
  transition: color var(--transition), border-color var(--transition);
}

.btn-notification:hover { color: var(--cream); border-color: var(--cream-soft); }

.notif-dot {
  position: absolute;
  top: 7px; right: 8px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  border: 1.5px solid var(--navy);
}

.topbar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.73rem;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.04em;
  cursor: pointer;
}

/* ══════════════════════════════════════
   PAGE SYSTEM
══════════════════════════════════════ */
.page {
  display: none;
  padding: 24px 28px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  animation: fadeIn 0.2s ease;
}

.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.card {
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--cream);
  letter-spacing: 0.01em;
}

.card-badge {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid rgba(194,162,91,0.3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-badge--warning {
  background: rgba(232, 164, 75, 0.12);
  color: var(--warning);
  border-color: rgba(232, 164, 75, 0.3);
}

/* ══════════════════════════════════════
   DASHBOARD — KPI GRID
══════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: border-color var(--transition), transform var(--transition);
}

.kpi-card:hover {
  border-color: rgba(194,162,91,0.3);
  transform: translateY(-1px);
}

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg { width: 20px; height: 20px; stroke: currentColor; }

.kpi-icon--gold { background: var(--gold-dim); color: var(--gold); }
.kpi-icon--navy { background: rgba(24,31,54,0.6); color: var(--cream); border: 1px solid var(--border); }

.kpi-body { display: flex; flex-direction: column; gap: 2px; }

.kpi-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  color: var(--cream);
  line-height: 1.1;
}

.kpi-delta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.kpi-delta--up   { color: var(--success); }
.kpi-delta--down { color: var(--danger); }
.kpi-delta--neutral { color: var(--text-muted); }

/* CONTENT GRID */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

.card--wide { margin-bottom: 0; height: 100%; }

/* ACTIVITY LIST */
.activity-list { display: flex; flex-direction: column; gap: 14px; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.activity-dot--gold  { background: var(--gold); }
.activity-dot--green { background: var(--success); }
.activity-dot--blue  { background: #5b8fc2; }

.activity-body { display: flex; flex-direction: column; gap: 2px; }

.activity-text {
  font-size: 0.84rem;
  color: var(--cream);
  line-height: 1.4;
}

.activity-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* HEARING LIST */
.hearing-list { display: flex; flex-direction: column; gap: 12px; }

.hearing-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--cream-dim);
  border: 1px solid var(--border-soft);
  transition: border-color var(--transition);
}

.hearing-item:hover { border-color: var(--border); }

.hearing-date {
  display: flex; flex-direction: column; align-items: center;
  min-width: 36px;
}

.hearing-day {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--gold);
  line-height: 1;
}

.hearing-month {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hearing-info {
  flex: 1;
  display: flex; flex-direction: column; gap: 2px;
}

.hearing-title {
  font-size: 0.84rem;
  color: var(--cream);
  font-weight: 500;
}

.hearing-court {
  font-size: 0.73rem;
  color: var(--text-muted);
}

.hearing-badge {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.hearing-badge--civil        { background: rgba(91,143,194,0.15); color: #5b8fc2; border: 1px solid rgba(91,143,194,0.3); }
.hearing-badge--trabalhista  { background: rgba(232,164,75,0.12); color: var(--warning); border: 1px solid rgba(232,164,75,0.3); }
.hearing-badge--familia      { background: rgba(92,184,138,0.12); color: var(--success); border: 1px solid rgba(92,184,138,0.3); }

/* ══════════════════════════════════════
   CONTATOS PAGE
══════════════════════════════════════ */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; }

/* STATUS BANNER */
.octadesk-status {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(232,164,75,0.08);
  border: 1px solid rgba(232,164,75,0.25);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.octadesk-status.connected {
  background: rgba(92,184,138,0.08);
  border-color: rgba(92,184,138,0.25);
}

.octadesk-status.hidden { display: none; }

.status-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.status-icon svg { width: 18px; height: 18px; stroke: currentColor; }
.status-icon--warning { background: rgba(232,164,75,0.15); color: var(--warning); }
.status-icon--success { background: rgba(92,184,138,0.15); color: var(--success); }

.status-title {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--cream);
  margin-bottom: 2px;
}

.status-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.nav-link-inline { color: var(--gold); border-bottom: 1px solid rgba(194,162,91,0.3); }
.nav-link-inline:hover { border-bottom-color: var(--gold); }

/* TABLE */
.table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table thead tr {
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 12px;
  color: var(--cream);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover { background: var(--cream-dim); }

.contact-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-mini-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid rgba(194,162,91,0.3);
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.contact-full-name { font-weight: 400; }

.status-pill {
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}

.status-pill--active   { background: rgba(92,184,138,0.12); color: var(--success); border: 1px solid rgba(92,184,138,0.3); }
.status-pill--inactive { background: var(--cream-dim); color: var(--text-muted); border: 1px solid var(--border-soft); }
.status-pill--pending  { background: rgba(232,164,75,0.12); color: var(--warning); border: 1px solid rgba(232,164,75,0.25); }

.action-btn {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}

.action-btn:hover { color: var(--gold); background: var(--gold-dim); }

/* EMPTY STATE */
.table-empty td { text-align: center; padding: 40px 20px !important; border: none !important; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-state p {
  font-size: 0.92rem;
  color: var(--cream-soft);
  font-weight: 400;
}

.empty-state span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* TABLE FOOTER */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 1px solid var(--border-soft);
}

.table-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pagination { display: flex; gap: 4px; }

.page-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--cream-dim);
  border: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.page-btn:hover, .page-btn.active {
  color: var(--gold);
  background: var(--gold-dim);
  border-color: rgba(194,162,91,0.3);
}

/* ══════════════════════════════════════
   RELATÓRIOS PAGE
══════════════════════════════════════ */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.report-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition), transform var(--transition);
  cursor: default;
}

.report-card:hover {
  border-color: rgba(194,162,91,0.3);
  transform: translateY(-2px);
}

.report-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--gold-dim);
  display: flex; align-items: center; justify-content: center;
}

.report-icon svg { width: 22px; height: 22px; }

.report-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--cream);
}

.report-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

/* ══════════════════════════════════════
   CONFIGURAÇÕES PAGE
══════════════════════════════════════ */
.settings-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.settings-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--cream-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--cream);
  font-size: 0.87rem;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.form-input:focus { border-color: var(--gold); }
.form-input::placeholder { color: var(--text-dim); }

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper .form-input { padding-right: 40px; }

.input-action {
  position: absolute;
  right: 10px;
  color: var(--text-muted);
  padding: 4px;
  transition: color var(--transition);
}
.input-action:hover { color: var(--gold); }

.input-with-suffix {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition);
}

.input-with-suffix:focus-within { border-color: var(--gold); }

.input-with-suffix .form-input {
  border: none;
  border-radius: 0;
  flex: 1;
}

.input-suffix {
  padding: 10px 12px;
  background: var(--navy-mid);
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.form-actions { display: flex; gap: 10px; }

.connection-feedback {
  font-size: 0.82rem;
  padding: 0;
  min-height: 0;
  transition: all var(--transition);
}

.connection-feedback.success { color: var(--success); }
.connection-feedback.error   { color: var(--danger); }

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 400;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn--primary {
  background: var(--gold);
  color: var(--navy);
  font-weight: 500;
}

.btn--primary:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(194,162,91,0.3);
}

.btn--secondary {
  background: var(--navy-light);
  color: var(--cream-soft);
  border: 1px solid var(--border);
}

.btn--secondary:hover {
  border-color: var(--cream-soft);
  color: var(--cream);
}

.btn--ghost {
  color: var(--gold);
  border: 1px solid rgba(194,162,91,0.3);
  background: transparent;
}

.btn--ghost:hover {
  background: var(--gold-dim);
  border-color: var(--gold);
}

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,13,26,0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 520px;
  max-width: 90vw;
  position: relative;
  animation: modalIn 0.2s ease;
  max-height: 85vh;
  overflow-y: auto;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}

.modal-close:hover { color: var(--cream); background: var(--cream-dim); }

/* LOADER */
.loader-dots {
  display: flex; gap: 6px; align-items: center;
  padding: 20px 0;
}

.loader-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: dotBounce 1.2s ease infinite;
}

.loader-dots span:nth-child(2) { animation-delay: 0.15s; }
.loader-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-w-col); }
  .main-content { margin-left: var(--sidebar-w-col); }
  .sidebar .logo-text, .sidebar .nav-label, .sidebar .user-info { opacity: 0; width: 0; overflow: hidden; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .topbar { padding: 14px 16px; }
  .page { padding: 16px; }
}