/* ── TapTrack AdminPanel — Design System ─────────────────────────────────── */
/* Mirrors the wireframe's visual language exactly.                            */

/* ── Custom Properties ──────────────────────────────────────────────────────*/
:root {
  --color-primary:    #123B62;
  --color-primary-dk: #0d2f52;
  --color-primary-lt: #dce8f4;
  --color-accent:     #00A9CB;
  --color-accent-lt:  #e0f7fb;
  --color-success:    #10B981;
  --color-success-lt: #D1FAE5;
  --color-danger:     #ba1a1a;
  --color-danger-lt:  #ffdad6;
  --color-warning:    #F59E0B;
  --color-warning-lt: #FEF3C7;
  --color-orange:     #F97316;
  --color-orange-lt:  #FFEDD5;
  --color-purple:     #6D28D9;
  --color-purple-lt:  #EDE9FE;
  --color-blue-lt:    #dbe9f8;

  --text-dark:   #0b1c30;
  --text-body:   #434655;
  --text-muted:  #545f73;
  --text-subtle: #737686;

  --bg-app:   #f8f9ff;
  --bg-card:  #ffffff;
  --bg-light: #eff4ff;

  --border:       #c3c6d7;
  --border-light: #dfe3e7;

  --sidebar-bg:     #ffffff;
  --sidebar-border: var(--border-light);
  --sidebar-text:   var(--text-muted);
  --sidebar-active: var(--color-primary);

  --topbar-height:  56px;
  --sidebar-width:  220px;
  --sidebar-collapsed-width: 60px;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);

  --transition: 0.15s ease;
  --font: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-icon: 'Material Symbols Rounded';

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  --icon-sm: 16px;
  --icon-md: 20px;
  --icon-lg: 24px;
}

/* ── Reset & Base ────────────────────────────────────────────────────────────*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-body);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ── Material Symbols ────────────────────────────────────────────────────────*/
.material-symbols-rounded {
  font-family: var(--font-icon);
  font-weight: normal;
  font-style: normal;
  font-size: var(--icon-md);
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}
.material-symbols-rounded.filled {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.icon-sm { font-size: var(--icon-sm); }
.icon-md { font-size: var(--icon-md); }
.icon-lg { font-size: var(--icon-lg); }

/* ── App Shell ───────────────────────────────────────────────────────────────*/
.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────────*/
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  border-right: 1px solid var(--sidebar-border);
  transition: width var(--transition), min-width var(--transition);
  overflow: hidden;
}

/* Scrollable nav wrapper — fills remaining space and scrolls when items overflow */
.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-item-text,
.sidebar.collapsed .sidebar-item .badge-count,
.sidebar.collapsed .sidebar-user-info { display: none; }

.sidebar.collapsed .sidebar-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar-logo { justify-content: center; }

.sidebar-logo {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-logo-box {
  width: 28px; height: 28px;
  background: var(--color-primary);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.sidebar-logo-text { font-weight: 700; font-size: 15px; color: var(--text-dark); white-space: nowrap; }
.sidebar-logo-badge {
  margin-left: auto;
  font-size: 9px; background: var(--color-primary-lt);
  color: var(--color-primary-dk); padding: 2px 7px; border-radius: 20px;
  border: 1px solid var(--color-primary-lt); white-space: nowrap;
}

.sidebar-section { padding: 16px 10px 6px; }
.sidebar-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--text-subtle);
  padding: 0 6px 6px; white-space: nowrap; overflow: hidden;
}

.sidebar-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--radius-md);
  cursor: pointer; color: var(--sidebar-text); font-size: 12.5px;
  font-weight: 500; transition: all var(--transition); margin-bottom: 1px;
  text-decoration: none;
}
.sidebar-item:hover { background: var(--bg-light); color: var(--text-dark); text-decoration: none; }
.sidebar-item.active { background: var(--color-primary-lt); color: var(--color-primary-dk); font-weight: 600; }
.sidebar-item .nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-item .nav-icon .material-symbols-rounded { font-size: 18px; line-height: 20px; }
.sidebar-item-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge-count {
  margin-left: auto;
  background: var(--color-danger); color: #fff;
  border-radius: 10px; font-size: 10px; font-weight: 700;
  padding: 1px 6px; min-width: 18px; text-align: center; flex-shrink: 0;
}

.sidebar-user {
  margin-top: auto; padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.sidebar-user-av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--color-primary-lt);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--color-primary-dk); flex-shrink: 0;
}
.sidebar-user-name { font-size: 12px; font-weight: 600; color: var(--text-dark); }
.sidebar-user-role { font-size: 10px; color: var(--text-subtle); }

/* ── Main Content Area ───────────────────────────────────────────────────────*/
.main {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; background: var(--bg-app);
  overflow: hidden;
}
.main-body {
  flex: 1; padding: 24px; overflow-y: auto;
}

/* ── Topbar ──────────────────────────────────────────────────────────────────*/
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text-dark); }
.topbar-subtitle { font-size: 12px; color: var(--text-subtle); }
.topbar-right {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
}
.topbar-icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-md);
  border: 1.5px solid var(--border); background: var(--bg-light);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px; position: relative;
  transition: background var(--transition);
}
.topbar-icon-btn:hover { background: var(--border-light); }
.topbar-icon-btn .notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-danger); border: 1.5px solid #fff;
}
.lang-btn {
  font-size: 11px; font-weight: 600; padding: 5px 10px;
  border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--bg-light); cursor: pointer; color: #4a5e76;
  transition: background var(--transition);
}
.lang-btn:hover { background: var(--border-light); }
.lang-select {
  font-size: 11px; font-weight: 600; padding: 4px 8px 4px 10px;
  border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--bg-light); cursor: pointer; color: #4a5e76;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23545f73'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 22px;
  outline: none;
  transition: background var(--transition);
}
.lang-select:hover { background-color: var(--border-light); }
.topbar-user-av {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(18,59,98,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--color-primary);
  cursor: pointer; border: 2px solid rgba(18,59,98,0.2);
  transition: background var(--transition);
}
.topbar-user-av:hover { background: rgba(18,59,98,0.2); }

