/* Jalsa design system — monochrome, quiet, precise.
   Black and white with one functional blue for focus. Surfaces are separated
   by tone, not lines or shadows; shadows are reserved for floating layers. */

/* Fonts: Apple devices use SF Pro / SF Arabic from the system. Everyone else
   gets Geist (Latin) and IBM Plex Sans Arabic, served from this server. */
@font-face { font-family: "Geist"; src: url("/vendor/fonts/geist-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Arabic"; src: url("/vendor/fonts/plex-arabic-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex Arabic"; src: url("/vendor/fonts/plex-arabic-500.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex Arabic"; src: url("/vendor/fonts/plex-arabic-600.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex Arabic"; src: url("/vendor/fonts/plex-arabic-700.woff2") format("woff2"); font-weight: 700 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Arabic", "Geist", "Plex Arabic", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Arabic", "Geist", "Plex Arabic", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

  --bg: #f5f5f7;
  --bg-elev: #ffffff;
  --bg-sunken: #ebebee;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --hover: rgba(0, 0, 0, 0.045);
  --press: rgba(0, 0, 0, 0.08);
  --line: rgba(0, 0, 0, 0.07);
  --line-strong: rgba(0, 0, 0, 0.14);
  --text: #111113;
  --text-2: #5f5f66;
  --text-3: #74747c;
  --accent: #111113;
  --accent-hover: #000000;
  --accent-soft: rgba(0, 0, 0, 0.055);
  --focus: #0a6cff;
  --focus-soft: rgba(10, 108, 255, 0.22);
  --link: #0a6cff;
  --primary-bg: #111113;
  --primary-bg-hover: #2a2a2e;
  --primary-fg: #ffffff;
  --success: #1f8a3c;
  --success-soft: rgba(31, 138, 60, 0.1);
  --danger: #d70015;
  --danger-soft: rgba(215, 0, 21, 0.08);
  --warning: #9a5800;
  --warning-soft: rgba(255, 159, 10, 0.14);
  --gold: #111113;
  --mark-shadow: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.18));
  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.05);
  --blur: saturate(180%) blur(20px);

  --r-xs: 8px;
  --r-sm: 12px;
  --r: 16px;
  --r-lg: 20px;
  --r-xl: 26px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --spring-soft: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}
/* Real spring curves (same physics as react-spring's presets) where supported. */
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.0458, 0.1478, 0.274, 0.4042, 0.5263, 0.6341, 0.7251, 0.7992, 0.8577, 0.9027, 0.9362, 0.9606, 0.9777, 0.9893, 0.9969, 1.0014, 1.004, 1.0051, 1.0053, 1.0051, 1.0045, 1.0038, 1.0031, 1.0025, 1.0019, 1.0014, 1.001, 1.0007, 1.0005, 1.0003, 1.0002, 1.0001, 1);
    --spring-soft: linear(0, 0.0203, 0.0687, 0.1339, 0.2077, 0.2845, 0.3606, 0.4334, 0.5015, 0.564, 0.6207, 0.6714, 0.7165, 0.7563, 0.7911, 0.8214, 0.8477, 0.8704, 0.89, 0.9067, 0.9211, 0.9333, 0.9437, 0.9526, 0.9601, 0.9665, 0.9718, 0.9764, 0.9802, 0.9834, 0.9861, 0.9884, 0.9903, 0.9919, 0.9932, 0.9944, 0.9953, 0.9961, 0.9967, 0.9973, 0.9977, 0.9981, 0.9984, 0.9987, 0.9989, 0.9991, 0.9993, 0.9994, 0.9995, 1);
    --spring-bouncy: linear(0, 0.0258, 0.0894, 0.1776, 0.2794, 0.3863, 0.4921, 0.5921, 0.6833, 0.764, 0.8333, 0.8911, 0.938, 0.9748, 1.0026, 1.0226, 1.0361, 1.0441, 1.0479, 1.0485, 1.0466, 1.0431, 1.0386, 1.0335, 1.0283, 1.0232, 1.0185, 1.0142, 1.0104, 1.0072, 1.0046, 1.0024, 1.0008, 0.9996, 0.9987, 0.9981, 0.9978, 0.9976, 0.9977, 0.9978, 0.998, 0.9982, 0.9984, 0.9987, 0.9989, 0.9992, 0.9994, 0.9995, 0.9997, 0.9998, 0.9999, 1);
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-elev: #141416;
    --bg-sunken: #0a0a0b;
    --surface: rgba(20, 20, 22, 0.72);
    --surface-strong: rgba(30, 30, 33, 0.92);
    --hover: rgba(255, 255, 255, 0.06);
    --press: rgba(255, 255, 255, 0.1);
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --text: #f2f2f4;
    --text-2: #a3a3aa;
    --text-3: #85858d;
    --accent: #f2f2f4;
    --accent-hover: #ffffff;
    --accent-soft: rgba(255, 255, 255, 0.08);
    --focus: #3d8bff;
    --focus-soft: rgba(61, 139, 255, 0.3);
    --link: #5aa0ff;
    --primary-bg: #f2f2f4;
    --primary-bg-hover: #ffffff;
    --primary-fg: #0a0a0b;
    --success: #32d74b;
    --success-soft: rgba(50, 215, 75, 0.14);
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, 0.15);
    --warning: #ffd60a;
    --warning-soft: rgba(255, 214, 10, 0.13);
    --gold: #f2f2f4;
    --mark-shadow: none;
    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: 0 32px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-elev: #141416;
  --bg-sunken: #0a0a0b;
  --surface: rgba(20, 20, 22, 0.72);
  --surface-strong: rgba(30, 30, 33, 0.92);
  --hover: rgba(255, 255, 255, 0.06);
  --press: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f2f2f4;
  --text-2: #a3a3aa;
  --text-3: #85858d;
  --accent: #f2f2f4;
  --accent-hover: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --focus: #3d8bff;
  --focus-soft: rgba(61, 139, 255, 0.3);
  --link: #5aa0ff;
  --primary-bg: #f2f2f4;
  --primary-bg-hover: #ffffff;
  --primary-fg: #0a0a0b;
  --success: #32d74b;
  --success-soft: rgba(50, 215, 75, 0.14);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.15);
  --warning: #ffd60a;
  --warning-soft: rgba(255, 214, 10, 0.13);
  --gold: #f2f2f4;
  --mark-shadow: none;
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 32px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  font-feature-settings: "kern";
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.022em; line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(32px, 4.6vw, 52px); letter-spacing: -0.035em; font-weight: 700; }
h2 { font-size: 26px; }
h3 { font-size: 18px; letter-spacing: -0.016em; }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; touch-action: manipulation; }
::selection { background: var(--focus-soft); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; letter-spacing: 0; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.center { display: grid; place-items: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; inset-inline-start: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- brand */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -0.02em; color: var(--text); text-decoration: none !important; }
.brand-mark { height: 30px; width: auto; display: block; flex: none; filter: var(--mark-shadow); user-select: none; -webkit-user-drag: none; }
.brand-mark.lg { height: 40px; }
.brand-mark.xl { height: 64px; }
.brand-name { line-height: 1; }
.brand-sub { font-size: 12px; font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-inline-start: 2px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--hover);
  --btn-fg: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 0;
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: 15px; font-weight: 500; white-space: nowrap; user-select: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.35s var(--spring), box-shadow 0.2s var(--ease), opacity 0.2s, filter 0.2s;
}
.btn:hover { background: var(--press); }
.btn:active { transform: scale(0.96); transition-duration: 0.08s; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus); }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { --btn-bg: var(--primary-bg); --btn-fg: var(--primary-fg); font-weight: 600; }
.btn-primary:hover { background: var(--primary-bg-hover); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-ghost { --btn-bg: transparent; }
.btn-ghost:hover { background: var(--hover); }
.btn-soft-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); }
.btn-soft-danger:hover { background: var(--danger-soft); filter: brightness(1.12); }
.btn-lg { height: 50px; padding: 0 26px; font-size: 17px; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13.5px; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- fields */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--text);
  font-size: 16px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s;
}
@media (min-width: 761px) { .input, .select, .textarea { font-size: 15px; } }
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 4px var(--focus-soft); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; }
.input-lg { height: 52px; font-size: 17px; border-radius: var(--r); padding: 0 18px; }
.select { appearance: none; padding-inline-end: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8b85' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
[dir="rtl"] .select { background-position: left 14px center; }
.hint { font-size: 12.5px; color: var(--text-3); }
.error-text { font-size: 13px; color: var(--danger); min-height: 18px; }

/* iOS switch */
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background 0.25s var(--ease); }
.switch span::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.3s var(--spring);
}
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-20px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus); }

