/* ============================================================
   معمل صدارة — Design Tokens
   ============================================================ */
:root {
  --navy-900: #0a1c3d;
  --navy-800: #0f2a54;
  --navy-700: #163a6e;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --teal-500: #14b8a6;
  --green-500: #22c55e;
  --amber-500: #f59e0b;
  --red-500: #ef4444;
  --purple-500: #8b5cf6;

  --bg: #f3f5fa;
  --surface: #ffffff;
  --border: #e4e9f2;
  --border-soft: #edf1f8;

  --ink-900: #0f1b31;
  --ink-700: #33415c;
  --ink-500: #64748b;
  --ink-400: #94a3b8;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(15, 27, 49, 0.04), 0 8px 24px rgba(15, 27, 49, 0.06);
  --shadow-pop: 0 24px 60px rgba(10, 28, 61, 0.18);

  --sidebar-w: 264px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink-900);
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

h1, h2, h3, h4 { margin: 0; font-weight: 800; color: var(--ink-900); }

/* ============================================================
   Layout shell
   ============================================================ */
.main-wrapper {
  margin-right: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 100%);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-y: auto;
}

.sidebar-header {
  padding: 22px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-badge.brand-logo-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-img {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
  padding: 3px;
}

.lab-name { color: #fff; font-weight: 800; font-size: 1.02rem; line-height: 1.3; }
.lab-sub { color: rgba(255,255,255,0.55); font-size: 0.72rem; margin-top: 2px; }

.sidebar-status {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: #a7f3d0;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}

.status-pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 0 0 rgba(34,197,94,.6);
  animation: pulse-ring 1.8s infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
  70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.nav-section { padding: 14px 12px; flex: 1; }

.nav-section-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.35);
  margin: 18px 10px 8px;
  font-weight: 700;
}
.nav-section-label:first-child { margin-top: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.72);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 2px;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.nav-badge {
  margin-right: auto;
  background: var(--amber-500);
  color: #1a1200;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,0.08); }

.sidebar-user { display: flex; align-items: center; gap: 10px; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-500), var(--blue-600));
  color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.user-name { color: #fff; font-size: 0.85rem; font-weight: 700; }
.user-role { color: rgba(255,255,255,0.45); font-size: 0.7rem; }
.user-info { flex: 1; min-width: 0; }

.logout-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.06);
}
.logout-btn:hover { color: #fff; background: rgba(239,68,68,0.25); }
.logout-btn svg { width: 16px; height: 16px; }

.sidebar-toggle {
  display: none;
  position: fixed; top: 14px; right: 14px; z-index: 50;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--navy-900); color: #fff; border: none;
  align-items: center; justify-content: center;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(10,28,61,0.5); z-index: 39;
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title { font-size: 1.28rem; }
.topbar-sub { margin: 4px 0 0; color: var(--ink-500); font-size: 0.84rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.main-content { padding: 26px 28px 40px; flex: 1; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.86rem;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn svg, .btn i { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--blue-600); color: #fff; box-shadow: 0 6px 16px rgba(37,99,235,0.3); }
.btn-primary:hover { background: #1d4ed8; }

.btn-outline { background: var(--surface); color: var(--navy-800); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--blue-500); color: var(--blue-600); }

.btn-ghost { background: transparent; color: var(--ink-500); }
.btn-ghost:hover { background: var(--border-soft); }

.btn-danger { background: var(--red-500); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: var(--green-500); color: #fff; }
.btn-success:hover { background: #16a34a; }

.btn-lg { padding: 12px 22px; font-size: 0.92rem; }

.badge-count {
  background: rgba(255,255,255,0.25);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
}

/* ============================================================
   Hero banner
   ============================================================ */
.dashboard-hero.brand-hero {
  background: linear-gradient(120deg, var(--navy-900) 0%, var(--navy-700) 55%, var(--blue-600) 130%);
  border-radius: var(--radius-lg);
  padding: 30px 32px;
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.dashboard-hero.brand-hero::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 85% 20%, rgba(20,184,166,0.25), transparent 55%);
  pointer-events: none;
}

.welcome-badge.brand-welcome-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  margin-bottom: 16px;
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--teal-500);
}

.dashboard-brand-header { display: flex; align-items: center; gap: 18px; }
.dashboard-logo-container {
  width: 62px; height: 62px; border-radius: var(--radius-md);
  background: #fff; padding: 6px; flex-shrink: 0;
}
.dashboard-logo-img { width: 100%; height: 100%; object-fit: contain; }

.dashboard-hero h2 { font-size: 1.35rem; margin-bottom: 6px; }
.dashboard-hero p { margin: 0; color: rgba(255,255,255,0.78); font-size: 0.88rem; max-width: 480px; }

.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-actions .btn-outline { background: rgba(255,255,255,0.08); color: #fff; border-color: rgba(255,255,255,0.25); }
.hero-actions .btn-outline:hover { background: rgba(255,255,255,0.16); }

/* ============================================================
   Section titles
   ============================================================ */
.section-title { margin: 26px 0 14px; }
.section-title h3 {
  display: flex; align-items: center; gap: 9px;
  font-size: 1.02rem; color: var(--ink-900);
}
.section-title h3 svg, .section-title h3 i { width: 18px; height: 18px; color: var(--blue-600); }

/* ============================================================
   Cards (generic)
   ============================================================ */
.card, .glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* ============================================================
   Stats grid
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-card);
}
.stat-card-hover { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.stat-card-hover:hover { transform: translateY(-3px); box-shadow: 0 16px 32px rgba(15,27,49,0.1); }

.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg, .stat-icon i { width: 21px; height: 21px; }
.si-amber { background: rgba(245,158,11,0.12); color: var(--amber-500); }
.si-blue  { background: rgba(37,99,235,0.12); color: var(--blue-600); }
.si-orange{ background: rgba(249,115,22,0.12); color: #f97316; }
.si-cyan  { background: rgba(20,184,166,0.12); color: var(--teal-500); }
.si-green { background: rgba(34,197,94,0.12); color: var(--green-500); }
.si-red   { background: rgba(239,68,68,0.12); color: var(--red-500); }
.si-purple{ background: rgba(139,92,246,0.12); color: var(--purple-500); }

.stat-value { font-size: 1.55rem; font-weight: 800; color: var(--ink-900); line-height: 1.2; }
.stat-label { font-size: 0.82rem; color: var(--ink-700); font-weight: 600; margin-top: 2px; }
.stat-sub { font-size: 0.72rem; margin-top: 4px; font-weight: 600; }
.text-amber { color: var(--amber-500); } .text-blue { color: var(--blue-600); }
.text-orange { color: #f97316; } .text-cyan { color: var(--teal-500); }
.text-green { color: var(--green-500); } .text-red { color: var(--red-500); }

/* ============================================================
   Subscription card
   ============================================================ */
.subscription-card {
  display: flex;
  padding: 24px;
  gap: 0;
  margin-bottom: 4px;
}
.subscription-side { flex: 1; padding: 4px 14px; }
.subscription-divider { width: 1px; background: var(--border); margin: 0 8px; }

.sub-status-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: var(--radius-pill);
  font-size: 0.78rem; font-weight: 700; margin-bottom: 14px;
}
.sub-status-badge svg, .sub-status-badge i { width: 15px; height: 15px; }
.sub-status-dot { width: 6px; height: 6px; border-radius: 50%; }
.sub-status-active { background: rgba(34,197,94,0.1); color: #15803d; }
.sub-status-active .sub-status-dot { background: var(--green-500); }
.sub-status-grace { background: rgba(245,158,11,0.1); color: #b45309; }
.sub-status-grace .sub-status-dot { background: var(--amber-500); }
.sub-status-suspended { background: rgba(239,68,68,0.1); color: #b91c1c; }
.sub-status-suspended .sub-status-dot { background: var(--red-500); }

.sub-plan-name {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.05rem; margin-bottom: 14px; color: var(--ink-900);
}
.sub-plan-name svg, .sub-plan-name i { width: 17px; height: 17px; color: var(--amber-500); }

.sub-period-label { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--ink-500); margin-bottom: 8px; }
.sub-period-label svg, .sub-period-label i { width: 14px; height: 14px; }
.sub-period-dates { display: flex; gap: 18px; }
.sub-period-item { display: flex; flex-direction: column; gap: 2px; font-size: 0.84rem; font-weight: 700; }
.sub-period-tag { font-size: 0.68rem; color: var(--ink-400); font-weight: 600; }

.sub-usage-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sub-usage-title { display: flex; align-items: center; gap: 7px; font-size: 0.84rem; font-weight: 700; color: var(--ink-700); }
.sub-usage-title svg, .sub-usage-title i { width: 15px; height: 15px; color: var(--blue-600); }
.sub-usage-numbers { font-size: 0.84rem; font-weight: 800; color: var(--ink-900); }

.progress-track { height: 9px; background: var(--border-soft); border-radius: var(--radius-pill); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-pill); transition: width 0.4s ease; }
.progress-green { background: linear-gradient(90deg, var(--green-500), #4ade80); }
.progress-orange { background: linear-gradient(90deg, var(--amber-500), #fbbf24); }
.progress-red { background: linear-gradient(90deg, #f97316, #fb923c); }
.progress-danger { background: linear-gradient(90deg, var(--red-500), #f87171); }

.sub-usage-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 0.78rem; }
.sub-usage-percent { font-weight: 800; color: var(--ink-900); }
.sub-usage-remaining { display: flex; align-items: center; gap: 5px; color: var(--ink-500); }
.sub-usage-remaining svg, .sub-usage-remaining i { width: 13px; height: 13px; }

/* ============================================================
   Alerts
   ============================================================ */
.alerts-wrapper { display: grid; gap: 12px; }
.alert-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px; border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.alert-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert-icon svg, .alert-icon i { width: 18px; height: 18px; }
.alert-text h4 { font-size: 0.88rem; margin-bottom: 3px; }
.alert-text p { margin: 0; font-size: 0.8rem; color: var(--ink-500); }

.alert-green { background: rgba(34,197,94,0.05); border-color: rgba(34,197,94,0.2); }
.alert-green .alert-icon { background: rgba(34,197,94,0.15); color: #15803d; }
.alert-orange { background: rgba(245,158,11,0.05); border-color: rgba(245,158,11,0.2); }
.alert-orange .alert-icon { background: rgba(245,158,11,0.15); color: #b45309; }
.alert-red { background: rgba(239,68,68,0.05); border-color: rgba(239,68,68,0.2); }
.alert-red .alert-icon { background: rgba(239,68,68,0.15); color: #b91c1c; }

/* ============================================================
   Danger zone
   ============================================================ */
.danger-zone { padding: 22px; border: 1px solid rgba(239,68,68,0.25); }
.danger-zone-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.danger-zone-icon {
  width: 42px; height: 42px; border-radius: var(--radius-md);
  background: rgba(239,68,68,0.1); color: var(--red-500);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.danger-zone-icon svg, .danger-zone-icon i { width: 20px; height: 20px; }
.danger-zone-title { font-weight: 800; font-size: 0.95rem; margin-bottom: 3px; }
.danger-zone-sub { font-size: 0.8rem; color: var(--ink-500); max-width: 560px; }
.danger-zone-actions { display: flex; gap: 10px; }

/* ============================================================
   Quick access grid
   ============================================================ */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.quick-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.quick-card:hover { border-color: var(--blue-500); transform: translateY(-2px); }
.quick-icon { width: 44px; height: 44px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.quick-icon svg, .quick-icon i { width: 20px; height: 20px; color: #fff; }
.bg-amber { background: linear-gradient(135deg, var(--amber-500), #fbbf24); }
.bg-blue { background: linear-gradient(135deg, var(--blue-600), var(--blue-500)); }
.bg-purple { background: linear-gradient(135deg, var(--purple-500), #a78bfa); }
.bg-teal { background: linear-gradient(135deg, var(--teal-500), #2dd4bf); }
.quick-info { flex: 1; min-width: 0; }
.quick-info h4 { font-size: 0.9rem; margin-bottom: 3px; }
.quick-info p { margin: 0; font-size: 0.78rem; color: var(--ink-500); }
.quick-arrow { width: 16px; height: 16px; color: var(--ink-400); flex-shrink: 0; }

/* ============================================================
   Performance panel / recent list (two-column dashboard row)
   ============================================================ */
.panel-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 4px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.panel-header h4 { font-size: 0.92rem; }
.panel-body { padding: 16px 20px 20px; }

.recent-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-soft);
}
.recent-row:last-child { border-bottom: none; }
.recent-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--border-soft); color: var(--blue-600);
  display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 800; flex-shrink: 0;
}
.recent-info { flex: 1; min-width: 0; }
.recent-name { font-size: 0.84rem; font-weight: 700; }
.recent-meta { font-size: 0.72rem; color: var(--ink-500); }
.status-chip { font-size: 0.7rem; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); flex-shrink: 0; }
.status-chip.done { background: rgba(34,197,94,0.12); color: #15803d; }
.status-chip.new { background: rgba(37,99,235,0.12); color: var(--blue-600); }
.status-chip.pending { background: rgba(245,158,11,0.12); color: #b45309; }

/* ============================================================
   Tables (generic list pages)
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.data-table th {
  text-align: right; padding: 13px 16px; background: var(--border-soft);
  color: var(--ink-500); font-weight: 700; font-size: 0.76rem; border-bottom: 1px solid var(--border);
}
table.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); color: var(--ink-900); }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--border-soft); }

/* ============================================================
   Forms
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label { font-size: 0.82rem; font-weight: 700; color: var(--ink-700); }
.form-control {
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.88rem; background: var(--surface); color: var(--ink-900);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(37,99,235,0.14); }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(10,28,61,0.55);
  align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface); border-radius: var(--radius-lg); padding: 28px;
  width: 100%; max-width: 380px; text-align: center; box-shadow: var(--shadow-pop);
}
.modal-icon { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; }
.modal-icon.text-danger { background: rgba(239,68,68,0.1); color: var(--red-500); }
.modal-icon svg, .modal-icon i { width: 24px; height: 24px; }
.modal-title { font-size: 1.05rem; margin-bottom: 8px; }
.modal-body { font-size: 0.86rem; color: var(--ink-500); margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ============================================================
   Flash messages
   ============================================================ */
.flash-container {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(92vw, 420px);
}
.flash-msg {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-pop);
  font-size: 0.85rem; font-weight: 600;
}
.flash-content { display: flex; align-items: center; gap: 9px; }
.flash-icon { width: 16px; height: 16px; flex-shrink: 0; }
.flash-close { background: none; border: none; cursor: pointer; opacity: 0.6; font-size: 0.8rem; }
.flash-close:hover { opacity: 1; }
.flash-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  padding: 18px 28px; text-align: center; font-size: 0.76rem; color: var(--ink-400);
  border-top: 1px solid var(--border);
}
.footer-divider { margin: 0 8px; }
.site-footer a { color: var(--blue-600); font-weight: 700; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1080px) {
  .subscription-card { flex-direction: column; }
  .subscription-divider { display: none; }
  .panel-row { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
  .sidebar { transform: translateX(100%); transition: transform 0.25s ease; box-shadow: -10px 0 30px rgba(0,0,0,0.2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: flex; }
  .main-wrapper { margin-right: 0; }
  .topbar { padding-right: 66px; }
}

@media (max-width: 560px) {
  .main-content { padding: 18px 16px 32px; }
  .topbar { padding: 14px 16px 14px 66px; flex-wrap: wrap; }
  .dashboard-hero.brand-hero { padding: 22px; }
  .dashboard-brand-header { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  flex-wrap: wrap;
  gap: 14px;
}
.pagination-info {
  font-size: 0.84rem;
  color: var(--ink-500);
  font-weight: 600;
}
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
}
.pagination-btn, .pagination-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-700);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}
.pagination-btn svg, .pagination-btn i {
  width: 14px;
  height: 14px;
}
.pagination-btn:hover:not(.disabled), .pagination-page:hover:not(.active) {
  border-color: var(--blue-500);
  color: var(--blue-600);
  background: rgba(37, 99, 235, 0.04);
}
.pagination-page.active {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.pagination-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.pagination-ellipsis {
  padding: 0 4px;
  color: var(--ink-400);
  font-weight: 700;
}

/* ============================================================
   Chips & Badges (AI Keywords & Aliases)
   ============================================================ */
.chips-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--blue-600);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
}

/* ============================================================
   Spinner (AI Button Loading)
   ============================================================ */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.full-width {
  grid-column: 1 / -1;
}

/* ============================================================
   Premium Medical SaaS Test Workflow Styles
   ============================================================ */
.form-container {
  max-width: 1040px;
  margin: 0 auto;
}

.header-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--blue-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.header-icon-badge i, .header-icon-badge svg {
  width: 20px;
  height: 20px;
}

.section-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 1px 2px rgba(15, 23, 42, 0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--blue-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.section-icon i, .section-icon svg {
  width: 20px;
  height: 20px;
}

.section-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--navy-900);
  margin: 0 0 3px 0;
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 0.82rem;
  color: var(--ink-500);
  margin: 0;
  line-height: 1.4;
}

/* ── Test Name Prominent Field ───────────────────────────── */
.test-name-field {
  margin-bottom: 20px;
}
.test-name-label {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--navy-900);
  margin-bottom: 7px;
}
.test-name-input {
  width: 100%;
  height: 48px;
  font-size: 0.96rem;
  font-weight: 600;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 16px;
  background: #ffffff;
  color: var(--navy-900);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.test-name-input:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.12);
}
.field-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--ink-500);
  margin-top: 6px;
}
.field-hint i, .field-hint svg {
  width: 13px;
  height: 13px;
  color: var(--blue-500);
  flex-shrink: 0;
}
.required-star {
  color: #ef4444;
  font-weight: 700;
  margin-right: 3px;
}

/* ── Basic Info 4-Column Responsive Grid ─────────────────── */
.basic-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 960px) {
  .basic-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 580px) {
  .basic-info-grid {
    grid-template-columns: 1fr;
  }
}

.field-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  height: 42px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  padding: 0 14px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink-900);
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
textarea.form-control {
  height: auto;
  min-height: 85px;
  padding: 10px 14px;
  line-height: 1.6;
  resize: vertical;
}

/* ── AI Assistant Secondary Card ─────────────────────────── */
.ai-assistant-card {
  background: #ffffff;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 14px;
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.04);
  position: relative;
}

.ai-assistant-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 28px;
  left: 28px;
  height: 2.5px;
  background: linear-gradient(90deg, var(--blue-600), rgba(13, 148, 136, 0.6), transparent);
  border-radius: 2px;
}

.ai-assistant-card .section-icon {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(13, 148, 136, 0.12));
  color: var(--blue-600);
}

.ai-assistant-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.08);
  color: var(--blue-700);
  padding: 2px 8px;
  border-radius: 9999px;
  margin-right: 8px;
}

.ai-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--blue-600);
  color: #ffffff;
  border: 1px solid var(--blue-600);
  font-weight: 700;
  font-size: 0.84rem;
  height: 38px;
  padding: 0 18px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
  transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.ai-btn-generate:hover:not(:disabled) {
  background: var(--blue-700);
  border-color: var(--blue-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}
.ai-btn-generate:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.ai-btn-generate i, .ai-btn-generate svg {
  width: 15px;
  height: 15px;
}

.ai-btn-regenerate {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  color: var(--ink-700);
  border: 1px solid #cbd5e1;
  font-weight: 600;
  font-size: 0.84rem;
  height: 38px;
  padding: 0 15px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.ai-btn-regenerate:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
  color: var(--navy-900);
}
.ai-btn-regenerate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.ai-btn-regenerate i, .ai-btn-regenerate svg {
  width: 14px;
  height: 14px;
}

.ai-status-box {
  display: none;
  margin-bottom: 18px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.ai-status-box.loading {
  display: flex;
  background: rgba(37, 99, 235, 0.08);
  color: var(--blue-700);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.ai-status-box.success {
  display: flex;
  background: rgba(16, 185, 129, 0.08);
  color: var(--green-600);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.ai-status-box.error {
  display: flex;
  background: rgba(239, 68, 68, 0.08);
  color: var(--red-500);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.ai-trust-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--ink-500);
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed #e2e8f0;
}
.ai-trust-note i, .ai-trust-note svg {
  width: 15px;
  height: 15px;
  color: var(--blue-500);
  flex-shrink: 0;
}

/* ── Interactive Tag / Chip Input (Keywords & Aliases) ───── */
.tag-input-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  min-height: 44px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tag-input-box:focus-within {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 3px 8px 3px 10px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
}

.tag-chip-remove {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.tag-chip-remove:hover {
  color: #ef4444;
}

.tag-input-field {
  flex: 1;
  min-width: 140px;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink-900);
  padding: 4px 0;
}

.tag-input-field::placeholder {
  color: var(--ink-400);
  font-size: 0.8rem;
}

/* ── Field Update Pulse Animation ────────────────────────── */
.ai-field-updated {
  animation: fieldPulse 1.2s ease-out;
}
@keyframes fieldPulse {
  0% { background-color: rgba(37, 99, 235, 0.09); }
  100% { background-color: #ffffff; }
}

/* ── Bottom Actions Bar ──────────────────────────────────── */
.form-actions-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  margin-top: 8px;
  margin-bottom: 40px;
  padding: 16px 0;
  position: sticky;
  bottom: 0;
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  z-index: 10;
}

.btn-save-test {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  min-width: 230px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 10px;
  background: var(--blue-600);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
  transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.btn-save-test:hover {
  background: var(--blue-700);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}
.btn-save-test i, .btn-save-test svg {
  width: 18px;
  height: 18px;
}

.btn-cancel-test {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  min-width: 120px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink-700);
  border: 1px solid #cbd5e1;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn-cancel-test:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: var(--navy-900);
}
/* ============================================================
   معمل صدارة — PREMIUM UI ENHANCEMENTS
   (Append this file to the bottom of static/css/style.css)
   Covers: test_service.html (list) + test_form.html (create/edit)
   ============================================================ */

/* ── Quick Stats Strip (test list page) ──────────────────── */
.ts-stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}
.ts-stat-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  box-shadow: var(--shadow-card);
  flex: 1;
  min-width: 200px;
}
.ts-stat-pill-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ts-stat-pill-icon svg, .ts-stat-pill-icon i { width: 19px; height: 19px; }
.ts-stat-pill-value { font-size: 1.25rem; font-weight: 800; color: var(--ink-900); line-height: 1.2; }
.ts-stat-pill-label { font-size: 0.76rem; color: var(--ink-500); font-weight: 600; margin-top: 2px; }

/* ── Filter Card (test list page) ────────────────────────── */
.ts-filter-card {
  padding: 20px 24px;
  margin-bottom: 22px;
}
.ts-filter-form {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.ts-filter-field { flex: 1; min-width: 200px; }
.ts-filter-search { flex: 2; min-width: 260px; }
.ts-filter-narrow { flex: 0 0 110px; min-width: 110px; }
.ts-filter-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink-700);
}
.ts-filter-actions { display: flex; gap: 8px; }
.ts-filter-btn { height: 42px; min-width: 90px; }
.ts-filter-reset { width: 42px; min-width: 42px; padding: 0; justify-content: center; }

.ts-input-icon-wrap { position: relative; }
.ts-input-icon {
  position: absolute;
  top: 50%;
  right: 13px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-400);
  pointer-events: none;
}
.ts-input-with-icon { width: 100%; padding-right: 38px; }

/* ── Table enhancements (test list page) ─────────────────── */
.ts-table-wrap { overflow: visible; }
.ts-data-table thead th {
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.ts-data-table tbody tr { transition: background-color 0.12s ease; }

.ts-id-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--border-soft);
  color: var(--ink-500);
  font-weight: 800;
  font-size: 0.76rem;
}

.ts-test-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ts-test-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(37, 99, 235, 0.12));
  color: var(--purple-500);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ts-test-avatar svg, .ts-test-avatar i { width: 17px; height: 17px; }
.ts-test-name-text { font-weight: 700; color: var(--ink-900); font-size: 0.95rem; }

.ts-lab-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-700);
}
.ts-lab-tag svg, .ts-lab-tag i { width: 14px; height: 14px; color: var(--blue-500); }

