:root {
  /* Rahdan brand: navy #0f2a4a primary, orange #e4572e accent */
  --navy-950: #081a30;
  --navy-900: #0f2a4a;
  --navy-800: #163a63;
  --navy-700: #1f4b7d;
  /* orange: 300 = text/lines on navy (5.9:1), 500 = brand accent (borders, focus, large text),
     600 = filled buttons with white text (5.1:1), 700 = orange text on white (6.4:1) */
  --orange-300: #f08a66;
  --orange-400: #ec6a42;
  --orange-500: #e4572e;
  --orange-600: #c0451f;
  --orange-700: #a83a17;
  --bg: #f3f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --shadow: 0 12px 30px -16px rgba(15, 26, 44, 0.25);
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* ===================== LOGIN SCREEN (EXACT RAHDAN IDENTITY) ===================== */
.login-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  direction: ltr;
  background: var(--navy-950);
  overflow-x: clip;
}

.login-hero {
  position: relative;
  flex: 1 1 56%;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--navy-950);
}
.login-hero-img,
.login-hero-lights {
  position: absolute;
  inset: 0;
  background-position: center left;
  background-size: cover;
  background-repeat: no-repeat;
}
.login-hero-img {
  background-image: url('/assets/login-hero-off.jpg?v=1');
}
.login-hero-lights {
  background-image: url('/assets/login-hero.jpg?v=2');
  opacity: 0;
  will-change: opacity, filter;
  animation: headlightCycle 6.4s ease-in-out infinite;
}
@keyframes headlightCycle {
  0%, 14%   { opacity: 0; filter: brightness(1); }
  18%       { opacity: 1; filter: brightness(1.06); }
  23%       { opacity: 0.1; filter: brightness(1); }
  28%       { opacity: 1; filter: brightness(1.08); }
  52%       { opacity: 1; filter: brightness(1.03); }
  72%       { opacity: 1; filter: brightness(1); }
  84%, 100% { opacity: 0; filter: brightness(1); }
}
@media (prefers-reduced-motion: reduce) {
  .login-hero-lights { animation: none; opacity: 1; }
}
.login-hero-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(9, 16, 29, 0.05) 0%, rgba(9, 16, 29, 0.14) 55%, rgba(11, 21, 38, 0.78) 100%),
    linear-gradient(180deg, rgba(9, 16, 29, 0.24) 0%, rgba(9, 16, 29, 0.04) 40%, rgba(9, 16, 29, 0.56) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding: 46px 72px 54px 36px;
  color: #fff;
  pointer-events: none;
}

.hero-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 340px;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
.hero-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  direction: ltr;
}
.hero-brand-mark { width: 58px; height: 58px; flex-shrink: 0; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35)); }
/* Official Rahdan logo (public/assets/brand/*, generated from rahdan-logo-source.jpg) */
.hero-logo { display: block; width: 270px; max-width: 100%; height: auto; filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.45)); }
.hero-brand-words { text-align: left; }
.hero-brand-ar { font-size: 32px; font-weight: 800; line-height: 1; color: #fff; letter-spacing: -0.4px; }
.hero-brand-en { font-size: 19px; font-weight: 800; line-height: 1.15; letter-spacing: 3.6px; color: #e2e8f0; }
.hero-brand-sub { font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, 0.78); margin-top: 8px; letter-spacing: 0.6px; }
.hero-brand-company { font-size: 15px; font-weight: 700; color: #fff; margin-top: 3px; }
.hero-brand-cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}
.hero-cat-bar {
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--orange-300);
}

.hero-tagline {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  direction: rtl;
  padding: 18px 24px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(9, 16, 29, 0.52) 0%, rgba(9, 16, 29, 0.72) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 45px -16px rgba(0, 0, 0, 0.6);
}
html[dir="ltr"] .hero-tagline { direction: ltr; }
.hero-lead {
  font-size: 17px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 2px;
}
.hero-headline {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(90deg, #f6b49c 0%, #f08a66 45%, #e4572e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-accent-line {
  width: 210px;
  height: 2.5px;
  margin: 12px 0 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--orange-300), transparent);
}
.hero-features {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.hero-feat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--orange-300);
}
.hero-feat span {
  font-size: 12.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
}
.hero-feat-sep {
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, 0.18);
}

.login-panel {
  position: relative;
  flex: 0 0 44%;
  min-width: 460px;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 85% 18%, rgba(228, 87, 46, 0.14) 0%, transparent 45%),
    linear-gradient(160deg, #14365d 0%, #0f2a4a 55%, #081a30 100%);
  z-index: 3;
}

.login-curve {
  position: absolute;
  top: 0;
  left: -82px;
  width: 84px;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.login-curve .curve-accent { fill: var(--orange-500); opacity: 0.92; }
.login-curve .curve-navy { fill: #12304f; }

.login-topbar {
  position: relative;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  padding: 20px 28px 0;
}

.login-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  font-weight: 700;
}
.login-lang .lang-sep { opacity: 0.35; }
.login-lang button {
  color: rgba(255, 255, 255, 0.72);
  min-width: 38px;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 700;
  transition: color .15s, background .15s;
}
.login-lang button.active,
.login-lang button:hover {
  color: var(--orange-300);
  background: rgba(228, 87, 46, 0.16);
}
.login-lang button:focus-visible {
  outline: 2px solid var(--orange-300);
  outline-offset: 2px;
}

.login-wrap {
  position: relative;
  z-index: 4;
  flex: 1;
  width: 100%;
  padding: 20px 36px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 100%;
  max-width: 420px;
  min-width: 0;
  direction: rtl;
  background: rgba(255, 255, 255, 0.99);
  border-radius: 22px;
  padding: 34px 32px 26px;
  box-shadow:
    0 28px 65px -18px rgba(0, 0, 0, 0.68),
    0 0 0 1px rgba(228, 87, 46, 0.32);
}
html[dir="ltr"] .login-card { direction: ltr; }

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 22px;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  direction: ltr;
}
.brand-mark {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
.brand-words { text-align: left; }
.brand-logo { display: block; width: 220px; max-width: 100%; height: auto; }
.brand-ar { font-size: 27px; font-weight: 800; color: var(--navy-900); line-height: 1.02; letter-spacing: -0.3px; }
.brand-en { font-size: 17px; font-weight: 800; color: var(--navy-800); letter-spacing: 3.2px; line-height: 1.12; }
.brand-sub { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 7px; letter-spacing: 0.35px; }
.brand-company { font-size: 14px; font-weight: 800; color: var(--navy-900); margin-top: 3px; }

.login-title { text-align: center; font-size: 23px; font-weight: 800; color: var(--navy-900); }
.login-welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin: 6px 0 20px;
}
.login-welcome::before, .login-welcome::after {
  content: '';
  height: 1.5px;
  width: 34px;
  flex-shrink: 0;
  background: linear-gradient(90deg, transparent, var(--orange-500));
}
.login-welcome::after { background: linear-gradient(270deg, transparent, var(--orange-500)); }

