/* =========================================================
   SmsHub design system
   - Brand: teal -> indigo gradient, rounded geometry
   - Themes: [data-theme=light|dark] on <html>
   - Direction: all spacing uses logical properties, so the same
     stylesheet serves LTR (English) and RTL (Arabic).
   ========================================================= */

:root {
  --font-sans: "Inter", "Cairo", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --teal: #14b8a6;
  --indigo: #6366f1;
  --grad: linear-gradient(135deg, #14b8a6 0%, #6366f1 100%);

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --header-h: 68px;
}

:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f9;
  --surface-3: #e2e8f3;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #586179;
  --border: #e0e6f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --on-primary: #ffffff;
  --link: #4338ca;
  --accent: #0d9488;
  --success: #047857;
  --success-bg: #d1fae5;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --overlay: rgba(15, 23, 42, .5);
  --glow-a: rgba(20, 184, 166, .20);
  --glow-b: rgba(99, 102, 241, .18);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-md: 0 10px 30px -10px rgba(30, 41, 99, .18), 0 2px 6px rgba(15, 23, 42, .05);
  --shadow-lg: 0 30px 70px -20px rgba(30, 41, 99, .35);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f1e;
  --surface: #111833;
  --surface-2: #18213f;
  --surface-3: #212c52;
  --text: #eaeefb;
  --text-2: #c3cbe3;
  --muted: #98a3c2;
  --border: #243056;
  --primary: #5b5bf0;
  --primary-hover: #6d6df5;
  --on-primary: #ffffff;
  --link: #a5b4fc;
  --accent: #2dd4bf;
  --success: #34d399;
  --success-bg: rgba(16, 185, 129, .16);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, .14);
  --overlay: rgba(2, 5, 15, .66);
  --glow-a: rgba(20, 184, 166, .16);
  --glow-b: rgba(99, 102, 241, .22);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 14px 34px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .75);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
html[lang="ar"] body { font-family: "Cairo", "Inter", system-ui, "Noto Sans Arabic", sans-serif; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { letter-spacing: 0; line-height: 1.35; }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.container { width: min(1160px, 100% - 40px); margin-inline: auto; }
.ltr { direction: ltr; unicode-bidi: isolate; }

.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .icon-flip { transform: scaleX(-1); }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.2rem; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; filter: drop-shadow(0 6px 14px rgba(99, 102, 241, .35)); }
.brand-name { direction: ltr; unicode-bidi: isolate; }
.brand-name b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .15s var(--ease), background-color .2s, border-color .2s, box-shadow .2s, color .2s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--primary) 80%, transparent); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--surface-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-soft-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-soft-danger:hover { background: var(--danger-bg); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .875rem; border-radius: 10px; }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 1rem; border-radius: 14px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; height: 40px; padding: 0 10px; border-radius: 12px;
  background: transparent; border: 1px solid var(--border); color: var(--text-2); cursor: pointer;
  font-size: .875rem; font-weight: 600; text-decoration: none;
  transition: background-color .2s, border-color .2s, color .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.theme-toggle .i-moon { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-moon { display: block; }
.controls { display: inline-flex; gap: 8px; align-items: center; }

/* ---------- public header / footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 28px; }
.main-nav { display: flex; gap: 6px; margin-inline-start: 8px; }
.main-nav a { padding: 8px 14px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: .95rem; }
.main-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }

.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: .9rem; margin-top: 72px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.site-footer .brand { font-size: 1rem; }
.site-footer .brand-mark { width: 28px; height: 28px; filter: none; }

/* ---------- landing ---------- */
.hero { position: relative; overflow: hidden; padding: 72px 0 40px; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; filter: blur(70px); z-index: 0; pointer-events: none; }
.hero::before { width: 520px; height: 520px; background: var(--glow-a); inset-block-start: -180px; inset-inline-start: -120px; }
.hero::after { width: 560px; height: 560px; background: var(--glow-b); inset-block-start: -120px; inset-inline-end: -160px; }
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--link);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); font-size: .85rem; font-weight: 600;
}
.hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); margin: 20px 0 18px; font-weight: 800; }
.hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.125rem; color: var(--text-2); max-width: 54ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.phone-wrap { display: flex; justify-content: center; }
.phone {
  position: relative; width: min(320px, 100%); padding: 10px; border-radius: 42px;
  background: linear-gradient(160deg, var(--surface-3), var(--surface-2)); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.phone-screen { background: var(--surface); border-radius: 33px; padding: 18px 14px 16px; min-height: 470px; display: flex; flex-direction: column; gap: 10px; }
.phone-notch { width: 84px; height: 6px; border-radius: 6px; background: var(--surface-3); margin: 0 auto 6px; }
.phone-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; font-weight: 700; }
.count-pill { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: .8rem; }
.msg-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 12px; display: grid; gap: 8px; }
.msg-to { font-size: .75rem; color: var(--muted); font-weight: 600; }
.msg-text { font-size: .9rem; line-height: 1.45; }
.msg-actions { display: flex; gap: 8px; }
.msg-actions .btn { flex: 1; min-height: 34px; padding: 0 10px; font-size: .8rem; border-radius: 10px; gap: 6px; }
.msg-actions .icon { width: 1em; height: 1em; }

