/* ============================================================
   SOCIAL TRADE PRO — FIBONIQ-INSPIRED DESIGN
   All colors driven by CSS variables — change in :root only
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── CSS VARIABLES — LIGHT THEME ────────────────────────── */
:root {
  --primary:        #F97316;
  --primary-dark:   #EA6C0A;
  --primary-light:  #FFF7ED;
  --primary-border: #FED7AA;
  --primary-rgb:    249, 115, 22;

  --sidebar-bg:     #1E293B;
  --sidebar-hover:  #334155;
  --sidebar-active: rgba(249,115,22,.15);
  --sidebar-text:   #94A3B8;
  --sidebar-text-active: #F97316;
  --sidebar-width:  260px;

  --bg-page:        #F1F5F9;
  --bg-card:        #FFFFFF;
  --bg-input:       #FFFFFF;
  --bg-sidebar-item:#00000000;

  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;
  --text-label:     #64748B;

  --border:         #E2E8F0;
  --border-input:   #CBD5E1;
  --border-focus:   var(--primary);

  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      14px;
  --radius-xl:      20px;
  --radius-full:    999px;

  --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:         0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-md:      0 10px 15px -3px rgba(0,0,0,.07), 0 4px 6px -2px rgba(0,0,0,.04);

  --success:        #16A34A;
  --success-light:  #DCFCE7;
  --warning:        #D97706;
  --warning-light:  #FEF3C7;
  --danger:         #DC2626;
  --danger-light:   #FEE2E2;
  --info:           #0EA5E9;
  --info-light:     #E0F2FE;

  --topbar-height:  64px;
  --font:           'Inter', 'Segoe UI', -apple-system, sans-serif;
  --font-mono:      'JetBrains Mono', 'Fira Code', monospace;
}

/* ── DARK THEME ─────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-page:        #0F172A;
  --bg-card:        #1E293B;
  --bg-input:       #0F172A;

  --text-primary:   #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted:     #64748B;
  --text-label:     #94A3B8;

  --border:         #334155;
  --border-input:   #475569;

  --sidebar-bg:     #0F172A;
  --sidebar-hover:  #1E293B;

  --shadow-sm:      0 1px 3px rgba(0,0,0,.3);
  --shadow:         0 4px 6px -1px rgba(0,0,0,.4);
  --shadow-md:      0 10px 15px -3px rgba(0,0,0,.4);

  --success-light:  rgba(22,163,74,.15);
  --warning-light:  rgba(217,119,6,.15);
  --danger-light:   rgba(220,38,38,.15);
  --info-light:     rgba(14,165,233,.15);
  --primary-light:  rgba(249,115,22,.1);
}

/* ── BASE ───────────────────────────────────────────────── */
html { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.6;
  height: 100%;
  overflow: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: var(--font); }

/* ── APP SHELL ──────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 200;
  transition: transform .25s ease;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-height);
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-size: 16px; font-weight: 700; color: #fff; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-logo-text span { color: var(--primary); }
.sidebar-logo-sub { font-size: 10px; color: var(--sidebar-text); }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 10px; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--sidebar-text); opacity: .6;
  padding: 10px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 500;
  text-decoration: none;
  transition: all .15s;
  position: relative;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--primary);
}
.nav-item-icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-item-arrow {
  margin-left: auto; font-size: 10px;
  transition: transform .2s; flex-shrink: 0;
}
.nav-item-arrow.open { transform: rotate(90deg); }
.nav-sub {
  margin-left: 28px; padding-left: 10px;
  border-left: 1px solid rgba(255,255,255,.08);
  margin-top: 2px; display: none;
}
.nav-sub.open { display: block; }
.nav-sub-item {
  display: block; padding: 7px 10px;
  font-size: 12.5px; color: var(--sidebar-text);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all .12s;
}
.nav-sub-item:hover { color: #fff; background: rgba(255,255,255,.05); text-decoration: none; }
.nav-sub-item.active { color: var(--primary); font-weight: 600; }

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
}
.sidebar-avatar {
  width: 34px; height: 34px; min-width: 34px;
  border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  border: 2px solid rgba(249,115,22,.4);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12px; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-role { font-size: 11px; color: var(--sidebar-text); }

/* ── MAIN AREA ──────────────────────────────────────────── */
.main {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
}

/* ── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 50;
}
.topbar-toggle {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 16px;
  transition: background .15s;
}
.topbar-toggle:hover { background: var(--bg-page); }
.topbar-breadcrumb {
  font-size: 13px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px; flex: 1;
}
.topbar-breadcrumb a { color: var(--text-muted); }
.topbar-breadcrumb .current { color: var(--text-primary); font-weight: 600; }
.topbar-right {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
}
.topbar-btn {
  height: 36px; padding: 0 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--primary-border);
  background: transparent;
  color: var(--primary); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.topbar-btn:hover { background: var(--primary); color: #fff; }
.topbar-btn-filled {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.topbar-btn-filled:hover { background: var(--primary-dark); }
.topbar-icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 15px;
  transition: background .15s; position: relative;
}
.topbar-icon-btn:hover { background: var(--bg-page); }

/* Language dropdown */
.lang-dropdown { position: relative; }
.lang-btn {
  height: 36px; padding: 0 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
  transition: background .15s;
}
.lang-btn:hover { background: var(--bg-page); }
.lang-menu {
  position: absolute; top: 42px; right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  min-width: 160px; z-index: 300; display: none;
  overflow: hidden;
}
.lang-menu.open { display: block; }
.lang-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; font-size: 13px;
  color: var(--text-primary); cursor: pointer;
  transition: background .12s;
}
.lang-menu-item:hover { background: var(--bg-page); }
.lang-menu-item.active { color: var(--primary); font-weight: 600; background: var(--primary-light); }