/* Settings-style grouped list */
.group { background: var(--bg-elev); border-radius: var(--r); overflow: hidden; }
.group-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 52px; }
.group-row + .group-row { border-top: 1px solid var(--line); }
.group-row .title { font-weight: 500; }
.group-row .desc { font-size: 13px; color: var(--text-2); }
.group-title { font-size: 13px; color: var(--text-2); margin: 24px 4px 8px; font-weight: 600; letter-spacing: -0.005em; }

/* Segmented control */
.segmented { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--press); gap: 2px; max-width: 100%; overflow-x: auto; }
.segmented button {
  border: 0; background: transparent; height: 30px; padding: 0 14px; border-radius: 8px; white-space: nowrap;
  font-size: 13.5px; font-weight: 500; color: var(--text-2); transition: background-color 0.25s var(--ease), color 0.2s, box-shadow 0.25s;
}
.segmented button[aria-pressed="true"] { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 0.5px var(--line); }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--bg-elev); border-radius: var(--r-lg); padding: 22px; }
.glass { background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0; background: var(--hover); color: var(--text-2); white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge-live { background: var(--danger-soft); color: var(--danger); }
.badge-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-accent, .badge-gold { background: var(--text); color: var(--bg-elev); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
@keyframes pulse { 50% { opacity: 0.35; } }

.avatar {
  --hue: 38;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 600; font-size: 14px; color: #fff; letter-spacing: 0;
  background: hsl(var(--hue) 12% 44%);
}

.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 2px 6px; border-radius: 6px; background: var(--hover); border: 1px solid var(--line); }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--text); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; top: max(16px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; width: min(440px, calc(100vw - 24px)); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding-block: 12px; padding-inline: 12px 14px; border-radius: 18px;
  background: var(--surface-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; width: 100%;
  animation: toast-in 0.55s var(--spring);
}
.toast.leaving { animation: toast-out 0.3s var(--ease) forwards; }
.toast .t-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.toast .t-icon svg { width: 16px; height: 16px; }
.toast.success .t-icon { background: var(--success-soft); color: var(--success); }
.toast.error .t-icon { background: var(--danger-soft); color: var(--danger); }
.toast .t-actions { display: flex; gap: 6px; margin-inline-start: auto; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(0.97); } }