.section { padding: 72px 0 0; }
.section-title { text-align: center; font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; max-width: 22ch; margin: 0 auto 40px; }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.tile { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--grad); color: #fff; margin-bottom: 16px; }
.tile .icon { width: 22px; height: 22px; }
.feature h3 { font-size: 1.05rem; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: .94rem; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: step; }
.step { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.step::before {
  counter-increment: step; content: counter(step); width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; color: #fff; background: var(--grad); margin-bottom: 14px; font-variant-numeric: tabular-nums;
}
.step h3 { font-size: 1.05rem; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: .94rem; }

.cta-band {
  margin-top: 72px; padding: 48px 32px; border-radius: 28px; text-align: center; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #14b8a6 0%, transparent 55%), radial-gradient(120% 140% at 100% 100%, #6366f1 0%, transparent 55%), #1e2a63;
  box-shadow: var(--shadow-lg);
}
.cta-band h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; }
.cta-band p { margin: 10px 0 26px; opacity: .9; }
.cta-band .btn-primary { background: #fff; color: #1e2a63; box-shadow: none; }
.cta-band .btn-primary:hover { background: #eef2ff; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .field .label-row label { font-size: .875rem; font-weight: 600; color: var(--text-2); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.label-row a { font-size: .85rem; font-weight: 500; }
.input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 12px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input:hover { border-color: var(--surface-3); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent); }
.input-wrap { position: relative; direction: ltr; } /* keep password dots and the show/hide button on a stable side in RTL */
.input-wrap .input { padding-inline-end: 72px; }
.reveal {
  position: absolute; inset-block: 6px; inset-inline-end: 6px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--link); font-size: .8rem; font-weight: 600; cursor: pointer;
}
.reveal:hover { background: var(--surface-2); }
.hint { font-size: .8rem; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: var(--muted); font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.g-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: #fff; background: var(--grad); font-family: "Inter", sans-serif; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--primary) 9%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--primary) 35%, transparent); color: var(--text-2); font-size: .85rem; }
.note .icon { margin-top: 2px; color: var(--primary); }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side {
  position: relative; overflow: hidden; color: #fff; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(90% 70% at 0% 0%, #0f9f90 0%, transparent 60%), radial-gradient(90% 80% at 100% 100%, #5558e8 0%, transparent 60%), #16204f;
}
.auth-side .brand { color: #fff; }
.auth-side h2 { font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 800; max-width: 14ch; }
.auth-side p { margin-top: 12px; opacity: .88; max-width: 38ch; font-size: 1.05rem; }
.auth-bubbles { display: grid; gap: 12px; max-width: 320px; }
.bubble { padding: 12px 16px; border-radius: 18px; background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .2); backdrop-filter: blur(8px); font-size: .9rem; display: flex; align-items: center; gap: 10px; }
.bubble:nth-child(2) { margin-inline-start: 36px; }
.bubble .icon { width: 18px; height: 18px; }
.auth-main { display: flex; flex-direction: column; padding: 24px 32px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; }
.auth-top .brand { display: none; }
.auth-card { margin: auto; width: min(420px, 100%); padding: 24px 0; }
.auth-card h1 { font-size: 1.8rem; font-weight: 800; }
.auth-card .sub { color: var(--muted); margin: 6px 0 24px; }
.auth-switch { text-align: center; margin-top: 22px; color: var(--muted); font-size: .92rem; }
.auth-switch a { font-weight: 600; }
.auth-card .note { margin-top: 18px; }

/* ---------- dashboard shell ---------- */
.dash { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 22px 16px;
  background: var(--surface); border-inline-end: 1px solid var(--border);
}
.sidebar .brand { padding-inline: 8px; }
.side-nav { display: grid; gap: 4px; }
.side-nav a, .side-nav .disabled {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--text-2); font-weight: 500; font-size: .95rem;
}
.side-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.side-nav a.active { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--link); font-weight: 600; }
.side-nav .disabled { opacity: .6; cursor: not-allowed; }
.side-user { margin: 4px 0 8px; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.side-user .who { min-width: 0; line-height: 1.3; }
.side-user .who b { display: block; font-size: .9rem; }
.side-user .who span { display: block; font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--grad); color: #fff; font-weight: 700; font-size: .85rem; direction: ltr; }
img.avatar { object-fit: cover; background: var(--surface-3); }
.user-chip { display: flex; align-items: center; gap: 4px; }
.user-link { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; }
.user-link .avatar { width: 34px; height: 34px; border-radius: 50%; }
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout-form { margin: 0; margin-inline-start: auto; }
.signout { color: var(--muted); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; }
.signout:hover { background: var(--surface-3); color: var(--text); }

.dash-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--header-h); display: flex; align-items: center; gap: 14px; padding: 0 28px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.topbar h2 { font-size: 1.05rem; font-weight: 700; }
.topbar .controls { margin-inline-start: auto; }
.top-links { display: flex; gap: 4px; margin-inline-start: 8px; }
.top-links a { padding: 6px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: .9rem; text-decoration: none; }
.top-links a:hover { background: var(--surface-2); color: var(--text); }
.nav-toggle { display: none; }
.scrim { display: none; }
.content { padding: 28px; display: grid; gap: 24px; width: min(1180px, 100%); }