.ts-price-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-weight: 800;
  color: var(--blue-600);
  font-size: 0.98rem;
  background: rgba(37, 99, 235, 0.07);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}
.ts-price-currency { font-size: 0.7rem; font-weight: 700; opacity: 0.8; }

.ts-sample-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--ink-800);
  font-weight: 600;
  background: rgba(20, 184, 166, 0.08);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}
.ts-sample-tag svg, .ts-sample-tag i { width: 12px; height: 12px; color: var(--teal-500); }

.ts-muted-dash { color: var(--ink-400); }

.ts-row-actions { display: flex; gap: 8px; justify-content: center; align-items: center; }
.ts-action-btn { transition: transform 0.12s ease, box-shadow 0.15s ease; }
.ts-action-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(15,27,49,0.08); }
.ts-action-danger { color: var(--red-500); border-color: rgba(239, 68, 68, 0.3); }
.ts-action-danger:hover { background: rgba(239, 68, 68, 0.06); border-color: var(--red-500); color: var(--red-500); }

.ts-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.12);
  color: var(--ink-400);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.ts-empty-icon svg, .ts-empty-icon i { width: 28px; height: 28px; }

/* ============================================================
   TEST FORM (create / edit) ENHANCEMENTS
   ============================================================ */

/* Progress ribbon at top of form */
.tf-progress-ribbon {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
}
.tf-progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-400);
}
.tf-progress-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border-soft);
  color: var(--ink-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 800;
  flex-shrink: 0;
}
.tf-progress-active { color: var(--blue-600); }
.tf-progress-active .tf-progress-dot {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  color: #fff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}
.tf-progress-line {
  flex: 1;
  min-width: 24px;
  height: 1.5px;
  background: var(--border);
}

/* Icon-prefixed inputs on the form */
.tf-input-icon-wrap { position: relative; }
.tf-input-icon {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--blue-500);
  pointer-events: none;
}
.tf-input-with-icon { padding-right: 44px !important; }