/* ── Profile Dropdown ─────────────────────────────────────────────────────── */
.profile-dropdown-wrap { position: relative; z-index: 200; }
.profile-dropdown {
  position: fixed;
  top: calc(var(--topbar-height) + 8px);
  inset-inline-end: 20px;
  width: 264px; background: var(--bg-card);
  border: 1px solid var(--border-light); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.07);
  z-index: 1000;
  overflow: hidden;
  animation: dropdown-in 0.14s cubic-bezier(.16,1,.3,1);
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.profile-dropdown-header {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 16px 14px;
  background: linear-gradient(135deg, rgba(18,59,98,0.05) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-light);
}
.profile-dropdown-av-lg {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(18,59,98,0.18) 0%, rgba(18,59,98,0.08) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--color-primary);
  border: 2px solid rgba(18,59,98,0.2);
  letter-spacing: -0.5px;
}
.profile-dropdown-info { flex: 1; min-width: 0; }
.profile-dropdown-name {
  font-size: 14px; font-weight: 700; color: var(--text-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.profile-dropdown-email {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px; line-height: 1.4;
}
.profile-plan-badge {
  display: inline-flex; align-items: center; gap: 3px;
  margin-top: 7px;
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 20px; cursor: pointer;
  color: var(--color-primary); border: 1.5px solid rgba(18,59,98,0.27);
  background: rgba(18,59,98,0.07); letter-spacing: 0.3px;
  transition: background var(--transition);
}
.profile-plan-badge:hover { background: rgba(18,59,98,0.14); }
.profile-dropdown-section { padding: 6px 0; }
.profile-dropdown-section + .profile-dropdown-section { border-top: 1px solid var(--border-light); }
.profile-dropdown-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text-body);
  cursor: pointer; text-decoration: none; width: 100%;
  background: none; border: none; text-align: left;
  transition: background var(--transition), color var(--transition);
}
.profile-dropdown-item:hover { background: var(--bg-light); color: var(--text-dark); }
.pdi-icon {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-light);
  transition: background var(--transition);
}
.pdi-icon .material-symbols-rounded { font-size: 16px; color: var(--text-muted); transition: color var(--transition); }
.profile-dropdown-item:hover .pdi-icon { background: rgba(18,59,98,0.08); }
.profile-dropdown-item:hover .pdi-icon .material-symbols-rounded { color: var(--color-primary); }
.pdi-danger { color: var(--color-danger); }
.pdi-danger .pdi-icon .material-symbols-rounded { color: var(--color-danger); }
.pdi-danger:hover { background: rgba(220,38,38,0.05) !important; }
.pdi-danger:hover .pdi-icon { background: rgba(220,38,38,0.1) !important; }
.pdi-danger:hover .pdi-icon .material-symbols-rounded { color: var(--color-danger) !important; }
.mode-badge {
  font-size: 10px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
  border: 1.5px solid; letter-spacing: 0.5px;
}
.mode-badge-hr     { color: var(--color-primary); border-color: rgba(18,59,98,0.27); background: rgba(18,59,98,0.07); }
.mode-badge-premium { color: #B45309; border-color: rgba(245,158,11,0.27); background: #FFFBEB; }

/* ── Cards ───────────────────────────────────────────────────────────────────*/
.wf-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 1px solid var(--border-light); box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  overflow: hidden;
}
.wf-card-header {
  padding: 14px 18px 12px; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 10px;
}
.wf-card-title { font-size: 13px; font-weight: 700; color: var(--text-dark); }
.wf-card-subtitle { font-size: 11px; color: var(--text-subtle); }
.wf-card-action { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.wf-card-body { padding: 16px 18px; }
.wf-card-footer {
  padding: 10px 18px; border-top: 1px solid var(--border-light);
  background: #fafbfc;
}

/* ── KPI Cards ───────────────────────────────────────────────────────────────*/
.kpi-grid { 
  display: grid; gap: 20px; margin-bottom: 24px; width: 100%;
}
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* Keep cards in one line on tablets, stack only on small phones */
@media (max-width: 1200px) {
  .kpi-grid-5 { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .kpi-grid-4 { grid-template-columns: repeat(4, 1fr); gap: 12px; }
}
@media (max-width: 900px) {
  .kpi-grid-5, .kpi-grid-4, .kpi-grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 0;
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 12px;
}
.kpi-label {
  font-size: 10.5px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; padding-top: 2px;
}
.kpi-icon-box {
  width: 42px; height: 42px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.kpi-icon-box .material-symbols-rounded { font-size: 22px; }
.kpi-icon-blue   { background: #EEF2FF; color: #4338ca; }
.kpi-icon-green  { background: #DCFCE7; color: #15803d; }
.kpi-icon-orange { background: #FEF3C7; color: #B45309; }
.kpi-icon-purple { background: #F3E8FF; color: #7e22ce; }
.kpi-icon-red    { background: #FEE2E2; color: #b91c1c; }
.kpi-icon-teal   { background: #CCFBF1; color: #0f766e; }

.kpi-value {
  font-size: 30px; font-weight: 800; color: var(--text-dark);
  line-height: 1.1; margin-bottom: 8px; letter-spacing: -0.5px;
}

.kpi-trend-row {
  display: flex; align-items: center; gap: 6px;
}
.kpi-trend-pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
}
.kpi-trend-pill .material-symbols-rounded { font-size: 13px; }
.kpi-trend-pill.up      { background: #F0FDF4; color: #16a34a; }
.kpi-trend-pill.down    { background: #FEF2F2; color: #dc2626; }
.kpi-trend-pill.neutral { background: var(--bg-light); color: var(--text-muted); }
.kpi-sub { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* ── Report Tabs ───────────────────────────────────────────────────────────*/
.report-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-light); border-radius: var(--radius-md);
  margin-bottom: 16px; align-self: flex-start;
}
.report-tab {
  padding: 6px 12px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); border: none; background: transparent;
  border-radius: 6px; cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.report-tab:hover { color: var(--text-dark); background: rgba(0,0,0,0.03); }
.report-tab.active {
  background: var(--bg-card); color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* ── Badges ──────────────────────────────────────────────────────────────────*/
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; padding: 3px 9px;
  border-radius: 20px; letter-spacing: 0.3px; white-space: nowrap;
}
.badge-green  { background: var(--color-success-lt); color: #047857; }
.badge-red    { background: var(--color-danger-lt);  color: #B91C1C; }
.badge-amber  { background: var(--color-warning-lt); color: #B45309; }
.badge-orange { background: var(--color-orange-lt);  color: #C2410C; }
.badge-blue   { background: var(--color-blue-lt);    color: #1D4ED8; }
.badge-purple { background: var(--color-purple-lt);  color: #6D28D9; }
.badge-gray   { background: #F0F4F8;                 color: #4a5e76; }
.badge-gold   { background: var(--color-warning-lt); color: #92400E; }
.badge-dark-red { background: #B91C1C; color: #fff; }

/* ── Tables ──────────────────────────────────────────────────────────────────*/

/* Shared table header + row styles used by both .wf-table and .table */
.wf-table-wrap { overflow-x: auto; }
.wf-table { width: 100%; border-collapse: collapse; }
.wf-table thead tr { border-bottom: 1.5px solid var(--border); }
.wf-table thead th {
  padding: 11px 16px; font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px; text-align: left; white-space: nowrap;
  background: transparent;
}
.wf-table tbody tr { border-bottom: 1px solid var(--border-light); transition: background var(--transition); }
.wf-table tbody tr:last-child { border-bottom: none; }
.wf-table tbody tr:hover { background: var(--bg-light); }
.wf-table tbody td { padding: 12px 16px; font-size: 12.5px; color: var(--text-body); vertical-align: middle; }

/* .table-container — white card wrapper used by dashboard / super pages */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  margin-bottom: 20px;
}

/* .table / .data-table — identical visual rules to .wf-table */
.table, .data-table { width: 100%; border-collapse: collapse; }
.table thead tr, .data-table thead tr { border-bottom: 1.5px solid var(--border); }
.table thead th, .data-table thead th {
  padding: 11px 16px; font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px; text-align: left; white-space: nowrap;
  background: transparent;
}
.table tbody tr, .data-table tbody tr { border-bottom: 1px solid var(--border-light); transition: background var(--transition); }
.table tbody tr:last-child, .data-table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover, .data-table tbody tr:hover { background: var(--bg-light); }
.table tbody td, .data-table tbody td { padding: 12px 16px; font-size: 12.5px; color: var(--text-body); vertical-align: middle; }
.table .row-danger,   .data-table .row-danger   { background: var(--color-danger-lt); }
.table .row-warning,  .data-table .row-warning  { background: var(--color-warning-lt); }
.table .row-selected, .data-table .row-selected { background: rgba(18,59,98,0.05); }
.wf-table .row-danger  { background: var(--color-danger-lt); }
.wf-table .row-warning { background: var(--color-warning-lt); }

.td-primary { font-weight: 600; color: var(--text-dark); }
.td-sub { font-size: 11px; color: var(--text-subtle); margin-top: 2px; }
.td-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.text-center { text-align: center; }
.text-muted { color: var(--text-subtle); }
.text-sm    { font-size: 11.5px; }
.font-bold  { font-weight: 700; }

/* ── Buttons ─────────────────────────────────────────────────────────────────*/
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 8px 16px;
  border-radius: var(--radius-md); cursor: pointer;
  border: 1.5px solid transparent; font-family: inherit;
  white-space: nowrap; transition: all var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff; border-color: transparent;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-secondary { background: var(--bg-card); color: var(--color-primary); border-color: #c0d5e8; }
.btn-secondary:hover { background: var(--color-primary-lt); }
.btn-outline { background: var(--bg-card); color: var(--text-body); border-color: #dde8f3; }
.btn-outline:hover { background: #f9fafb; border-color: #cbd5e1; color: var(--text-dark); }
.btn-danger    { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger:hover:not(:disabled) { opacity: 0.9; }
.btn-outline-danger { background: var(--bg-card); color: var(--color-danger); border-color: #fca5a5; }
.btn-outline-danger:hover { background: var(--color-danger-lt); }
.btn-ghost     { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--color-primary-lt); color: var(--color-primary); }
.btn-sm { padding: 5px 11px; font-size: 11px; border-radius: var(--radius-sm); }
.btn-icon {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg-light); cursor: pointer; font-size: 13px; color: var(--text-muted);
}
.btn-icon:hover { background: var(--color-primary-lt); color: var(--color-primary); border-color: var(--color-primary-lt); }
.btn:disabled, button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── AppIconButton ────────────────────────────────────────────────────────────*/
.app-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-md); cursor: pointer;
  transition: background var(--transition), color var(--transition);
  padding: 0; flex-shrink: 0;
}
.app-icon-btn-sm  { width: 28px; height: 28px; }
.app-icon-btn-md  { width: 34px; height: 34px; }
.app-icon-btn-lg  { width: 40px; height: 40px; }
.app-icon-btn-sm  .material-symbols-rounded { font-size: 16px; }
.app-icon-btn-md  .material-symbols-rounded { font-size: 20px; }
.app-icon-btn-lg  .material-symbols-rounded { font-size: 24px; }
.app-icon-btn-default { background: var(--bg-light); color: var(--text-muted); border: 1.5px solid var(--border); }
.app-icon-btn-default:hover { background: var(--border-light); color: var(--text-body); }
.app-icon-btn-primary { background: var(--color-primary-lt); color: var(--color-primary); }
.app-icon-btn-primary:hover { background: var(--color-primary); color: #fff; }
.app-icon-btn-danger  { background: var(--color-danger-lt); color: var(--color-danger); }
.app-icon-btn-danger:hover  { background: var(--color-danger); color: #fff; }
.app-icon-btn-ghost   { background: transparent; color: var(--text-muted); }
.app-icon-btn-ghost:hover   { background: var(--bg-light); color: var(--text-body); }
.app-icon-btn.disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ── Forms ───────────────────────────────────────────────────────────────────*/
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label { font-size: 11.5px; font-weight: 600; color: #4a5e76; }
.form-label .req { color: var(--color-danger); margin-left: 2px; }
.form-control {
  height: 38px; border: 1.5px solid #dde8f3; border-radius: var(--radius-md);
  padding: 0 12px; font-size: 12px; font-family: inherit;
  background: var(--bg-card); color: var(--text-dark); width: 100%;
  transition: border-color var(--transition);
}
.form-control:focus { outline: none; border-color: var(--color-primary); }
.form-control.readonly, .form-control:disabled { background: var(--bg-app); color: var(--text-subtle); }
.form-control.is-invalid { border-color: var(--color-danger); }
.form-select {
  height: 38px; border: 1.5px solid #dde8f3; border-radius: var(--radius-md);
  padding: 0 28px 0 11px; font-size: 12px; font-family: inherit;
  background: var(--bg-light) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238fa8c4' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 8px center no-repeat;
  appearance: none; cursor: pointer; color: var(--text-body); width: 100%;
}
.form-select:focus { outline: none; border-color: var(--color-primary); }
.form-textarea {
  border: 1.5px solid #dde8f3; border-radius: var(--radius-md);
  padding: 10px 12px; font-size: 12px; font-family: inherit;
  background: var(--bg-card); color: var(--text-body); width: 100%;
  resize: vertical; min-height: 80px;
}
.form-textarea:focus { outline: none; border-color: var(--color-primary); }
.form-helper { font-size: 10.5px; color: var(--text-subtle); margin-top: 2px; }
.form-error  { font-size: 10.5px; color: var(--color-danger); margin-top: 2px; }
.validation-message { font-size: 10.5px; color: var(--color-danger); display: block; margin-top: 3px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 700px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

.form-section { margin-bottom: 24px; }
.form-section-title {
  font-size: 12px; font-weight: 700; color: var(--color-primary);
  text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 14px;
  padding-bottom: 8px; border-bottom: 1.5px solid var(--border-light);
}
.form-actions {
  display: flex; align-items: center; gap: 10px;
  padding-top: 20px; border-top: 1px solid var(--border-light); margin-top: 8px;
}

.form-toggle {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--bg-light); border-radius: var(--radius-md); border: 1.5px solid var(--border);
}
.toggle-switch {
  width: 36px; height: 20px; border-radius: 10px; background: #c8d8ec;
  position: relative; cursor: pointer; flex-shrink: 0; transition: background var(--transition);
}
.toggle-switch.on { background: var(--color-primary); }
.toggle-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.on::after { left: 19px; }

/* ── Filters ─────────────────────────────────────────────────────────────────*/
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px; background: var(--bg-card); border-radius: var(--radius-lg);
  border: 1.5px solid var(--border); margin-bottom: 16px;
}
.filter-input {
  height: 34px; border: 1.5px solid #dde8f3; border-radius: var(--radius-md);
  padding: 0 12px; font-size: 12px; font-family: inherit; background: var(--bg-light);
  color: var(--text-body); min-width: 200px;
}
.filter-input:focus { outline: none; border-color: var(--color-primary); }
.filter-select {
  height: 34px; border: 1.5px solid #dde8f3; border-radius: var(--radius-md);
  padding: 0 28px 0 11px; font-size: 12px; font-family: inherit;
  background: var(--bg-light) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238fa8c4' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 8px center no-repeat;
  appearance: none; cursor: pointer; color: var(--text-body);
}

.summary-bar {
  display: flex; gap: 20px; padding: 10px 18px; background: var(--bg-light);
  border-radius: var(--radius-md); border: 1px solid var(--border);
  margin-bottom: 16px; font-size: 12px; color: #4a5e76; flex-wrap: wrap;
}
.summary-bar .item { display: flex; align-items: center; gap: 6px; }
.summary-bar .item strong { color: var(--text-dark); font-weight: 700; }
.summary-bar .sep { color: var(--border); }

/* ── Progress ────────────────────────────────────────────────────────────────*/
.progress-wrap { background: #e8eef4; border-radius: 4px; height: 6px; flex: 1; }
.progress-fill { height: 6px; border-radius: 4px; transition: width 0.3s; }
.progress-fill-primary { background: var(--color-primary); }
.progress-fill-green   { background: var(--color-success); }
.progress-fill-amber   { background: var(--color-warning); }
.progress-fill-red     { background: var(--color-danger); }

/* ── Alerts ──────────────────────────────────────────────────────────────────*/
.alert {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-radius: var(--radius-md); font-size: 13px; font-weight: 500;
  margin-bottom: 16px; border: 1.5px solid;
}
.alert-danger  { background: var(--color-danger-lt);  border-color: #f5c6c6; color: #b91c1c; }
.alert-warning { background: var(--color-warning-lt); border-color: #fcd34d; color: #92400e; }
.alert-info    { background: var(--color-blue-lt);    border-color: #a5b4fc; color: #3730a3; }
.alert-success { background: var(--color-success-lt); border-color: #6ee7b7; color: #065f46; }
.alert-icon    { font-size: 18px; flex-shrink: 0; }
.alert-body    { flex: 1; line-height: 1.45; }
.alert-action  { margin-inline-start: auto; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ── Tabs ────────────────────────────────────────────────────────────────────*/
.tab-bar {
  display: flex; border-bottom: 2px solid var(--border);
  background: var(--bg-card); padding: 0 18px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.tab {
  padding: 13px 16px; font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2.5px solid transparent; margin-bottom: -2px; white-space: nowrap;
  transition: all var(--transition);
}
.tab:hover { color: var(--text-body); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ── Wizard ──────────────────────────────────────────────────────────────────*/
.wizard-steps {
  display: flex; align-items: center; margin-bottom: 32px; padding: 0 20px;
}
.wizard-step {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; flex: 1; position: relative;
}
.wizard-step::before {
  content: ''; position: absolute; top: 14px;
  left: calc(50% + 14px); right: calc(-50% + 14px);
  height: 2px; background: var(--border); z-index: 0;
}
.wizard-step:last-child::before { display: none; }
.wizard-step-circle {
  width: 28px; height: 28px; border-radius: 50%; background: var(--border);
  color: var(--text-subtle); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; z-index: 1; position: relative;
}
.wizard-step.done .wizard-step-circle   { background: var(--color-success); color: #fff; }
.wizard-step.active .wizard-step-circle { background: var(--color-primary); color: #fff; box-shadow: 0 0 0 4px rgba(18,59,98,0.13); }
.wizard-step-label { font-size: 10px; font-weight: 600; color: var(--text-subtle); text-align: center; }
.wizard-step.active .wizard-step-label { color: var(--color-primary); }
.wizard-step.done .wizard-step-label   { color: var(--color-success); }

/* ── System Health Chips ─────────────────────────────────────────────────────*/
.sys-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--bg-card); border-radius: var(--radius-md);
  border: 1.5px solid var(--border); flex: 1; min-width: 130px;
}
.sys-chip-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.sys-chip-dot.green  { background: var(--color-success); box-shadow: 0 0 0 3px var(--color-success-lt); }
.sys-chip-dot.amber  { background: var(--color-warning); box-shadow: 0 0 0 3px var(--color-warning-lt); }
.sys-chip-dot.red    { background: var(--color-danger);  box-shadow: 0 0 0 3px var(--color-danger-lt); }
.sys-chip-name { font-size: 12px; font-weight: 600; color: var(--text-dark); }
.sys-chip-val  { font-size: 10.5px; color: var(--text-subtle); }

/* ── Plan Cards ──────────────────────────────────────────────────────────────*/
.plan-card {
  background: var(--bg-light); border-radius: var(--radius-lg);
  border: none; padding: 20px; flex: 1;
}
.plan-card.featured { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(18,59,98,0.1); }
.plan-name   { font-size: 18px; font-weight: 800; color: var(--text-dark); margin-bottom: 2px; }
.plan-price  { font-size: 26px; font-weight: 900; color: var(--color-primary); }
.plan-price span { font-size: 13px; font-weight: 400; color: var(--text-subtle); }
.plan-tenants { font-size: 11px; color: var(--text-subtle); margin-bottom: 14px; margin-top: 4px; }
.plan-divider { height: 1px; background: var(--border-light); margin: 14px 0; }
.feature-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border-light); font-size: 12px;
}
.feature-row:last-child { border-bottom: none; }
.check { color: var(--color-success); font-weight: 800; font-size: 14px; }
.cross { color: #c8d8ec;              font-weight: 800; font-size: 14px; }

/* ── QR Grid ─────────────────────────────────────────────────────────────────*/
.qr-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1100px) { .qr-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .qr-grid { grid-template-columns: repeat(2, 1fr); } }
.qr-card {
  background: var(--bg-light); border-radius: var(--radius-lg);
  border: none; padding: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.qr-image {
  width: 120px; height: 120px; background: var(--bg-app);
  border: 2px solid var(--border); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: var(--border);
}

/* ── Misc Helpers ────────────────────────────────────────────────────────────*/
.wf-row { display: flex; gap: 16px; margin-bottom: 20px; align-items: flex-start; }
.flex-1  { flex: 1; min-width: 0; }
.flex-2  { flex: 2; min-width: 0; }
.flex-3  { flex: 3; min-width: 0; }
.w-100   { width: 100%; }
.mb-0    { margin-bottom: 0; }
.mt-4    { margin-top: 16px; }
.section-title {
  font-size: 14px; font-weight: 800; color: var(--text-dark);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.chip-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

/* ── Loading States ──────────────────────────────────────────────────────────*/
.spinner-ring {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border-light); border-top-color: var(--color-primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 40px; color: var(--text-subtle); font-size: 13px;
}

/* ── Auth Pages ──────────────────────────────────────────────────────────────*/
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1E2A3B 0%, #0f1722 100%); padding: 24px;
}
.auth-card {
  background: var(--bg-card); border-radius: var(--radius-xl);
  padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-md);
}
.auth-logo {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  margin-bottom: 28px;
}
.auth-logo-box {
  width: 40px; height: 40px; background: var(--color-primary);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #fff;
}
.auth-logo-text { font-weight: 800; font-size: 20px; color: var(--text-dark); }
.auth-title { font-size: 22px; font-weight: 800; color: var(--text-dark); margin-bottom: 4px; }
.auth-subtitle { font-size: 13px; color: var(--text-subtle); margin-bottom: 28px; }
.auth-error-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-app);
}
.auth-error-card {
  text-align: center; padding: 48px; max-width: 380px;
}
.auth-error-icon { font-size: 52px; margin-bottom: 16px; display: block; }
.auth-loading {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 100vh; font-size: 14px; color: var(--text-subtle);
}

/* ── Pagination ──────────────────────────────────────────────────────────────*/
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn {
  min-width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; cursor: pointer; color: #4a5e76;
  transition: all var(--transition);
}
.page-btn:hover   { background: var(--border-light); }
.page-btn.active  { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Toasts ──────────────────────────────────────────────────────────────────*/
.toast {
  padding: 12px 18px; border-radius: var(--radius-md);
  font-size: 12.5px; font-weight: 500; min-width: 240px;
  box-shadow: var(--shadow-md); animation: slideUp 0.2s ease;
  transition: opacity 0.3s, transform 0.3s;
}
.toast-info    { background: var(--color-primary); color: #fff; }
.toast-success { background: var(--color-success); color: #fff; }
.toast-danger  { background: var(--color-danger);  color: #fff; }
.toast-warning { background: var(--color-warning); color: #fff; }
.toast-hide    { opacity: 0; transform: translateY(10px); }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ── RTL Support ─────────────────────────────────────────────────────────────*/
/* NOTE: sidebar-item uses flex-direction:row which in RTL already flows RIGHT→LEFT,
   giving icon on the right (inline-start) and text on the left — no override needed. */
[dir="rtl"] .topbar-right { margin-left: unset; margin-right: auto; }
[dir="rtl"] .td-actions { justify-content: flex-start; }
[dir="rtl"] .form-actions { flex-direction: row-reverse; }
[dir="rtl"] .wf-card-header .wf-card-action { margin-left: unset; margin-right: auto; }

/* ── Stat Row (plan usage bars) ─────────────────────────────────────────────*/
.stat-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.stat-label { font-size: 11.5px; color: #4a5e76; width: 130px; flex-shrink: 0; }
.stat-bar   { flex: 1; display: flex; align-items: center; gap: 8px; }
.stat-val   { font-size: 11.5px; font-weight: 600; color: var(--text-dark); white-space: nowrap; }

/* ── Day Chips (shifts) ──────────────────────────────────────────────────────*/
.day-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: var(--radius-sm);
  font-size: 10px; font-weight: 700; border: 1.5px solid var(--border); color: var(--text-subtle);
}
.day-chip.on { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ── Action Panel ────────────────────────────────────────────────────────────*/
.action-panel { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.action-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-light); border-radius: var(--radius-md); border: 1.5px solid var(--border);
}
.action-item-icon  { font-size: 18px; }
.action-item-title { font-size: 12px; font-weight: 600; color: var(--text-dark); }
.action-item-sub   { font-size: 10.5px; color: var(--text-subtle); }
.action-item-btn   { margin-left: auto; }

/* ── Fraud Cards ─────────────────────────────────────────────────────────────*/
.fraud-score {
  font-size: 24px; font-weight: 900; padding: 6px 12px;
  border-radius: var(--radius-md); line-height: 1;
}
.fraud-score-high { background: var(--color-danger-lt);  color: #B91C1C; }
.fraud-score-med  { background: var(--color-warning-lt); color: #92400E; }
.fraud-score-low  { background: var(--color-success-lt); color: #047857; }
.fraud-reason-tag { font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 4px; }
.fraud-reason-gps     { background: var(--color-orange-lt); color: #C2410C; }
.fraud-reason-device  { background: var(--color-purple-lt); color: #6D28D9; }
.fraud-reason-offline { background: var(--color-blue-lt);   color: #1D4ED8; }
.fraud-reason-general { background: var(--color-danger-lt); color: #B91C1C; }

/* Compatibility Aliases removed - now unified in core components */
.loading-message { font-size: 13px; color: var(--text-subtle); }
.loading-overlay.overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.8); z-index: 100; }

/* ── Subscription Page ───────────────────────────────────────────────────────*/
.sub-stat-card {
  background: var(--bg-light); border-radius: var(--radius-md);
  padding: 14px 16px;
}
.sub-stat-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 4px;
}
.sub-stat-value {
  font-size: 22px; font-weight: 800; color: var(--text-dark); line-height: 1.2;
}
.sub-stat-max { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.sub-stat-bar {
  height: 5px; border-radius: 3px; background: var(--border-light);
  margin-top: 8px; overflow: hidden;
}
.sub-stat-fill {
  height: 100%; border-radius: 3px; transition: width 0.3s ease;
}
.sub-stat-fill.ok      { background: var(--color-success); }
.sub-stat-fill.warning { background: var(--color-warning); }
.sub-stat-fill.danger  { background: var(--color-danger); }
.plan-feature-row {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--text-body);
  padding: 5px 0;
}
.plan-feature-row .material-symbols-rounded { color: var(--color-success); }
.plan-feature-off { color: var(--text-muted); }
.plan-feature-off .material-symbols-rounded { color: var(--color-danger); }
.plan-option-card {
  border: 2px solid var(--border-light); border-radius: var(--radius-md);
  padding: 14px 16px; cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.plan-option-card:hover { border-color: var(--color-primary); background: rgba(18,59,98,0.03); }
.plan-option-card.selected { border-color: var(--color-primary); background: rgba(18,59,98,0.05); }
.plan-option-radio {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); background: #fff;
  transition: border-color var(--transition), background var(--transition);
}
.plan-option-radio.checked {
  border-color: var(--color-primary); background: var(--color-primary);
  box-shadow: inset 0 0 0 3px #fff;
}

/* ── Modal ───────────────────────────────────────────────────────────────────*/
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.38); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: var(--bg-card); border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2); width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal-sm  { max-width: 440px; }
.modal-md  { max-width: 560px; }
.modal-lg  { max-width: 720px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border-light); flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-dark); }
.modal-body  { padding: 22px; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--border-light);
  background: var(--bg-light); border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.modal-close {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: var(--bg-app); color: var(--text-subtle); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  transition: background var(--transition); flex-shrink: 0;
}
.modal-close:hover { background: var(--border); color: var(--text-dark); }

/* ── Confirm Dialog ──────────────────────────────────────────────────────────*/
.confirm-body { padding: 24px 22px; text-align: center; }
.confirm-icon { font-size: 40px; margin-bottom: 12px; }
.confirm-title { font-size: 16px; font-weight: 700; color: var(--text-dark); margin-bottom: 8px; }
.confirm-text  { font-size: 13px; color: var(--text-subtle); }

/* Topbar missing elements */
.topbar-toggle {
  background: none; border: none; cursor: pointer; padding: 6px;
  border-radius: var(--radius-sm); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.topbar-toggle .material-symbols-rounded { font-size: 22px; }
.topbar-toggle:hover { background: var(--bg-app); }
.topbar-breadcrumb { font-size: 15px; font-weight: 700; color: var(--text-dark); flex: 1; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-lang { display: flex; align-items: center; gap: 4px; }
.topbar-lang .btn.active { background: var(--color-primary-lt); color: var(--color-primary); border-color: rgba(18,59,98,0.3); }

/* Page structure */
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title  { font-size: 20px; font-weight: 800; color: var(--text-dark); }
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

/* ── Login page — Brand redesign ─────────────────────────────────────────── */

/* Full-screen gradient, flex-column so hero + card stack vertically */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(160deg, #123B62 0%, #00A9CB 100%);
  position: relative;
  overflow: hidden;
}

/* Top bar (language dropdown) */
.login-top-bar {
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: flex-end;
  padding: 20px 24px 0;
}

/* Language dropdown on gradient background */
.lang-dropdown-gradient {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 20px 7px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.18);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  min-width: 110px;
  text-align: start;
  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 d='M1 1l5 5 5-5' stroke='%23fff' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.lang-dropdown-gradient option {
  color: #123B62;
  background: #ffffff;
  font-weight: 600;
}
.lang-dropdown-gradient:focus { outline: none; }

/* Hero section: logo + brand on gradient */
.login-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px 32px;
  animation: fadeInDown 0.55s ease;
}
.login-logo-hero {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: brightness(0) invert(1) drop-shadow(0 4px 16px rgba(0,0,0,0.2));
  margin-bottom: 12px;
}
.login-brand-name {
  font-size: 28px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.login-hero-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  text-align: center;
}

/* Auth card logo (ForgotPassword / ResetPassword) */
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
}
.login-logo .auth-card-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.login-logo .login-brand {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text-dark, #0d1b2a);
  letter-spacing: -0.3px;
}

/* White card */
.login-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 36px 36px 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 64px rgba(18,59,98,0.28);
  animation: slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.1s;
}

/* Card title */
.login-title {
  font-size: 20px;
  font-weight: 800;
  color: #123B62;
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Input with icon — uses logical CSS for RTL/LTR */
.input-with-icon { position: relative; }
.input-with-icon .input-icon {
  position: absolute;
  inset-inline-start: 12px;   /* left in LTR, right in RTL */
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  line-height: 1;
  color: #8F939B;
  pointer-events: none;
  transition: color 0.15s;
  display: inline-flex;
  align-items: center;
}
.input-with-icon:focus-within .input-icon { color: #00A9CB; }
.form-control-icon {
  padding-inline-start: 40px !important;   /* icon side */
  padding-inline-end: 12px !important;
}
.form-control-icon.has-toggle {
  padding-inline-end: 40px !important;     /* toggle side */
}
.input-toggle {
  position: absolute;
  inset-inline-end: 10px;    /* right in LTR, left in RTL */
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #8F939B;
  display: inline-flex;
  align-items: center;
  padding: 4px;
  transition: color 0.15s;
}
.input-toggle:hover { color: #123B62; }

/* Brand primary button */
.btn-brand {
  background: linear-gradient(135deg, #123B62, #00A9CB);
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-brand:hover:not(:disabled) { opacity: 0.9; }
.btn-brand:active:not(:disabled) { transform: scale(0.98); }
.btn-brand:disabled { opacity: 0.6; cursor: not-allowed; }

/* Spinner */
.btn-spin { animation: btn-spin 0.9s linear infinite; font-size: 18px; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* Full-width */
.btn-full { width: 100%; justify-content: center; margin-top: 8px; }

/* Forgot */
.login-forgot { text-align: center; margin-top: 16px; font-size: 13px; }
.login-forgot a { color: #00A9CB; font-weight: 600; text-decoration: none; }
.login-forgot a:hover { text-decoration: underline; }

/* Animations */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Mobile: card fills full width and sticks to bottom */
@media (max-width: 540px) {
  .login-page { justify-content: flex-end; }
  .login-card {
    border-radius: 24px 24px 0 0;
    max-width: 100%;
    margin-top: auto;
    padding: 28px 24px 32px;
  }
}

/* Alert close button */
.alert-close { background: none; border: none; cursor: pointer; margin-inline-start: auto; color: inherit; opacity: 0.6; padding: 2px; line-height: 1; display: flex; align-items: center; border-radius: var(--radius-sm); flex-shrink: 0; }
.alert-close:hover { opacity: 1; background: rgba(0,0,0,0.06); }

/* Avatar sizes */
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; background: var(--color-primary-lt); color: var(--color-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.avatar-lg { width: 48px; height: 48px; border-radius: 50%; background: var(--color-primary-lt); color: var(--color-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; flex-shrink: 0; }

/* Pagination info */
.pagination-info { font-size: 11.5px; color: var(--text-subtle); margin-left: 8px; }

/* Filter search width */
.filter-search { min-width: 220px; }

/* Misc helpers */
.text-center    { text-align: center; }
.text-right     { text-align: right; }
.detail-list    { display: flex; flex-direction: column; gap: 10px; }
.detail-list dt { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.detail-list dd { font-size: 13px; color: var(--text-body); margin: 0; }
.detail-grid    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btn-group      { display: flex; gap: 6px; align-items: center; }
.btn-group-vertical { display: flex; flex-direction: column; gap: 6px; }
.form-row       { display: flex; gap: 14px; }
.form-hint      { font-size: 10.5px; color: var(--text-subtle); margin-top: 3px; }
.tabs           { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn        { padding: 10px 16px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; background: none; border: none; border-bottom: 2.5px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.tab-btn:hover  { color: var(--text-body); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.code-block     { font-family: 'Courier New', monospace; font-size: 12px; background: var(--bg-app); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text-dark); }

/* ── Environment banner ──────────────────────────────────────────────────── */
.env-banner       { position: sticky; top: 0; z-index: 1000; background: #F59E0B; color: #1a2232; text-align: center; padding: 6px 16px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.env-banner-icon  { font-size: 14px; }

/* ── Notification list ───────────────────────────────────────────────────── */
.notification-list    { display: flex; flex-direction: column; gap: 8px; }
.notification-card    { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: background var(--transition), border-color var(--transition); }
.notification-card:hover { background: var(--bg-light); border-color: var(--color-primary); }
.notification-unread  { border-left: 3px solid var(--color-primary); background: var(--color-primary-lt); }
.notification-icon    { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.notification-body    { flex: 1; min-width: 0; }
.notification-title   { font-size: 13.5px; font-weight: 600; color: var(--text-dark); margin-bottom: 3px; }
.notification-text    { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; white-space: pre-wrap; }
.notification-meta    { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.notification-dot     { width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); flex-shrink: 0; margin-top: 6px; }

/* ── Location Map ────────────────────────────────────────────────────────────*/
.map-container {
  width: 100%;
  height: 260px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  overflow: hidden;
  position: relative;
  margin-bottom: 8px;
  background: #e8eef4;
}
.map-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  margin-top: 6px;
  gap: 8px;
}
.map-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.map-hint {
  font-size: 10.5px;
  color: var(--text-subtle);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 3px;
}
/* Tiny inline spinner used in the "Use Current Location" button */
.loc-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(37,99,235,0.25);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: loc-spin 0.7s linear infinite;
  flex-shrink: 0;
}
.btn-primary .loc-spinner,
.btn-secondary .loc-spinner {
  border-color: rgba(255,255,255,0.35);
  border-top-color: currentColor;
}
@keyframes loc-spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
  .map-container { height: 200px; }
  .map-section-header { flex-wrap: wrap; }
}

/* ── RTL / Arabic support ──────────────────────────────────────────────────── */
[dir="rtl"] {
  /* Noto Sans Arabic first: it's loaded with real 400-800 weight files, unlike the
     locally-installed Segoe UI/Tahoma fallbacks which top out at Bold(700) and force
     the browser to fake-bold heavier weights (e.g. .page-title's 800), rendering
     noticeably heavier than intended. */
  font-family: 'Noto Sans Arabic', 'Segoe UI', 'Tahoma', Arial, sans-serif;
  text-align: right;
}
[dir="rtl"] .sidebar             { left: auto; right: 0; border-right: none; border-left: 1px solid var(--border-light); }
[dir="rtl"] .main-content        { margin-left: 0; margin-right: var(--sidebar-width); }
[dir="rtl"] .sidebar.collapsed + .main-content { margin-right: var(--sidebar-collapsed-width); }
[dir="rtl"] .topbar              { left: 0; right: var(--sidebar-width); }
[dir="rtl"] .sidebar.collapsed ~ .topbar { right: var(--sidebar-collapsed-width); }
[dir="rtl"] .ms-auto            { margin-left: 0 !important; margin-right: auto !important; }
[dir="rtl"] .me-auto            { margin-right: 0 !important; margin-left: auto !important; }
[dir="rtl"] .text-end           { text-align: left !important; }
[dir="rtl"] .text-start         { text-align: right !important; }
[dir="rtl"] .float-end          { float: left !important; }
[dir="rtl"] .float-start        { float: right !important; }
[dir="rtl"] .btn-group          { flex-direction: row-reverse; }
[dir="rtl"] .form-label         { text-align: right; }
[dir="rtl"] .sidebar-nav-icon   { margin-right: 0; margin-left: 10px; }
[dir="rtl"] .table th,
[dir="rtl"] .table td           { text-align: right; }
[dir="rtl"] .card-header-actions { margin-left: 0; margin-right: auto; }
[dir="rtl"] .pagination-row     { flex-direction: row-reverse; }
[dir="rtl"] .topbar-actions     { flex-direction: row-reverse; }

/* ── Language switcher ─────────────────────────────────────────────────────── */
.language-switcher              { display: flex; align-items: center; gap: 2px; }
.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.lang-btn:hover                 { color: var(--color-primary); background: var(--bg-light); }
.lang-btn--active               { color: var(--color-primary); }
.lang-btn:disabled              { cursor: default; }
.lang-divider                   { color: var(--border); font-size: 11px; }

/* ══════════════════════════════════════════════════════════════════════════════
   BRAND DESIGN SYSTEM — TapTrack #123B62 / #00A9CB
   ══════════════════════════════════════════════════════════════════════════════ */
:root {
  --brand-navy:  #123B62;
  --brand-cyan:  #00A9CB;
  --brand-gray:  #8F939B;
  --brand-navy-lt: rgba(18,59,98,0.09);
  --brand-cyan-lt: rgba(0,169,203,0.1);
}

/* ── Sidebar — Navy theme ────────────────────────────────────────────────────*/
.sidebar {
  --sidebar-bg:     #123B62;
  --sidebar-border: rgba(255,255,255,0.1);
  --sidebar-text:   rgba(255,255,255,0.72);
  --sidebar-active: #00A9CB;
  background: #123B62;
  border-right-color: rgba(255,255,255,0.08);
}

/* Logo strip */
.sidebar-logo { border-bottom-color: rgba(255,255,255,0.1); }
.sidebar-logo-img {
  width: 32px; height: 32px; object-fit: contain;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}
.sidebar-logo-text { color: #ffffff; font-weight: 800; }
.sidebar-logo-badge {
  background: rgba(0,169,203,0.25);
  color: #7ee8ff;
  border-color: rgba(0,169,203,0.3);
}

/* Section labels */
.sidebar-section-label { color: rgba(255,255,255,0.4); }

/* Nav items */
.sidebar-item { color: rgba(255,255,255,0.72); }
.sidebar-item:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  text-decoration: none;
}
.sidebar-item.active {
  background: rgba(0,169,203,0.22);
  color: #ffffff;
  font-weight: 700;
}
.sidebar-item.active .material-symbols-rounded { color: #00A9CB; }

/* Dashboard first item — slightly bolder highlight */
.sidebar-section-top .sidebar-item { font-weight: 600; }
.sidebar-section-top .sidebar-item.active {
  background: linear-gradient(90deg, rgba(0,169,203,0.3), rgba(0,169,203,0.1));
}

/* Collapse toggle button */
.sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 8px 0;
  background: none; border: none; border-top: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4); cursor: pointer;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.06); }
.sidebar-collapse-btn .material-symbols-rounded { font-size: 18px; }
/* RTL: sidebar is on the right so chevrons point the opposite way */
[dir="rtl"] .sidebar-collapse-btn .material-symbols-rounded { transform: scaleX(-1); }

/* User strip */
.sidebar-user { border-top-color: rgba(255,255,255,0.1); }
.sidebar-user-av {
  background: rgba(0,169,203,0.25);
  color: #7ee8ff;
}
.sidebar-user-name { color: rgba(255,255,255,0.92); }
.sidebar-user-role { color: rgba(255,255,255,0.45); }

/* ── KPI cards — brand colour variants ────────────────────────────────────── */
.kpi-icon-cyan   { background: rgba(0,169,203,0.12);  color: #00A9CB; }
.kpi-icon-navy   { background: rgba(18,59,98,0.1);    color: #123B62; }
.kpi-icon-teal   { background: rgba(0,169,203,0.12);  color: #0097b5; }

/* ── Dashboard layout ────────────────────────────────────────────────────────*/

/* KPI row — 4 cards */
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .dash-kpi-row { grid-template-columns: 1fr; }
}

/* Chart cards row — 4 donuts */
.dash-charts-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 1100px) {
  .dash-charts-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .dash-charts-row { grid-template-columns: 1fr; }
}

/* Super admin: 3 donuts */
.dash-charts-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .dash-charts-row-3 { grid-template-columns: 1fr 1fr; }
}

/* Bottom split: live-feed | line chart */
.dash-bottom-row {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
}
@media (max-width: 1000px) {
  .dash-bottom-row { grid-template-columns: 1fr; }
}

/* Generic dashboard card */
.dash-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px 16px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 8px;
}

.dash-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  flex: 1;
}

.dash-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dash-card-btn {
  width: 26px; height: 26px;
  border: none; background: none;
  border-radius: var(--radius-sm);
  color: var(--text-subtle);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.dash-card-btn:hover { background: var(--bg-app); color: var(--text-dark); }
.dash-card-btn .material-symbols-rounded { font-size: 16px; }

/* Donut chart — flex: 1 fills space between header and legend so all cards look uniform */
.dash-donut-wrap {
  flex: 1;
  min-height: 130px;
  max-height: 200px;
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* Donut legend */
.dash-legend {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.dash-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-body);
}

.dash-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-legend-item > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dash-legend-val {
  font-size: 12px; font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
}

.dash-legend-pct {
  font-size: 11px;
  color: var(--text-subtle);
  white-space: nowrap;
}

/* ── Live feed ─────────────────────────────────────────────────────────────── */
.dash-feed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 320px;
}

.dash-feed-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-feed-av {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-cyan-lt);
  color: var(--brand-cyan);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.dash-feed-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.dash-feed-name {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.dash-feed-sub {
  font-size: 11px;
  color: var(--text-subtle);
}

.dash-feed-time {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Date badge in page header ─────────────────────────────────────────────── */
.dash-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 4px 10px;
}

/* ── Live-dot pulse ────────────────────────────────────────────────────────── */
.dash-live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #10B981;
  flex-shrink: 0;
  animation: livePulse 1.5s infinite ease-in-out;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(16,185,129,0); }
}

/* ── Refresh badge ──────────────────────────────────────────────────────────── */
.dash-refresh-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px; font-weight: 600;
  color: var(--text-subtle);
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
}

/* ── Empty state ────────────────────────────────────────────────────────────── */
.dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 16px;
  color: var(--text-subtle);
  font-size: 13px;
}
.dash-empty .material-symbols-rounded { font-size: 32px; opacity: 0.4; }

/* ── Line chart wrapper ──────────────────────────────────────────────────────── */
.dash-line-wrap {
  flex: 1;
  min-height: 200px;
  position: relative;
}

/* ══ RESPONSIVE IMPROVEMENTS ════════════════════════════════════════════════ */

/* 5-column KPI row (super admin) */
.dash-kpi-row-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 1200px) {
  .dash-kpi-row-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .dash-kpi-row-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .dash-kpi-row-5 { grid-template-columns: 1fr; }
}

/* 4-column KPI row — finer tablet breakpoints */
@media (max-width: 800px) {
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* 3-donut row — add missing single-column breakpoint */
@media (max-width: 560px) {
  .dash-charts-row-3 { grid-template-columns: 1fr; }
}

/* Bottom row: stack on medium screens too */
@media (max-width: 1100px) {
  .dash-bottom-row { grid-template-columns: 1fr; }
}

/* ══ RTL DASHBOARD FIXES ═════════════════════════════════════════════════════ */

/* Notification unread accent bar: flip to inline-start side */
[dir="rtl"] .notification-unread {
  border-left: none;
  border-right: 3px solid var(--color-primary);
}

/* Legend: dot stays at inline-start, values pushed to inline-end */
[dir="rtl"] .dash-legend-item > span:nth-child(2) {
  text-align: right;
}

/* KPI card trend pill: icon before text in reading direction */
[dir="rtl"] .kpi-trend-pill {
  flex-direction: row-reverse;
}

/* Date badge: icon follows text in RTL reading direction */
[dir="rtl"] .dash-date-badge {
  flex-direction: row-reverse;
}

/* Refresh badge: sync icon follows label */
[dir="rtl"] .dash-refresh-badge {
  flex-direction: row-reverse;
}

/* Feed meta text: explicit right-align for Arabic */
[dir="rtl"] .dash-feed-meta {
  text-align: right;
}

.dash-legend-dot {
  width: 9px; height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.dash-legend-val {
  margin-inline-start: auto;
  font-weight: 700;
  font-size: 12px;
  color: var(--text-dark);
}

.dash-legend-pct {
  font-size: 11px;
  color: var(--text-subtle);
  margin-inline-start: 2px;
}

/* Line chart */
.dash-line-wrap {
  flex: 1;
  min-height: 200px;
  position: relative;
}

/* Live feed */
.dash-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  max-height: 280px;
  flex: 1;
}

.dash-feed-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.dash-feed-item:last-child { border-bottom: none; }
.dash-feed-item:hover { background: var(--bg-app); border-radius: var(--radius-sm); }

.dash-feed-av {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-cyan-lt);
  color: var(--brand-cyan);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}

.dash-feed-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dark);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-feed-time {
  font-size: 11px;
  color: var(--text-subtle);
  flex-shrink: 0;
}

.dash-feed-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.dash-feed-sub {
  font-size: 11px;
  color: var(--text-subtle);
}

/* Date badge in page header */
.dash-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background: var(--brand-cyan-lt);
  color: var(--brand-cyan);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid rgba(0,169,203,0.18);
}

/* Refresh badge */
.dash-refresh-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--brand-cyan);
  font-weight: 600;
}

/* Live indicator */
.dash-live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  animation: dash-pulse 2s infinite;
}
@keyframes dash-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Empty state inside card */
.dash-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  font-size: 12px;
  gap: 6px;
  padding: 20px 0;
}
.dash-empty .material-symbols-rounded { font-size: 32px; color: var(--border); }

/* ══ ADMIN REDESIGN — SHARED COMPONENTS ════════════════════════════════════ */

/* ── Toolbar ────────────────────────────────────────────────────────────────*/
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar-search { position: relative; flex: 1; min-width: 180px; }
.toolbar-search .material-symbols-rounded {
  position: absolute;
  inset-inline-start: 11px;
  top: 50%; transform: translateY(-50%);
  font-size: 16px; color: var(--text-subtle); pointer-events: none;
}
.toolbar-search input {
  width: 100%; height: 38px;
  padding-inline: 36px 12px; padding-block: 0;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-xl);
  background: var(--bg-app);
  font-size: 13px; color: var(--text-body); font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.toolbar-search input:focus {
  outline: none; border-color: #00A9CB;
  box-shadow: 0 0 0 3px rgba(0,169,203,0.1); background: var(--bg-card);
}
.toolbar-search input::placeholder { color: var(--text-subtle); }
[dir="rtl"] .toolbar-search input { padding-inline: 12px 36px; }

.toolbar-select {
  height: 38px; padding-inline: 12px 30px; padding-block: 0;
  border: 1.5px solid var(--border-light); border-radius: var(--radius-md);
  background-color: var(--bg-app);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24'%3E%3Cpath fill='%23737686' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
  appearance: none; -webkit-appearance: none;
  font-size: 12.5px; font-family: var(--font); color: var(--text-body);
  cursor: pointer; transition: border-color var(--transition); min-width: 130px;
}
.toolbar-select:focus { outline: none; border-color: #00A9CB; }
[dir="rtl"] .toolbar-select { background-position: left 10px center; padding-inline: 30px 12px; }
.toolbar-sep { width: 1px; height: 22px; background: var(--border-light); flex-shrink: 0; }
.toolbar-end { margin-inline-start: auto; }

/* ── Page card ──────────────────────────────────────────────────────────────*/
.pg-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
  margin-bottom: 16px; overflow: hidden;
}
.pg-card-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid var(--border-light);
}
.pg-card-hd-icon {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #123B62 0%, #00A9CB 100%);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pg-card-hd-icon .material-symbols-rounded { font-size: 15px; color: #fff; }
.pg-card-title { font-size: 13.5px; font-weight: 700; color: var(--text-dark); flex: 1; }
.pg-card-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.pg-card-body { padding: 20px; }

/* ── View-mode fields ───────────────────────────────────────────────────────*/
.view-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.view-fields.cols-1 { grid-template-columns: 1fr; }
.view-fields.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.view-field { display: flex; flex-direction: column; gap: 4px; }
.view-field.span-2 { grid-column: span 2; }
.vf-label {
  font-size: 10.5px; font-weight: 700;
  color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.6px;
}
.vf-value {
  font-size: 13px; color: var(--text-dark); font-weight: 500;
  padding: 8px 12px; background: var(--bg-app);
  border-radius: var(--radius-md); border: 1.5px solid var(--border-light);
  min-height: 38px; display: flex; align-items: center; line-height: 1.5; word-break: break-word;
}
.vf-value.lg { min-height: 72px; align-items: flex-start; }
.vf-value .empty { color: var(--text-subtle); font-style: italic; font-weight: 400; }

/* ── Detail split layout ────────────────────────────────────────────────────*/
.detail-split { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
@media (max-width: 900px) {
  .detail-split { grid-template-columns: 1fr; }
  .view-fields  { grid-template-columns: 1fr; }
  .view-field.span-2 { grid-column: span 1; }
}

/* ── View/Edit mode toggle ──────────────────────────────────────────────────*/
.mode-toggle {
  display: inline-flex; border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md); overflow: hidden; background: var(--bg-card);
}
.mode-toggle-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); transition: all var(--transition);
  text-decoration: none; font-family: var(--font);
}
.mode-toggle-btn + .mode-toggle-btn { border-inline-start: 1.5px solid var(--border-light); }
.mode-toggle-btn.active {
  background: linear-gradient(135deg, #123B62 0%, #00A9CB 100%);
  color: #fff; cursor: default;
}
.mode-toggle-btn:hover:not(.active) { background: var(--bg-app); color: var(--text-dark); text-decoration: none; }
.mode-toggle-btn .material-symbols-rounded { font-size: 14px; }

/* ── Form section headers ───────────────────────────────────────────────────*/
.form-section-hd {
  display: flex; align-items: center; gap: 7px;
  padding-bottom: 10px; border-bottom: 1.5px solid var(--border-light); margin-bottom: 16px;
}
.form-section-hd .material-symbols-rounded { font-size: 15px; color: #00A9CB; }
.form-section-hd-text {
  font-size: 11.5px; font-weight: 700;
  color: var(--text-dark); text-transform: uppercase; letter-spacing: 0.6px;
}

/* ── Feature grid ───────────────────────────────────────────────────────────*/
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.feature-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-body); cursor: pointer;
  padding: 7px 10px; border-radius: var(--radius-sm); transition: background var(--transition);
}
.feature-check:hover { background: var(--bg-app); }
.feature-check input[type="checkbox"] {
  width: 14px; height: 14px; accent-color: #00A9CB; cursor: pointer; flex-shrink: 0;
}
.feature-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.feature-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
}
.feature-tag.on  { background: var(--color-success-lt); color: #047857; }
.feature-tag.off { background: var(--bg-app); color: var(--text-subtle); border: 1px solid var(--border-light); }
.feature-tag .material-symbols-rounded { font-size: 12px; }

/* ── Attendance method radio group ─────────────────────────────────────────*/
.method-radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.method-radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}
.method-radio-option input[type="radio"] { display: none; }
.method-radio-option .material-symbols-rounded { font-size: 18px; }
.method-radio-option:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-lt, #e8f4ff);
}
.method-radio-option.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-lt, #e8f4ff);
  color: var(--color-primary);
}

/* ── Table empty state ──────────────────────────────────────────────────────*/
.table-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 56px 24px; color: var(--text-subtle); text-align: center;
}
.table-empty-state .material-symbols-rounded { font-size: 38px; opacity: 0.2; margin-bottom: 10px; }
.table-empty-title { font-size: 13.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 3px; }
.table-empty-sub   { font-size: 12px; }

/* ── Action list ────────────────────────────────────────────────────────────*/
.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: var(--radius-md); cursor: pointer; font-size: 12.5px; font-weight: 500;
  border: 1.5px solid var(--border-light); background: var(--bg-card);
  color: var(--text-body); transition: all var(--transition);
  text-align: start; width: 100%; font-family: var(--font);
}
.action-item:hover { background: var(--bg-app); border-color: var(--border); }
.action-item.danger  { color: var(--color-danger); border-color: rgba(186,26,26,0.2); }
.action-item.danger:hover  { background: var(--color-danger-lt); border-color: var(--color-danger); }
.action-item.success { color: var(--color-success); border-color: rgba(16,185,129,0.2); }
.action-item.success:hover { background: var(--color-success-lt); border-color: var(--color-success); }
.action-item .material-symbols-rounded { font-size: 18px; flex-shrink: 0; }
.action-item-body  { display: flex; flex-direction: column; gap: 1px; }
.action-item-title { font-weight: 600; }
.action-item-sub   { font-size: 11px; color: var(--text-subtle); }

/* ── Entity cell ────────────────────────────────────────────────────────────*/
.entity-cell { display: flex; align-items: center; gap: 10px; }
.entity-av {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #123B62 0%, #00A9CB 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.entity-av.sq { border-radius: var(--radius-md); }
.entity-name  { font-weight: 600; color: var(--text-dark); font-size: 13px; }
.entity-sub   { font-size: 11px; color: var(--text-subtle); margin-top: 1px; }

/* ── Code block ─────────────────────────────────────────────────────────────*/
.code-block {
  background: #0d1f33; color: #8dd8c0;
  padding: 16px 18px; border-radius: var(--radius-md);
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 12px; line-height: 1.7;
  overflow-x: auto; max-height: 420px; overflow-y: auto; white-space: pre;
}

/* ── Btn success ─────────────────────────────────────────────────────────────*/
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #0d9e6e; }

/* ── Table th improvements ──────────────────────────────────────────────────*/
.table thead th {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-subtle); background: var(--bg-app);
  padding: 10px 14px; white-space: nowrap;
}
.table tbody td { padding: 12px 14px; }
.table tbody tr:hover td { background: var(--bg-app); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Modal improvements ─────────────────────────────────────────────────────*/
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
}
.modal-hd-title { font-size: 15px; font-weight: 700; color: var(--text-dark); }
.modal-bd { padding: 20px; }
.modal-ft {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border-light);
  background: var(--bg-app);
}