/* ---------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 20px; cursor: default;
  background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.25s var(--ease);
}
.modal {
  width: min(560px, 100%); max-height: calc(100dvh - 40px); overflow: auto; overscroll-behavior: contain;
  background: var(--bg-elev); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  animation: sheet-in 0.6s var(--spring); color: var(--text);
}
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 6px; position: sticky; top: 0; background: var(--bg-elev); z-index: 2; }
.modal-head h3 { flex: 1; }
.modal-body { padding: 14px 24px 8px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 24px 22px; flex-wrap: wrap; }
.modal-backdrop.leaving { animation: fade-out 0.2s var(--ease) forwards; }
.modal-backdrop.leaving .modal { animation: sheet-out 0.2s var(--ease) forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(20px) scale(0.96); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(12px) scale(0.98); } }
@media (max-width: 640px) {
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: rise 0.55s var(--spring); }
  .modal-foot { position: sticky; bottom: 0; background: var(--bg-elev); }
  .modal-foot .btn { flex: 1; }
  .modal-backdrop.leaving .modal { animation: drop 0.22s var(--ease) forwards; }
}
@keyframes rise { from { transform: translateY(100%); } }
@keyframes drop { to { transform: translateY(100%); } }

/* ---------------------------------------------------------------- menu / action sheet */
.menu {
  position: fixed; z-index: 950; min-width: 220px; max-width: min(320px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); overflow-y: auto;
  padding: 6px; border-radius: 14px; color: var(--text);
  background: var(--surface-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: menu-in 0.4s var(--spring); transform-origin: top;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; padding: 8px 10px; border: 0;
  background: transparent; border-radius: 9px; font-size: 14px; color: inherit; min-height: 36px;
}
.menu button:hover, .menu button:focus-visible { background: var(--hover); outline: none; }
.menu button .check { margin-inline-start: auto; color: var(--text); }
.menu button.danger { color: var(--danger); }
.menu button.danger:hover { background: var(--danger-soft); }
.menu button svg { width: 17px; height: 17px; opacity: 0.85; flex: none; }
.menu .menu-label { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 8px 10px 4px; }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 5px 6px; }
@keyframes menu-in { from { opacity: 0; transform: scale(0.94) translateY(-6px); } }

