/* ============================================================
   PÓS-OBRA — Design System
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary:       #2563EB;
  --primary-light: #3B82F6;
  --primary-dark:  #1D4ED8;
  --accent:        #0EA5E9;
  --success:       #10B981;
  --warning:       #F59E0B;
  --danger:        #EF4444;
  --info:          #6366F1;

  --bg:            #F8FAFC;
  --surface:       #FFFFFF;
  --surface2:      #F1F5F9;
  --border:        #E2E8F0;
  --border-strong: #CBD5E1;

  --text:          #0F172A;
  --text-muted:    #64748B;
  --text-light:    #94A3B8;

  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        10px;
  --radius-lg:     16px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
  --transition:    .18s ease;
}


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

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
  opacity: 0; visibility: hidden;
  transition: all var(--transition);
}
.sidebar-backdrop.open { opacity: 1; visibility: visible; }

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: grid; place-items: center;
  color: #fff; font-size: 18px;
}
.sidebar-logo-text { font-weight: 700; font-size: .95rem; color: var(--text); line-height: 1.2; }
.sidebar-logo-sub  { font-size: .7rem; color: var(--text-muted); font-weight: 400; }

.sidebar-section { padding: 14px 12px 4px; }
.sidebar-section-label {
  font-size: .65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-light); padding: 0 8px; margin-bottom: 4px;
}

.sidebar-nav { list-style: none; }
.sidebar-nav a,
.sidebar-nav-group-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  text-decoration: none; color: var(--text-muted);
  font-size: .875rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
  width: 100%;
}
.sidebar-nav-group-toggle {
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.sidebar-nav a:hover,
.sidebar-nav-group-toggle:hover { background: var(--surface2); color: var(--text); }
.sidebar-nav a.active,
.sidebar-nav-group-toggle.active { background: #EFF6FF; color: var(--primary); }
.sidebar-nav a .nav-icon,
.sidebar-nav-group-toggle .nav-icon { width: 20px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.sidebar-nav .nav-label { flex: 1; min-width: 0; }
.sidebar-nav .nav-chevron {
  margin-left: auto;
  font-size: 1rem;
  transition: transform var(--transition);
}
.sidebar-nav-group.open .nav-chevron { transform: rotate(180deg); }
.sidebar-subnav {
  display: none;
  list-style: none;
  margin: 2px 0 6px 0;
  padding-left: 18px;
}
.sidebar-nav-group.open .sidebar-subnav { display: block; }
.sidebar-subnav a {
  padding: 8px 10px 8px 12px;
  font-size: .82rem;
}
.sidebar-nav-spaced { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.sidebar-nav .nav-badge {
  margin-left: auto; background: var(--danger);
  color: #fff; border-radius: 100px;
  font-size: .68rem; font-weight: 700; padding: 1px 7px;
}

.sidebar-footer {
  margin-top: auto; padding: 14px 12px;
  border-top: 1px solid var(--border);
}
.sidebar-legal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--text-light);
  font-size: .72rem;
}
.sidebar-legal-links a {
  color: var(--text-muted);
  text-decoration: none;
}
.sidebar-legal-links a:hover { color: var(--primary); text-decoration: underline; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px;
  text-decoration: none; color: var(--text);
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--surface2); }
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .7rem; color: var(--text-muted); }

/* Topbar */
.topbar {
  position: fixed; top: 0;
  left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; z-index: 100;
  transition: left var(--transition);
}
.topbar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.25rem; padding: 4px;
}
.topbar-title { font-size: 1rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center;
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: all var(--transition); font-size: .95rem;
}
.topbar-btn:hover { background: var(--surface2); color: var(--text); }

/* Search bar */
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  flex: 0 1 280px;
}
.topbar-search input {
  border: none; background: transparent; outline: none;
  font-size: .875rem; color: var(--text); width: 100%;
  font-family: inherit;
}
.topbar-search .search-icon { color: var(--text-light); font-size: .9rem; }

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

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 1.4rem; font-weight: 700; }
.page-subtitle { font-size: .85rem; color: var(--text-muted); margin-top: 2px; }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.card-title { font-size: .95rem; font-weight: 600; }
.card-body   { }

