:root {
  --bg: #0b1220;
  --surface: #111827;
  --surface2: #1a2332;
  --border: #243044;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* Auth */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, #1e3a5f 0%, var(--bg) 60%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

.auth-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: .9rem; margin-bottom: 24px; }

.auth-foot {
  margin-top: 16px;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
}

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }

input, select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius);
  font: inherit;
  margin-bottom: 14px;
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"],
input[type="datetime-local"],
input[type="time"] {
  min-height: 44px;
  line-height: 1.2;
  color-scheme: dark;
  position: relative;
  display: block;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: start;
  min-height: 1.2em;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.75;
  filter: invert(0.85);
  padding: 4px;
}

select.input-select,
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field-date,
.field-text,
.field-select {
  margin-bottom: 0;
}

.field-date label,
.field-text label,
.field-select label {
  display: block;
}

.grid-2 .field-date,
.grid-2 .field-text,
.grid-2 .field-select {
  min-width: 0;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}

textarea { min-height: 72px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.auth-card .btn-primary { width: 100%; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:focus-visible,
.nav-item:focus-visible,
.link-btn:focus-visible,
.profile-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.35);
}

.nav-item:focus-visible { border-left-color: var(--accent); }
.profile-card:focus-visible { border-color: var(--accent); }

.msg { padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; font-size: .9rem; }
.msg-error { background: rgba(239,68,68,.15); color: #fca5a5; }
.msg-ok { background: rgba(34,197,94,.15); color: #86efac; }

.link-btn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font: inherit; text-decoration: underline;
  border-radius: 4px; padding: 2px 4px;
}
.link-btn:hover { color: var(--accent-hover); }

.auth-inline-links { margin-top: 8px; display: block; }
.auth-inline-links .link-btn { padding: 0; }
.auth-form-disabled { opacity: 0.55; pointer-events: none; }

/* App shell */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
}

.brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.brand h2 { font-size: 1.1rem; }
.brand span { font-size: .75rem; color: var(--muted); }

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item.active { color: #fff; background: var(--surface2); border-left-color: var(--accent); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar h1 { font-size: 1.25rem; }

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .85rem;
}

.role-tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .75rem;
  color: var(--muted);
  text-transform: capitalize;
}

.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--role-color, #64748b) 16%, transparent);
  color: var(--role-color, #94a3b8);
  border: 1px solid color-mix(in srgb, var(--role-color, #64748b) 35%, transparent);
  white-space: nowrap;
}

.org-hierarchy {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.org-tier {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--role-color) 10%, var(--surface2));
  border: 1px solid color-mix(in srgb, var(--role-color) 30%, var(--border));
  font-size: 0.82rem;
  font-weight: 600;
}

.org-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--role-color);
  flex-shrink: 0;
}

.org-role { color: var(--text); }

@media (max-width: 640px) {
  .org-hierarchy { flex-direction: column; align-items: stretch; }
}

.content { padding: 24px; overflow: auto; flex: 1; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.stat-card .val { font-size: 1.75rem; font-weight: 700; }
.stat-card .lbl { color: var(--muted); font-size: .85rem; margin-top: 4px; }

/* Table */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.toolbar input, .toolbar select { margin-bottom: 0; width: auto; min-width: 160px; }
.toolbar-wrap { justify-content: space-between; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.inline-label { display: flex; flex-direction: column; gap: 4px; font-size: .75rem; color: var(--muted); }
.actions-cell select { min-width: 140px; font-size: .85rem; padding: 6px 8px; }

.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px 16px;
  margin: 0 0 16px;
  background: var(--surface2);
}
.form-section legend {
  padding: 0 8px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.modal-sub { margin: -8px 0 16px; color: var(--muted); font-size: .9rem; }
.check-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: .9rem; cursor: pointer; }
.modal select { width: 100%; margin-bottom: 0; }

.phase-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--phase-color) 18%, transparent);
  color: var(--phase-color);
  border: 1px solid color-mix(in srgb, var(--phase-color) 35%, transparent);
  white-space: nowrap;
}

.phase-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.phase-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .8rem;
  cursor: pointer;
}
.phase-pill.active {
  border-color: var(--phase-color, var(--accent));
  background: color-mix(in srgb, var(--phase-color, var(--accent)) 12%, var(--surface));
  color: var(--phase-color, var(--accent));
  font-weight: 600;
}

