:root {
  color-scheme: light;
  --bg: #F8FAFC;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-solid: #ffffff;
  --surface-2: #F1F5F9;
  --text: #0F172A;
  --muted: #1E293B;
  --line: rgba(0, 0, 0, 0.06);
  --brand: #1E3A8A;
  --brand-2: #0EA5E9;
  --good: #16A34A;
  --warn: #F59E0B;
  --bad: #EF4444;
  --ink: #0F172A;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.06), 0 4px 8px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.08), 0 8px 16px rgba(15, 23, 42, 0.04);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-full: 9999px;
  --font-en: Tajawal, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-ar: Tajawal, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font: var(--font-en);
  --glass-blur: blur(24px);
  --glass-border: 1px solid rgba(255, 255, 255, 0.4);
  
  /* Background Orbs */
  --orb-1: rgba(94, 129, 255, 0.15);
  --orb-2: rgba(31, 191, 168, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090E17;
  --surface: rgba(15, 23, 42, 0.7);
  --surface-solid: #0F172A;
  --surface-2: rgba(30, 41, 59, 0.8);
  --text: #F8FAFC;
  --muted: #94A3B8;
  --line: rgba(255, 255, 255, 0.06);
  --brand: #0EA5E9;
  --brand-2: #14B8A6;
  --good: #4ADE80;
  --warn: #FBBF24;
  --bad: #F87171;
  --ink: #F8FAFC;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.5);
  --glass-border: 1px solid rgba(255, 255, 255, 0.05);
  
  /* Background Orbs */
  --orb-1: rgba(14, 165, 233, 0.15);
  --orb-2: rgba(20, 184, 166, 0.12);
}

html[dir="rtl"] { 
  --font: var(--font-ar); 
}
html[dir="rtl"] body {
  font-size: 16px; /* Slightly larger for Arabic legibility */
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background-color: var(--bg);
}

/* Dynamic Background container */
.app-bg-wrapper {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background-color: var(--bg);
}

.app-bg-wrapper::before,
.app-bg-wrapper::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  animation: floatOrb 20s infinite ease-in-out alternate;
}

.app-bg-wrapper::before {
  width: 50vw;
  height: 50vw;
  background: var(--orb-1);
  top: -10vw;
  left: -10vw;
}

.app-bg-wrapper::after {
  width: 40vw;
  height: 40vw;
  background: var(--orb-2);
  bottom: -10vw;
  right: -5vw;
  animation-delay: -10s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(5%, 10%) scale(1.1); }
}

body {
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
html[dir="rtl"] body {
  letter-spacing: 0 !important;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* -------------------------------------------------------------
   Login Page Styling
------------------------------------------------------------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(420px, 0.9fr);
  position: relative;
}

.login-visual {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
  background: none;
  color: #fff;
  overflow: hidden;
}

.login-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(15, 23, 42, 0.8), rgba(30, 58, 138, 0.5));
  z-index: 0;
}

.login-brand, .login-copy, .top-actions {
  position: relative;
  z-index: 1;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.5px;
}

.login-brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: rgba(255,255,255, 0.95);
  border-radius: var(--radius-sm);
  padding: 8px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.login-copy { max-width: 680px; }
.login-copy h1 {
  font-size: clamp(48px, 7.5vw, 92px);
  font-weight: 800;
  line-height: 1.05;
  margin: 0 0 20px;
  letter-spacing: -1.5px;
}
.login-copy p {
  max-width: 580px;
  margin: 0;
  font-size: 19px;
  line-height: 1.6;
  color: rgba(255,255,255, 0.9);
}

.login-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--bg);
  position: relative;
}

.login-card {
  width: min(100%, 460px);
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.1);
}

.login-card h2, .page-title h1 {
  margin: 0;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.login-card p, .page-title p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 15px;
}

.login-card h2 { font-size: 28px; margin-bottom: 8px; }
.login-card p { margin-bottom: 32px; }

/* -------------------------------------------------------------
   Forms & Inputs
------------------------------------------------------------- */
.field { margin: 0 0 20px; }
.field label {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.input, .select, .textarea {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text);
  padding: 12px 16px;
  outline: none;
  font-size: 15px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  appearance: none;
  -webkit-appearance: none;
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-inline-end: 42px;
}

html[dir="rtl"] .select {
  background-position: left 16px center;
}

.input[type="date"] {
  position: relative;
}

.input[type="date"]::-webkit-calendar-picker-indicator {
  background: transparent;
  bottom: 0;
  color: transparent;
  cursor: pointer;
  height: auto;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  width: auto;
}

.input[type="date"]::after {
  content: '\F282';
  font-family: "bootstrap-icons";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

html[dir="rtl"] .input[type="date"]::after {
  right: auto;
  left: 16px;
}

.textarea { min-height: 120px; resize: vertical; }

.textarea.is-readonly {
  opacity: 0.65;
  cursor: not-allowed;
}

input[type="checkbox"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand), transparent 85%), 0 2px 4px rgba(0,0,0,0.02);
  transform: translateY(-1px);
}

/* -------------------------------------------------------------
   Buttons
------------------------------------------------------------- */
.btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  color: var(--text);
  background: var(--surface-solid);
  padding: 10px 20px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--brand);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none;
  color: #fff;
  box-shadow: 0 8px 16px color-mix(in srgb, var(--brand), transparent 70%);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  border: none;
  box-shadow: 0 12px 24px color-mix(in srgb, var(--brand), transparent 60%);
}