/* User dropdown */
.user-dropdown { position: relative; cursor: pointer; }
.user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  transition: background .15s;
}
.user-btn:hover { background: var(--bg-page); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  position: relative;
}
.user-avatar::after {
  content: '';
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--bg-card);
  position: absolute; bottom: 0; right: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ── PAGE CONTENT ───────────────────────────────────────── */
.page-content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 24px;
  background: var(--bg-page);
}
.page-content::-webkit-scrollbar { width: 5px; }
.page-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }

/* ── PAGE TITLE ─────────────────────────────────────────── */
.page-title-bar {
  margin-bottom: 22px;
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: -.02em; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.card-title-group {}
.card-title {
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.card-title::before {
  content: ''; width: 3px; height: 16px;
  background: var(--primary); border-radius: 3px;
  display: inline-block; flex-shrink: 0;
}
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; padding-left: 11px; }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 20px; }

/* ── KPI CARDS ──────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--kpi-color, var(--primary));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kpi-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--kpi-light, var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px;
}
.kpi-value {
  font-size: 28px; font-weight: 700;
  color: var(--text-primary); line-height: 1;
  letter-spacing: -.025em; margin-bottom: 5px;
}
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi-trend { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* ── SYSTEM STATUS STRIP ────────────────────────────────── */
.status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.status-tile {
  padding: 14px 18px;
  border-right: 1px solid var(--border);
}
.status-tile:last-child { border-right: none; }
.status-tile-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .10em;
  color: var(--text-muted); margin-bottom: 10px;
}
.status-row {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 4px; font-size: 13px;
}
.status-row-label { color: var(--text-secondary); }
.status-row-value { font-weight: 600; display: flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--success); box-shadow: 0 0 5px var(--success); }
.dot-gray  { background: var(--text-muted); }
.dot-red   { background: var(--danger); }

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 16px; height: 38px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: all .15s; font-family: var(--font);
}
.btn:hover { background: var(--bg-page); color: var(--text-primary); }

.btn-primary {
  background: var(--primary); border-color: var(--primary);
  color: #fff; font-weight: 600;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-outline {
  border-color: var(--primary-border);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 11px; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }

.btn-success { background: var(--success-light); border-color: var(--success); color: var(--success); }
.btn-danger  { background: var(--danger-light);  border-color: var(--danger);  color: var(--danger); }
.btn-warning { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }
.btn-info    { background: var(--info-light);    border-color: var(--info);    color: var(--info); }

/* ── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-primary { background: var(--primary-light); color: var(--primary); border-color: var(--primary-border); }
.badge-muted   { background: var(--bg-page); color: var(--text-muted); border-color: var(--border); }

/* ── TABLES ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 11px 16px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
  text-align: left; white-space: nowrap;
}
[dir="rtl"] thead th { text-align: right; }
tbody td {
  padding: 12px 16px;
  font-size: 13px; color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-page); }
.td-link { color: var(--primary); font-weight: 500; cursor: pointer; }
.td-link:hover { text-decoration: underline; }
.td-mono { font-family: var(--font-mono); font-size: 12px; }
.td-muted { color: var(--text-muted); font-size: 12px; }
.td-actions { display: flex; gap: 5px; }
.pos { color: var(--success); font-weight: 600; }
.neg { color: var(--danger);  font-weight: 600; }

/* ── FORMS ──────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--text-label); letter-spacing: .03em;
  text-transform: uppercase;
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; height: 42px;
  padding: 0 14px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13.5px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { height: auto; padding: 10px 14px; resize: vertical; }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%2394A3B8' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
[dir="rtl"] select.form-control {
  background-position: left 14px center;
  padding-right: 14px; padding-left: 36px;
}
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; line-height: 1.5; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── FILTERS BAR ────────────────────────────────────────── */
.filters-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; background: var(--bg-page);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.filters-bar .form-control {
  height: 36px; font-size: 12.5px; border-radius: var(--radius-full);
  width: auto; min-width: 80px;
}
.search-input {
  position: relative; flex: 1; max-width: 280px;
}
.search-input input { padding-left: 36px; }
.search-input::before {
  content: '🔍'; position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 13px; pointer-events: none;
}