.tf-input-suffix {
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-400);
  background: var(--border-soft);
  padding: 3px 8px;
  border-radius: 999px;
  pointer-events: none;
}
.tf-input-with-suffix { padding-left: 56px; }

.tf-field-label-icon {
  width: 14px;
  height: 14px;
  color: var(--blue-500);
  vertical-align: -2px;
  margin-left: 5px;
}

/* Pulsing AI bot icon */
.tf-ai-icon-pulse { position: relative; }
.tf-ai-icon-pulse::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 12px;
  border: 1.5px solid rgba(37, 99, 235, 0.35);
  animation: tf-ai-pulse-ring 2.2s ease-out infinite;
}
@keyframes tf-ai-pulse-ring {
  0%   { transform: scale(1);   opacity: 0.9; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* Subtle hover lift on the two main section cards */
.section-card, .ai-assistant-card {
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.section-card:hover {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}
.ai-assistant-card:hover {
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.08);
}

/* Slightly richer tag chip hover */
.tag-chip { transition: background-color 0.15s ease, transform 0.1s ease; }
.tag-chip:hover { background: rgba(37, 99, 235, 0.13); }

/* Save button micro-interaction */
.btn-save-test:active { transform: translateY(1px); }

/* Responsive tweaks for the new elements */
@media (max-width: 720px) {
  .ts-filter-form { flex-direction: column; align-items: stretch; }
  .ts-filter-field, .ts-filter-narrow, .ts-filter-search { min-width: 100%; }
  .ts-filter-actions { width: 100%; }
  .ts-filter-btn { flex: 1; }
  .tf-progress-ribbon { gap: 6px; }
  .tf-progress-step span:last-child { display: none; }
}

/* ============================================================
   معمل صدارة — BASE & DASHBOARD ENHANCEMENTS
   (Append this file to the bottom of static/css/style.css,
   after style-additions.css)
   ============================================================ */

/* ── Sidebar logo ring + polish ───────────────────────────── */
.brand-logo-ring {
  padding: 2px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--teal-500), var(--blue-500));
  flex-shrink: 0;
}
.brand-logo-ring .brand-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #fff;
  padding: 3px;
  display: block;
}