.login-field {
  margin-bottom: 14px;
}
.login-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
  text-align: start;
}

.input-group {
  position: relative;
}
.input-group input {
  width: 100%;
  min-width: 0;
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid #dbe2ec;
  background: #f8fafc;
  padding-inline-start: 42px;
  padding-inline-end: 46px;
  font-size: 15px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input-group input::placeholder { color: #94a3b8; font-size: 13.5px; }
.input-group input:focus {
  outline: none;
  border-color: var(--orange-500);
  background: #fff;
  box-shadow: 0 0 0 3.5px rgba(228, 87, 46, 0.2);
}
.input-ico {
  position: absolute;
  top: 50%;
  inset-inline-start: 14px;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pwd-toggle {
  position: absolute;
  top: 50%;
  inset-inline-end: 4px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 9px;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.pwd-toggle:hover { background: #eef2f7; color: var(--navy-900); }
.pwd-toggle:focus-visible { outline: 2px solid var(--orange-500); outline-offset: -2px; }

.login-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 13px;
  margin: 6px 2px 18px;
}
.remember-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: #334155;
  font-weight: 600;
  cursor: pointer;
}
.remember-label input { width: 17px; height: 17px; accent-color: var(--orange-600); cursor: pointer; }
.forgot-link {
  color: var(--orange-700);
  font-weight: 700;
  font-size: 12.5px;
  min-height: 36px;
  padding: 4px 2px;
}
.forgot-link:hover { text-decoration: underline; }
.forgot-link:focus-visible { outline: 2px solid var(--orange-500); border-radius: 6px; }

.btn-accent {
  width: 100%;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 12px;
  background: linear-gradient(90deg, #b8401c 0%, #c94a22 50%, #b8401c 100%);
  color: #fff;
  font-size: 15.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 12px 24px -10px rgba(192, 69, 31, 0.6);
  transition: transform .12s, filter .15s, box-shadow .15s;
}
.btn-accent:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 16px 28px -10px rgba(192, 69, 31, 0.7);
}
.btn-accent:active:not(:disabled) { transform: translateY(0); }
.btn-accent:focus-visible { outline: 2px solid var(--navy-900); outline-offset: 2px; }
.btn-accent:disabled { opacity: 0.72; cursor: progress; }

html[dir="rtl"] .btn-arrow { transform: scaleX(-1); }

.btn-spinner {
  width: 17px;
  height: 17px;
  border-radius: 999px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-err {
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: 11px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  word-break: break-word;
}
.login-foot {
  text-align: center;
  margin-top: 20px;
  font-size: 11.5px;
  color: #94a3b8;
  font-weight: 600;
  line-height: 1.55;
}

/* ===================== DASHBOARD SHELL ===================== */
.shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 60%, #13355c 100%);
  color: #e2e8f0;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-inline-end: 1px solid rgba(228, 87, 46, 0.2);
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.side-brand .brand-ar { color: #fff; font-size: 20px; }
.side-brand .brand-en { color: var(--orange-300); font-size: 12px; letter-spacing: 2.2px; }
.side-brand .brand-tag { letter-spacing: 0; font-size: 12.5px; font-weight: 700; }
/* official logo in the sidebar, platform tagline under it */
.side-brand:has(.side-logo) { flex-direction: column; align-items: flex-start; gap: 6px; }
.side-logo { display: block; width: 158px; max-width: 100%; height: auto; }
.wb-logo { display: block; height: 46px; width: auto; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.wa-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12.5px;
  font-weight: 700;
}
.wa-dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; background: #94a3b8; }
.wa-dot.open { background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.22); }
.wa-dot.qr { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.22); }
.wa-dot.closed { background: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.22); }

.nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
  text-align: start;
  transition: background .15s, color .15s;
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-btn.active {
  background: linear-gradient(90deg, rgba(228, 87, 46, 0.24), rgba(228, 87, 46, 0.08));
  color: var(--orange-300);
  box-shadow: inset 3px 0 0 var(--orange-300);
}
html[dir="rtl"] .nav-btn.active { box-shadow: inset -3px 0 0 var(--orange-300); }
.nav-badge {
  margin-inline-start: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--orange-500);
  color: var(--navy-950);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.side-user {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-box { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--orange-500), var(--orange-700));
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 13.5px; font-weight: 700; color: #fff; }
.user-role { font-size: 11.5px; color: var(--orange-300); }
.btn-logout {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  font-size: 12.5px;
  font-weight: 700;
  transition: background .15s;
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.25); color: #fff; }

/* ===================== MAIN CONTENT ===================== */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 19px; font-weight: 800; color: var(--navy-900); }
.topbar-sub { font-size: 12.5px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn-primary { background: var(--orange-600); color: #fff; }
.btn-primary:hover { background: var(--orange-700); }
.btn-navy { background: var(--navy-900); color: #fff; }
.btn-navy:hover { background: var(--navy-800); }
.btn-outline { background: #fff; border: 1.5px solid var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--orange-500); color: var(--navy-900); }
.btn-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }

.content { padding: 24px 26px 40px; display: flex; flex-direction: column; gap: 20px; }

/* ===================== KPI & CARDS ===================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
}
.kpi {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 3.5px;
  background: var(--accent, var(--orange-500));
}
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi-val { font-size: 28px; font-weight: 800; color: var(--navy-900); margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* Overview KPI row: all 6 cards on one row on wide screens, 3 below 1200px, 2 on phones */
#kpiGrid.kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
/* wide screens: every card on one row whatever their count (6 today, 7 since the phase-4 «طلبات اليوم» card) */
@media (min-width: 1201px) { #kpiGrid.kpi-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); } }
@media (max-width: 1200px) { #kpiGrid.kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { #kpiGrid.kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* Status donut card: conversion badge (ⓘ + tooltip) and its formula line */
.conv-badge { cursor: help; }
.conv-badge .info-i { font-size: 12px; opacity: 0.8; }
.card-note { font-size: 11px; color: var(--muted); margin: -8px 0 10px; }

/* Wait time of a quote when it is not urgent/overdue */
.wait-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* phones: a wide child (staff table, long name + overdue chip) must not stretch the card past the screen */
.grid-2 > * { min-width: 0; }
#overviewPending .feed-head { flex-wrap: wrap; }

/* Header «🚨 N طلبات متأخرة» */
.late-alert {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #f5c2c0;
  background: #fde8e8;
  color: #b42318;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  animation: latePulse 2s ease-in-out infinite;
}
.late-alert[hidden] { display: none; }
.late-alert:hover { background: #fbd5d5; }
.late-alert:focus-visible { outline: 2px solid #b42318; outline-offset: 2px; }
@keyframes latePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(180, 35, 24, 0); }
}
@media (prefers-reduced-motion: reduce) { .late-alert { animation: none; } }
html[data-theme="dark"] .late-alert { background: rgba(220, 38, 38, 0.2); color: #fca5a5; border-color: rgba(220, 38, 38, 0.45); }
html[data-theme="dark"] .late-alert:hover { background: rgba(220, 38, 38, 0.3); }
html[data-theme="dark"] .late-alert:focus-visible { outline-color: #fca5a5; }
/* dark mode: headings and KPI numbers were navy-on-navy (unreadable) */
html[data-theme="dark"] .topbar h1,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .kpi-val { color: var(--ink); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-title { font-size: 16px; font-weight: 800; color: var(--navy-900); display: flex; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #f1f5f9;
  color: #334155;
}
.chip.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.chip.accent { background: #fdf0eb; color: #a83a17; border: 1px solid #f6c2b0; }
.chip.warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.chip.info { background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; }
.chip.danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ===================== TABLES & QUOTES ===================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: start; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px; border-bottom: 1.5px solid var(--border); white-space: nowrap; }
td { padding: 12px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
tr:hover td { background: #fafbfd; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.input, .select, .textarea {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  background: #fff;
  color: var(--ink);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--orange-500); box-shadow: 0 0 0 3px rgba(228, 87, 46, 0.16); }
.textarea { width: 100%; line-height: 1.7; resize: vertical; }

.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: #475569;
  font-size: 12.5px;
  font-weight: 700;
}
.pill.active { background: var(--navy-900); border-color: var(--navy-900); color: var(--orange-300); }

.vin-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy-900);
  direction: ltr;
}
.vin-copy {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--navy-900);
  color: var(--orange-300);
  font-size: 11px;
  font-weight: 700;
  font-family: 'Tajawal', sans-serif;
}
.vin-copy:hover { background: var(--navy-800); }

.reply-box { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.reply-row { display: flex; gap: 6px; }
.reply-row input { flex: 1; min-width: 0; }

/* ===================== LIVE FEED ===================== */
.feed { display: flex; flex-direction: column; gap: 8px; max-height: 540px; overflow-y: auto; padding-inline-end: 4px; }
.feed-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.feed-item.incoming { border-inline-start: 4px solid var(--info); }
.feed-item.ai { border-inline-start: 4px solid var(--ok); background: #f8fffe; }
.feed-item.handoff { border-inline-start: 4px solid var(--orange-500); background: #fff8f5; }
.feed-item.error { border-inline-start: 4px solid var(--danger); background: #fff8f8; }
.feed-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); gap: 8px; }
.feed-text { font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }

/* ===================== FORMS & SETTINGS ===================== */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 700; color: var(--navy-900); }
.field small { font-size: 11.5px; color: var(--muted); }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafbfd;
}
.toggle-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--orange-600); }

.staff-list { display: flex; flex-direction: column; gap: 8px; }
.staff-row { display: flex; gap: 8px; align-items: center; }
.staff-row input { flex: 1; min-width: 0; }

.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; border: 1.5px dashed var(--orange-500); border-radius: 14px; background: #fff8f5; }
.qr-box img { width: 220px; height: 220px; border-radius: 10px; }

.toast {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  z-index: 99;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--navy-900);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 18px 36px -12px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(228, 87, 46, 0.4);
}
.toast.err { background: #991b1b; border-color: #fca5a5; }

.empty { text-align: center; padding: 28px; color: var(--muted); font-size: 13.5px; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }

  .login-screen { display: block; }
  .login-hero {
    position: fixed;
    inset: 0;
    min-height: 0;
    z-index: 0;
  }
  .hero-content { display: none; }
  .login-hero-vignette {
    background: linear-gradient(180deg, rgba(9, 16, 29, 0.78) 0%, rgba(11, 21, 38, 0.88) 55%, rgba(9, 16, 29, 0.94) 100%);
  }
  .login-curve { display: none; }
  .login-panel {
    position: relative;
    min-width: 0;
    max-width: none;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: transparent;
  }
  .login-topbar { padding: 16px 20px 0; }
  .login-wrap { padding: 16px 20px 28px; }
}

@media (max-width: 480px) {
  .login-topbar { padding: 14px 14px 0; }
  .login-wrap { padding: 12px 14px 24px; }
  .login-card {
    padding: 26px 20px 22px;
    border-radius: 18px;
  }
  .brand-mark { width: 44px; height: 44px; }
  .brand-ar { font-size: 23px; }
  .brand-en { font-size: 15px; letter-spacing: 2.6px; }
  .login-title { font-size: 21px; }
  .login-welcome { font-size: 12.5px; margin-bottom: 18px; }
  .input-group input { font-size: 16px; }
}

/* ===================== PRO UPGRADE: DARK MODE, CHARTS, SLA, QUICK REPLIES, MODAL, DRAWER, PRINT ===================== */
html[data-theme="dark"] {
  --bg: #0b1220;
  --card: #121c2e;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --border: #23324a;
  --shadow: 0 14px 32px -16px rgba(0, 0, 0, 0.65);
}
html[data-theme="dark"] .topbar { background: #10192b; border-bottom-color: var(--border); }
html[data-theme="dark"] .input,
html[data-theme="dark"] .select,
html[data-theme="dark"] .textarea,
html[data-theme="dark"] .pill,
html[data-theme="dark"] .btn-outline { background: #0d1526; color: var(--ink); border-color: var(--border); }
html[data-theme="dark"] .pill.active { background: var(--orange-500); border-color: var(--orange-500); color: var(--navy-950); }
html[data-theme="dark"] td { border-bottom-color: #1c2940; }
html[data-theme="dark"] tr:hover td { background: #162238; }
html[data-theme="dark"] .chip { background: #1c2940; color: #cbd5e1; }
html[data-theme="dark"] .chip.ok { background: rgba(5, 150, 105, 0.18); color: #6ee7b7; border-color: rgba(5, 150, 105, 0.4); }
html[data-theme="dark"] .chip.accent { background: rgba(228, 87, 46, 0.18); color: #f6c2b0; border-color: rgba(228, 87, 46, 0.45); }
html[data-theme="dark"] .chip.warn { background: rgba(217, 119, 6, 0.18); color: #fcd34d; border-color: rgba(217, 119, 6, 0.4); }
html[data-theme="dark"] .chip.info { background: rgba(2, 132, 199, 0.18); color: #7dd3fc; border-color: rgba(2, 132, 199, 0.4); }
html[data-theme="dark"] .chip.danger { background: rgba(220, 38, 38, 0.18); color: #fca5a5; border-color: rgba(220, 38, 38, 0.4); }
html[data-theme="dark"] .feed-item,
html[data-theme="dark"] .toggle-row,
html[data-theme="dark"] .surface-bar,
html[data-theme="dark"] .vin-box,
html[data-theme="dark"] .qr-template-card { background: #0e1729; border-color: var(--border); color: var(--ink); }
html[data-theme="dark"] .field label { color: #e2e8f0; }

.topbar-left { display: flex; align-items: center; gap: 10px; }
.mobile-only { display: none; }
.btn-icon { padding: 7px 11px; font-size: 16px; line-height: 1; }
.select-sm { padding: 6px 10px; font-size: 12.5px; }
.filter-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }
.surface-bar { padding: 12px; background: #f8fafc; border-radius: 12px; border: 1px solid var(--border); }

.side-user-actions { display: flex; gap: 6px; margin-top: 8px; }
.side-user-actions > button { flex: 1; }
.btn-side-sec {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.btn-side-sec:hover { background: rgba(255, 255, 255, 0.16); }

/* Charts */
.chart-box { min-height: 190px; display: flex; align-items: center; justify-content: center; }
.chart-svg { width: 100%; height: 190px; overflow: visible; }
.chart-legend { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.lg-dot.total { background: var(--navy-700); }
.lg-dot.conf { background: var(--orange-500); }
.donut-wrap { display: flex; align-items: center; gap: 20px; width: 100%; justify-content: center; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; min-width: 150px; }
.donut-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.donut-label { display: inline-flex; align-items: center; gap: 6px; }

/* SLA Badges */
.sla-urgent { animation: slaPulse 1.8s ease-in-out infinite; }
@keyframes slaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

/* Quick Replies */
.qr-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 4px; }
.qr-chip {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(228, 87, 46, 0.14);
  color: var(--orange-700);
  border: 1px solid rgba(228, 87, 46, 0.38);
}
html[data-theme="dark"] .qr-chip { color: var(--orange-300); }
.qr-chip:hover { background: var(--orange-500); color: var(--navy-950); }
.qr-templates-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.qr-template-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fafbfd;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qr-template-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(9, 16, 29, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.5);
}

/* Mobile Sidebar Drawer */
.sidebar-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(9, 16, 29, 0.55); }
@media (max-width: 980px) {
  .mobile-only { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    width: 270px;
    z-index: 80;
    height: 100vh;
    transform: translateX(100%);
    transition: transform 0.22s ease;
  }
  html[dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
}

/* Print Report Styles */
.print-only-header { display: none; }
@media print {
  .sidebar, .sidebar-backdrop, .topbar, .toolbar, .smart-queue-strip, .reply-box, .btn, .vin-copy, .toast, .modal-overlay, #view-wallboard { display: none !important; }
  .print-only-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    margin-bottom: 14px;
    border-bottom: 2.5px solid #0f2a4a;
  }
  .shell, .main, .content { display: block !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #cbd5e1 !important; break-inside: avoid; margin-bottom: 12px !important; }
  body { background: #fff !important; color: #000 !important; }
}

/* ===================== ENTERPRISE SAAS WOW COMPONENTS ===================== */
.seg-btns { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.seg-btn { padding: 4px 10px; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--card); }
.seg-btn.active { background: var(--navy-900); color: var(--orange-300); }
html[data-theme="dark"] .seg-btn.active { background: var(--orange-500); color: var(--navy-950); }

/* Employee of the Month Spotlight */
.eom-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f2a4a 0%, #163a63 60%, #1f4b7d 100%);
  border: 1px solid rgba(240, 138, 102, 0.45);
  color: #fff;
  box-shadow: 0 16px 34px -16px rgba(9, 16, 29, 0.55);
}
.eom-left { display: flex; align-items: center; gap: 14px; }
.eom-trophy {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(240, 138, 102, 0.18);
  border: 1px solid rgba(240, 138, 102, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
}
.eom-label { font-size: 11.5px; font-weight: 700; color: var(--orange-300); letter-spacing: 0.4px; }
.eom-name { font-size: 18px; font-weight: 800; margin-top: 2px; }
.eom-metrics { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.eom-stat { background: rgba(255, 255, 255, 0.08); padding: 7px 12px; border-radius: 10px; text-align: center; }
.eom-stat b { display: block; font-size: 16px; color: var(--orange-300); }
.eom-stat small { font-size: 11px; color: #cbd5e1; }

/* Leaderboard Podium & Gamification */
.podium-list { display: flex; flex-direction: column; gap: 10px; }
.podium-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.podium-row.rank-1 { border-color: rgba(228, 87, 46, 0.65); background: linear-gradient(90deg, rgba(228, 87, 46, 0.12), transparent); }
.podium-medal { font-size: 22px; width: 32px; text-align: center; }
.podium-info { flex: 1; min-width: 0; }
.podium-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.podium-pts { text-align: end; }
.podium-pts strong { font-size: 16px; color: var(--orange-600); display: block; }
html[data-theme="dark"] .podium-pts strong { color: var(--orange-300); }

/* Forecast Box */
.forecast-box { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.forecast-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.forecast-tile { padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); text-align: center; }
.forecast-tile .ft-val { font-size: 24px; font-weight: 800; color: var(--ink); }
.forecast-tile .ft-lbl { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.progress-track { height: 9px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--navy-700), var(--orange-500)); }

/* Activity Stream */
.activity-stream { display: flex; flex-direction: column; gap: 8px; max-height: 290px; overflow-y: auto; }
.act-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); font-size: 12.5px; }
.act-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange-500); margin-top: 6px; flex-shrink: 0; }
.act-time { margin-inline-start: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Smart Queue Strip & Customer VIP / Risk Badges */
.smart-queue-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.sq-card {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}
.sq-card:hover { transform: translateY(-2px); border-color: var(--orange-500); }
.sq-card.active { border-color: var(--orange-500); box-shadow: 0 0 0 3px rgba(228, 87, 46, 0.2); }
.sq-card strong { font-size: 20px; font-weight: 800; }
.tier-vip { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #78350f; border: 1px solid #f59e0b; }
html[data-theme="dark"] .tier-vip { background: rgba(245, 158, 11, 0.22); color: #fde68a; }
.risk-badge { background: #fef2f2; color: #b91c1c; border: 1px solid #f87171; animation: slaPulse 1.6s infinite; }
html[data-theme="dark"] .risk-badge { background: rgba(220, 38, 38, 0.24); color: #fca5a5; }
.sla-bar { width: 90px; height: 5px; border-radius: 99px; background: var(--border); overflow: hidden; margin-top: 5px; }
.sla-bar > i { display: block; height: 100%; border-radius: 99px; }

/* Customer Timeline Stepper */
.tl-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.tl-step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); opacity: 0.55; }
.tl-step.done { opacity: 1; border-color: rgba(5, 150, 105, 0.45); background: rgba(5, 150, 105, 0.06); }
.tl-ico { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; background: var(--border); }
.tl-step.done .tl-ico { background: var(--ok); color: #fff; }

/* Audit Pagination & Command Palette */
.pagination-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.muted-sm { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.cust-phone { color: var(--ink); font-weight: 700; text-decoration: none; unicode-bidi: isolate; }
.cust-phone:hover { color: var(--orange-500, #e4572e); text-decoration: underline; }
.cmd-list { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }
.cmd-item { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--ink); text-align: start; }
.cmd-item:hover { background: rgba(228, 87, 46, 0.16); }

/* Command Center TV Wallboard Mode (/dashboard/live) */
body.wallboard-active .sidebar,
body.wallboard-active .topbar { display: none !important; }
body.wallboard-active .shell { display: block !important; }
body.wallboard-active .content { padding: 0 !important; }
.wallboard-pane {
  min-height: 100vh;
  background: radial-gradient(circle at top right, #163a63 0%, #081a30 65%);
  color: #f8fafc;
  padding: 24px 28px;
}
.wb-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.wb-brand { display: flex; align-items: center; gap: 14px; }
.wb-live-dot { width: 14px; height: 14px; border-radius: 50%; background: #10b981; box-shadow: 0 0 16px #10b981; animation: slaPulse 1.6s infinite; }
.wb-title { font-size: 22px; font-weight: 800; color: #fff; }
.wb-sub { font-size: 11px; letter-spacing: 1.8px; color: var(--orange-300); font-weight: 700; margin-top: 2px; }
.wb-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wb-clock { font-family: ui-monospace, Consolas, monospace; font-size: 22px; font-weight: 800; color: var(--orange-300); padding: 4px 12px; background: rgba(255, 255, 255, 0.06); border-radius: 10px; }
.wb-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px; margin-top: 20px; }
.wb-kpi { padding: 18px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-top: 3px solid var(--accent, var(--orange-300)); }
.wb-kpi-lbl { font-size: 13px; color: #cbd5e1; font-weight: 600; }
.wb-kpi-val { font-size: 38px; font-weight: 800; color: #fff; margin-top: 6px; line-height: 1.05; }
.wb-kpi-sub { font-size: 11.5px; color: #94a3b8; margin-top: 6px; }
.wb-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.wb-card { background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px; padding: 16px; }
.wb-card-title { font-size: 15px; font-weight: 800; color: var(--orange-300); margin-bottom: 12px; }
.wb-scroll { display: flex; flex-direction: column; gap: 8px; max-height: 380px; overflow-y: auto; }
.wb-item { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.09); font-size: 13px; }
@media (max-width: 1100px) { .wb-grid-3 { grid-template-columns: 1fr; } }

/* ===================== RAHDAN PHASE 1: refs, handoffs, conversations, business settings ===================== */
.ref-tag { font-family: ui-monospace, Consolas, monospace; font-weight: 800; color: var(--navy-900); letter-spacing: 0.3px; }
html[data-theme="dark"] .ref-tag { color: var(--orange-300); }
.card-title .nav-badge { margin-inline-start: 6px; vertical-align: middle; }
.field .field-label { font-size: 13px; font-weight: 700; color: var(--navy-900); }
html[data-theme="dark"] .field .field-label { color: #e2e8f0; }
.hint-note { font-size: 13px; color: var(--ink); background: #fff8f5; border: 1px solid #f6c2b0; border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
html[data-theme="dark"] .hint-note { background: rgba(228, 87, 46, 0.1); border-color: rgba(228, 87, 46, 0.4); }

/* «عملاء طلبوا موظف» */
.handoff-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.handoff-list > .empty { grid-column: 1 / -1; }
.feed-item.handoff-row { border-inline-start: 4px solid var(--orange-500); display: flex; flex-direction: column; gap: 8px; }
.feed-item.handoff-row .btn { align-self: flex-start; }
.handoff-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

/* «المحادثات» */
.conv-layout { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.conv-list { display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow-y: auto; }
.conv-item { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--ink); text-align: start; }
.conv-item:hover { border-color: var(--orange-500); }
.conv-item.active { border-color: var(--orange-500); box-shadow: 0 0 0 3px rgba(228, 87, 46, 0.18); }
.conv-item:focus-visible { outline: 2px solid var(--orange-500); outline-offset: 2px; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.conv-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.conv-last { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-thread-head { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
.conv-thread { display: flex; flex-direction: column; gap: 8px; max-height: 66vh; overflow-y: auto; padding: 4px 2px; }
.msg { max-width: min(78%, 560px); padding: 8px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.6; }
.msg-meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-user { align-self: flex-start; background: #f1f5f9; border: 1px solid var(--border); }
.msg-assistant { align-self: flex-end; background: #eef4fb; border: 1px solid #cfe0f3; }
.msg-owner { align-self: flex-end; background: #fff3ee; border: 1px solid #f6c2b0; }
html[data-theme="dark"] .msg-user { background: #142034; }
html[data-theme="dark"] .msg-assistant { background: #13294a; border-color: #1f4b7d; }
html[data-theme="dark"] .msg-owner { background: rgba(228, 87, 46, 0.14); border-color: rgba(228, 87, 46, 0.4); }

/* settings: hours slots, branches, logo */
.slot-list { display: flex; flex-direction: column; gap: 6px; }
.slot-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.slot-row .select { min-width: 110px; }
.slot-row .input { width: 120px; }
.branch-table td { padding: 6px 4px; }
.input.input-sm { padding: 7px 9px; font-size: 13px; min-width: 110px; }
.logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-preview { width: 64px; height: 64px; object-fit: contain; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--orange-500); outline-offset: 2px; }

@media (max-width: 980px) {
  .conv-layout { grid-template-columns: 1fr; }
  .conv-list { max-height: 40vh; }
  .msg { max-width: 92%; }
}
@media (max-width: 480px) {
  .handoff-list { grid-template-columns: 1fr; }
  .slot-row .input { width: 100px; }
}

/* ===================== Rahdan phase 2: reports (lost parts, branch race, lost reasons) ===================== */
.report-filters { margin-inline-start: 0; }
.range-custom { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.range-custom .input-sm { min-width: 0; width: 150px; }
.report-summary { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.report-summary strong { color: var(--ink); }
.report-table td, .report-table th { white-space: nowrap; }
.report-table td.wrap { white-space: normal; min-width: 140px; }
.count-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.count-cell b { min-width: 22px; font-variant-numeric: tabular-nums; }
.mini-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; min-width: 50px; }
.mini-bar i { display: block; height: 100%; border-radius: 999px; background: var(--orange-500); }

.br-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.br-card { border: 1.5px solid var(--border); border-radius: 14px; padding: 14px; background: var(--card); display: flex; flex-direction: column; gap: 10px; }
.br-card.fastest { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12); }
.br-card.slowest { border-color: var(--orange-500); box-shadow: 0 0 0 3px rgba(228, 87, 46, 0.12); }
.br-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.br-name { font-size: 15px; font-weight: 800; color: var(--navy-900); }
.br-big { font-size: 26px; font-weight: 800; color: var(--navy-900); font-variant-numeric: tabular-nums; line-height: 1.1; }
.br-big small { font-size: 12px; font-weight: 700; color: var(--muted); }
.br-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; font-size: 12.5px; color: var(--muted); }
.br-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
html[data-theme="dark"] .br-name, html[data-theme="dark"] .br-big { color: var(--ink); }

.report-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 180px) 1fr 44px; align-items: center; gap: 10px; font-size: 13.5px; }
.bar-row .bar-label { font-weight: 700; }
.bar-track { height: 14px; border-radius: 999px; background: var(--border); overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--navy-800), var(--orange-500)); }
.bar-row .bar-count { font-weight: 800; text-align: end; font-variant-numeric: tabular-nums; }

.report-preview { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 13px; line-height: 1.75; background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 12px; max-height: 360px; overflow-y: auto; }
html[data-theme="dark"] .report-preview { background: #0e1729; color: var(--ink); }
.owner-hint { color: var(--orange-700); font-weight: 700; }
html[data-theme="dark"] .owner-hint { color: var(--orange-300); }
.avail-select { max-width: 150px; }
.branch-chip { white-space: nowrap; }

@media (max-width: 640px) {
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .bar-row { grid-template-columns: minmax(90px, 120px) 1fr 34px; gap: 8px; font-size: 12.5px; }
  .br-grid { grid-template-columns: 1fr; }
  .range-custom .input-sm { width: 132px; }
}
#view-lostparts > .card + .card, #view-lostreasons > .card + .card { margin-top: 18px; }
.report-summary bdi, .kpi-sub bdi { white-space: nowrap; }

/* ===================== Rahdan phase 3: request parts, garage, waitlist, ratings, reminders ===================== */
.q-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.q-tool { padding: 4px 9px; font-size: 11.5px; }
.q-tool .chip { padding: 1px 6px; font-size: 10.5px; }
.modal-card.modal-wide, .modal-card.modal-mid { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal-card.modal-wide { max-width: 880px; }
.modal-card.modal-mid { max-width: 560px; }
.items-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13.5px; }
.items-list { display: flex; flex-direction: column; gap: 10px; }
.item-card { border: 1.5px solid var(--border); border-radius: 14px; padding: 12px; background: var(--card); }
.item-card.unsure { border-color: #fcd34d; background: #fffdf5; }
html[data-theme="dark"] .item-card.unsure { background: rgba(217, 119, 6, 0.08); border-color: rgba(217, 119, 6, 0.5); }
.item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.item-no { font-variant-numeric: tabular-nums; color: var(--navy-900); }
html[data-theme="dark"] .item-no { color: var(--orange-300); }
.item-guess { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.item-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; }
.item-f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); min-width: 0; }
.item-f .input, .item-f .select { width: 100%; min-width: 0; }
.item-f.item-wide { grid-column: span 2; }
.items-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 6px; }
.items-total b { color: var(--ink); }
.veh-list { display: flex; flex-direction: column; gap: 10px; }
.veh-card { border: 1.5px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.veh-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.veh-meta { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.veh-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.conv-head-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.wl-groups { display: flex; flex-direction: column; gap: 14px; }
.wl-group { border: 1.5px solid var(--border); border-radius: 14px; padding: 12px; }
.wl-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.wl-part { font-size: 16px; font-weight: 800; color: var(--navy-900); }
html[data-theme="dark"] .wl-part { color: var(--ink); }
.arrived-result { margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; border: 1px solid var(--border); }
.arrived-result.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.arrived-result.danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
html[data-theme="dark"] .arrived-result.ok { background: rgba(5, 150, 105, 0.14); color: #6ee7b7; border-color: rgba(5, 150, 105, 0.4); }
html[data-theme="dark"] .arrived-result.danger { background: rgba(220, 38, 38, 0.14); color: #fca5a5; border-color: rgba(220, 38, 38, 0.4); }
.stars { color: #d97706; letter-spacing: 1px; white-space: nowrap; }
.bar-row.bar-low .bar-track i { background: linear-gradient(90deg, #f59e0b, var(--danger)); }
.rating-low { border-inline-start: 3px solid var(--danger); }
.route-table td { padding: 6px 4px; }
.route-table .select, .route-table .input { min-width: 120px; }
.months-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 10px; }
.month-f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
#view-waitlist > .card + .card, #view-ratings > .card + .card, #view-reminders > .card + .card { margin-top: 18px; }

@media (max-width: 760px) {
  .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .modal-overlay { padding: 8px; }
  .modal-card.modal-wide, .modal-card.modal-mid { padding: 14px; max-height: calc(100dvh - 16px); }
  .item-card { padding: 10px; }
  .item-grid { gap: 6px 8px; }
  .items-foot { flex-direction: column; align-items: stretch; }
  .items-foot .btn { justify-content: center; }
  .conv-head-tools { align-items: flex-start; }
  .wl-head .btn { width: 100%; justify-content: center; }
  .months-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===== Rahdan phase 4: company lists, PDF quotation, inventory ===== */
.list-badge-row { margin-top: 5px; }
.list-badge-row .chip b { color: #b91c1c; }
.pdf-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; }
/* the 300-line list editor: one table, the header stays visible while scrolling */
.items-table-wrap { max-height: min(56vh, 560px); overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
.items-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.items-table thead th { position: sticky; top: 0; z-index: 2; background: var(--card); box-shadow: 0 1px 0 var(--border); padding: 8px 6px; }
.items-table td { padding: 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.items-table .input, .items-table .select { width: 100%; min-width: 0; padding: 5px 7px; font-size: 12.5px; }
.items-table .c-part { min-width: 150px; }
.items-table .c-pn, .items-table .c-car { min-width: 120px; }
.items-table .c-vin { min-width: 150px; }
.items-table .c-qty { width: 70px; min-width: 64px; }
.items-table .c-price { min-width: 90px; }
.items-table .c-grade { min-width: 80px; }
.items-table .c-av { min-width: 110px; }
.items-table .c-miss { min-width: 120px; white-space: nowrap; }
.items-table .item-no { font-weight: 800; white-space: nowrap; padding-inline: 8px; }
.items-table tr.missing td { background: #fffbeb; }
.items-table tr.missing td:first-child { box-shadow: inset -3px 0 0 #f59e0b; }
.items-table tr.unpriced td, .item-card.unpriced { background: #fef2f2; }
.items-table tr.unpriced .c-price .input, .item-card.unpriced [data-if="unit_price"] { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.18); }
html[data-theme="dark"] .items-table tr.missing td { background: rgba(217, 119, 6, 0.1); }
html[data-theme="dark"] .items-table tr.unpriced td, html[data-theme="dark"] .item-card.unpriced { background: rgba(220, 38, 38, 0.12); }
.pdf-bar { border: 1.5px dashed var(--border); border-radius: 14px; padding: 12px; margin: 10px 0; }
.pdf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.pdf-last { font-size: 13px; margin-bottom: 8px; }
.pdf-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pdf-msg { margin-top: 10px; padding: 9px 12px; border-radius: 10px; font-size: 13px; border: 1px solid var(--border); }
.pdf-msg.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.pdf-msg.danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
html[data-theme="dark"] .pdf-msg.ok { background: rgba(5, 150, 105, 0.14); color: #6ee7b7; border-color: rgba(5, 150, 105, 0.4); }
html[data-theme="dark"] .pdf-msg.danger { background: rgba(220, 38, 38, 0.14); color: #fca5a5; border-color: rgba(220, 38, 38, 0.4); }
.pdf-modal { max-width: 960px; display: flex; flex-direction: column; }
.pdf-frame { width: 100%; height: min(78vh, 1100px); border: 1px solid var(--border); border-radius: 12px; background: #fff; }
/* inventory */
#view-inventory > .card + .card, #view-inventory > .card + .grid-2 { margin-top: 18px; }
.inv-upload { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.inv-upload .input[type="file"] { flex: 1 1 260px; min-width: 0; }
.inv-note { margin: 0 0 8px; }
.inv-result { margin-top: 10px; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; border: 1px solid var(--border); }
.inv-result.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.inv-result.danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
html[data-theme="dark"] .inv-result.ok { background: rgba(5, 150, 105, 0.14); color: #6ee7b7; border-color: rgba(5, 150, 105, 0.4); }
html[data-theme="dark"] .inv-result.danger { background: rgba(220, 38, 38, 0.14); color: #fca5a5; border-color: rgba(220, 38, 38, 0.4); }
.inv-rejected { margin-top: 8px; color: var(--ink); }
.inv-rejected summary { cursor: pointer; font-weight: 700; }
.inv-states { margin-bottom: 10px; }
.inv-table-wrap { max-height: 70vh; overflow: auto; }
.inv-table thead th { position: sticky; top: 0; z-index: 1; background: var(--card); }
.inv-table td.num, .report-table td.num { font-variant-numeric: tabular-nums; }
.inv-table td.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.inv-table tr.inv-out td:first-child { box-shadow: inset -3px 0 0 var(--danger); }
.inv-table tr.inv-low td:first-child { box-shadow: inset -3px 0 0 #f59e0b; }
.min-edit { display: flex; gap: 4px; align-items: center; }
.min-edit .input { width: 84px; min-width: 0; }
.inv-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.inv-alert.out { border-inline-start: 3px solid var(--danger); }
.inv-alert.low { border-inline-start: 3px solid #f59e0b; }
.inv-alert-meta { margin: 6px 0; }
.inv-alert details summary { cursor: pointer; }
@media (max-width: 480px) {
  .inv-upload .btn { width: 100%; justify-content: center; }
  .pdf-actions .btn { flex: 1 1 100%; justify-content: center; }
  .pdf-frame { height: 70vh; }
  .min-edit .input { width: 64px; }
}
.inv-table td.wrap { min-width: 110px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.modal-card.modal-wide:has(.items-table) { max-width: 1180px; }
/* phones: one card per stock line (label: value), no sideways scrolling */
@media (max-width: 640px) {
  .inv-table-wrap { max-height: none; overflow: visible; }
  .inv-table thead { display: none; }
  .inv-table, .inv-table tbody, .inv-table tr { display: block; width: 100%; }
  .inv-table tr { border: 1px solid var(--border); border-radius: 12px; padding: 6px 10px; margin-bottom: 10px; }
  .inv-table td { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--border); white-space: normal; min-width: 0 !important; text-align: end; }
  .inv-table td:last-child { border-bottom: 0; }
  .inv-table td::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--muted); text-align: start; }
  .inv-table td.empty { display: block; text-align: center; }
  .inv-table td.empty::before { content: none; }
  .inv-table tr.inv-out { border-inline-start: 3px solid var(--danger); }
  .inv-table tr.inv-low { border-inline-start: 3px solid #f59e0b; }
  .inv-table tr td:first-child { box-shadow: none !important; }
}

/* ===== More WhatsApp numbers: the switcher, the link code, the manage dialog ===== */
.bot-switch {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.bot-switch-label { font-size: 11.5px; font-weight: 700; color: #cbd5e1; }
.bot-switch-row { display: flex; align-items: center; gap: 9px; }
.bot-select {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}
.bot-select:disabled { opacity: 1; cursor: default; }
.bot-select option { color: #0f172a; background: #fff; }
.bot-select:focus-visible { outline: 2px solid var(--orange-300); outline-offset: 2px; }
.bot-switch-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bot-switch-actions > button { flex: 1 1 auto; }
.bot-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--navy-900);
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.bot-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-chip:focus-visible { outline: 2px solid var(--orange-500); outline-offset: 2px; }
#botAddForm > .card-note { margin: 0 0 12px; font-size: 12.5px; }
.qr-pane { margin-top: 14px; }
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: #fafbfd;
}
.qr-box .card-note { margin: 0; font-size: 12px; }
.qr-img {
  width: 264px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  image-rendering: pixelated;
  background: #fff;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.qr-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.qr-steps { text-align: start; margin: 0; padding-inline-start: 20px; font-size: 13px; line-height: 1.9; color: var(--ink); }
.qr-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.qr-placeholder, .qr-done-icon { font-size: 44px; line-height: 1; }
.qr-wait { animation: qrPulse 1.4s ease-in-out infinite; }
@keyframes qrPulse { 50% { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .qr-wait { animation: none; } }
.bot-rename-row { display: flex; gap: 8px; }
.bot-rename-row .input { flex: 1; min-width: 0; }
.danger-zone {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fff7f7;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.danger-zone h3 { font-size: 14px; font-weight: 800; color: #b91c1c; }
.danger-zone p { font-size: 12.5px; color: #7f1d1d; line-height: 1.7; }
.danger-zone label { font-size: 12.5px; font-weight: 700; }
.danger-zone .btn { align-self: flex-start; }
.danger-zone .btn:disabled { opacity: 0.5; cursor: not-allowed; }
html[data-theme="dark"] .qr-box { background: #0f1828; }
html[data-theme="dark"] .danger-zone { background: rgba(185, 28, 28, 0.1); border-color: rgba(239, 68, 68, 0.35); }
html[data-theme="dark"] .danger-zone p { color: #fecaca; }
html[data-theme="dark"] .bot-chip { color: #e2e8f0; }
@media (max-width: 480px) {
  .bot-chip { max-width: 150px; }
  .bot-rename-row { flex-direction: column; }
}

/* Spare-Parts Catalog (Original / Mando / Commercial) & Quote Suggestions */
.tier-original { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.tier-mando { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.tier-commercial { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
html[data-theme="dark"] .tier-original { background: rgba(5, 150, 105, 0.2); color: #6ee7b7; border-color: rgba(5, 150, 105, 0.45); }
html[data-theme="dark"] .tier-mando { background: rgba(37, 99, 235, 0.22); color: #93c5fd; border-color: rgba(59, 130, 246, 0.45); }
html[data-theme="dark"] .tier-commercial { background: rgba(217, 119, 6, 0.2); color: #fcd34d; border-color: rgba(217, 119, 6, 0.45); }
.cat-sug-box {
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(207, 162, 70, 0.08);
  border: 1px dashed rgba(207, 162, 70, 0.45);
  margin-bottom: 4px;
}
.cat-sug-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