/* ── PAGINATION ─────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}
.pag-btns { display: flex; gap: 3px; }
.pag-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer; font-size: 12px;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.pag-btn:hover { background: var(--bg-page); }
.pag-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── INFO PANEL (sidebar for detail pages) ──────────────── */
.info-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.info-panel-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.info-panel-section:last-child { border-bottom: none; }
.info-panel-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .10em;
  color: var(--text-muted); margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.info-row {
  display: flex; justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px; gap: 8px; font-size: 13px;
}
.info-row:last-child { margin-bottom: 0; }
.info-key { color: var(--text-secondary); flex-shrink: 0; max-width: 50%; }
.info-val { font-weight: 500; color: var(--text-primary); text-align: right; }

/* ── DETAIL SECTIONS ────────────────────────────────────── */
.detail-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.detail-section-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-page);
}
.detail-section-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.detail-section-title::before {
  content: ''; width: 3px; height: 14px;
  background: var(--primary); border-radius: 3px;
}
.detail-section-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; padding-left: 11px; }
.detail-row {
  display: flex; padding: 11px 18px;
  border-bottom: 1px solid var(--border); align-items: center;
}
.detail-row:last-child { border-bottom: none; }
.detail-key {
  width: 200px; min-width: 200px;
  font-size: 13px; color: var(--text-secondary); font-weight: 500;
}
.detail-val { font-size: 13px; color: var(--text-primary); }

/* ── TABS ───────────────────────────────────────────────── */
.tabs {
  display: flex; border-bottom: 1px solid var(--border);
  margin-bottom: 18px; gap: 0; overflow-x: auto;
}
.tab {
  padding: 11px 18px;
  font-size: 13.5px; font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
  text-decoration: none; cursor: pointer;
  white-space: nowrap; transition: all .15s;
}
.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── MODALS ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow-md);
  max-height: 90vh; overflow-y: auto; animation: modal-in .2s ease;
}
@keyframes modal-in { from { opacity:0; transform: scale(.96) translateY(8px); } to { opacity:1; transform: none; } }
.modal-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.modal-body { padding: 20px 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--bg-page);
}

/* ── TOGGLE SWITCH ──────────────────────────────────────── */
.toggle {
  width: 42px; height: 24px;
  border-radius: 12px;
  background: var(--border);
  position: relative; cursor: pointer;
  border: none; outline: none; flex-shrink: 0;
  transition: background .18s;
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: ''; position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: left .18s;
}
.toggle.on::after { left: 21px; }

/* ── ALERTS ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13px; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px; border-left: 3.5px solid;
}
.alert-info    { background: var(--info-light);    border-color: var(--info);    color: #0369A1; }
.alert-success { background: var(--success-light); border-color: var(--success); color: #15803D; }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: #92400E; }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);  color: #991B1B; }
[data-theme="dark"] .alert-info    { color: var(--info); }
[data-theme="dark"] .alert-success { color: var(--success); }
[data-theme="dark"] .alert-warning { color: var(--warning); }
[data-theme="dark"] .alert-danger  { color: var(--danger); }

/* ── TWO COLUMN LAYOUT ──────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 290px; gap: 20px; align-items: start; }

/* ── EMPTY STATE ────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text-muted); font-size: 13px;
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }

/* ── MINI CHART ─────────────────────────────────────────── */
.mini-chart { display: flex; align-items: flex-end; gap: 3px; height: 44px; }
.mini-bar { flex: 1; border-radius: 2px 2px 0 0; min-width: 10px; max-width: 20px; }
.chart-labels { font-size: 10px; color: var(--text-muted); display: flex; gap: 3px; margin-top: 2px; }
.chart-labels span { flex: 1; text-align: center; }

/* ── MOBILE OVERLAY ─────────────────────────────────────── */
.mob-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 199;
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100%;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .mob-overlay { display: block; }
  .mob-overlay.hidden { display: none; }
  .page-content { padding: 14px; }
  .topbar { padding: 0 14px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .status-strip { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .page-title { font-size: 18px; }
  .topbar-breadcrumb { display: none; }
  .hide-mobile { display: none !important; }
  .kpi-value { font-size: 22px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .status-strip { grid-template-columns: 1fr; }
  .page-content { padding: 10px; }
}

/* ── RTL SUPPORT ────────────────────────────────────────── */
[dir="rtl"] .sidebar { right: 0; left: auto; border-left: none; }
[dir="rtl"] .sidebar.open { transform: translateX(0); }
[dir="rtl"] .nav-item.active::before { left: auto; right: 0; border-radius: 3px 0 0 3px; }
[dir="rtl"] .nav-sub { margin-left: 0; margin-right: 28px; padding-left: 0; padding-right: 10px; border-left: none; border-right: 1px solid rgba(255,255,255,.08); }
[dir="rtl"] .card-title::before, [dir="rtl"] .detail-section-title::before { display: none; }
[dir="rtl"] .card-title::after, [dir="rtl"] .detail-section-title::after {
  content: ''; width: 3px; height: 16px;
  background: var(--primary); border-radius: 3px;
  display: inline-block; flex-shrink: 0; margin-right: 0; margin-left: 8px;
  order: 2;
}
[dir="rtl"] .alert { border-left: none; border-right: 3.5px solid; }
[dir="rtl"] .lang-menu { right: auto; left: 0; }