.btn-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface-solid);
}

.btn-ghost { 
  background: transparent; 
  border-color: transparent; 
  box-shadow: none; 
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: transparent;
  box-shadow: none;
}

[data-theme="light"] .btn-ghost { color: var(--text); }
.login-visual .btn-ghost { color: #fff; }

.btn-icon { width: 46px; padding: 0; }
.btn svg { width: 20px; height: 20px; }

/* -------------------------------------------------------------
   App Layout
------------------------------------------------------------- */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-inline-end: var(--glass-border);
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text);
  padding: 24px 20px;
  box-shadow: 4px 0 24px rgba(0,0,0,0.02);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 24px;
  font-weight: 800;
  font-size: 22px;
  color: var(--text);
}

.brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: var(--surface-solid);
  border-radius: var(--radius-sm);
  padding: 6px;
  box-shadow: var(--shadow-sm);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button, .nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text);
  background: transparent;
  padding: 14px 16px;
  text-align: start;
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav button.active, .nav a.active {
  background: color-mix(in srgb, var(--brand), transparent 90%);
  color: var(--brand);
  font-weight: 700;
}

.nav button:hover:not(.active), .nav a:hover:not(.active) {
  background: var(--surface-2);
  color: var(--text);
  transform: translateX(4px);
}
html[dir="rtl"] .nav button:hover:not(.active), html[dir="rtl"] .nav a:hover:not(.active) {
  transform: translateX(-4px);
}

.nav svg, .nav i { 
  width: 22px; 
  height: 22px; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  font-size: 18px;
}

.sidebar-footer {
  margin-top: auto;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  padding-inline: 8px;
}
html[dir="rtl"] .sidebar-footer {
  text-align: right;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  padding: 16px 32px;
  border-bottom: var(--glass-border);
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.mobile-menu { display: none; }
.top-actions, .inline-actions { display: flex; align-items: center; gap: 12px; }

.content {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 32px;
  flex: 1; /* push footer to bottom on short pages */
  display: flex;
  flex-direction: column;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
}

/* -------------------------------------------------------------
   Grids & Cards
------------------------------------------------------------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--brand), transparent 70%);
}

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.card-link:hover .card {
  border-color: var(--brand);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}
.card-link:active .card {
  transform: translateY(-2px);
}

.card-pad { padding: 24px; }
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.compact-head {
  padding: 0 0 16px;
  border-bottom: 0;
}

.kpi {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.kpi::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100px; height: 100px;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand), transparent 90%) 0%, transparent 70%);
  z-index: 0;
  border-radius: 50%;
  transform: translate(30%, -30%);
}

html[dir="rtl"] .kpi::before {
  right: auto; left: 0;
  transform: translate(-30%, -30%);
}

.kpi > * { position: relative; z-index: 1; }

.kpi .value {
  font-size: 42px;
  font-weight: 800;
  margin-top: 12px;
  letter-spacing: -1px;
}
.kpi .hint { color: var(--muted); font-size: 14px; font-weight: 500; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  gap: 6px;
}
.badge.good { background: color-mix(in srgb, var(--good), transparent 85%); color: var(--good); }
.badge.warn { background: color-mix(in srgb, var(--warn), transparent 85%); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--bad), transparent 85%); color: var(--bad); }
.badge.brand { background: color-mix(in srgb, var(--brand), transparent 85%); color: var(--brand); }

.chart-box {
  height: 340px;
  padding: 20px;
}

/* -------------------------------------------------------------
   Datatables & Tables
------------------------------------------------------------- */
.table-wrap { overflow: auto; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
}
.table th, .table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: middle;
}
.table th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.table tbody tr {
  transition: background 0.2s ease, transform 0.2s ease;
}

.table tbody tr:hover {
  background: color-mix(in srgb, var(--brand), transparent 95%);
  transform: scale(1.005);
}

.dataTable-wrapper {
  font-family: var(--font);
}
.dataTable-table > thead > tr > th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
}
.dataTable-table > tbody > tr > td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.dataTable-table > tbody > tr {
  transition: background 0.2s ease, transform 0.2s ease;
}
.dataTable-table > tbody > tr:hover {
  background: color-mix(in srgb, var(--brand), transparent 95%);
  transform: scale(1.005);
}
.dataTable-input {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  background: var(--surface-solid);
  color: var(--text);
  outline: none;
}
.dataTable-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand), transparent 85%);
}
.dataTable-selector {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  background: var(--surface-solid);
  color: var(--text);
}
.dataTable-pagination a {
  border-radius: var(--radius-sm);
  color: var(--text);
}
.dataTable-pagination a:hover {
  background: var(--surface-2);
}
.dataTable-pagination .active a {
  background: var(--brand) !important;
  color: #fff !important;
}

/* -------------------------------------------------------------
   Components
------------------------------------------------------------- */
.rate-bars { display: flex; align-items: stretch; gap: 8px; }
.rate-bar {
  height: 10px;
  min-width: 16px;
  border-radius: var(--radius-full);
  background: var(--line);
  transition: width 0.4s ease;
}
.rate-bar.poor { background: var(--bad); }
.rate-bar.average { background: var(--warn); }
.rate-bar.good { background: #3B82F6; }
.rate-bar.excellent { background: var(--good); }

.profile-logo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  padding: 8px;
  box-shadow: var(--shadow-sm);
}