/* Active nav item gets a left accent bar (RTL: appears on the right edge) */
.nav-item {
  border-right: 3px solid transparent;
}
.nav-item.active {
  border-right: 3px solid #fff;
}

/* User avatar ring in sidebar footer */
.avatar-ring {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12), 0 0 0 4px rgba(20, 184, 166, 0.25);
}

/* Topbar subtle shadow only once page scrolls a bit — degrades gracefully without JS */
.topbar {
  box-shadow: 0 1px 0 rgba(15, 27, 49, 0.02);
}

/* ── Dashboard hero decorative blobs ──────────────────────── */
.dashboard-hero.brand-hero {
  position: relative;
}
.hero-decor-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
  opacity: 0.5;
}
.hero-decor-blob-1 {
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.35), transparent 70%);
  top: -90px;
  left: -60px;
}
.hero-decor-blob-2 {
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.3), transparent 70%);
  bottom: -70px;
  left: 30%;
}
.hero-welcome, .hero-actions { position: relative; z-index: 1; }

/* ── Stat card trend icon ─────────────────────────────────── */
.stat-sub {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.stat-sub-icon {
  width: 12px;
  height: 12px;
}

/* ── Quick access cards: arrow slide + icon lift ──────────── */
.quick-card {
  position: relative;
  overflow: hidden;
}
.quick-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(37, 99, 235, 0.04), transparent);
  transform: translateX(100%);
  transition: transform 0.4s ease;
}
.quick-card:hover::before { transform: translateX(-100%); }
.quick-card:hover .quick-icon { transform: scale(1.06); }
.quick-card:hover .quick-arrow { transform: translateX(-4px); color: var(--blue-500); }
.quick-icon, .quick-arrow {
  transition: transform 0.2s ease, color 0.2s ease;
  position: relative;
  z-index: 1;
}
.quick-info { position: relative; z-index: 1; }