.sheet-backdrop { position: fixed; inset: 0; z-index: 949; background: rgba(0, 0, 0, 0.32); animation: fade-in 0.2s; }
.menu.sheet {
  left: 8px !important; right: 8px !important; top: auto !important; bottom: max(8px, env(safe-area-inset-bottom)) !important;
  max-width: none; min-width: 0; width: auto; padding: 0; border-radius: 16px; background: transparent; border: 0; box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none; animation: rise 0.55s var(--spring); max-height: 80dvh;
}
.menu.sheet .sheet-group { background: var(--surface-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-radius: 14px; overflow: hidden; }
.menu.sheet .sheet-group + .sheet-group { margin-top: 8px; }
.menu.sheet button { border-radius: 0; min-height: 52px; padding: 0 18px; font-size: 17px; justify-content: flex-start; }
.menu.sheet .sheet-group button + button, .menu.sheet hr + button { border-top: 1px solid var(--line); }
.menu.sheet hr { display: none; }
.menu.sheet .sheet-cancel { justify-content: center; font-weight: 600; color: var(--link); }
.menu.sheet .menu-label { padding: 12px 18px 6px; text-align: center; text-transform: none; letter-spacing: 0; font-size: 13px; }

/* ---------------------------------------------------------------- tooltip (pointer devices only) */
@media (hover: hover) and (pointer: fine) {
  [data-tip] { position: relative; }
  [data-tip]:hover::after {
    content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
    padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; white-space: nowrap; pointer-events: none;
    background: rgba(30, 30, 32, 0.94); color: #f4f2ee; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); z-index: 20;
    animation: fade-in 0.15s 0.4s both;
  }
}

/* ---------------------------------------------------------------- empty state */
.empty { text-align: center; padding: 44px 20px; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .empty-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--hover); color: var(--text-2); }
.empty .empty-icon svg { width: 24px; height: 24px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------- Arabic & right-to-left */
/* Arabic letters join; tracking breaks them, so all letter-spacing is off. */
:lang(ar), :lang(ar) * { letter-spacing: 0 !important; }
html:lang(ar) body { line-height: 1.6; }
html:lang(ar) h1, html:lang(ar) h2, html:lang(ar) h3, html:lang(ar) h4 { line-height: 1.3; }
html:lang(ar) .tiny { font-size: 12px; }
[dir="rtl"] .rtl-flip { transform: scaleX(-1); }
/* Codes, links, numbers and English names keep their own direction. */
.mono, .kbd, code, input[type="email"], input[type="url"], .ltr { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .mono, [dir="rtl"] .ltr { text-align: end; }
bdi, .bidi { unicode-bidi: isolate; }

/* Language switch — a quiet text button. */
.lang-switch { background: none; border: 0; padding: 6px 10px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--text-2); transition: background-color 0.2s, color 0.2s; }
.lang-switch:hover { color: var(--text); background: var(--hover); }
.lang-switch:lang(ar) { font-family: var(--font); }