.profile-strip { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }

.empty {
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
  font-size: 15px;
}

/* -------------------------------------------------------------
   Modals & Toasts
------------------------------------------------------------- */
.modal-backdrop {
  background: rgba(11, 18, 32, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-content {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal.fade .modal-dialog {
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal.show .modal-dialog {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.modal-title {
  font-weight: 800;
  font-size: 18px;
}
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.device-screenshot {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.toast-region {
  position: fixed;
  inset-inline-end: 24px;
  bottom: 24px;
  z-index: 60;
  display: grid;
  gap: 12px;
}
.toast {
  max-width: 380px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  border: var(--glass-border);
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-weight: 500;
  animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* -------------------------------------------------------------
   Responsive
------------------------------------------------------------- */
@media (max-width: 1120px) {
  .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { min-height: 45vh; padding: 40px; }
  .login-panel { min-height: auto; padding: 40px; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: 300px;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 30;
  }
  html[dir="rtl"] .sidebar {
    inset-inline-start: auto;
    inset-inline-end: 0;
    transform: translateX(105%);
  }
  .sidebar.open, html[dir="rtl"] .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .content { padding: 20px; }
  .topbar { padding: 16px 20px; }
  .page-title { flex-direction: column; gap: 12px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .login-visual { padding: 32px 24px; }
  .login-copy h1 { font-size: 40px; }
  .login-card { padding: 24px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .filter-row, .form-row, .device-meta, .ticket-head { flex-direction: column; align-items: stretch; }
}

/* -------------------------------------------------------------
   Rate Pills (dashboard feedback table)
------------------------------------------------------------- */
.rate-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  color: #fff;
}
.rate-pill-1 { background: #EF4444; }
.rate-pill-2 { background: #F59E0B; color: #1a1a1a; }
.rate-pill-3 { background: #3B82F6; }
.rate-pill-4 { background: #16A34A; }

.dashboard-recent-feedback .rate-cell {
  text-align: center;
}

.dashboard-recent-feedback .rate-pill {
  justify-content: center;
  margin-inline: auto;
}

.feedback-summary {
  display: grid;
  gap: 12px;
}

.feedback-total-card {
  width: min(100%, 420px);
  margin-inline: auto;
}

.feedback-records-table .table th,
.feedback-records-table .table td,
.feedback-records-table .dataTable-table > thead > tr > th,
.feedback-records-table .dataTable-table > tbody > tr > td {
  text-align: center;
  vertical-align: middle;
}

.feedback-records-table .rate-pill,
.feedback-records-table .info-chip,
.feedback-records-table .wa-icon-link {
  justify-content: center;
  margin-inline: auto;
}

/* -------------------------------------------------------------
   Quick Action Buttons (full-width strip)
------------------------------------------------------------- */
.quick-action-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  z-index: 1;
}
.quick-action-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
}
.quick-action-btn:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  color: #fff;
  border-color: transparent;
}
.quick-action-btn:hover::after {
  opacity: 1;
}
.quick-action-btn:hover i { 
  transform: scale(1.2) rotate(5deg); 
  color: #fff !important;
}
.quick-action-btn i { 
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s ease; 
}

/* -------------------------------------------------------------
   WA Link
------------------------------------------------------------- */
.wa-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  transition: opacity 0.2s;
}
.wa-link:hover { opacity: 0.85; }

.customers-kpi-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.customers-table-wrap .table th,
.customers-table-wrap .table td,
.customers-table-wrap .dataTable-table > thead > tr > th,
.customers-table-wrap .dataTable-table > tbody > tr > td {
  text-align: center;
  vertical-align: middle;
}

.customers-table-wrap .wa-link {
  justify-content: center;
  margin-inline: auto;
}

.customer-phone {
  font-family: monospace;
  font-weight: 600;
}

.customer-last-seen {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

/* Inline WA icon beside phone number */
.wa-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0;
}
.wa-icon-link:hover { transform: scale(1.15); opacity: .9; }

/* -------------------------------------------------------------
   Premium Device Cards
------------------------------------------------------------- */
.device-card-modern {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s ease, border-color 0.3s ease;
  display: flex;
  flex-direction: column;
}
.device-card-modern:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--brand), transparent 60%);
}

/* Gradient header strip */
.dcm-header {
  height: 6px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.dcm-header.status-expired  { background: linear-gradient(90deg, #EF4444, #F87171); }
.dcm-header.status-loggedout{ background: linear-gradient(90deg, #64748B, #94A3B8); }
.dcm-header.status-new      { background: linear-gradient(90deg, #F59E0B, #FBBF24); }

.dcm-preview-wrap {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.dcm-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--surface-2);
  transition: transform 0.4s ease;
}
.device-card-modern:hover .dcm-preview { transform: scale(1.03); }

.dcm-body { padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 14px; }

.dcm-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.dcm-title { font-size: 16px; font-weight: 700; margin: 0; color: var(--text); }
.dcm-code  { font-size: 12px; color: var(--muted); margin-top: 3px; font-family: monospace; }

.dcm-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
  white-space: nowrap;
  color: #fff;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dcm-status.status-active    { background: #16A34A; }
.dcm-status.status-expired   { background: #EF4444; }
.dcm-status.status-loggedout { background: #EF4444; }
.dcm-status.status-new       { background: #F59E0B; color: #1a1a1a; }

/* Rate bars inside card */
.dcm-bars { display: flex; gap: 6px; align-items: stretch; height: 8px; border-radius: var(--radius-full); overflow: hidden; }
.dcm-bar { min-width: 4px; flex: 1; }
.dcm-bar.poor      { background: #EF4444; }
.dcm-bar.average   { background: #F59E0B; }
.dcm-bar.good      { background: #3B82F6; }
.dcm-bar.excellent { background: #16A34A; }

/* Meta row */
.dcm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dcm-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.dcm-chip i { font-size: 11px; }

.dcm-actions { margin-top: auto; display: flex; gap: 8px; }
.dcm-actions .btn { flex: 1; font-size: 13px; min-height: 38px; }


/* ============================================================
   PREMIUM UPGRADE v2 — Enhanced Design System
   ============================================================ */

/* Animated sidebar nav active pill */
.nav a.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand), transparent 85%), color-mix(in srgb, var(--brand-2), transparent 85%));
  color: var(--brand);
  font-weight: 700;
  border-inline-start: 3px solid var(--brand);
  padding-inline-start: 13px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand), transparent 80%);
}
.nav a, .nav button {
  border-inline-start: 3px solid transparent;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
html[dir="rtl"] .nav a.active { border-inline-start: none; border-inline-end: 3px solid var(--brand); padding-inline-start: 16px; padding-inline-end: 13px; }
html[dir="rtl"] .nav a, html[dir="rtl"] .nav button { border-inline-start: none; border-inline-end: 3px solid transparent; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* Nav icon glow on active */
.nav a.active i, .nav a.active .bi { color: var(--brand); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--brand), transparent 50%)); }

/* Sidebar brand gradient line */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0; inset-inline-end: 0;
  width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent, var(--brand), transparent);
  opacity: 0.3;
}

/* Premium KPI cards */
.kpi-icon-wrap {
  width: 58px; height: 58px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  position: relative; overflow: hidden; flex-shrink: 0;
}
.kpi-icon-wrap::before {
  content: ''; position: absolute; inset: 0;
  background: inherit; filter: blur(12px); opacity: 0.5;
  transform: scale(1.3);
}
.kpi-icon-wrap i { position: relative; z-index: 1; }
.kpi-icon-blue  { background: linear-gradient(135deg, #1E3A8A, #3B82F6); color: #fff; }
.kpi-icon-cyan  { background: linear-gradient(135deg, #0EA5E9, #06B6D4); color: #fff; }
.kpi-icon-green { background: linear-gradient(135deg, #16A34A, #22C55E); color: #fff; }
.kpi-icon-amber { background: linear-gradient(135deg, #D97706, #F59E0B); color: #fff; }
.kpi-icon-rose  { background: linear-gradient(135deg, #DC2626, #EF4444); color: #fff; }
.kpi-icon-violet{ background: linear-gradient(135deg, #7C3AED, #8B5CF6); color: #fff; }

/* Stat delta */
.stat-delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; padding: 2px 8px;
  border-radius: var(--radius-full);
}
.stat-delta.up   { background: color-mix(in srgb, var(--good), transparent 88%); color: var(--good); }
.stat-delta.down { background: color-mix(in srgb, var(--bad),  transparent 88%); color: var(--bad); }

/* Page entrance animation */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.content > * { animation: fadeUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both; }
.content > *:nth-child(1) { animation-delay: 0.05s; }
.content > *:nth-child(2) { animation-delay: 0.10s; }
.content > *:nth-child(3) { animation-delay: 0.15s; }
.content > *:nth-child(4) { animation-delay: 0.20s; }
.content > *:nth-child(5) { animation-delay: 0.25s; }

/* Enhanced card hover */
.card {
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1), box-shadow 0.28s ease, border-color 0.28s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--brand), transparent 75%);
}

/* Topbar enhancement */
.topbar {
  gap: 20px;
}
.topbar .page-breadcrumb {
  display: flex; flex-direction: column; gap: 2px;
}
.topbar .page-breadcrumb strong {
  font-size: 17px; font-weight: 800; letter-spacing: -0.3px;
}
.topbar .page-breadcrumb small {
  font-size: 12px; color: var(--muted);
}

/* Notification dot */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--bad); color: #fff;
  font-size: 10px; font-weight: 800;
  margin-inline-start: auto;
}

/* Premium table */
.table tbody tr:last-child td { border-bottom: none; }
.table thead tr th:first-child  { border-radius: var(--radius-sm) 0 0 0; }
.table thead tr th:last-child   { border-radius: 0 var(--radius-sm) 0 0; }

/* Sidebar overlay backdrop */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  z-index: 25; opacity: 0; transition: opacity 0.3s;
}
.sidebar-backdrop.show { opacity: 1; }
@media (max-width: 820px) { .sidebar-backdrop { display: block; } }

/* Section divider in sidebar */
.nav-divider {
  height: 1px; background: var(--line);
  margin: 8px 0; opacity: 0.6;
}
.nav-section-label {
  font-size: 10px; font-weight: 800; letter-spacing: 1.2px;
  color: var(--muted); text-transform: uppercase;
  padding: 8px 16px 4px; opacity: 0.6;
}

/* Welcome banner */
.welcome-banner {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  border-radius: var(--radius); padding: 28px 32px;
  color: #fff; position: relative; overflow: hidden;
  border: none; box-shadow: 0 12px 32px color-mix(in srgb, var(--brand), transparent 65%);
}
.welcome-banner::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23fff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.welcome-banner h2 { font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.welcome-banner p  { margin: 0; opacity: 0.88; font-size: 14px; }
.welcome-banner .wb-date { font-weight: 700; font-size: 15px; opacity: 0.9; }

/* Empty state */
.empty-state { padding: 72px 32px; text-align: center; }
.empty-state-icon { font-size: 56px; opacity: 0.15; color: var(--brand); margin-bottom: 20px; }
.empty-state h3 { font-weight: 800; font-size: 20px; margin: 0 0 8px; }
.empty-state p   { color: var(--muted); max-width: 360px; margin: 0 auto 24px; }

/* Status timeline dot for tickets */
.ticket-status-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor, transparent 80%);
}

/* Subscription card */
.sub-card-accent {
  height: 4px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

/* Smooth scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Focus visible ring */
*:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Pulse animation for status indicators */
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good), transparent 60%); }
  50%       { box-shadow: 0 0 0 5px color-mix(in srgb, var(--good), transparent 100%); }
}
.status-pulse { animation: pulse-dot 2.5s infinite; }

/* Chip style for info snippets */
.info-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line);
}
.info-chip i { font-size: 12px; }

/* Premium input focus glow */
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand), transparent 82%), 0 2px 8px rgba(0,0,0,0.04);
  background: var(--surface-solid);
}

/* Sidebar user card */
.sidebar-user-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-decoration: none; color: inherit;
  transition: all 0.2s;
  margin-bottom: 8px;
}
.sidebar-user-card:hover { background: color-mix(in srgb, var(--brand), transparent 90%); border-color: color-mix(in srgb, var(--brand), transparent 70%); }
.sidebar-user-avatar {
  width: 42px; height: 42px; border-radius: 12px;
  object-fit: contain; background: var(--surface-solid);
  padding: 5px; border: 1px solid var(--line);
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.3; }
.sidebar-user-sub  { font-size: 11px; color: var(--muted); }

/* Shimmer skeleton */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2), transparent 20%) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
}

/* ============================================================
   PROFILE TABS — premium underline style
   ============================================================ */
.tab-link {
  color: var(--muted);
  border-bottom: 3px solid transparent;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  padding: 14px 20px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.2s ease;
}
.tab-link:hover { color: var(--brand); }
.tab-link.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  background: color-mix(in srgb, var(--brand), transparent 94%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* ============================================================
   SUBSCRIPTIONS — plan badge
   ============================================================ */
.plan-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand), transparent 70%);
}