/* ── Panel header polish (performance chart card) ─────────── */
.panel-header h4 { display: flex; align-items: center; }

/* Responsive: keep blobs from overflowing on small screens */
@media (max-width: 560px) {
  .hero-decor-blob { display: none; }
}


/* ============================================================
   معمل صدارة — SUBSCRIPTION PAGE ENHANCEMENTS
   (Append this file to the bottom of static/css/style.css,
   after style-additions.css and style-additions-2.css)

   Note: this page also relies on classes not present in the
   style.css you shared (.settings-grid, .info-grid, .usage-card,
   .action-card, .card-title, etc.) — presumably defined in another
   stylesheet on your end. The rules below only add new classes on
   top of the markup and don't redefine anything, so they're safe
   to append regardless.
   ============================================================ */

/* ── Colored icon chip inside a card-header title ─────────── */
.card-title-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  vertical-align: -8px;
  flex-shrink: 0;
}
.card-title-icon svg, .card-title-icon i { width: 15px; height: 15px; }

.ct-icon-green  { background: rgba(34, 197, 94, 0.12);  color: var(--green-500); }
.ct-icon-blue   { background: rgba(37, 99, 235, 0.12);  color: var(--blue-600); }
.ct-icon-purple { background: rgba(139, 92, 246, 0.12); color: var(--purple-500); }