/* Legal pages */
.legal-layout {
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.legal-summary {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  padding: 16px;
}
.legal-summary a {
  display: block;
  padding: 7px 0;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .84rem;
}
.legal-summary a:hover { color: var(--primary); }
.legal-content {
  max-width: 900px;
}
.legal-content h2 {
  font-size: 1.02rem;
  margin: 22px 0 8px;
}
.legal-content h2:first-child { margin-top: 0; }
.legal-content p {
  color: var(--text-muted);
  margin-bottom: 12px;
}
.legal-content a { color: var(--primary); }

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

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.kpi-icon.blue   { background: #EFF6FF; color: var(--primary); }
.kpi-icon.green  { background: #ECFDF5; color: var(--success); }
.kpi-icon.yellow { background: #FFFBEB; color: var(--warning); }
.kpi-icon.red    { background: #FEF2F2; color: var(--danger); }
.kpi-icon.purple { background: #EEF2FF; color: var(--info); }
.kpi-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.kpi-label { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 8px;
  font-size: .875rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; text-decoration: none;
  transition: all var(--transition); white-space: nowrap;
  font-family: inherit;
}
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { background: #059669; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-danger:hover   { background: #DC2626; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-warning:hover  { background: #D97706; }
.btn-outline  { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover  { background: var(--surface2); }
.btn-ghost    { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover    { background: var(--surface2); color: var(--text); }
.btn-sm  { padding: 5px 12px; font-size: .8rem; }
.btn-lg  { padding: 11px 22px; font-size: .95rem; }
.btn-icon{ padding: 8px; }

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

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface2); }
th {
  padding: 11px 14px; text-align: left;
  font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 14px; font-size: .875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--surface2); }

/* ── FORMS ───────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 16px; }
.form-full { grid-column: 1/-1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: .82rem; font-weight: 500; color: var(--text); }
.required::after { content: ' *'; color: var(--danger); }

input, select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px; font-size: .875rem;
  font-family: inherit; color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
input[type="checkbox"], input[type="radio"] {
  width: auto;
  flex: 0 0 auto;
  box-shadow: none;
}
textarea { resize: vertical; min-height: 90px; }
select   { cursor: pointer; }
.form-hint { font-size: .75rem; color: var(--text-muted); }

/* ── FILTER BAR ──────────────────────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px;
}
.filter-bar select, .filter-bar input { width: auto; flex: 1; min-width: 140px; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 16px;
  opacity: 0; visibility: hidden; transition: all var(--transition);
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 540px;
  box-shadow: var(--shadow-lg);
  transform: scale(.96); transition: transform var(--transition);
  max-height: 90vh; overflow-y: auto;
}
.modal-backdrop.open .modal { transform: scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem; padding: 4px;
  border-radius: 6px; transition: background var(--transition);
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body   { padding: 20px 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── TIMELINE ────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 10px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
  position: absolute; left: -24px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--surface); background: var(--primary);
  box-shadow: 0 0 0 3px var(--border);
}
.timeline-dot.success { background: var(--success); }
.timeline-dot.warning { background: var(--warning); }
.timeline-dot.danger  { background: var(--danger); }
.timeline-date { font-size: .75rem; color: var(--text-muted); margin-bottom: 4px; }
.timeline-card {
  background: var(--surface2); border-radius: 8px;
  padding: 12px 14px; border: 1px solid var(--border);
}
.timeline-card p { font-size: .85rem; margin-top: 4px; color: var(--text-muted); }

/* ── ALERTS / FLASH ──────────────────────────────────────── */
.alert {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: 8px;
  font-size: .875rem; margin-bottom: 16px; border: 1px solid transparent;
}
.alert-success { background: #ECFDF5; color: #065F46; border-color: #A7F3D0; }
.alert-error   { background: #FEF2F2; color: #991B1B; border-color: #FCA5A5; }
.alert-warning { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border-color: #BFDBFE; }
.alert-close   { margin-left: auto; cursor: pointer; background: none; border: none; font-size: 1rem; color: inherit; opacity: .7; }

/* Cookie notice */
.cookie-notice {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  max-width: 980px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  z-index: 9999;
}
.cookie-notice[hidden] { display: none; }
.cookie-notice-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text-muted);
  font-size: .82rem;
  line-height: 1.4;
}
.cookie-notice-text strong {
  color: var(--text);
  font-size: .9rem;
}
.cookie-notice-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── UPLOAD ZONE ─────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius); padding: 30px;
  text-align: center; cursor: pointer;
  transition: all var(--transition); color: var(--text-muted);
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--primary); background: #EFF6FF; color: var(--primary); }
.upload-zone input { display: none; }
.upload-previews { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.upload-preview {
  position: relative; width: 80px; height: 80px;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--border);
}
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview-del {
  position: absolute; top: 2px; right: 2px;
  background: rgba(0,0,0,.6); color: #fff;
  border: none; border-radius: 50%; width: 18px; height: 18px;
  cursor: pointer; font-size: .7rem; display: grid; place-items: center;
}

/* Photo gallery */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); gap: 10px; }
.photo-item {
  border-radius: 8px; overflow: hidden; aspect-ratio: 1;
  border: 1px solid var(--border); cursor: pointer;
  transition: transform var(--transition);
}
.photo-item:hover { transform: scale(1.04); }
.photo-item img   { width: 100%; height: 100%; object-fit: cover; }

/* ── PAGINATION ──────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 4px;
  justify-content: center; margin-top: 20px; flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 8px;
  font-size: .82rem; font-weight: 500; text-decoration: none;
  border: 1px solid var(--border); color: var(--text-muted);
  transition: all var(--transition);
}
.pagination a:hover    { background: var(--surface2); color: var(--text); }
.pagination .active    { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled  { opacity: .4; pointer-events: none; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: .875rem; }

/* ── CHARTS ──────────────────────────────────────────────── */
.chart-container { position: relative; height: 260px; }

/* ── STATUS CHIPS ────────────────────────────────────────── */
.status-flow {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 14px 0; margin-bottom: 16px;
}
.status-step {
  padding: 6px 14px; border-radius: 100px; font-size: .78rem;
  font-weight: 600; border: 1.5px solid transparent;
  cursor: pointer; transition: all var(--transition);
}
.status-step.current { box-shadow: 0 0 0 3px rgba(37,99,235,.2); }

/* ── TABS ────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); gap: 0; margin-bottom: 20px; }
.tab {
  padding: 10px 18px; font-size: .875rem; font-weight: 500;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: all var(--transition); margin-bottom: -1px;
}
.tab:hover  { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  html { font-size: 15px; } /* Slightly scale down root size on small screens but keep inputs 16px to prevent zoom */
  input, select, textarea { font-size: 16px !important; }
  .sidebar { transform: translateX(-260px); width: 260px; }
  .sidebar.open { transform: translateX(0); }
  .topbar { left: 0; }
  .topbar-toggle { display: grid; }
  .topbar-search { display: none; }
  .topbar-actions { gap: 6px; }
  .hide-mobile { display: none !important; }
  .table-wrap table { min-width: 700px !important; }
  .dashboard-grid,
  .dashboard-grid-equal,
  .dashboard-grid-2-1,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  #install-app-btn {
    position: fixed;
    right: 16px;
    bottom: 76px;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    background: var(--surface);
  }
  .main { margin-left: 0; padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .legal-layout { grid-template-columns: 1fr; }
  .legal-summary { position: static; }
  .cookie-notice { flex-direction: column; align-items: flex-start; }
  .cookie-notice-actions { width: 100%; justify-content: flex-start; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 1.25rem; }
  .page-subtitle { font-size: .8rem; }
  .card { padding: 16px; }
  .card-title { font-size: .9rem; }
  .btn { min-height: 38px; padding: 7px 14px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .table-wrap table { min-width: 600px; }
}

/* ── UTILITIES ───────────────────────────────────────────── */
.flex    { display: flex; }
.flex-1  { flex: 1; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.gap-20  { gap: 20px; }
.grid-2  { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.grid-3  { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.dashboard-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; margin-bottom: 20px; }
.dashboard-grid-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.dashboard-grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }
.mt-4    { margin-top: 4px; }
.mt-8    { margin-top: 8px; }
.mt-16   { margin-top: 16px; }
.mt-24   { margin-top: 24px; }
.mb-16   { margin-bottom: 16px; }
.mb-24   { margin-bottom: 24px; }
.text-sm    { font-size: .825rem; }
.text-xs    { font-size: .75rem; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }
.truncate   { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.divider    { height: 1px; background: var(--border); margin: 16px 0; }
.hidden     { display: none !important; }

/* ── SCROLL TOP ── */
.scroll-top { position: fixed; bottom: 24px; right: 24px; width: 44px; height: 44px; background: var(--primary); color: #fff; border: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transition: all .2s; z-index: 100; }
.scroll-top.visible { opacity: 1; visibility: visible; }
.scroll-top:hover { transform: translateY(-4px); background: #1D4ED8; }

/* ── ACCESSIBILITY & FOCUS ── */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── ANIMATIONS ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.main, .card, .kpi-card { animation: fadeIn .22s ease; }

/* ── OTHER UI ── */
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); position: absolute; top: 6px; right: 6px; border: 2px solid var(--surface); }
.progress { background: var(--surface2); border-radius: 100px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 100px; transition: width .4s ease; }

[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%);
  background: #1E293B; color: #fff; font-size: .72rem;
  padding: 4px 8px; border-radius: 5px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
  z-index: 99;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── PRINT ── */
@media print {
  .sidebar, .topbar, .btn, .filter-bar, .no-print, #sidebar-toggle, .scroll-top, .pagination { display: none !important; }
  .app-layout { grid-template-columns: 1fr; padding: 0; display: block; }
  .main { margin: 0; padding: 0; background: #fff; }
  .card { box-shadow: none; border: 1px solid #eee; break-inside: avoid; margin-bottom: 20px; }
  body { background: #fff; color: #000; font-size: 10pt; }
  a { text-decoration: none; color: #000; }
  .table-wrap { overflow: visible; }
  table { border-collapse: collapse; width: 100%; }
  th, td { border: 1px solid #ddd; padding: 8px; }
}
/* ── DROPDOWNS ───────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
  display: none; position: absolute; right: 0; top: calc(100% - 1px);
  background-color: var(--surface); min-width: 180px;
  box-shadow: var(--shadow-lg); border-radius: 8px;
  border: 1px solid var(--border); z-index: 300;
  margin-top: 0; overflow: hidden;
}
.dropdown-content a {
  color: var(--text); padding: 10px 14px;
  text-decoration: none; display: flex; align-items: center; gap: 10px;
  font-size: .85rem; transition: background var(--transition);
}
.dropdown-content a:hover { background-color: var(--surface2); }
.dropdown.open .dropdown-content,
.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content { display: block; }
.dropdown.open .btn-outline,
.dropdown:hover .btn-outline,
.dropdown:focus-within .btn-outline { background: var(--surface2); }