/* ============================================================
   DEVICES PAGE — status strip colors consolidated
   ============================================================ */
.dcm-header { height: 5px; }

/* ============================================================
   BROADCAST page
   ============================================================ */
.wa-compose-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.wa-preview-bubble {
  background: #dcf8c6;
  color: #111;
  border-radius: 18px 18px 4px 18px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 340px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  white-space: pre-wrap;
}
[data-theme="dark"] .wa-preview-bubble { background: #1e3b2e; color: #e5f5e2; }

/* ============================================================
   SIDEBAR — width tweak for extra breathing room
   ============================================================ */
.app-shell { grid-template-columns: 264px minmax(0, 1fr); }
.sidebar { padding: 24px 16px; }

/* ============================================================
   TOPBAR — breadcrumb icon
   ============================================================ */
.topbar .page-breadcrumb strong { font-size: 16px; }

/* ============================================================
   RESPONSIVE — fix grid on medium screens
   ============================================================ */
@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 240px minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 20px 16px; }
  .welcome-banner { padding: 22px 20px; }
  .welcome-banner h2 { font-size: 18px; }
}

/* ============================================================
   REPORTS page
   ============================================================ */
.report-card {
  display: flex; flex-direction: column;
  gap: 12px; align-items: flex-start;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}
.report-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--brand), transparent 70%);
}
.report-icon {
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(135deg, #EF4444, #F87171);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}


/* ============================================================
   ENHANCED MICRO-INTERACTIONS v3
   ============================================================ */

/* ── Sidebar nav — hover left-slide effect ── */
.nav a, .nav button {
  position: relative;
}
.nav a::before, .nav button::before {
  content: '';
  position: absolute;
  inset-inline-start: 0; top: 20%; height: 60%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--brand);
  transform: scaleY(0);
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.nav a.active::before { transform: scaleY(1); }
.nav a:hover:not(.active)::before { transform: scaleY(0.6); opacity: 0.5; }
html[dir="rtl"] .nav a::before { border-radius: 3px 0 0 3px; }

/* ── Card glass shimmer on hover ── */
.card {
  position: relative;
  isolation: isolate;
}
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,.04) 50%, transparent 60%);
  background-size: 200% 200%;
  background-position: 100% 100%;
  transition: background-position 0.5s ease;
  pointer-events: none;
  border-radius: inherit;
}
.card:hover::after { background-position: 0% 0%; }

