:root {
  --sidebar-width: 248px;
  --header-height: 64px;
  --navy: #111827;
  --border: #e5e7eb;
  --muted: #6b7280;
}
* { box-sizing: border-box; }
body { margin: 0; background: #f5f7fb; color: #172033; }
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 100;
  width: var(--sidebar-width); background: var(--navy); color: #fff;
  display: flex; flex-direction: column; padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; padding: 4px 8px 24px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #4f46e5; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a, .nav-disabled { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 12px; border-radius: 8px; color: #cbd5e1; text-decoration: none; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: #1f2937; color: #fff; }
.nav-disabled { opacity: .55; cursor: default; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 9px; border-top: 1px solid #273244; padding: 16px 4px 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #374151; font-weight: 700; }
.sidebar-user-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.sidebar-user-copy strong, .sidebar-user-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy strong { font-size: 13px; }
.sidebar-user-copy span { color: #9ca3af; font-size: 11px; }
.icon-button { border: 0; background: transparent; color: #cbd5e1; }
.app-header { position: fixed; z-index: 90; top: 0; left: var(--sidebar-width); right: 0; height: var(--header-height); display: flex; align-items: center; justify-content: flex-end; padding: 0 32px; background: #fff; border-bottom: 1px solid var(--border); }
.header-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.sidebar-toggle { display: none; }
.app-main { margin-left: var(--sidebar-width); padding: calc(var(--header-height) + 32px) 32px 48px; min-height: 100vh; }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 24px; }
.page-heading h1 { margin: 0; font-size: 28px; }
.eyebrow { margin: 0 0 4px; color: #6b7280; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.filter-form { display: flex; align-items: center; gap: 8px; }
.filter-form label { font-size: 13px; color: var(--muted); }
.filter-form select { border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 8px 34px 8px 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.metric-card { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.metric-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; font-weight: 800; }
.metric-icon.blue { background: #dbeafe; color: #2563eb; }.metric-icon.green { background: #dcfce7; color: #16a34a; }.metric-icon.purple { background: #ede9fe; color: #7c3aed; }.metric-icon.red { background: #fee2e2; color: #dc2626; }
.metric-card div:last-child { display: flex; flex-direction: column; }.metric-card span { color: var(--muted); font-size: 12px; }.metric-card strong { margin-top: 2px; font-size: 24px; }
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; }.panel-heading h2 { margin: 0; font-size: 16px; }
.chart-panel canvas { max-height: 280px; padding: 0 14px 16px; }
.panel-total { background: #f3f4f6; border-radius: 999px; padding: 6px 10px; font-size: 12px; color: var(--muted); }
.security-row { display: flex; justify-content: space-between; align-items: center; min-height: 64px; margin: 0 20px; border-top: 1px solid var(--border); font-size: 13px; }.security-row span { color: var(--muted); }
.activity-panel { overflow: hidden; }.activity-table { width: 100%; border-collapse: collapse; }.activity-table th { background: #f9fafb; color: var(--muted); font-size: 12px; text-align: left; }.activity-table th, .activity-table td { padding: 12px 20px; border-top: 1px solid var(--border); }.action-badge { background: #eef2ff; color: #4338ca; border-radius: 6px; padding: 4px 7px; font-size: 12px; }.empty-state { text-align: center; color: var(--muted); padding: 32px !important; }
.pagination { display: flex; gap: 5px; justify-content: flex-end; padding: 12px 20px; }.pagination a { padding: 5px 9px; border: 1px solid var(--border); border-radius: 6px; color: #374151; text-decoration: none; }.pagination a.active { background: #4f46e5; color: #fff; }
.error-state { max-width: 560px; margin: 80px auto; text-align: center; }
@media (max-width: 992px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }.dashboard-grid { grid-template-columns: 1fr; }
  .app-sidebar { transform: translateX(-100%); transition: transform .2s; }.app-sidebar.open { transform: translateX(0); }.app-header { left: 0; justify-content: space-between; }.sidebar-toggle { display: block; border: 0; background: transparent; font-size: 20px; }.app-main { margin-left: 0; padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 576px) { .metric-grid { grid-template-columns: 1fr; }.page-heading { align-items: flex-start; gap: 16px; }.filter-form { flex-direction: column; align-items: flex-start; }.app-main { padding-left: 12px; padding-right: 12px; }.activity-table th, .activity-table td { padding-left: 10px; padding-right: 10px; } }

.header-tools { display: flex; align-items: center; gap: 10px; }
.language-select, .theme-toggle {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #172033;
}
.language-select { padding: 0 8px; font-size: 12px; }
.theme-toggle { width: 36px; font-size: 18px; }

:root[data-theme="dark"] {
  --border: #30384a;
  --muted: #a9b1c1;
  color-scheme: dark;
}
:root[data-theme="dark"] body { background: #0f1522; color: #edf1f7; }
:root[data-theme="dark"] .app-header,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .metric-card,
:root[data-theme="dark"] .language-select,
:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .filter-form select,
:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select {
  background: #171d2b;
  color: #edf1f7;
  border-color: var(--border);
}
:root[data-theme="dark"] .activity-table th { background: #1c2433; }
:root[data-theme="dark"] .activity-table td,
:root[data-theme="dark"] .activity-table th,
:root[data-theme="dark"] .security-row,
:root[data-theme="dark"] .panel { border-color: var(--border); }
:root[data-theme="dark"] .text-muted { color: #a9b1c1 !important; }
:root[data-theme="dark"] .panel-total,
:root[data-theme="dark"] .action-badge { background: #262d3d; color: #dfe5ef; }

html[dir="rtl"] .app-sidebar { right: 0; left: auto; }
html[dir="rtl"] .app-header { right: var(--sidebar-width); left: 0; }
html[dir="rtl"] .app-main { margin-right: var(--sidebar-width); margin-left: 0; }
html[dir="rtl"] .sidebar-nav a,
html[dir="rtl"] .nav-disabled,
html[dir="rtl"] .brand,
html[dir="rtl"] .security-row,
html[dir="rtl"] .metric-card { text-align: right; }
html[dir="rtl"] .activity-table th,
html[dir="rtl"] .activity-table td { text-align: right; }
@media (max-width: 992px) {
  html[dir="rtl"] .app-sidebar { transform: translateX(100%); }
  html[dir="rtl"] .app-sidebar.open { transform: translateX(0); }
  html[dir="rtl"] .app-header { right: 0; }
  html[dir="rtl"] .app-main { margin-right: 0; }
}