/* ── Icon-prefixed select / input inside subscription forms ─ */
.sub-select-icon-wrap { position: relative; }
.sub-select-icon {
  position: absolute;
  top: 50%;
  right: 13px;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--blue-500);
  pointer-events: none;
  z-index: 1;
}
.sub-select-with-icon {
  padding-right: 38px !important;
  width: 100%;
}

/* Emphasized current-value number inside the action card description */
.action-desc-strong {
  color: var(--blue-600);
  font-weight: 800;
}

/* Slight hover lift consistent with the rest of the dashboard */
.action-card {
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.action-card:hover {
  box-shadow: 0 10px 24px rgba(15, 27, 49, 0.07);
}


/* ============================================================
   معمل صدارة — LABORATORY & FEEDBACK PAGE ENHANCEMENTS
   (Append this file to the bottom of static/css/style.css,
   after style-additions.css, -2.css and -3.css)
   ============================================================ */

/* ── Laboratory row avatar: blue instead of the purple test avatar ── */
.lb-avatar {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(20, 184, 166, 0.12));
  color: var(--blue-600);
}

/* ── Feedback (reviews) table ─────────────────────────────── */
.fb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-500), var(--blue-600));
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fb-stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  direction: ltr;
}
.fb-stars svg, .fb-stars i { width: 15px; height: 15px; }
.fb-star-filled { color: var(--amber-500); fill: var(--amber-500); }
.fb-star-empty { color: #e2e8f0; }

.fb-note {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.85rem;
  color: var(--ink-700);
  max-width: 280px;
}


/* ==========================================================================
   Subscription Page Layout & Component Styles
   ========================================================================== */

/* Cards Base */
.summary-card, .usage-card, .action-card {
    padding: 24px;
    margin-bottom: 24px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

/* Header Status Top */
.summary-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

/* Info Grid (4 Items Row) */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #f8fafc;
    border-radius: 10px;
}

.info-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.si-blue { background: #dbeafe; color: #1d4ed8; }
.si-purple { background: #f3e8ff; color: #6b21a8; }
.si-green { background: #dcfce7; color: #15803d; }
.si-amber { background: #fef3c7; color: #b45309; }

.info-label {
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 2px;
}
.info-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

/* Usage Header & Progress Bar */
.usage-header-lg {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.usage-numbers-lg {
    font-weight: 700;
    font-size: 1.1rem;
}

.progress-track-lg {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-bar { height: 100%; transition: width 0.3s ease; }
.progress-green { background: #22c55e; }
.progress-orange { background: #f97316; }
.progress-red { background: #ef4444; }

/* Usage Stats Grid (3 Columns) */
.usage-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.usage-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
}

.usage-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.usage-stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
}
.usage-stat-label {
    font-size: 0.8rem;
    color: #64748b;
}

/* Settings Forms Grid (3 Columns) */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.action-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.action-desc {
    font-size: 0.85rem;
    color: #64748b;
    margin: 8px 0 16px 0;
}

.sub-select-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.sub-select-icon {
    position: absolute;
    right: 12px;
    width: 18px;
    height: 18px;
    color: #94a3b8;
    pointer-events: none;
}

.sub-select-with-icon {
    padding-right: 38px !important;
    width: 100%;
}

.btn-block {
    width: 100%;
    margin-top: 12px;
}

/* Danger Zone */
.danger-zone {
    padding: 24px;
    border: 1px solid #fecaca;
    background: #fff5f5;
    border-radius: 12px;
}

.danger-zone-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.danger-zone-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #fee2e2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
}

.danger-zone-title {
    font-weight: 700;
    color: #991b1b;
}

.danger-zone-sub {
    font-size: 0.85rem;
    color: #7f1d1d;
}

.danger-zone-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}