/* ── Button press scale ── */
.btn:active { transform: translateY(1px) scale(0.98) !important; }

/* ── Input label uppercase style ── */
.field label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

/* ── Switch / Toggle ── */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.toggle-switch input[type="checkbox"] { display: none; }
.toggle-track {
  width: 46px; height: 26px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  transition: background 0.25s;
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.toggle-switch input:checked ~ .toggle-track { background: var(--brand); }
.toggle-switch input:checked ~ .toggle-track::after { transform: translateX(20px); }
html[dir="rtl"] .toggle-track::after { left: auto; right: 3px; }
html[dir="rtl"] .toggle-switch input:checked ~ .toggle-track::after { transform: translateX(-20px); }

/* ── Step circles (broadcast / reports) ── */
.step-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand), transparent 65%);
}

/* ── Selectable chip (broadcast) ── */
.selectable-chip {
  padding: 10px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
  font-weight: 600; font-size: 14px; color: var(--muted);
  box-shadow: var(--shadow-sm);
}
.peer:checked + .selectable-chip {
  background: color-mix(in srgb, var(--brand), transparent 88%);
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand), transparent 75%);
}
.selectable-chip:hover { background: var(--surface-2); color: var(--text); transform: translateY(-1px); }

/* ── Audience panel (broadcast) ── */
.audience-panel {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  position: sticky;
  top: 96px;
}
.audience-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.audience-row:last-child { border-bottom: none; }
.audience-row .label { color: var(--muted); font-weight: 500; }
.audience-row .value { font-weight: 700; color: var(--text); }

