/* ==========================================================================
   FTTH Portal — design system
   Logical properties throughout (inline-start / inline-end) so the same CSS
   serves English (LTR) and Arabic (RTL).
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
    --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "SF Pro Display", Roboto, "Noto Sans Arabic", Tahoma, sans-serif;
    --font-mono: "Cascadia Mono", "SF Mono", Consolas, "Roboto Mono", ui-monospace, monospace;

    --navy-950: #070d1a;
    --navy-900: #0b1220;
    --navy-850: #0f1a2e;
    --navy-800: #13213a;
    --navy-700: #1c2d4d;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-400: #60a5fa;
    --cyan-400: #22d3ee;
    --cyan-300: #67e8f9;
    --sky-400: #38bdf8;

    --bg: #f3f6fb;
    --bg-elev: #ffffff;
    --bg-sunken: #eaf0f7;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --surface-hover: #f1f5fb;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --faint: #94a3b8;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #e0ebff;
    --primary-text: #1e40af;
    --accent: #0891b2;
    --accent-soft: #dff7fc;

    --success: #16a34a;
    --success-soft: #dcfce7;
    --success-text: #15803d;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --warning-text: #b45309;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --danger-text: #b91c1c;
    --info: #0284c7;
    --info-soft: #e0f2fe;
    --info-text: #0369a1;
    --neutral-soft: #eef2f7;
    --neutral-text: #475569;

    --sidebar-bg: var(--navy-900);
    --sidebar-text: #cbd5e1;
    --sidebar-muted: #64748b;
    --sidebar-hover: rgba(148, 163, 184, .1);
    --sidebar-active: rgba(56, 189, 248, .14);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px -4px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 40px -12px rgba(15, 23, 42, .25);
    --ring: 0 0 0 3px rgba(37, 99, 235, .25);

    --sidebar-w: 264px;
    --topbar-h: 64px;
    --gutter: clamp(16px, 3vw, 32px);
    --ease: cubic-bezier(.2, .7, .2, 1);
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #080e1b;
    --bg-elev: #0e172a;
    --bg-sunken: #060b16;
    --surface: #0e1729;
    --surface-2: #111c31;
    --surface-hover: #15223b;
    --border: #1e2b44;
    --border-strong: #2a3a59;
    --text: #e6edf7;
    --text-2: #c3cfe0;
    --muted: #8696b0;
    --faint: #5c6b85;

    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-soft: rgba(59, 130, 246, .16);
    --primary-text: #93c5fd;
    --accent: #22d3ee;
    --accent-soft: rgba(34, 211, 238, .12);

    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, .14);
    --success-text: #4ade80;
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, .14);
    --warning-text: #fbbf24;
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, .14);
    --danger-text: #f87171;
    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, .14);
    --info-text: #7dd3fc;
    --neutral-soft: rgba(148, 163, 184, .12);
    --neutral-text: #a7b4c8;

    --sidebar-bg: #060b16;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 16px 48px -12px rgba(0, 0, 0, .7);
    --ring: 0 0 0 3px rgba(96, 165, 250, .35);
    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
[dir="rtl"] body { font-size: 15.5px; }
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { margin: 0; line-height: 1.25; font-family: var(--font-display); letter-spacing: -.01em; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { letter-spacing: 0; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(59, 130, 246, .25); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

.icon { width: 20px; height: 20px; flex: none; }
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 16px; height: 16px; }
.icon-xl { width: 36px; height: 36px; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

.muted { color: var(--muted); }
.small { font-size: .86em; }
.mono { font-family: var(--font-mono); font-size: .93em; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger-text) !important; }
.text-success { color: var(--success-text); }
.small-caps { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
[dir="rtl"] .small-caps { letter-spacing: 0; text-transform: none; font-size: .82rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }
.hide-sm { }

/* ---------- Buttons ---------- */
.btn {
    --btn-bg: var(--surface);
    --btn-fg: var(--text);
    --btn-bd: var(--border);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 16px;
    border: 1px solid var(--btn-bd); border-radius: 10px;
    background: var(--btn-bg); color: var(--btn-fg);
    font-weight: 600; font-size: .92rem; line-height: 1; white-space: nowrap;
    cursor: pointer; user-select: none; text-decoration: none;
    transition: background .15s var(--ease), border-color .15s, color .15s, box-shadow .15s, transform .08s;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { color: var(--btn-fg); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: #fff; --btn-bd: transparent; box-shadow: 0 1px 2px rgba(37, 99, 235, .3), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover:not(:disabled) { --btn-bg: var(--primary-hover); }
.btn-secondary:hover:not(:disabled) { --btn-bg: var(--surface-hover); --btn-bd: var(--border-strong); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); }
.btn-ghost:hover:not(:disabled) { --btn-bg: var(--surface-hover); }
.btn-success { --btn-bg: var(--success); --btn-fg: #fff; --btn-bd: transparent; }
.btn-success:hover:not(:disabled) { filter: brightness(1.06); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.06); }
.btn-warning { --btn-bg: var(--warning-soft); --btn-fg: var(--warning-text); --btn-bd: transparent; }
.btn-warning:hover:not(:disabled) { filter: brightness(.97); }
.btn-danger-ghost { --btn-bg: transparent; --btn-fg: var(--danger-text); --btn-bd: var(--border); }
.btn-danger-ghost:hover:not(:disabled) { --btn-bg: var(--danger-soft); --btn-bd: transparent; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: .84rem; border-radius: 8px; gap: 6px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon-text { padding: 0 10px; gap: 6px; }

.spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .7s linear infinite; }
.spinner-lg { display: inline-block; width: 26px; height: 26px; border-width: 3px; color: var(--primary); }
.is-loading .spinner { display: inline-block; }
.is-loading > .icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .label { font-weight: 600; font-size: .88rem; color: var(--text-2); }
.field-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; inset-inline-start: 13px; color: var(--faint); pointer-events: none; width: 18px; height: 18px; }
input[type="text"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
    width: 100%; min-height: 44px; padding: 10px 14px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 10px;
    font-size: 16px; /* prevents iOS zoom */
    transition: border-color .15s, box-shadow .15s, background .15s;
    appearance: none; -webkit-appearance: none;
}
textarea { min-height: 64px; resize: vertical; font-family: var(--font-mono); font-size: 13px; line-height: 1.45; }
select { padding-inline-end: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 18px; background-position: right 10px center; }
[dir="rtl"] select { background-position: left 10px center; }
.input-wrap input { padding-inline-start: 40px; }
.input-wrap input:has(+ .input-action) { padding-inline-end: 44px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input:disabled { background: var(--surface-2); color: var(--faint); cursor: not-allowed; }
.is-invalid input, .is-invalid textarea, input.is-invalid { border-color: var(--danger); }
.is-invalid input:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .2); }
.input-action { position: absolute; inset-inline-end: 4px; width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; }
.input-action:hover { color: var(--text); background: var(--surface-hover); }
.hint { font-size: .8rem; color: var(--muted); line-height: 1.45; }
.hint .icon { display: inline-block; vertical-align: -3px; }
.field-error { font-size: .82rem; color: var(--danger-text); font-weight: 500; min-height: 0; }
.field-error:empty { display: none; }
.form-status { text-align: center; min-height: 1.2em; }
.form-status:empty { display: none; }
.input-num { max-width: 120px; text-align: center; }