.client-pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow: auto; }
.client-pick-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--text);
}
.client-pick-row:hover { border-color: var(--accent); }
.client-pick-row span { font-size: .85rem; color: var(--muted); }

/* Import / file drop */
.import-modal .import-actions-row { margin-bottom: 12px; }
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  cursor: pointer;
  text-align: center;
  margin-bottom: 16px;
  transition: border-color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.file-drop:hover,
.file-drop.drag-over,
.file-drop.has-file {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface2));
}
.file-drop-icon { font-size: 2rem; line-height: 1; }
.file-drop strong { color: var(--text); }
.file-drop span { font-size: .85rem; color: var(--muted); }
.file-drop-name { font-size: .9rem; color: var(--accent); font-weight: 600; }
.import-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: .8rem;
}
.import-divider::before,
.import-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.import-paste {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  min-height: 120px;
}

/* Safari / iOS safe areas & touch */
@supports (-webkit-touch-callout: none) {
  input, select, textarea, .btn { font-size: 16px; }
  @media (max-width: 900px) {
    input[type="date"] { min-height: 48px; }
  }
}

/* Performance: contain layout on heavy lists */
.table-wrap { contain: inline-size; }
.profile-grid { contain: layout style; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

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

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th { background: var(--surface2); color: var(--muted); font-weight: 600; position: sticky; top: 0; }

tr:hover td { background: rgba(59,130,246,.05); }

.actions { display: flex; gap: 6px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
}

.modal h3 { margin-bottom: 16px; }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }
  .content { padding: 16px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input, .toolbar select { width: 100%; min-width: 0; }
  th, td { white-space: normal; min-width: 100px; }
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s;
}