.preview-banner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; background: color-mix(in srgb, #f59e0b 14%, var(--surface)); border: 1px solid color-mix(in srgb, #f59e0b 40%, transparent); color: var(--text-2); font-size: .88rem; }
.preview-banner .icon { color: #d97706; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.page-head h1 { font-size: 1.7rem; font-weight: 800; }
.page-head p { margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.stat .tile { margin: 0; flex: none; }
.stat .num { font-size: 1.75rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .num.sm { font-size: 1.25rem; padding-block: 4px; }
.stat .lbl { color: var(--muted); font-size: .85rem; margin-top: 2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 1.1rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 12px 22px; background: var(--surface-2); white-space: nowrap; }
html[lang="ar"] .table th { letter-spacing: 0; text-transform: none; font-size: .82rem; }
.table td { padding: 16px 22px; border-top: 1px solid var(--border); vertical-align: middle; font-size: .94rem; }
.table tbody tr { transition: background-color .15s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table tbody tr:first-child td { border-top: 0; }
.table .col-actions { text-align: end; }
.dev { display: flex; align-items: center; gap: 14px; }
.dev-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--link); flex: none; }
.dev b { display: block; line-height: 1.3; }
.dev small { display: block; color: var(--muted); font-size: .8rem; direction: ltr; text-align: start; }
html[dir="rtl"] .dev small { text-align: right; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.online { background: var(--success-bg); color: var(--success); }
.chip.online::before { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
/* ---------- messages ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.filter-bar .input { height: 42px; width: auto; flex: 1 1 220px; }
.filter-bar select.input { flex: 0 1 200px; }
.filter-bar .btn { min-height: 42px; }
.col-body { max-width: 520px; }
.msg-body { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--border); font-size: .9rem; }
.pager-links { display: flex; gap: 8px; }

.empty { text-align: center; padding: 56px 24px; display: grid; justify-items: center; gap: 8px; }
.empty .tile { margin-bottom: 8px; }
.empty h3 { font-size: 1.1rem; }
.empty p { color: var(--muted); margin-bottom: 12px; }
.flash { animation: flash 1.6s var(--ease); }
@keyframes flash { from { background: color-mix(in srgb, var(--teal) 28%, transparent); } to { background: transparent; } }

/* ---------- dialogs ---------- */
dialog { border: 0; padding: 0; background: var(--surface); color: var(--text); border-radius: 24px; width: min(540px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
dialog[open] { animation: pop .25s var(--ease); }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg { padding: 26px; display: grid; gap: 18px; }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dlg-head h3 { font-size: 1.25rem; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.dlg-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--danger-bg); color: var(--danger); }
.pair-grid { display: grid; grid-template-columns: 184px 1fr; gap: 22px; align-items: center; }
.qr { background: #fff; border-radius: 18px; padding: 12px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.qr img { width: 100%; height: auto; aspect-ratio: 1; }
.pair-steps { margin: 0; padding-inline-start: 20px; color: var(--text-2); font-size: .94rem; display: grid; gap: 8px; }
.code-box { margin-top: 16px; }
.code-box .lbl { font-size: .78rem; color: var(--muted); font-weight: 600; }
.code { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; letter-spacing: .18em; direction: ltr; text-align: start; line-height: 1.2; }
html[dir="rtl"] .code { text-align: right; }
.expires { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.expires.expired { color: var(--danger); font-weight: 600; }
.waiting { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: .9rem; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.success-box { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 22px 0 6px; }
.success-box .tile { background: linear-gradient(135deg, #10b981, #14b8a6); width: 60px; height: 60px; border-radius: 20px; margin: 0; }
.success-box .tile .icon { width: 30px; height: 30px; stroke-width: 2.4; }
.success-box b { font-size: 1.15rem; }

/* ---------- toasts ---------- */
.toasts { position: fixed; inset-block-end: 20px; inset-inline-end: 20px; z-index: 100; display: grid; gap: 10px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-md); font-size: .92rem; font-weight: 500; animation: pop .25s var(--ease); pointer-events: auto; }
.toast .icon { color: #34d399; }
.toast-error .icon { color: #f87171; }

/* ---------- error ---------- */
.center-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 40px 20px; }
.center-page h1 { font-size: 2rem; margin: 18px 0 8px; }
.center-page p { color: var(--muted); margin-bottom: 22px; }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
  .feature-grid, .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; text-align: start; }
  .main-nav { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-top .brand { display: inline-flex; }
  .dash { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; inset-block: 0; inset-inline-start: 0; width: 280px; transform: translateX(-102%); transition: transform .28s var(--ease); box-shadow: var(--shadow-lg); }
  [dir="rtl"] .sidebar { transform: translateX(102%); }
  .nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .nav-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .top-links a { padding: 6px 8px; }
  .content { padding: 20px 16px; }
}
@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr; }
  .feature-grid, .steps { grid-template-columns: 1fr; }
  .header-inner { gap: 10px; }
  .header-actions { gap: 6px; }
  .header-actions .btn-ghost { display: none; }
  .header-actions .btn { padding: 0 14px; min-height: 40px; }
  .header-actions .icon-btn span { display: none; }
  .user-name { display: none; }
  .hero-cta .btn { flex: 1 1 100%; }
  .pair-grid { grid-template-columns: 1fr; justify-items: center; text-align: start; }
  .pair-grid .qr { width: 200px; }
  .pair-info { width: 100%; }
  .hero { padding-top: 40px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 14px 16px; border-top: 1px solid var(--border); }
  .table tbody tr:first-child { border-top: 0; }
  .table td { border: 0; padding: 6px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; }
  .table td.col-body { max-width: none; align-items: flex-start; }
  .table td.col-body .msg-body { text-align: end; }
  .filter-bar, .pager { padding-inline: 16px; }
  .table td.col-device { padding-bottom: 10px; }
  .table td.col-device::before { content: none; }
  .table .col-actions { justify-content: flex-end; text-align: end; }
  .auth-main { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- validation / alerts ---------- */
.validation-summary-valid { display: none; }
.validation-summary-errors {
  margin-bottom: 18px; padding: 12px 14px; border-radius: 12px; font-size: .9rem;
  background: var(--danger-bg); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}
.validation-summary-errors ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pair-error { color: var(--danger); font-size: .9rem; }
.qr svg { width: 100%; height: auto; aspect-ratio: 1; }
.qr .qr-placeholder { aspect-ratio: 1; display: grid; place-items: center; }

/* Long-form pages (privacy policy) */
.prose { max-width: 760px; }
.prose h2 { font-size: 1.25rem; margin: 2rem 0 .5rem; }
.prose h3 { font-size: 1.02rem; margin: 1.25rem 0 .35rem; }
.prose p, .prose li { line-height: 1.75; color: var(--text); }
.prose ul { padding-inline-start: 1.25rem; margin: .4rem 0; }
.prose .muted { color: var(--muted); }
.prose a { text-decoration: underline; }
.auth-legal { text-align: center; margin-top: 18px; font-size: .85rem; }
.auth-legal a, .footer-inner a { color: var(--muted); text-decoration: underline; }