.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 46px; height: 26px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .2s; }
.switch-thumb { position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + .switch-track .switch-thumb { transform: translateX(-20px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }

.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.strength i { height: 4px; border-radius: 4px; background: var(--border); transition: background .2s; }
.strength[data-score="1"] i:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] i:nth-child(-n+2) { background: var(--warning); }
.strength[data-score="3"] i:nth-child(-n+3) { background: var(--info); }
.strength[data-score="4"] i { background: var(--success); }

/* ---------- Alerts, badges, toasts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: .9rem; border: 1px solid transparent; line-height: 1.5; }
.alert .icon { margin-top: 1px; }
.alert-danger { background: var(--danger-soft); color: var(--danger-text); }
.alert-warning { background: var(--warning-soft); color: var(--warning-text); }
.alert-info { background: var(--info-soft); color: var(--info-text); }
.alert-success { background: var(--success-soft); color: var(--success-text); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: .76rem; font-weight: 700; white-space: nowrap; vertical-align: middle; letter-spacing: .01em; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-neutral { background: var(--neutral-soft); color: var(--neutral-text); }
.badge.is-live::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.75); } }

.toast-stack { position: fixed; z-index: 90; inset-inline-end: 16px; bottom: 16px; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: .9rem; animation: toast-in .25s var(--ease); }
.toast .icon { margin-top: 1px; }
.toast-success .icon { color: var(--success); }
.toast-error .icon { color: var(--danger); }
.toast-info .icon { color: var(--info); }
.toast.is-leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head-pad { padding: 20px 20px 0; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 700; }
.card-title .icon { color: var(--primary); width: 18px; height: 18px; }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); font-size: .92rem; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; min-width: 0; }
.brand:hover { color: inherit; }
.brand-mark { width: 36px; height: 36px; flex: none; filter: drop-shadow(0 4px 10px rgba(37, 99, 235, .35)); }
.brand-text { display: grid; line-height: 1.2; min-width: 0; }
.brand-text strong { font-family: var(--font-display); font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap; }
.brand-text small { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Dropdowns & toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 4px; }
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; z-index: 60; top: calc(100% + 8px); inset-inline-end: 0;
    min-width: 200px; padding: 6px; border-radius: var(--radius);
    background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.98); transform-origin: top;
    transition: opacity .15s, transform .15s var(--ease), visibility .15s;
}
.dropdown.is-open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-header { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-header small { color: var(--muted); font-size: .78rem; }
.dropdown-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: .9rem; border: 0; background: transparent; cursor: pointer; text-align: start; }
.dropdown-item .icon:first-child { color: var(--muted); }
.dropdown-item span { flex: 1; }
.dropdown-item:hover { background: var(--surface-hover); color: var(--text); }
.dropdown-item.is-active { color: var(--primary); font-weight: 600; }
.dropdown-item.text-danger .icon { color: inherit; }

.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: .9rem; color: #fff; background: linear-gradient(135deg, var(--sky-400), var(--blue-600)); }
.avatar-sm { width: 30px; height: 30px; font-size: .8rem; }
.avatar-img { object-fit: cover; background: var(--surface-2); }
.avatar-btn { padding: 0 4px; min-height: 40px; }

/* ==========================================================================
   Guest layout (landing, auth)
   ========================================================================== */
body.guest { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--navy-950); color: #e6edf7; }
body.guest { --surface: #0e1729; --surface-2: #111c31; --surface-hover: #15223b; --border: #1e2b44; --border-strong: #2a3a59; --text: #e6edf7; --text-2: #c3cfe0; --muted: #8696b0; --faint: #5c6b85; --bg-elev: #0e172a; color-scheme: dark;
    --primary: #3b82f6; --primary-hover: #60a5fa; --danger-soft: rgba(239,68,68,.14); --danger-text: #fca5a5; --warning-soft: rgba(245,158,11,.14); --warning-text: #fcd34d; --info-soft: rgba(56,189,248,.14); --info-text: #7dd3fc; --success-soft: rgba(34,197,94,.14); --success-text: #86efac; --ring: 0 0 0 3px rgba(96,165,250,.35); }
:root:not([data-theme="dark"]) body.guest .auth-card { --surface: #ffffff; --surface-2: #f7f9fc; --surface-hover: #f1f5fb; --border: #e2e8f0; --border-strong: #cbd5e1; --text: #0f172a; --text-2: #334155; --muted: #64748b; --faint: #94a3b8; --bg-elev: #fff; color: var(--text); color-scheme: light;
    --primary: #2563eb; --primary-hover: #1d4ed8; --danger-soft: #fee2e2; --danger-text: #b91c1c; --warning-soft: #fef3c7; --warning-text: #b45309; --info-soft: #e0f2fe; --info-text: #0369a1; --success-soft: #dcfce7; --success-text: #15803d; --ring: 0 0 0 3px rgba(37,99,235,.25); }
.guest-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.guest-grid { position: absolute; inset: -2px; background-image: linear-gradient(rgba(148, 163, 184, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, .06) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, #000 30%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, #000 30%, transparent 75%); }
.guest-glow { position: absolute; width: 900px; height: 600px; top: -260px; inset-inline-start: 50%; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(37, 99, 235, .35), rgba(34, 211, 238, .12) 55%, transparent); filter: blur(10px); }
[dir="rtl"] .guest-glow { transform: translateX(50%); }
.guest-header, .guest-main, .guest-footer { position: relative; z-index: 1; }
.guest-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px var(--gutter); max-width: 1240px; width: 100%; margin: 0 auto; }
.guest-header .brand-text small { color: #8696b0; }
.guest-header .btn-ghost { --btn-fg: #cbd5e1; }
.guest-header .btn-ghost:hover { --btn-bg: rgba(148, 163, 184, .12); }
.guest-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px var(--gutter) 48px; width: 100%; max-width: 1240px; margin: 0 auto; }
.guest-footer { text-align: center; padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom)); color: #5c6b85; font-size: .8rem; }

/* Landing */
.landing { width: 100%; display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px 48px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 10px; border-radius: 99px; background: rgba(56, 189, 248, .1); border: 1px solid rgba(56, 189, 248, .25); color: var(--cyan-300); font-size: .8rem; font-weight: 600; letter-spacing: .02em; }
[dir="rtl"] .eyebrow { padding: 6px 10px 6px 14px; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan-400); box-shadow: 0 0 0 0 rgba(34, 211, 238, .6); animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, .55); } 80%, 100% { box-shadow: 0 0 0 10px rgba(34, 211, 238, 0); } }
.display { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 750; margin: 20px 0 16px; letter-spacing: -.025em; line-height: 1.08; background: linear-gradient(180deg, #fff 30%, #a9c2e8); -webkit-background-clip: text; background-clip: text; color: transparent; }
[dir="rtl"] .display { letter-spacing: 0; line-height: 1.3; }
.lead { font-size: clamp(1rem, 1.4vw, 1.12rem); color: #9fb0c9; max-width: 560px; }
.landing-actions { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.landing .btn-secondary { --btn-bg: rgba(148, 163, 184, .08); --btn-bd: rgba(148, 163, 184, .25); --btn-fg: #e6edf7; }
.landing .btn-secondary:hover { --btn-bg: rgba(148, 163, 184, .14); --btn-bd: rgba(148, 163, 184, .4); }
.landing-note { margin-top: 18px; display: flex; align-items: center; gap: 8px; color: #6f81a0; }

.landing-visual { position: relative; min-height: 360px; }
.lv-card { background: linear-gradient(180deg, rgba(19, 33, 58, .92), rgba(11, 18, 32, .92)); border: 1px solid rgba(148, 163, 184, .16); border-radius: 18px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255,255,255,.04); backdrop-filter: blur(6px); }
.lv-main { position: absolute; inset: 20px 30px 20px 0; padding: 18px; overflow: hidden; }
[dir="rtl"] .lv-main { inset: 20px 0 20px 30px; }
.lv-head { display: flex; align-items: center; gap: 6px; margin-bottom: 18px; }
.lv-dot { width: 10px; height: 10px; border-radius: 50%; background: #334155; }
.lv-title { margin-inline-start: 10px; font-family: var(--font-mono); font-size: .8rem; color: #8696b0; }
.lv-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.lv-stats div { background: rgba(148, 163, 184, .06); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.lv-stats small { color: #6f81a0; font-size: .7rem; }
.lv-stats b { font-size: 1.3rem; color: #e6edf7; }
.lv-stats .ok b { color: #4ade80; } .lv-stats .bad b { color: #f87171; }
.lv-rows { display: grid; gap: 8px; }
.lv-row { display: grid; grid-template-columns: 1fr 1.6fr 52px; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: rgba(148, 163, 184, .04); }
.lv-row span { height: 8px; border-radius: 6px; background: rgba(148, 163, 184, .18); }
.lv-row span + span { opacity: .6; }
.lv-row i { height: 18px; border-radius: 99px; background: rgba(34, 197, 94, .25); }
.lv-row i.bad { background: rgba(239, 68, 68, .3); }
.lv-float, .lv-float2 { position: absolute; display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-weight: 600; font-size: .9rem; color: #e6edf7; animation: float 6s ease-in-out infinite; }
.lv-float .icon, .lv-float2 .icon { color: var(--cyan-400); }
.lv-float { inset-inline-end: 0; top: 0; }
.lv-float2 { inset-inline-end: 10px; bottom: 0; animation-delay: -3s; }
.lv-float2 .icon { color: var(--blue-400); }
@keyframes float { 50% { transform: translateY(-8px); } }

.features { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { padding: 20px; border-radius: var(--radius-lg); background: rgba(19, 33, 58, .5); border: 1px solid rgba(148, 163, 184, .12); }
.feature h3 { font-size: 1rem; margin: 14px 0 6px; color: #e6edf7; }
.feature p { color: #8696b0; font-size: .9rem; }
.feature-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: rgba(56, 189, 248, .12); color: var(--cyan-300); }

/* Auth card */
.auth-card { width: 100%; max-width: 440px; padding: 32px; border-radius: var(--radius-xl); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); display: grid; gap: 20px; animation: rise .35s var(--ease); }
.auth-card-wide { max-width: 760px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.auth-head { text-align: center; display: grid; gap: 8px; justify-items: center; }
.auth-head h1 { font-size: 1.55rem; }
.auth-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--primary-soft, #e0ebff); color: var(--primary); margin-bottom: 4px; }
:root[data-theme="dark"] .auth-icon, body.guest .auth-icon { background: rgba(59, 130, 246, .14); }
.auth-foot { text-align: center; font-size: .9rem; color: var(--muted); }
.auth-foot a { font-weight: 600; }
.device-note { display: flex; gap: 8px; align-items: flex-start; justify-content: center; text-align: center; padding-top: 4px; border-top: 1px solid var(--border); padding-top: 16px; }
.device-note .icon { margin-top: 2px; }

.register-grid { grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.register-photo { display: grid; gap: 10px; }
.photo-drop { position: relative; display: grid; place-items: center; aspect-ratio: 3 / 4; border-radius: var(--radius-lg); border: 2px dashed var(--border-strong); background: var(--surface-2); cursor: pointer; overflow: hidden; transition: border-color .15s, background .15s; }
.photo-drop:hover, .photo-drop.is-drag { border-color: var(--primary); background: var(--primary-soft, rgba(59,130,246,.08)); }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.photo-empty { display: grid; justify-items: center; gap: 10px; padding: 16px; text-align: center; color: var(--muted); font-size: .85rem; }
.photo-empty .icon { color: var(--faint); }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-actions .btn { flex: 1; }
.register-fields { display: grid; gap: 16px; }
.is-invalid .photo-drop { border-color: var(--danger); }

.pending-card { text-align: center; justify-items: center; max-width: 480px; }
.pending-card h1 { font-size: 1.45rem; }
.pending-visual { position: relative; width: 84px; height: 84px; display: grid; place-items: center; border-radius: 50%; background: rgba(59, 130, 246, .12); color: var(--primary); }
.ring-anim { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--primary); border-inline-end-color: var(--accent); animation: spin 1.6s linear infinite; }
.steps { width: 100%; text-align: start; background: var(--surface-2); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: .92rem; color: var(--text-2); }
.step-n { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-size: .78rem; font-weight: 700; }

.error-page { text-align: center; display: grid; gap: 14px; justify-items: center; padding: 40px 0; }
.error-code { font-size: clamp(4rem, 12vw, 7rem); font-weight: 800; line-height: 1; background: linear-gradient(180deg, var(--blue-400), var(--blue-600)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.debug { text-align: start; max-width: 90vw; overflow: auto; font-size: 12px; background: rgba(0,0,0,.4); padding: 12px; border-radius: 8px; }

/* ==========================================================================
   App layout
   ========================================================================== */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50;
    width: var(--sidebar-w); display: flex; flex-direction: column;
    background: var(--sidebar-bg); color: var(--sidebar-text);
    border-inline-end: 1px solid rgba(148, 163, 184, .08);
}
.sidebar::before { content: ""; position: absolute; inset: 0 0 auto; height: 240px; background: radial-gradient(ellipse at 30% 0%, rgba(37, 99, 235, .22), transparent 70%); pointer-events: none; }
.sidebar-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; }
.sidebar .brand-text strong { color: #fff; }
.sidebar .brand-text small { color: var(--sidebar-muted); }
.sidebar-close { display: none; --btn-fg: #cbd5e1; }
.nav { position: relative; flex: 1; overflow-y: auto; padding: 8px 12px; display: grid; align-content: start; gap: 2px; }
.nav-label { padding: 16px 12px 8px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--sidebar-muted); }
[dir="rtl"] .nav-label { letter-spacing: 0; font-size: .78rem; text-transform: none; }
.nav-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--sidebar-text); font-weight: 500; font-size: .93rem; transition: background .15s, color .15s; }
.nav-link .icon { width: 19px; height: 19px; color: #7d8ca6; transition: color .15s; }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link:hover .icon { color: #cbd5e1; }
.nav-link.is-active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-link.is-active .icon { color: var(--sky-400); }
.nav-link.is-active::before { content: ""; position: absolute; inset-inline-start: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sky-400); }
[dir="rtl"] .nav-link.is-active::before { border-radius: 3px 0 0 3px; }
.nav-badge { margin-inline-start: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--warning); color: #1c1203; font-size: .72rem; font-weight: 800; display: grid; place-items: center; }
.sidebar-foot { position: relative; display: flex; align-items: center; gap: 8px; padding: 14px; margin: 12px; border-radius: 14px; background: rgba(148, 163, 184, .06); border: 1px solid rgba(148, 163, 184, .08); }
.sidebar-foot .btn-ghost { --btn-fg: #94a3b8; }
.sidebar-foot .btn-ghost:hover { --btn-bg: rgba(239, 68, 68, .14); --btn-fg: #fca5a5; }
.user-chip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-chip-text { display: grid; min-width: 0; line-height: 1.25; }
.user-chip-text strong { color: #fff; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-text small { color: var(--sidebar-muted); font-size: .76rem; }
.sidebar-overlay { display: none; }

.main { flex: 1; min-width: 0; margin-inline-start: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar-h); display: flex; align-items: center; gap: 8px; padding: 0 var(--gutter); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--border); }
.topbar-title { flex: 1; font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn, .brand-compact { display: none; }
.brand-compact { gap: 8px; }
.brand-compact .brand-mark { width: 30px; height: 30px; }
.content { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 28px var(--gutter) 40px; }
.app-footer { padding: 16px var(--gutter) 24px; text-align: center; color: var(--faint); font-size: .8rem; }
.bottom-nav { display: none; }

/* Page */
.page { display: grid; gap: 24px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: clamp(1.35rem, 2.4vw, 1.75rem); font-weight: 750; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-sub { color: var(--muted); margin-top: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .88rem; font-weight: 500; margin-bottom: 8px; }
.back-link:hover { color: var(--text); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.stack { display: grid; gap: 20px; align-content: start; }

.mini-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.mini-stat { display: grid; gap: 0; padding: 10px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); min-width: 92px; box-shadow: var(--shadow-sm); }
.mini-stat small { color: var(--muted); font-size: .76rem; font-weight: 600; }
.mini-stat b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.mini-stat.ok b { color: var(--success-text); }
.mini-stat.bad b { color: var(--danger-text); }

/* ---------- Service cards ---------- */
.services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.service {
    --tone: var(--primary); --tone-soft: var(--primary-soft);
    position: relative; display: flex; flex-direction: column; gap: 20px;
    padding: 22px; border-radius: var(--radius-xl);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
    overflow: hidden; transition: box-shadow .2s, border-color .2s, transform .2s var(--ease);
}
.service::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 40%, var(--accent))); }
.service::after { content: ""; position: absolute; width: 220px; height: 220px; inset-inline-end: -90px; top: -110px; border-radius: 50%; background: radial-gradient(closest-side, var(--tone-soft), transparent); opacity: .9; pointer-events: none; }
.service:hover { box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--tone) 30%, var(--border)); }
.service-full { --tone: #6366f1; --tone-soft: rgba(99, 102, 241, .14); }
.service-single { --tone: var(--blue-600); --tone-soft: rgba(37, 99, 235, .14); }
.service-ring { --tone: #0891b2; --tone-soft: rgba(8, 145, 178, .14); }
:root[data-theme="dark"] .service-full { --tone: #818cf8; }
:root[data-theme="dark"] .service-single { --tone: var(--blue-400); }
:root[data-theme="dark"] .service-ring { --tone: var(--cyan-400); }
.service-head { position: relative; z-index: 1; display: flex; gap: 14px; align-items: flex-start; }
.service-icon { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--tone-soft); color: var(--tone); }
.service-icon .icon { width: 24px; height: 24px; }
.service h2 { font-size: 1.12rem; font-weight: 750; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
[dir="rtl"] .service h2 { text-transform: none; letter-spacing: 0; font-size: 1.18rem; }
.service-head p { color: var(--muted); font-size: .9rem; }
.service-form { position: relative; z-index: 1; display: grid; gap: 14px; margin-top: auto; }
.service .btn-primary { --btn-bg: var(--tone); box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--tone) 60%, transparent); }
.service .btn-primary:hover:not(:disabled) { --btn-bg: color-mix(in srgb, var(--tone) 85%, #000); }
:root[data-theme="dark"] .service .btn-primary { --btn-fg: #06101f; }
:root[data-theme="dark"] .service .btn-primary:hover:not(:disabled) { --btn-bg: color-mix(in srgb, var(--tone) 85%, #fff); }
.service-note, .service-lock { display: flex; gap: 8px; align-items: center; font-size: .82rem; color: var(--muted); }
.service-lock { color: var(--warning-text); background: var(--warning-soft); padding: 8px 10px; border-radius: 8px; }
.service.is-locked .service-icon { filter: grayscale(.6); opacity: .7; }

/* ---------- Job list ---------- */
.job-list { display: grid; }
.job-item { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-radius: 10px; color: var(--text); border-bottom: 1px solid var(--border); }
.job-item:last-child { border-bottom: 0; }
.job-item:hover { background: var(--surface-hover); color: var(--text); }
.job-main { flex: 1; display: grid; min-width: 0; }
.job-main strong { font-family: var(--font-mono); font-size: .92rem; }
.job-main small { color: var(--muted); font-size: .8rem; }
.job-icon { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; }
.job-icon .icon { width: 18px; height: 18px; }
.type-full { background: rgba(99, 102, 241, .12); color: #6366f1; }
.type-single { background: rgba(37, 99, 235, .12); color: var(--primary); }
.type-ring { background: rgba(8, 145, 178, .12); color: var(--accent); }
:root[data-theme="dark"] .type-full { color: #a5b4fc; }
.type-cell { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.type-cell .job-icon { width: 28px; height: 28px; border-radius: 8px; }
.type-cell .job-icon .icon { width: 15px; height: 15px; }

/* ---------- Tabs / filters ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-sunken); border-radius: 12px; overflow-x: auto; scrollbar-width: none; max-width: 100%; border: 1px solid var(--border); }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .88rem; white-space: nowrap; }
.tab .icon { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab-count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--neutral-soft); color: var(--neutral-text); font-size: .74rem; display: inline-grid; place-items: center; }
.tab-count.is-warn { background: var(--warning-soft); color: var(--warning-text); }
.toolbar-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.search { position: relative; display: flex; align-items: center; min-width: 240px; }
.search .input-icon { inset-inline-start: 12px; }
.search input { padding-inline-start: 38px; min-height: 42px; }
.filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; padding: 16px; }
.filters .field { min-width: 160px; }
.filters .field-grow { flex: 1; min-width: 200px; }
.filter-actions { display: flex; gap: 8px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.table th { position: sticky; top: 0; z-index: 1; text-align: start; font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
[dir="rtl"] .table th { letter-spacing: 0; text-transform: none; font-size: .8rem; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-hover); }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.actions-cell { text-align: end; white-space: nowrap; }
.cell-sub { display: block; margin-top: 4px; font-size: .78rem; max-width: 340px; }
.user-cell { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.device-cell { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); white-space: nowrap; }
.details-cell code { display: block; font-family: var(--font-mono); font-size: .76rem; color: var(--text-2); background: var(--surface-2); padding: 6px 8px; border-radius: 6px; max-width: 520px; white-space: pre-wrap; word-break: break-all; }
.ua { display: block; margin-top: 4px; word-break: break-all; font-size: .76rem; }
.event-tag { display: inline-block; font-weight: 600; font-size: .84rem; }
.event-tag.level-warning { color: var(--warning-text); }
.event-tag.level-error { color: var(--danger-text); }
.level-row.level-warning td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.level-row.level-error td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
[dir="rtl"] .level-row.level-warning td:first-child { box-shadow: inset -3px 0 0 var(--warning); }
[dir="rtl"] .level-row.level-error td:first-child { box-shadow: inset -3px 0 0 var(--danger); }

/* ---------- Admin ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { --tone: var(--primary); position: relative; display: grid; gap: 2px; padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); overflow: hidden; transition: border-color .15s, transform .15s; }
a.kpi:hover { color: var(--text); border-color: color-mix(in srgb, var(--tone) 35%, var(--border)); }
.kpi small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.kpi b { font-size: 1.85rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-icon { position: absolute; inset-inline-end: 14px; top: 14px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: color-mix(in srgb, var(--tone) 12%, transparent); color: var(--tone); }
.kpi-success { --tone: var(--success); }
.kpi-warning { --tone: var(--warning); }
.kpi-danger { --tone: var(--danger); }
.health { display: grid; gap: 4px; }
.health-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.health-row:last-of-type { border-bottom: 0; margin-bottom: 10px; }
.health-label { font-weight: 600; min-width: 140px; font-size: .9rem; }
.health .btn { justify-self: start; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 170px; padding-top: 18px; }
.bar-col { display: grid; grid-template-rows: 18px 1fr 18px; height: 100%; justify-items: center; gap: 2px; min-width: 0; }
.bar-val { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { position: relative; width: 100%; max-width: 26px; align-self: end; min-height: 3px; height: 0; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--blue-400), var(--primary)); overflow: hidden; transition: height .5s var(--ease); }
.bar-fail { position: absolute; inset: auto 0 0; background: var(--danger); opacity: .85; height: 0; }
.bar-label { font-size: .68rem; color: var(--faint); }
.type-split { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: .88rem; color: var(--text-2); }
.type-split span { display: inline-flex; align-items: center; gap: 6px; }
.type-split .icon { width: 16px; height: 16px; color: var(--muted); }

.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); margin-top: 7px; flex: none; }
.activity-item.level-warning .activity-dot { background: var(--warning); }
.activity-item.level-error .activity-dot { background: var(--danger); }
.activity-body { min-width: 0; }

.user-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; }
.profile-card { display: grid; gap: 18px; align-content: start; }
.face { border-radius: var(--radius); overflow: hidden; background: var(--surface-2); aspect-ratio: 3 / 4; border: 1px solid var(--border); }
.face img { width: 100%; height: 100%; object-fit: cover; }
.face-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--faint); }
.meta { display: grid; gap: 10px; margin: 0; }
.meta div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; font-size: .9rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.meta-inline { gap: 6px; margin: 8px 0; }
.meta-inline div { grid-template-columns: 150px 1fr; font-size: .85rem; }
.action-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.device-card { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 14px; }
.device-icon { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.device-info { min-width: 0; flex: 1; }
.disclosure { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.disclosure summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--text-2); }
.plain-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.plain-list li { display: grid; gap: 2px; font-size: .88rem; }

.settings-form { display: grid; gap: 20px; }
.settings-list { display: grid; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; }
.setting-text { display: grid; gap: 2px; min-width: 0; }
.setting-text label { font-weight: 600; font-size: .93rem; }
.setting-control { flex: none; }
.setting-control input[type="text"] { width: 180px; }
.sticky-actions { position: sticky; bottom: 16px; z-index: 5; display: flex; justify-content: flex-end; }
.sticky-actions .btn { box-shadow: var(--shadow-lg); }
.session-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; margin-bottom: 14px; }
.session-card { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }
.session-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.session-actions { display: flex; gap: 8px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 17, .6); backdrop-filter: blur(3px); animation: fade .2s; }
.modal-card { position: relative; width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 24px; box-shadow: var(--shadow-lg); display: grid; gap: 14px; animation: rise .25s var(--ease); }
.modal-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--warning-soft); color: var(--warning-text); }
.modal-title { font-size: 1.05rem; font-weight: 650; line-height: 1.45; }
.modal-extra:empty { display: none; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
@keyframes fade { from { opacity: 0; } }

/* ==========================================================================
   Results
   ========================================================================== */
.result-host { display: grid; gap: 20px; min-width: 0; }
.loading-card { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 40px; color: var(--muted); }

.job-live { display: grid; gap: 16px; padding: 22px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.job-live::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent); background-size: 200% 100%; animation: sweep 1.6s linear infinite; }
@keyframes sweep { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.job-live-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.job-live-title { flex: 1; min-width: 0; display: grid; }
.job-live-title strong { font-size: 1.05rem; }
.job-live-title small { color: var(--muted); }
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stage { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--faint); font-size: .82rem; font-weight: 600; border: 1px solid transparent; }
.stage-dot { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; }
.stage.is-done { color: var(--success-text); background: var(--success-soft); }
.stage.is-done .stage-dot { background: currentColor; }
.stage.is-done .stage-dot::after { content: ""; width: 6px; height: 3px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); }
.stage.is-current { color: var(--primary-text); background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.stage.is-current .stage-dot { border-inline-end-color: transparent; animation: spin .8s linear infinite; }
.job-live-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .86rem; }
.job-live-meta b { color: var(--text); font-variant-numeric: tabular-nums; }

.result-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.result-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.result-title .job-icon { width: 46px; height: 46px; border-radius: 14px; }
.result-title .job-icon .icon { width: 22px; height: 22px; }
.result-title h2 { font-size: 1.2rem; font-family: var(--font-mono); letter-spacing: 0; }
.result-title p { color: var(--muted); font-size: .88rem; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.result-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); margin-top: 18px; }
.result-meta div { background: var(--surface-2); padding: 10px 14px; display: grid; gap: 2px; min-width: 0; }
.result-meta small { color: var(--muted); font-size: .76rem; font-weight: 600; }
.result-meta b { font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }

.stat-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.stat-tiles.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { --tone: var(--primary); position: relative; padding: 16px 16px 14px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; display: grid; gap: 2px; }
[dir="rtl"] .tile { padding: 16px 20px 14px 16px; }
.tile::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--tone); }
.tile small { color: var(--muted); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
[dir="rtl"] .tile small { text-transform: none; letter-spacing: 0; font-size: .82rem; }
.tile b { font-size: 1.7rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile em { font-style: normal; font-size: .8rem; color: var(--muted); margin-inline-start: 4px; font-weight: 500; }
.tile-success { --tone: var(--success); } .tile-success b { color: var(--success-text); }
.tile-danger { --tone: var(--danger); } .tile-danger b { color: var(--danger-text); }
.tile-warning { --tone: var(--warning); } .tile-warning b { color: var(--warning-text); }
.tile-indigo { --tone: #6366f1; }
.tile-accent { --tone: var(--accent); }
.tile b.is-zero { color: var(--muted); }

.result-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.result-tools .search { flex: 1; min-width: 200px; }
.chip-toggle { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: .86rem; user-select: none; }
.chip-toggle input { accent-color: var(--danger); width: 16px; height: 16px; }
.chip-toggle:has(input:checked) { border-color: var(--danger); background: var(--danger-soft); color: var(--danger-text); }

.data-table { font-size: .86rem; }
.data-table th { font-size: .7rem; }
.data-table td { padding: 10px 14px; white-space: nowrap; }
.data-table tr.is-down td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
[dir="rtl"] .data-table tr.is-down td:first-child { box-shadow: inset -3px 0 0 var(--danger); }
.data-table .c-muted { color: var(--muted); }
.data-table .c-fat { font-weight: 700; color: var(--primary-text); }
.data-table .c-serial { font-family: var(--font-mono); font-size: .84rem; }
.data-table .c-reason-bad { color: var(--danger-text); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: .76rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill-up { background: var(--success-soft); color: var(--success-text); }
.pill-down { background: var(--danger-soft); color: var(--danger-text); }
.pill-weak { background: var(--warning-soft); color: var(--warning-text); }
.pill-good { background: var(--success-soft); color: var(--success-text); }
.pill-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.fat-groups { display: grid; gap: 12px; }
.fat-group { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm); }
.fat-group > summary { list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; cursor: pointer; user-select: none; background: var(--surface-2); }
.fat-group > summary::-webkit-details-marker { display: none; }
.fat-group > summary .chev { transition: transform .2s; color: var(--muted); }
.fat-group[open] > summary .chev { transform: rotate(180deg); }
.fat-group[open] > summary { border-bottom: 1px solid var(--border); }
.fat-label { font-weight: 750; font-size: 1rem; color: var(--primary-text); font-family: var(--font-mono); min-width: 70px; }
.fat-group.has-down .fat-label { color: var(--danger-text); }
.fat-pills { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.pill-count { background: var(--primary-soft); color: var(--primary-text); }

.ring-table td { white-space: nowrap; }
.group-badge { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 8px; border-radius: 8px; background: var(--navy-700); color: #fff; font-weight: 700; font-size: .8rem; }
:root[data-theme="dark"] .group-badge { background: var(--primary-soft); color: var(--primary-text); }
.port { font-family: var(--font-mono); font-weight: 600; }
.side-main { box-shadow: inset 0 3px 0 var(--success); }
.side-backup { box-shadow: inset 0 3px 0 var(--warning); }
.users-bar { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.users-bar b { min-width: 30px; font-variant-numeric: tabular-nums; }
.users-bar span { flex: 1; height: 6px; border-radius: 6px; background: var(--border); overflow: hidden; }
.users-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--sky-400), var(--primary)); width: 0; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; }
.legend .l-good { background: var(--success); } .legend .l-weak { background: var(--warning); } .legend .l-bad { background: var(--danger); }
.report-links { display: flex; gap: 8px; flex-wrap: wrap; }
.result-failed { display: grid; gap: 14px; justify-items: start; }
.result-failed .alert { width: 100%; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
    .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .service-full { grid-column: 1 / -1; }
    .stat-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    :root { --topbar-h: 58px; }
    .sidebar { transform: translateX(-100%); transition: transform .28s var(--ease); box-shadow: none; width: min(300px, 86vw); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    body.sidebar-open { overflow: hidden; }
    .sidebar-close { display: inline-flex; }
    .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(2, 6, 17, .55); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; backdrop-filter: blur(2px); }
    body.sidebar-open .sidebar-overlay { opacity: 1; visibility: visible; }
    .main { margin-inline-start: 0; }
    .menu-btn { display: inline-flex; }
    .grid-2, .user-layout { grid-template-columns: minmax(0, 1fr); }
    .user-layout .profile-card { grid-template-columns: 200px 1fr; align-items: start; }
    .landing { grid-template-columns: 1fr; gap: 40px; text-align: center; }
    .landing-copy { display: grid; justify-items: center; }
    .landing-actions, .landing-note { justify-content: center; }
    .landing-visual { min-height: 300px; max-width: 520px; width: 100%; margin: 0 auto; }
}

@media (max-width: 760px) {
    body { font-size: 15px; }
    .content { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
    .app-footer { display: none; }
    .topbar { padding: 0 8px 0 4px; gap: 4px; }
    .topbar-title { display: none; }
    .brand-compact { display: inline-flex; flex: 1; min-width: 0; }
    .brand-compact strong { font-size: .98rem; white-space: nowrap; }
    .hide-sm { display: none; }
    .services { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .service { padding: 18px; border-radius: var(--radius-lg); }
    .page { gap: 18px; }
    .page-head { align-items: stretch; }
    .mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; gap: 8px; }
    .mini-stat { min-width: 0; padding: 8px 10px; }
    .mini-stat b { font-size: 1.15rem; }
    .mini-stat small { font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .stat-tiles, .stat-tiles.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat-tiles .tile:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
    .tile b { font-size: 1.4rem; }
    .kpis { gap: 10px; }
    .kpi { padding: 14px; }
    .kpi b { font-size: 1.5rem; }
    .kpi-icon { width: 32px; height: 32px; }
    .stages { grid-template-columns: repeat(2, 1fr); }
    .card { padding: 16px; border-radius: var(--radius); }
    .card-flush { padding: 0; }
    .card-head-pad { padding: 16px 16px 0; }
    .auth-card { padding: 24px 18px; border-radius: var(--radius-lg); }
    .register-grid { grid-template-columns: 1fr; gap: 20px; }
    .register-photo { justify-items: center; }
    .photo-drop { width: 180px; }
    .photo-actions { width: 100%; }
    .features { grid-template-columns: 1fr; }
    .landing-visual { display: none; }
    .landing-actions .btn { flex: 1 1 100%; }
    .guest-header { padding: 12px 16px; }
    .guest-header .brand-text small { display: none; }
    .field-row { grid-template-columns: 1fr 1fr; }
    .user-layout .profile-card { grid-template-columns: 1fr; }
    .face { max-width: 260px; margin: 0 auto; width: 100%; }
    .meta div, .meta-inline div { grid-template-columns: 1fr; gap: 0; }
    .setting { flex-direction: column; align-items: stretch; gap: 10px; }
    .setting-control input[type="text"], .input-num { width: 100%; max-width: none; text-align: start; }
    .sticky-actions { bottom: calc(80px + env(safe-area-inset-bottom)); }
    .sticky-actions .btn { width: 100%; }
    .toolbar-row { flex-direction: column; align-items: stretch; }
    .search { min-width: 0; }
    .filters .field, .filters .field-grow { min-width: 0; flex: 1 1 100%; }
    .filter-actions { width: 100%; } .filter-actions .btn { flex: 1; }
    .result-actions { width: 100%; }
    .result-actions .btn { flex: 1 1 auto; }
    .modal { place-items: end center; padding: 0; }
    .modal-card { width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
    .modal-actions .btn { flex: 1; }
    .toast-stack { bottom: calc(84px + env(safe-area-inset-bottom)); inset-inline: 16px; width: auto; }
    .bars { gap: 3px; height: 140px; }

    /* Responsive tables: rows become cards */
    .table-responsive thead { display: none; }
    .table-responsive, .table-responsive tbody, .table-responsive tr, .table-responsive td { display: block; width: 100%; }
    .table-responsive tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
    .table-responsive tbody tr:last-child { border-bottom: 0; }
    .table-responsive td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; border: 0; text-align: end; }
    .table-responsive td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; text-align: start; flex: none; }
    .table-responsive td:not([data-label])::before { display: none; }
    .table-responsive td.num { text-align: end; }
    .table-responsive td.actions-cell { justify-content: stretch; padding-top: 10px; }
    .table-responsive td.actions-cell .btn { width: 100%; }
    .table-responsive tbody tr:hover td { background: transparent; }
    .table-responsive .cell-sub { max-width: 60vw; }
    .table-responsive td.details-cell { flex-direction: column; align-items: stretch; text-align: start; }
    .data-table.table-responsive td { white-space: normal; }
    .data-table.table-responsive tr.is-down { box-shadow: inset 3px 0 0 var(--danger); }
    [dir="rtl"] .data-table.table-responsive tr.is-down { box-shadow: inset -3px 0 0 var(--danger); }
    .data-table.table-responsive tr.is-down td:first-child { box-shadow: none; }
    .level-row.level-warning td:first-child, .level-row.level-error td:first-child { box-shadow: none !important; }
    .table-responsive td::before { font-family: var(--font); font-weight: 600; }
    .ring-table td.side-main, .ring-table td.side-backup { box-shadow: none; }
    .ring-table td.side-main::before { color: var(--success-text); }
    .ring-table td.side-backup::before { color: var(--warning-text); }
    .ring-table tr td:first-child { padding-bottom: 8px; }

    .bottom-nav {
        position: fixed; z-index: 40; inset-inline: 0; bottom: 0;
        display: flex; justify-content: space-around;
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
        backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
        border-top: 1px solid var(--border);
    }
    .bottom-nav a, .bottom-nav button { position: relative; flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border: 0; background: transparent; color: var(--muted); font-size: .68rem; font-weight: 600; border-radius: 10px; cursor: pointer; min-width: 0; }
    .bottom-nav span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .bottom-nav .icon { width: 22px; height: 22px; }
    .bottom-nav .is-active { color: var(--primary); }
    .bottom-nav .is-active .icon { filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--primary) 40%, transparent)); }
    .bottom-nav .dot { position: absolute; top: 4px; inset-inline-end: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
}

@media (max-width: 400px) {
    .field-row { grid-template-columns: 1fr; }
    .mini-stats { grid-template-columns: repeat(2, 1fr); }
    .result-meta { grid-template-columns: 1fr 1fr; }
}

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

@media print {
    .sidebar, .topbar, .bottom-nav, .result-actions, .result-tools, .app-footer, .toast-stack { display: none !important; }
    .main { margin: 0; }
    .card, .tile, .fat-group { box-shadow: none; break-inside: avoid; }
}

/* ==========================================================================
   Result tables: horizontal on every screen (swipe on phones), first column pinned,
   values shared by all rows shown once as chips.
   ========================================================================== */
.rows-block { display: grid; min-width: 0; }
.common-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.common-label { font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-inline-end: 4px; }
[dir="rtl"] .common-label { text-transform: none; letter-spacing: 0; font-size: .8rem; }
.common-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: .82rem; max-width: 100%; }
.common-chip small { color: var(--muted); font-size: .74rem; white-space: nowrap; }
.common-chip b { font-weight: 600; overflow-wrap: anywhere; }
.swipe-hint { display: none; }
.table-scroll { overscroll-behavior-x: contain; scrollbar-width: thin; }
.data-table th:first-child, .data-table td:first-child { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface); }
.data-table thead th:first-child { z-index: 2; background: var(--surface-2); }
.data-table td:first-child { box-shadow: inset -1px 0 0 var(--border); }
[dir="rtl"] .data-table td:first-child { box-shadow: inset 1px 0 0 var(--border); }
.data-table tr.is-down td:first-child { box-shadow: inset 3px 0 0 var(--danger), inset -1px 0 0 var(--border); }
[dir="rtl"] .data-table tr.is-down td:first-child { box-shadow: inset -3px 0 0 var(--danger), inset 1px 0 0 var(--border); }
.data-table td:first-child, .data-table th:first-child { font-family: var(--font-mono); font-weight: 600; }
.ring-table td:first-child, .ring-table th:first-child { font-family: var(--font); }
.session-banner a { font-weight: 700; text-decoration: underline; color: inherit; }

@media (max-width: 760px) {
    .swipe-hint { display: block; margin: 0; padding: 8px 16px 0; font-size: .76rem; color: var(--muted); }
    .swipe-hint-pad { padding-bottom: 6px; }
    .common-strip { padding: 10px 12px; gap: 6px; }
    .common-chip { font-size: .78rem; padding: 3px 8px; }
    .data-table { font-size: .8rem; }
    .data-table th { padding: 9px 10px; font-size: .66rem; }
    .data-table td { padding: 8px 10px; white-space: nowrap; }
    .data-table .pill { height: 22px; padding: 0 8px; font-size: .72rem; }
    .data-table .c-serial { font-size: .78rem; }
    .result-tools { gap: 8px; }
    .result-tools .chip-toggle { height: 40px; }
    /* edge fade hints that the table continues sideways */
    .table-scroll { background:
        linear-gradient(to right, var(--surface) 30%, transparent) left / 24px 100% no-repeat local,
        linear-gradient(to left, var(--surface) 30%, transparent) right / 24px 100% no-repeat local,
        linear-gradient(to left, rgba(15, 23, 42, .12), transparent) right / 12px 100% no-repeat scroll; }
    [dir="rtl"] .table-scroll { background:
        linear-gradient(to left, var(--surface) 30%, transparent) right / 24px 100% no-repeat local,
        linear-gradient(to right, var(--surface) 30%, transparent) left / 24px 100% no-repeat local,
        linear-gradient(to right, rgba(15, 23, 42, .12), transparent) left / 12px 100% no-repeat scroll; }
    .users-bar { min-width: 120px; }
}

/* Phones: summary tiles in one swipeable row, compact meta grid, tools on one line */
@media (max-width: 760px) {
    .stat-tiles, .stat-tiles.cols-4 { display: flex; overflow-x: auto; gap: 10px; scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
    .stat-tiles::-webkit-scrollbar { display: none; }
    .stat-tiles .tile { flex: 0 0 auto; min-width: 128px; scroll-snap-align: start; padding: 12px 14px 10px 18px; }
    [dir="rtl"] .stat-tiles .tile { padding: 12px 18px 10px 14px; }
    .stat-tiles .tile:first-child:nth-last-child(odd) { grid-column: auto; }
    .tile small { font-size: .68rem; white-space: nowrap; }
    .tile b { font-size: 1.3rem; }
    .result-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 14px; }
    .result-meta div { padding: 8px 10px; }
    .result-meta small { font-size: .68rem; }
    .result-meta b { font-size: .8rem; }
    .result-tools { flex-wrap: nowrap; }
    .result-tools .search { min-width: 0; }
    .result-tools .chip-toggle { flex: none; padding: 0 10px; font-size: .78rem; }
    .result-tools .report-links { display: none; }
}