.audience-count-box {
  margin-top: 20px;
  padding: 20px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand), transparent 88%), color-mix(in srgb, var(--brand-2), transparent 90%));
  border: 1px solid color-mix(in srgb, var(--brand), transparent 70%);
  text-align: center;
}
.audience-count-box .big-num {
  font-size: 40px; font-weight: 900; letter-spacing: -1.5px;
  color: var(--brand); line-height: 1;
}
.audience-count-box .sub {
  font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 600;
}

/* ── WA compose textarea ── */
.wa-textarea {
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  min-height: 140px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
}

/* ── Report type card ── */
.report-type-card {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 20px;
  background: var(--surface-solid);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
}
.report-type-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  opacity: 0;
  transition: opacity 0.25s;
}
.report-type-card.selected { border-color: var(--brand); }
.report-type-card.selected::before { opacity: 0.07; }
.report-type-card:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow); }
.rtc-icon {
  width: 54px; height: 54px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0; position: relative; z-index: 1;
}
.rtc-body { flex: 1; min-width: 0; position: relative; z-index: 1; }
.rtc-title { font-weight: 800; font-size: 15px; color: var(--text); }
.rtc-desc  { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.rtc-check {
  color: var(--brand); font-size: 22px; opacity: 0;
  transform: scale(0.5) rotate(-10deg);
  transition: opacity 0.25s, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  position: relative; z-index: 1; flex-shrink: 0;
}
.report-type-card.selected .rtc-check { opacity: 1; transform: scale(1) rotate(0deg); }

/* ── Page title subtitle ── */
.page-title h1 { font-size: 26px; font-weight: 900; letter-spacing: -0.5px; margin: 0 0 4px; }
.page-title p  { color: var(--muted); font-size: 14px; margin: 0; }

/* ── Social card field focus highlight ── */
.social-field-card { border: 1px solid var(--line); }
.social-field-card:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand), transparent 85%);
  transform: translateY(-3px);
}

/* ── Social icon badge ── */
.social-icon-badge {
  width: 44px; height: 44px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ── Topbar notification bell pulse ── */
@keyframes bell-shake {
  0%,100% { transform: rotate(0deg); }
  20% { transform: rotate(8deg); }
  40% { transform: rotate(-8deg); }
  60% { transform: rotate(5deg); }
  80% { transform: rotate(-5deg); }
}
.bell-alert { animation: bell-shake 2.5s ease infinite; transform-origin: top center; }

/* ── Profile page avatar upload area ── */
.logo-upload-area {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  background: var(--surface-2);
}
.logo-upload-area:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand), transparent 94%);
}

/* ── Device card image zoom ── */
.dcm-preview { transition: transform 0.5s cubic-bezier(0.4,0,0.2,1); }
.device-card-modern:hover .dcm-preview { transform: scale(1.06); }

/* ── Card sub-header accent ── */
.card-accent-top {
  height: 4px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  margin: -1px -1px 0;
}

/* ── Floating action button ── */
.fab {
  position: fixed;
  inset-inline-end: 28px;
  bottom: 28px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--brand), transparent 55%);
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 50;
}
.fab:hover { transform: scale(1.12) translateY(-3px); box-shadow: 0 14px 32px color-mix(in srgb, var(--brand), transparent 45%); }

/* ── Scroll to top button ── */
#scrollTop {
  position: fixed;
  inset-inline-end: 28px;
  bottom: 96px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  z-index: 49;
  opacity: 0; pointer-events: none;
}
#scrollTop.visible { opacity: 1; pointer-events: auto; }
#scrollTop:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-2px); }

/* ── Table row number ── */
.table tbody tr td:first-child .row-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted);
  font-size: 11px; font-weight: 700;
}