.profile-card:hover { border-color: var(--accent); }
.profile-card h4 { margin-bottom: 8px; font-size: 1rem; }
.profile-card p { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.pager span { color: var(--muted); font-size: .85rem; }

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-icon { font-size: 2rem; margin-bottom: 8px; opacity: 0.5; }
.empty-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-hint { font-size: .85rem; }

.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px;
  color: var(--muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.modal-wide { max-width: 640px; }

.table-empty td {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px;
  white-space: normal;
}

.chart-list { list-style: none; }
.chart-list li {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.chart-list-empty {
  justify-content: center;
  color: var(--muted);
  font-style: italic;
  border-bottom: none;
  padding: 16px 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.panel h3 { margin-bottom: 12px; font-size: 1rem; }

/* ── Slide-out sidebar (mobile / tablet) ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  backdrop-filter: blur(2px);
}

.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-close { display: none; }
.menu-toggle { display: none; }

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-left h1 {
  font-size: 1.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.lang-toggle { width: 100%; }

@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .sidebar-close { display: inline-flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 88vw);
    z-index: 210;
    padding: 16px 0;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
  }

  body.sidebar-open .sidebar { transform: translateX(0); }

  body.rtl .sidebar {
    left: auto;
    right: 0;
    transform: translateX(105%);
  }
  body.rtl.sidebar-open .sidebar { transform: translateX(0); }

  .main { width: 100%; }
}

@media (min-width: 901px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }
  .sidebar-foot { margin-top: auto; }
}

/* ── Profile cards & contacts ── */
.profile-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 140px;
}

.profile-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge-active { color: #86efac; border-color: rgba(34, 197, 94, 0.35); }
.badge-emirate { color: #93c5fd; border-color: rgba(59, 130, 246, 0.35); }

.profile-card h4 {
  line-height: 1.35;
  word-break: break-word;
}

.profile-card-meta {
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-word;
}

.profile-card-contacts {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 1rem;
  transition: border-color 0.15s, background 0.15s;
}

.mini-chip:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
}

.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.contact-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  word-break: break-all;
  transition: border-color 0.15s;
}

.contact-chip:hover { border-color: var(--accent); }
.contact-email { border-left: 3px solid #3b82f6; }
.contact-phone { border-left: 3px solid #22c55e; }

body.rtl .contact-email,
body.rtl .contact-phone { border-left: none; border-right: 3px solid; }
body.rtl .contact-email { border-right-color: #3b82f6; }
body.rtl .contact-phone { border-right-color: #22c55e; }

.profile-analytics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin: 16px 0;
  padding: 14px;
  background: var(--surface2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.profile-analytics .pa-val {
  font-size: 1.25rem;
  font-weight: 700;
}

.profile-analytics .pa-lbl {
  font-size: 0.75rem;
  color: var(--muted);
}

.profile-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 12px 0;
  font-size: 0.9rem;
}

.profile-detail-grid dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.profile-detail-grid dd {
  margin: 0 0 8px;
  word-break: break-word;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.filters-row select {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0;
}

/* Mobile tracker cards */
.tracker-cards { display: none; }

@media (max-width: 768px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-detail-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap.desktop-table { display: none; }
  .tracker-cards { display: block; }

  .tracker-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
  }

  .tracker-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
  }

  .tracker-card-head strong { font-size: 1rem; }

  .tracker-card-row {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 4px;
  }

  .tracker-card-row span { color: var(--text); }

  .tracker-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }

  .user-badge {
    font-size: 0.8rem;
    gap: 8px;
  }

  .role-tag { display: none; }

  .modal {
    max-height: 95vh;
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
    align-self: flex-end;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
}

/* RTL tweaks */
body.rtl .nav-item {
  text-align: right;
  border-left: none;
  border-right: 3px solid transparent;
}

body.rtl .nav-item.active {
  border-right-color: var(--accent);
}

body.rtl .sidebar-head,
body.rtl .topbar-left {
  flex-direction: row-reverse;
}

body.rtl .user-badge {
  flex-direction: row-reverse;
}

@media (max-width: 768px) {
  body.rtl .nav-item {
    border-right: none;
    border-bottom: 3px solid transparent;
  }
  body.rtl .nav-item.active {
    border-bottom-color: var(--accent);
  }
}

/* ── Super Admin analytics ── */
.super-admin { max-width: 1400px; }

.super-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 55%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 20px;
}

.super-hero-brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.super-logo { font-size: 1.75rem; font-weight: 800; letter-spacing: 0.06em; color: #fff; }
.super-hero-sub { font-size: 0.85rem; color: #93c5fd; text-transform: uppercase; letter-spacing: 0.08em; }
.super-hero-desc { margin-top: 8px; color: #cbd5e1; font-size: 0.95rem; }

.super-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.super-tab {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.super-tab:hover { color: var(--text); border-color: var(--muted); }
.super-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.super-toolbar { margin-bottom: 16px; }

.super-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.super-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  border-top: 3px solid var(--border);
}

.super-kpi.accent-blue { border-top-color: #3b82f6; }
.super-kpi.accent-green { border-top-color: #22c55e; }
.super-kpi.accent-gold { border-top-color: #f59e0b; }
.super-kpi.accent-teal { border-top-color: #14b8a6; }
.super-kpi.accent-red { border-top-color: #ef4444; }

.super-kpi-val {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.super-kpi-lbl {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.super-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-panel h3 { margin-bottom: 14px; font-size: 0.95rem; }
.panel-count { font-weight: 400; color: var(--muted); font-size: 0.85rem; }

.chart-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 24px 0;
  text-align: center;
}

.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 2fr auto;
  gap: 10px;
  align-items: center;
  font-size: 0.8rem;
}

.bar-label {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 10px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
  transition: width .3s ease;
}

.bar-val { font-weight: 600; font-size: 0.75rem; white-space: nowrap; }

.donut-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  justify-content: center;
}

.donut-svg-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.donut-svg { width: 100%; height: 100%; }

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-center-val { font-size: 1.5rem; font-weight: 700; }
.donut-center-sub { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; }

.donut-legend {
  list-style: none;
  font-size: 0.8rem;
  flex: 1;
  min-width: 120px;
}

.donut-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
}

.donut-legend strong { color: var(--text); margin-left: auto; }
.donut-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.line-chart { width: 100%; }
.line-svg { width: 100%; height: 80px; display: block; }
.line-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 6px;
  gap: 4px;
}

.line-labels span { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; }

.table-empty { text-align: center; color: var(--muted); padding: 24px !important; }

@media (max-width: 640px) {
  .super-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .super-charts-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr; gap: 4px; }
  .bar-val { text-align: left; }
}