/* ── Loading spinner inline ── */
.btn-loading { pointer-events: none; opacity: 0.75; }
.btn-loading::after {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin-inline-start: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Improve alert styling ── */
.alert {
  border-radius: var(--radius-sm) !important;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
}
.alert-success {
  background: color-mix(in srgb, var(--good), transparent 90%) !important;
  color: var(--good) !important;
  border-color: color-mix(in srgb, var(--good), transparent 70%) !important;
}
.alert-danger {
  background: color-mix(in srgb, var(--bad), transparent 90%) !important;
  color: var(--bad) !important;
  border-color: color-mix(in srgb, var(--bad), transparent 70%) !important;
}
.alert-warning {
  background: color-mix(in srgb, var(--warn), transparent 90%) !important;
  color: var(--warn) !important;
  border-color: color-mix(in srgb, var(--warn), transparent 70%) !important;
}

/* ============================================================
   CENTERED KPI CARDS
   ============================================================ */
.kpi-card-c {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 20px 20px;
  gap: 8px;
  min-height: 160px;
  position: relative;
  overflow: hidden;
}
.kpi-card-c::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand), transparent 85%) 0%, transparent 70%);
  pointer-events: none;
}
.kpi-card-c .kpi-icon-wrap {
  margin-bottom: 4px;
}
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  line-height: 1.3;
}
.kpi-num {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--text);
}
.kpi-unit {
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0;
}
.kpi-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
  opacity: .7;
  transition: opacity .2s;
}
.card-link:hover .kpi-sub { opacity: 1; color: var(--brand); }
.kpi-card-sm {
  min-height: 120px;
  padding: 20px 16px;
}
.kpi-card-sm .kpi-num { font-size: 34px; }

/* ============================================================
   SIDEBAR — scrollable nav
   ============================================================ */
.sidebar {
  overflow: hidden;
}
.sidebar-nav-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.sidebar-nav-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-nav-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

/* ============================================================
   PORTAL FOOTER
   ============================================================ */
.portal-footer {
  margin-top: auto; /* flex-push: always at bottom */
  padding: 20px 32px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.portal-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color .2s;
}
.portal-footer a:hover { color: var(--brand); }
.portal-footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.portal-footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}
@media (max-width: 640px) {
  .portal-footer { flex-direction: column; text-align: center; padding: 20px; }
  .portal-footer-links { flex-wrap: wrap; justify-content: center; gap: 12px; }
}

/* ============================================================
   INTERACTIVE ENHANCEMENTS v4
   ============================================================ */

/* ── Page Progress Bar ── */
#page-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), #7C3AED);
  background-size: 200% 100%;
  z-index: 9999;
  transition: width 0.3s ease;
  animation: progress-shine 1.5s linear infinite;
}
#page-progress.done {
  width: 100%;
  opacity: 0;
  transition: width 0.2s ease, opacity 0.4s ease 0.2s;
}
@keyframes progress-shine {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Sidebar Collapse (Icon-Only Mode) ── */
.app-shell.sidebar-collapsed { grid-template-columns: 64px minmax(0,1fr); }
@media (max-width: 1200px) {
  .app-shell.sidebar-collapsed { grid-template-columns: 64px minmax(0,1fr); }
}

.sidebar-collapsed .sidebar {
  padding: 20px 8px;
  overflow: visible;
}
.sidebar-collapsed .sidebar-user-card {
  padding: 8px;
  justify-content: center;
  margin-bottom: 12px;
}
.sidebar-collapsed .sidebar-user-name,
.sidebar-collapsed .sidebar-user-sub,
.sidebar-collapsed .sidebar-user-card > div:not(:first-child),
.sidebar-collapsed .sidebar-user-card > i { display: none; }
.sidebar-collapsed .sidebar-user-avatar { width: 36px; height: 36px; }

.sidebar-collapsed .nav-section-label { display: none; }
.sidebar-collapsed .brand > span,
.sidebar-collapsed .brand-text { display: none; }

.sidebar-collapsed .nav a span,
.sidebar-collapsed .nav button span { display: none; }
.sidebar-collapsed .nav-badge { 
  position: absolute; 
  top: 4px; inset-inline-end: 4px;
  min-width: 14px; height: 14px;
  font-size: 8px; padding: 0 3px;
}
.sidebar-collapsed .nav a,
.sidebar-collapsed .nav button {
  justify-content: center;
  gap: 0;
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  position: relative;
}
.sidebar-collapsed .sidebar-footer { display: none; }

/* Collapse toggle button */
.sidebar-collapse-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: absolute;
  bottom: 32px;
  inset-inline-end: -14px;
  z-index: 30;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
  font-size: 13px;
}
.sidebar-collapse-btn:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transform: scale(1.15);
}
.sidebar-collapsed .sidebar-collapse-btn {
  inset-inline-end: -14px;
}
.sidebar-collapse-btn i {
  transition: transform 0.3s ease;
}
.sidebar-collapsed .sidebar-collapse-btn i {
  transform: rotate(180deg);
}
html[dir="rtl"] .sidebar-collapse-btn i { transform: rotate(180deg); }
html[dir="rtl"] .sidebar-collapsed .sidebar-collapse-btn i { transform: rotate(0deg); }

@media (max-width: 820px) {
  .sidebar-collapse-btn { display: none; }
}

/* Tooltip on collapsed nav items */
.nav-tooltip {
  position: absolute;
  inset-inline-start: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: var(--surface-solid);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  transform: translateY(-50%) translateX(-6px);
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-tooltip::before {
  content: '';
  position: absolute;
  top: 50%;
  inset-inline-end: 100%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-inline-end-color: var(--ink);
}
.sidebar-collapsed .nav a:hover .nav-tooltip,
.sidebar-collapsed .nav button:hover .nav-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
html[dir="rtl"] .nav-tooltip {
  inset-inline-start: auto;
  inset-inline-end: calc(100% + 12px);
}

/* ── Ripple Effect ── */
.ripple-host {
  position: relative;
  overflow: hidden;
}
.ripple-wave {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transform: scale(0);
  animation: ripple-expand 0.55s cubic-bezier(0.4,0,0.2,1) forwards;
  pointer-events: none;
}
[data-theme="light"] .btn:not(.btn-primary):not(.btn-dark) .ripple-wave {
  background: rgba(30,58,138,0.12);
}
@keyframes ripple-expand {
  to { transform: scale(4); opacity: 0; }
}

/* ── 3D Card Tilt ── */
[data-tilt] {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.1s ease, box-shadow 0.3s ease;
}
[data-tilt]:hover {
  box-shadow: var(--shadow-lg) !important;
}
[data-tilt] > * { transform: translateZ(8px); }

/* ── Live Search / Filter ── */
.live-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.live-search-wrap .bi-search {
  position: absolute;
  inset-inline-start: 14px;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}
.live-search-input {
  width: 260px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-solid);
  color: var(--text);
  padding: 8px 16px 8px 38px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-sm);
}
.live-search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand), transparent 82%);
  width: 300px;
}
html[dir="rtl"] .live-search-wrap .bi-search { inset-inline-start: auto; inset-inline-end: 14px; }
html[dir="rtl"] .live-search-input { padding: 8px 38px 8px 16px; }

/* highlight matched text */
.search-hl {
  background: color-mix(in srgb, var(--brand), transparent 80%);
  color: var(--brand);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 700;
}

/* ── Toast Notification System ── */
#toast-region {
  position: fixed;
  inset-inline-end: 24px;
  bottom: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}
.portal-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  max-width: 360px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  position: relative;
  overflow: hidden;
  animation: toast-in 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.portal-toast.out {
  animation: toast-out 0.28s ease forwards;
}
@keyframes toast-in {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(120%); opacity: 0; }
}
.portal-toast-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.portal-toast.success .portal-toast-icon { background: color-mix(in srgb, var(--good), transparent 85%); color: var(--good); }
.portal-toast.error   .portal-toast-icon { background: color-mix(in srgb, var(--bad),  transparent 85%); color: var(--bad); }
.portal-toast.info    .portal-toast-icon { background: color-mix(in srgb, var(--brand), transparent 85%); color: var(--brand); }
.portal-toast.warn    .portal-toast-icon { background: color-mix(in srgb, var(--warn),  transparent 85%); color: var(--warn); }
.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  animation: toast-progress linear forwards;
}
.portal-toast.success .toast-progress { background: var(--good); }
.portal-toast.error   .toast-progress { background: var(--bad); }
.portal-toast.info    .toast-progress { background: var(--brand); }
.portal-toast.warn    .toast-progress { background: var(--warn); }
@keyframes toast-progress {
  from { width: 100%; }
  to   { width: 0; }
}

/* ── Copy Phone Button ── */
.copy-phone-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  flex-shrink: 0;
  padding: 0;
}
.copy-phone-btn:hover {
  background: color-mix(in srgb, var(--brand), transparent 88%);
  color: var(--brand);
  border-color: var(--brand);
  transform: scale(1.1);
}
.copy-phone-btn.copied {
  background: color-mix(in srgb, var(--good), transparent 88%);
  color: var(--good);
  border-color: var(--good);
}

/* ── Table Row Stagger Reveal ── */
@keyframes rowFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.table-row-reveal {
  animation: rowFadeUp 0.3s ease both;
}

/* ── Auto-dismiss Alert ── */
.alert.auto-dismiss {
  position: relative;
  overflow: hidden;
}
.alert.auto-dismiss::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  width: 100%;
  background: currentColor;
  animation: alert-dismiss-bar 4s linear forwards;
  opacity: 0.3;
}
@keyframes alert-dismiss-bar {
  from { width: 100%; }
  to   { width: 0; }
}

/* ── Dashboard welcome banner particles ── */
.welcome-banner { overflow: hidden; }
.wb-particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  animation: float-particle linear infinite;
  pointer-events: none;
}
@keyframes float-particle {
  0%   { transform: translateY(100%) scale(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-120%) scale(1.2); opacity: 0; }
}

/* ── No-results row ── */
.filter-no-results {
  display: none;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}
.filter-no-results.visible { display: block; }

/* ── Live filter badge ── */
.live-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  margin-inline-start: 8px;
  transition: all 0.2s;
}

/* ── Enhanced card shimmer (override existing) ── */
.card::after {
  background: linear-gradient(125deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%);
  background-size: 250% 250%;
  background-position: 200% 200%;
  transition: background-position 0.6s ease;
}
.card:hover::after { background-position: -50% -50%; }

/* ── Sidebar transition smooth ── */
.sidebar {
  transition: padding 0.3s ease, width 0.3s ease;
}
.app-shell {
  transition: grid-template-columns 0.3s ease;
}
