/* Ringkey - one stylesheet for the whole site (public pages, dashboard, admin).
   Light and dark themes come from the tokens below; data-theme is set on
   <html> before first paint (see page_head in includes/ui.php). Spacing uses
   logical properties (inline-start/end) so Hebrew mirrors correctly. */

/* ---------- Tokens ---------- */
:root {
    --bg: #f5f8fb;
    --bg-soft: #ecf2f7;
    --surface: #ffffff;
    --surface-2: #f2f6fa;
    --surface-3: #e8eef5;
    --border: #dfe7ef;
    --border-strong: #c8d3df;
    --text: #0c1a2b;
    --text-2: #354559;
    --muted: #5d6d82;
    /* Brand: the logo runs mint #32f5c1 -> teal #00d1d4 -> blue #078cfd. Those
       are too light for text and white-on-colour, so solid UI colours use
       deeper shades of the same blue and teal (4.5:1 or better). */
    --primary: #0868d0;
    --primary-hover: #0558b5;
    --primary-soft: #e3f0fd;
    --primary-text: #0660c4;
    --on-primary: #ffffff;
    --accent: #007c84;
    --success: #047857;
    --success-soft: #e3f6ee;
    --danger: #c81e1e;
    --danger-soft: #fdeaea;
    --warning: #b45309;
    --warning-soft: #fdf1e1;
    --code: #0b2545;
    --ring: 0 0 0 3px rgba(8, 104, 208, .28);
    --shadow-sm: 0 1px 2px rgba(12, 26, 43, .06);
    --shadow: 0 1px 2px rgba(12, 26, 43, .05), 0 6px 20px -6px rgba(12, 26, 43, .12);
    --shadow-lg: 0 24px 60px -18px rgba(12, 26, 43, .28);
    --hero-glow: radial-gradient(55% 60% at 28% 0%, rgba(50, 245, 193, .16), transparent 70%), radial-gradient(50% 60% at 78% 8%, rgba(7, 140, 253, .13), transparent 70%);
    /* The logo's own gradient, for marks and decoration (never behind text). */
    --brand-grad: linear-gradient(135deg, #32f5c1 0%, #00d1d4 45%, #078cfd 100%);
    /* Gradient text and white-on-gradient panels: deeper, still on-brand. */
    --brand-text: linear-gradient(100deg, #078f86, #0868d0);
    --brand-deep: linear-gradient(120deg, #0868d0, #00727a);
    --wordmark-key: linear-gradient(90deg, #0fb8e8, #0a78ee);
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --font: 'Inter', 'Heebo', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    --header-h: 64px;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #070d17;
    --bg-soft: #0a121f;
    --surface: #0f1828;
    --surface-2: #132033;
    --surface-3: #19283e;
    --border: #213049;
    --border-strong: #2d4062;
    --text: #ebf2fa;
    --text-2: #c2cedc;
    --muted: #8f9eb2;
    --primary: #3db8ff;
    --primary-hover: #5cc5ff;
    --primary-soft: rgba(61, 184, 255, .14);
    --primary-text: #6fcbff;
    --on-primary: #03111f;
    --accent: #2ee6c4;
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, .12);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, .12);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, .12);
    --code: #dbeefe;
    --ring: 0 0 0 3px rgba(61, 184, 255, .4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -10px rgba(0, 0, 0, .55);
    --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .7);
    --hero-glow: radial-gradient(55% 60% at 28% 0%, rgba(46, 230, 196, .13), transparent 70%), radial-gradient(50% 60% at 78% 8%, rgba(61, 184, 255, .16), transparent 70%);
    --brand-text: linear-gradient(100deg, #2ee6c4, #3db8ff);
    --brand-deep: linear-gradient(120deg, #0868d0, #00727a);
    --wordmark-key: linear-gradient(90deg, #2fd4f5, #3da2ff);
    color-scheme: dark;
}
html[lang="he"] { --font: 'Heebo', 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; }

/* ---------- Base ---------- */
/* Note: rules for grey caption text inside a component ("x span") skip icon
   tiles, avatars and badges - otherwise those turn grey and lose their layout. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
    margin: 0; min-height: 100vh; font-family: var(--font); font-size: 16px; line-height: 1.6;
    background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
    transition: background-color .25s ease, color .25s ease;
}
img, svg { display: block; max-width: 100%; }
svg.icon { display: inline-block; flex-shrink: 0; vertical-align: middle; }
a { color: var(--primary-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 800; }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); font-weight: 750; }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
::selection { background: var(--primary-soft); }
[hidden] { display: none !important; }
[dir="ltr"], [data-ltr] { direction: ltr; unicode-bidi: isolate; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 10px 16px; border-radius: 10px; font-weight: 600; }
.skip-link:focus { top: 12px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 20px; }
.container-narrow { max-width: 760px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Buttons ---------- */
.btn {
    --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border-strong);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 0 18px; border-radius: 11px; border: 1px solid var(--btn-border);
    background: var(--btn-bg); color: var(--btn-fg); font: inherit; font-weight: 600; font-size: .94rem;
    line-height: 1; text-decoration: none; cursor: pointer; white-space: nowrap; user-select: none;
    transition: background-color .15s, border-color .15s, color .15s, transform .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-border: transparent; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--primary) 55%, transparent); }
.btn-primary:hover { --btn-bg: var(--primary-hover); border-color: transparent; }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; }
.btn-ghost:hover { --btn-bg: var(--surface-2); border-color: transparent; }
.btn-soft { --btn-bg: var(--primary-soft); --btn-fg: var(--primary-text); --btn-border: transparent; }
.btn-soft:hover { border-color: transparent; filter: brightness(.97); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: transparent; }
.btn-danger:hover { border-color: transparent; filter: brightness(1.08); }
.btn-danger-soft { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-border: transparent; }
.btn-danger-soft:hover { border-color: var(--danger); }
.btn-google { --btn-bg: #fff; --btn-fg: #1f1f1f; --btn-border: #dadce0; }
:root[data-theme="dark"] .btn-google { --btn-bg: #131314; --btn-fg: #e3e3e3; --btn-border: #8e918f; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .85rem; border-radius: 9px; }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 1.02rem; border-radius: 13px; }
.btn-block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
    display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.is-on { color: #f59e0b; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn-sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn, .theme-toggle { flex-shrink: 0; }
/* Activity in plain words: a coloured dot for the kind of event. */
.tone-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.tone-dot.green { background: var(--success); }
.tone-dot.red { background: var(--danger); }
.act-line { display: inline-flex; align-items: center; gap: 8px; }
.act-row { flex-wrap: wrap; gap: 4px 12px; }
.act-row .grow { min-width: 55%; }
.act-row .nowrap { margin-inline-start: auto; }
@media (max-width: 900px) { .icon-btn-sm { width: 36px; height: 36px; } .code-actions .icon-btn { width: 40px; height: 40px; } }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline-block; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-text); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-weight: 600; font-size: .9rem; color: var(--text-2); }
.field-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
/* Three short fields (algorithm, digits, seconds) side by side, even in a phone popup. */
.waiting-phones { margin-bottom: 18px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.waiting-phones .small { margin: 0 0 6px; }
.waiting-phone { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding-top: 10px; }
.waiting-phone .grow { min-width: 130px; }
.waiting-code { font-family: var(--mono); font-weight: 800; font-size: 1.15rem; letter-spacing: .12em; color: var(--primary-text); }
.form-section-title { margin: 0 0 10px; font-size: .74rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.field-row.field-row-3 { gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
.hint { font-size: .82rem; color: var(--muted); margin: 0; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url],
input[type=number], input[type=search], input[type=file], input[type=date], select, textarea {
    width: 100%; min-height: 44px; padding: 10px 13px; border-radius: 11px;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    font: inherit; font-size: 1rem; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
/* File pickers (built by app.js around the real input). */
.file-pick { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 13px; border: 1.5px dashed var(--border-strong); background: var(--surface-2); color: var(--primary-text); transition: border-color .15s, background-color .15s; }
.file-pick:hover, .file-pick.drag { border-color: var(--primary); background: var(--primary-soft); }
.file-pick:focus-within { box-shadow: var(--ring); }
.file-pick input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; opacity: 0; cursor: pointer; }
.file-pick-text { display: grid; min-width: 0; }
.file-pick-text strong { color: var(--text); font-weight: 650; font-size: .94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick-text span { font-size: .8rem; color: var(--muted); }
.file-pick.has-file { border-style: solid; border-color: var(--success); }
.file-pick.has-file .icon { color: var(--success); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667089' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-inline-end: 38px; }
[dir="rtl"] select { background-position: left 12px center; }
/* Arrows point the way you read: in Hebrew "back" points right. */
[dir="rtl"] .icon-arrow-left, [dir="rtl"] .icon-arrow-right, [dir="rtl"] .icon-chevron-right { transform: scaleX(-1); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input[aria-invalid="true"] { border-color: var(--danger); }
.input-wrap { position: relative; }
.input-wrap input { padding-inline-end: 46px; }
.input-wrap .pw-reveal { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-inline-start: 40px; }
.code-input { font-family: var(--mono); font-size: 1.4rem !important; letter-spacing: .3em; text-align: center; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 7px 0; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--primary); flex-shrink: 0; }
.check strong { display: block; font-weight: 600; }
.check span:not(.card-icon, .avatar, .av-letter, .badge, .ic-tile, .tone-dot, .dot) { color: var(--text-2); }
/* Switch: a checkbox drawn as a toggle. */
.switch { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; cursor: pointer; padding: 12px 0; }
.switch + .switch { border-top: 1px solid var(--border); }
.switch input { appearance: none; flex-shrink: 0; width: 44px; height: 26px; margin: 2px 0 0; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: background-color .2s; }
.switch input::after { content: ''; 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,.3); transition: transform .2s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }
[dir="rtl"] .switch input:checked::after { transform: translateX(-18px); }
.switch input:focus-visible { box-shadow: var(--ring); }
.switch-text strong { display: block; font-weight: 600; }
.switch-text span:not(.card-icon, .avatar, .av-letter, .badge, .ic-tile, .tone-dot, .dot) { display: block; font-size: .85rem; color: var(--muted); }
.hp-field { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.strength { height: 5px; border-radius: 9px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.strength i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .25s, background-color .25s; }
.strength-label { font-size: .78rem; color: var(--muted); }
.strength-label:empty { display: none; }

/* ---------- Cards, alerts, badges ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.12rem; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.card-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-text); flex-shrink: 0; }
.card-icon.green { background: var(--success-soft); color: var(--success); }
.card-icon.amber { background: var(--warning-soft); color: var(--warning); }
.card-icon.red { background: var(--danger-soft); color: var(--danger); }
.card-foot { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.card-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 12px; border: 1px solid transparent; font-size: .93rem; margin-bottom: 18px; }
.alert > svg { margin-top: 2px; }
.alert.success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.info { background: var(--primary-soft); color: var(--primary-text); border-color: color-mix(in srgb, var(--primary) 20%, transparent); }
.alert.warn { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert p { margin: 0; color: inherit; }
.alert .alert-body { color: var(--text-2); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.amber { background: var(--warning-soft); color: var(--warning); }
.badge.blue { background: var(--primary-soft); color: var(--primary-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); display: inline-block; }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-weight: 750; font-size: 1.05rem; color: #fff; flex-shrink: 0; text-transform: uppercase; }
.avatar-sm { width: 34px; height: 34px; border-radius: 10px; font-size: .9rem; }
/* A company icon instead of the letter: on a white tile in both themes, so
   dark logos (GitHub) stay visible. The letter stays in the markup as the fallback. */
.avatar.avatar-icon { background: #fff !important; padding: 7px; box-shadow: inset 0 0 0 1px rgba(12, 26, 43, .1); }
.avatar.avatar-icon img { width: 100%; height: 100%; object-fit: contain; }
.avatar.avatar-icon .av-letter { display: none; }
.avatar-sm.avatar-icon { padding: 5px; }
.avatar .av-letter { color: #fff; line-height: 1; }
/* A person's Google photo instead of their letter: always a circle. */
.avatar.avatar-photo, .profile-head .avatar.avatar-photo, .me-card .avatar.avatar-photo { padding: 0; overflow: hidden; border-radius: 50%; background: var(--bg-soft); }
.avatar.avatar-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* A row of overlapping code icons (summary of a list). */
.avatar-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-more { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 700; }
.avatar-xs { width: 24px; height: 24px; border-radius: 7px; font-size: .7rem; }
.avatar-xs.avatar-icon { padding: 3px; }
.check .avatar-xs { margin-top: 1px; }
/* Edit dialog: choosing a code's icon. */
.icon-pick, .icon-access { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.icon-access legend { padding: 0; margin-bottom: 4px; }
.icon-pick legend { padding: 0; margin-bottom: 8px; }
.icon-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.icon-choice { display: grid; justify-items: center; gap: 5px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--border); cursor: pointer; text-align: center; transition: border-color .15s, background-color .15s; }
.icon-choice:hover { border-color: var(--border-strong); }
.icon-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.icon-choice:has(input:focus-visible) { box-shadow: var(--ring); }
.ic-tile { display: grid; place-items: center; width: 40px; height: 40px; padding: 6px; border-radius: 11px; background: #fff; box-shadow: inset 0 0 0 1px rgba(12, 26, 43, .1); }
.ic-tile img { width: 100%; height: 100%; object-fit: contain; }
.ic-auto { background: var(--primary-soft); color: var(--primary-text); box-shadow: none; }
.ic-letter { background: var(--muted); color: #fff; font-weight: 750; box-shadow: none; }
.icon-admin-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); align-items: stretch; }
.icon-admin-grid .card + .card { margin-top: 0; }
.icon-admin-grid .card-head { margin-bottom: 0; }   /* nothing below it - the form opens in a popup */
/* A long ID with its copy button beside it, not dropped to a line of its own. */
.id-line { display: flex; align-items: center; gap: 6px; }
.id-line > span { min-width: 0; overflow-wrap: anywhere; }
.id-line .icon-btn { flex: none; }
.ic-name { font-size: .74rem; font-weight: 600; color: var(--text-2); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.empty { text-align: center; padding: 48px 20px; }
.empty .empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--primary-soft); color: var(--primary-text); margin-bottom: 14px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 440px; margin: 0 auto 18px; }
.kbd { font-family: var(--mono); font-size: .75rem; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted); }

/* ---------- Scrollbars ----------
   Thin rounded pills in the site's own tones, on a clear track; they turn
   brand blue on hover. Chrome, Edge and Safari use the ::-webkit-scrollbar
   rules (full control of the shape). Firefox, which lacks them, gets the
   standard thin scrollbar in the same colours. No element may set
   scrollbar-width / scrollbar-color itself: in current Chrome that switches
   the element back to the plain scrollbar. */
:root { --scroll-thumb: color-mix(in srgb, var(--muted) 42%, transparent); --scroll-thumb-hover: color-mix(in srgb, var(--primary) 75%, transparent); }
@supports selector(::-webkit-scrollbar) {
    ::-webkit-scrollbar { width: 12px; height: 12px; }
    ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
    ::-webkit-scrollbar-thumb { min-height: 44px; min-width: 44px; border-radius: 99px; border: 3px solid transparent; background: var(--scroll-thumb) padding-box; }
    ::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
    ::-webkit-scrollbar-thumb:active { background-color: var(--primary); }
    ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
    /* Small scroll areas (address boxes, lists in a card): a slimmer pill. */
    .secret-line code::-webkit-scrollbar, .pick-list::-webkit-scrollbar, .menu-list::-webkit-scrollbar, textarea::-webkit-scrollbar { width: 8px; height: 8px; }
    .secret-line code::-webkit-scrollbar-thumb, .pick-list::-webkit-scrollbar-thumb, .menu-list::-webkit-scrollbar-thumb, textarea::-webkit-scrollbar-thumb { border-width: 2px; }
}
@supports not selector(::-webkit-scrollbar) {
    * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
}

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 200; inset-inline-end: 20px; bottom: 20px; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); pointer-events: none; }
/* Shown as a popover (above open popups): undo the browser's popover box. */
.toasts[popover] { inset: auto; inset-inline-end: 20px; bottom: 20px; margin: 0; padding: 0; border: 0; background: none; color: inherit; overflow: visible; height: auto; }
.form-error { margin: 14px 0 0; animation: toast-in .2s ease; }
.form-error p { margin: 0; }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 13px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: .93rem; pointer-events: auto; animation: toast-in .25s ease; }
.toast.success > svg { color: var(--success); }
.toast.error > svg { color: var(--danger); }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: all .2s; }
.toast-text { flex: 1; min-width: 0; word-break: break-word; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (max-width: 640px) { .toasts, .toasts[popover] { inset-inline: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); width: auto; } }

/* ---------- Dialogs ---------- */
/* Pinned near the top rather than centred: a dialog whose tabs change its
   height then grows downwards instead of jumping under the pointer. */
dialog.modal {
    margin: max(6vh, 24px) auto auto;
    width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - max(6vh, 24px) - 24px); padding: 0; border: 1px solid var(--border);
    border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.modal-wide { width: min(680px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(8, 10, 20, .55); backdrop-filter: blur(3px); }
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in .2s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 1.1rem; margin: 0; flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-head, .modal-foot { flex: none; }
/* A popup that is one big form (Edit this code, Download a backup): the form
   passes the column layout on, so the middle scrolls and the buttons stay in view. */
dialog.modal[open] > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
@media (max-width: 640px) {
    dialog.modal { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
    dialog.modal[open] { animation: sheet-in .25s ease; }
    @keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
}
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* More tabs past an edge (set by app.js): that edge fades out. */
.tabs.more-end { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.tabs.more-start { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); }
.tabs.more-start.more-end { -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
[dir="rtl"] .tabs.more-end:not(.more-start) { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); }
[dir="rtl"] .tabs.more-start:not(.more-end) { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
/* Dialog tab bars on small phones: words only, so all four fit. */
@media (max-width: 420px) { .modal .tabs .tab svg { display: none; } .modal .tabs .tab { padding: 0 9px; } }
.tab { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-selected="true"], .tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab-panel { padding-top: 18px; }
.js [data-autosave] .autosave-hide { display: none; }

/* ---------- Header / footer (public) ---------- */
.site-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s, background-color .2s; }
.site-header.scrolled { border-bottom-color: var(--border); }
.header-row { display: flex; align-items: center; gap: 20px; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; direction: ltr; } /* icon before name, as in the logo, in Hebrew too */
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; }
/* "Ringkey" typed in the logo's style: "Ring" in the text colour, "key" in the
   logo's blue. Always left-to-right, also on Hebrew pages. */
.wordmark { direction: ltr; unicode-bidi: isolate; font-weight: 800; font-size: 1.24rem; letter-spacing: -.03em; line-height: 1; color: var(--text); }
.wordmark b { font-weight: inherit; background: var(--wordmark-key); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* The full logo pictures come in a light-theme and a dark-theme version. */
.logo-img { display: block; height: auto; max-width: 100%; }
.logo-img.on-dark, :root[data-theme="dark"] .logo-img.on-light { display: none; }
:root[data-theme="dark"] .logo-img.on-dark { display: block; }
.tagline { direction: ltr; unicode-bidi: isolate; font-size: .78rem; font-weight: 750; letter-spacing: .2em; text-transform: uppercase; }
.main-nav { display: flex; gap: 4px; margin-inline-start: 12px; }
.main-nav a { padding: 8px 12px; border-radius: 9px; color: var(--text-2); text-decoration: none; font-size: .93rem; font-weight: 550; }
.main-nav a:hover, .main-nav a[aria-current] { color: var(--text); background: var(--surface-2); }
.header-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.lang-switch { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.lang-switch a { display: inline-grid; place-items: center; min-width: 34px; min-height: 30px; padding: 3px 9px; border-radius: 7px; font-size: .78rem; font-weight: 700; color: var(--muted); text-decoration: none; }
@media (max-width: 900px) { .lang-switch a { min-width: 40px; min-height: 34px; } }
.lang-switch a[aria-current] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.nav-toggle { display: none; }
@media (max-width: 900px) {
    .main-nav { position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; gap: 2px; margin: 0; padding: 12px 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateY(-8px); opacity: 0; visibility: hidden; transition: all .2s; }
    .main-nav.open { transform: none; opacity: 1; visibility: visible; }
    .main-nav a { padding: 12px 14px; font-size: 1rem; }
    .nav-toggle { display: inline-grid; }
    .header-actions .lang-switch { display: none; }
    .main-nav .nav-extra { display: grid; gap: 10px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
    .nav-extra .nav-account { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--text); }
    .nav-prefs { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 14px; }
    .main-nav .lang-switch a { padding: 3px 9px; font-size: .82rem; }
    .main-nav .lang-switch a[aria-current] { background: var(--surface); }
}
.nav-extra { display: none; }
/* Small phones: the theme switch lives in the menu, so the header fits. */
@media (max-width: 380px) { .header-theme { display: none; } }
@media (max-width: 420px) { .hide-xs { display: none !important; } .header-actions { gap: 4px; } }
.site-footer { margin-top: 80px; padding: 56px 0 28px; border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-grid { display: grid; gap: 32px; grid-template-columns: 1.6fr repeat(3, 1fr); }
.footer-brand p { max-width: 320px; margin: 14px 0; font-size: .92rem; }
.footer-logo { display: inline-block; }
.footer-logo .logo-img { width: 220px; }
.footer-line { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.footer-mail { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--text-2); text-decoration: none; font-size: .93rem; }
.footer-col { display: grid; gap: 10px; align-content: start; }
.footer-col h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 4px; }
.footer-col a { color: var(--text-2); text-decoration: none; font-size: .93rem; }
.footer-col a:hover { color: var(--text); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--border); font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.footer-bottom p { margin: 0; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* ---------- Landing ---------- */
.hero { position: relative; padding: 72px 0 40px; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: -120px 0 auto; height: 620px; background: var(--hero-glow); pointer-events: none; }
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 56px; align-items: center; }
.eyebrow.tagline { color: var(--text-2); letter-spacing: .18em; padding-inline: 12px 16px; }
.eyebrow.tagline .dot { background: var(--brand-grad); box-shadow: 0 0 0 4px var(--primary-soft); }
.eyebrow { max-width: 100%; flex-wrap: wrap; display: inline-flex; align-items: center; gap: 9px; padding: 6px 13px 6px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: .84rem; font-weight: 600; color: var(--text-2); box-shadow: var(--shadow-sm); margin-bottom: 22px; }
.hero h1 { font-size: clamp(2.3rem, 5.6vw, 3.9rem); line-height: 1.04; letter-spacing: -.035em; margin-bottom: 20px; }
.hero h1 .grad { background: var(--brand-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: clamp(1.05rem, 2vw, 1.22rem); color: var(--text-2); max-width: 560px; margin-bottom: 30px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-meta { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 26px; font-size: .88rem; color: var(--muted); }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta svg { color: var(--success); }
.demo { position: relative; padding: 22px; border-radius: 26px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.demo-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-weight: 700; }
.demo-live { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 650; color: var(--success); }
.demo-row { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.demo-row + .demo-row { margin-top: 10px; }
.demo-row .who { flex: 1; min-width: 0; }
.demo-row .who strong { display: block; font-size: .95rem; }
.demo-row .who span:not(.card-icon, .avatar, .av-letter, .badge, .ic-tile, .tone-dot, .dot) { font-size: .8rem; color: var(--muted); }
.demo-code { font-family: var(--mono); font-weight: 700; font-size: 1.45rem; letter-spacing: .06em; color: var(--code); direction: ltr; }
.demo-call { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 14px; border-radius: 16px; background: var(--brand-deep); color: #fff; }
.demo-call .ring-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.18); animation: ring 2.4s ease-in-out infinite; }
.demo-call small { display: block; opacity: .85; font-size: .78rem; }
.demo-call strong { font-size: 1.05rem; direction: ltr; unicode-bidi: isolate; }
@keyframes ring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-12deg); } 80% { transform: rotate(12deg); } 85% { transform: rotate(-8deg); } 90% { transform: rotate(6deg); } }
.section { padding: 76px 0; }
.section-alt { background: var(--bg-soft); border-block: 1px solid var(--border); }
.section-head { text-align: center; max-width: 660px; margin: 0 auto 44px; }
.kicker { display: inline-block; font-size: .78rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--primary-text); margin-bottom: 10px; }
.section-head p { color: var(--text-2); font-size: 1.06rem; }
.features { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); }
.feature { padding: 26px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); transition: transform .2s, box-shadow .2s, border-color .2s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.feature .card-icon { margin-bottom: 16px; }
.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--text-2); margin: 0; font-size: .95rem; }
.steps { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); counter-reset: step; }
.step { position: relative; padding: 26px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; margin-bottom: 14px; background: var(--primary); color: var(--on-primary); font-weight: 800; }
.step p { color: var(--text-2); margin: 0; font-size: .95rem; }
.band { position: relative; overflow: hidden; border-radius: 28px; padding: 48px; background: linear-gradient(125deg, #062a5c, #0868d0 55%, #00727a); color: #fff; display: grid; grid-template-columns: 1.2fr .8fr; gap: 32px; align-items: center; }
.band::after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; inset-inline-end: -120px; top: -160px; background: rgba(255,255,255,.08); }
.band h2 { color: #fff; font-size: clamp(1.6rem, 3.4vw, 2.2rem); }
.band p { color: rgba(255,255,255,.86); }
.band .kicker { color: #a7f3e3; }
.band-number { position: relative; z-index: 1; text-align: center; padding: 28px; border-radius: 22px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); backdrop-filter: blur(6px); }
.band-number small { display: block; text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; opacity: .8; margin-bottom: 6px; }
.band-number a { display: block; color: #fff; font-size: clamp(1.9rem, 4.6vw, 2.6rem); font-weight: 800; text-decoration: none; letter-spacing: .02em; direction: ltr; }
.band .btn { --btn-bg: #fff; --btn-fg: #063a75; --btn-border: transparent; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.ticks { list-style: none; padding: 0; margin: 20px 0 26px; display: grid; gap: 12px; }
.ticks li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-2); }
.ticks svg { color: var(--success); margin-top: 3px; }
.ext-mock { border-radius: 22px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; max-width: 380px; margin-inline: auto; }
/* The extension popup, as it really looks (same sizes and parts as popup.css). */
.ext-mock { max-width: 360px; background: var(--bg); text-align: start; }
.xm-bar { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--bg); }
.xm-bar img { width: 24px; height: 24px; }
.xm-bar .wordmark { font-size: 1.05rem; }
.xm-who { flex: 1; min-width: 0; text-align: end; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xm-body { padding: 14px; display: grid; gap: 10px; }
.xm-scan { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: 12px; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: .95rem; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--primary) 70%, transparent); }
.xm-card { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.xm-title { font-weight: 700; font-size: .88rem; margin-bottom: 4px; }
.xm-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.xm-row:nth-child(2) { border-top: 0; }
.xm-names { flex: 1; min-width: 0; }
.xm-names strong { display: block; font-size: .88rem; }
.xm-names span { display: block; font-size: .74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xm-value { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; letter-spacing: .04em; color: var(--code); direction: ltr; }
.xm-ring { width: 20px; height: 20px; flex: none; transform: rotate(-90deg); }
.xm-ring circle { fill: none; stroke-width: 3; }
.xm-ring .bg { stroke: var(--border); }
.xm-ring .fg { stroke: var(--primary); stroke-linecap: round; }
.xm-foot { display: flex; gap: 8px; }
.xm-soft, .xm-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); font-size: .8rem; font-weight: 650; }
.xm-soft { flex: 1; background: var(--surface); color: var(--primary-text); }
.xm-ghost { color: var(--muted); }
.faq { max-width: 780px; margin: 0 auto; display: grid; gap: 10px; }
.faq details { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; cursor: pointer; font-weight: 650; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { transition: transform .2s; color: var(--muted); }
.faq details[open] summary svg { transform: rotate(180deg); }
.faq details > div { padding: 0 20px 18px; color: var(--text-2); }
.cta-final { text-align: center; padding: 64px 24px; border-radius: 28px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.cta-final::before { content: ''; position: absolute; inset: 0; background: var(--hero-glow); pointer-events: none; }
.cta-final > * { position: relative; }
.cta-final .hero-cta { justify-content: center; }
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (max-width: 960px) {
    .hero { padding-top: 44px; }
    .hero-grid, .split, .band { grid-template-columns: minmax(0, 1fr); }
    .features, .steps { grid-template-columns: 1fr 1fr; }
    .band { padding: 32px 24px; }
}
@media (max-width: 640px) {
    .features, .steps { grid-template-columns: 1fr; }
    .section { padding: 56px 0; }
    .hero-cta .btn { flex: 1 1 auto; }
}

/* ---------- Content pages (legal, phone, contact) ---------- */
.page-hero { padding: 56px 0 8px; position: relative; }
.page-hero::before { content: ''; position: absolute; inset: -80px 0 auto; height: 360px; background: var(--hero-glow); pointer-events: none; z-index: -1; }
.page-hero .lede { font-size: 1.12rem; color: var(--text-2); max-width: 660px; }
.prose { color: var(--text-2); }
.prose h2 { margin-top: 1.8em; font-size: 1.3rem; color: var(--text); }
.prose ul, .prose ol { padding-inline-start: 22px; }
.prose li { margin-bottom: .45em; }
.toc { position: sticky; top: calc(var(--header-h) + 20px); display: grid; gap: 4px; font-size: .9rem; }
.toc a { color: var(--muted); text-decoration: none; padding: 5px 10px; border-radius: 8px; border-inline-start: 2px solid transparent; }
.toc a:hover { color: var(--text); background: var(--surface-2); }
.doc-layout { display: grid; grid-template-columns: 220px 1fr; gap: 48px; align-items: start; }
@media (max-width: 860px) { .doc-layout { grid-template-columns: 1fr; } .toc { display: none; } }
.contact-layout { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
@media (max-width: 860px) { .contact-layout { grid-template-columns: 1fr; } }
.side-card { display: grid; gap: 14px; }
.side-card a.contact-row { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; }
.side-card a.contact-row:hover { border-color: var(--primary); }
.side-card small { display: block; color: var(--muted); }
.phone-big { display: inline-block; font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; letter-spacing: .02em; color: var(--primary-text); text-decoration: none; direction: ltr; white-space: nowrap; }
/* Other countries' lines, listed under the visitor's own. */
.other-lines { display: grid; gap: 6px; margin: 4px 0 16px; text-align: start; }
.other-lines-title { font-size: .8rem; color: var(--muted); }
.other-lines a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: .9rem; }
.other-lines a:hover { border-color: var(--primary); text-decoration: none; }
.other-lines strong { margin-inline-start: auto; font-weight: 700; }
.flag { display: inline-grid; place-items: center; min-width: 28px; height: 20px; padding: 0 5px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-text); font-size: .7rem; font-weight: 800; letter-spacing: .04em; direction: ltr; }
/* The phone line number never breaks in two ("079-495-" / "6739"): its box is
   a size container and the number scales to the width it actually has. */
.number-fit { display: block; container-type: inline-size; }
.number-fit .phone-big { font-size: min(2.8rem, 12.5cqi); }
.number-fit.small .phone-big { font-size: min(2rem, 12.5cqi); }
.band-number .number-fit a { font-size: min(2.6rem, 12.5cqi); white-space: nowrap; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-aside { position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(70% 55% at 10% 0%, rgba(50, 245, 193, .22), transparent 70%), radial-gradient(70% 60% at 100% 100%, rgba(7, 140, 253, .32), transparent 70%), linear-gradient(160deg, #061325, #0a2340 60%, #06344a); color: #fff; }
.auth-aside::after { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; inset-inline-end: -200px; bottom: -200px; background: rgba(255,255,255,.07); }
.auth-logo { position: relative; z-index: 1; display: inline-block; align-self: flex-start; }
.auth-logo .logo-img { width: 230px; }
.auth-aside h2 { color: #fff; font-size: clamp(1.7rem, 3vw, 2.4rem); max-width: 440px; }
.auth-aside p { color: rgba(255,255,255,.82); max-width: 420px; }
.auth-aside ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 14px; position: relative; z-index: 1; }
.auth-aside li { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.92); }
.auth-aside li svg { flex-shrink: 0; padding: 7px; width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.14); }
.auth-main { display: flex; flex-direction: column; padding: 24px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.auth-top .brand { visibility: hidden; }
.auth-box { width: 100%; max-width: 420px; margin: auto; padding: 32px 0; }
.auth-box h1 { font-size: 1.85rem; margin-bottom: 6px; }
.auth-box .sub { color: var(--muted); margin-bottom: 26px; }
.or { display: flex; align-items: center; gap: 14px; margin: 20px 0; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-switch { text-align: center; margin-top: 22px; color: var(--muted); font-size: .94rem; }
.auth-foot { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; font-size: .82rem; }
.auth-foot a { color: var(--muted); }
@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-top .brand { visibility: visible; }
}

/* ---------- App shell (dashboard + admin) ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; border-inline-end: 1px solid var(--border); background: var(--surface); overflow-y: auto; }
.sidebar .brand { padding: 6px 10px 18px; }
.side-nav { display: grid; gap: 2px; }
.side-label { font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: 16px 12px 6px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: var(--text-2); text-decoration: none; font-weight: 560; font-size: .94rem; border: 0; background: none; font-family: inherit; cursor: pointer; width: 100%; text-align: start; }
.side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-link[aria-current="page"], .side-link[aria-selected="true"] { background: var(--primary-soft); color: var(--primary-text); }
.side-link .count { margin-inline-start: auto; }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
/* On a short screen only the menu scrolls: the name, theme and Sign out stay pinned at the bottom. */
.sidebar .side-foot { position: sticky; bottom: -18px; padding-bottom: 18px; margin-bottom: -18px; background: var(--surface); }
@media (max-height: 800px) {
    .sidebar { gap: 2px; padding-block: 12px; }
    .sidebar .brand { padding-bottom: 10px; }
    .side-link { padding-block: 8px; }
    .side-label { padding-top: 10px; }
}
/* The account card at the foot of the sidebar: who you are, and a way into Account. */
.me-card { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); color: inherit; text-decoration: none; transition: border-color .15s, background-color .15s; }
.me-card:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface); }
.me-card .avatar-sm { width: 36px; height: 36px; border-radius: 11px; font-size: .95rem; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .18); }
.me-text { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.me-text strong { font-size: .93rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text span { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-go { display: inline-grid; color: var(--muted); transition: transform .15s, color .15s; }
[dir="rtl"] .me-go svg { transform: scaleX(-1); }
.me-card:hover .me-go { color: var(--text-2); transform: translateX(2px); }
[dir="rtl"] .me-card:hover .me-go { transform: translateX(-2px); }
/* Sign out takes the row; the light/dark switch sits beside it as a clear, bordered button. */
.side-actions { display: flex; align-items: center; gap: 8px; }
.side-actions form { flex: 1; min-width: 0; }
.side-actions .theme-toggle { width: 36px; height: 36px; border-color: var(--border); color: var(--text-2); }
.side-actions .theme-toggle:hover { border-color: var(--border-strong); }
/* The admin's personal account: a small icon button that opens the admin panel (after the admin password or an emailed code). */
.side-actions .side-icon { width: 36px; height: 36px; flex: none; border: 1px solid var(--border); color: var(--primary-text); background: var(--primary-soft); }
.side-actions .side-icon:hover { border-color: var(--primary); text-decoration: none; }
/* In the admin panel: My codes, and Back to my account. */
.side-admin { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; font-weight: 600; }
.side-admin:hover { border-color: var(--primary); text-decoration: none; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: var(--header-h); padding: 10px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 1.25rem; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .brand { display: none; }
.content { padding: 28px; width: 100%; max-width: 1120px; }
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title h2 { margin: 0; }
.page-title p { margin: 4px 0 0; color: var(--muted); }
/* Add a code: next to the codes on wide screens (the top bar's far corner is
   a long way from them); in the top bar on phones. The top-bar button also
   stays for the Phone and Extension panels on phones only. */
.toolbar-add { display: none; }
@media (min-width: 901px) {
    .app:has([data-panel="codes"].active #codes) .toolbar-add { display: inline-flex; }
    .topbar-add { display: none; }
}
/* One visible title per screen: the top bar names the page on wide screens
   (and always in the admin panel), the page's own heading does on phones. */
@media (min-width: 901px) { .app .page-title h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } .app .page-title p { margin-top: 0; } }
.admin-app .page-title h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.admin-app .page-title p { margin-top: 0; }
.bottom-nav { display: none; }
.mobile-only { display: none; }
.app-panel { display: none; }
.app-panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.settings-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }
.settings-grid .card + .card { margin-top: 0; }
/* Grid and stack children may shrink below their widest line (a long address
   in a one-line box), instead of pushing the page wider than the screen. */
.settings-grid > *, .stack > *, .split > *, .icon-admin-grid > *, .features > *, .steps > * { min-width: 0; }
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .topbar { padding: 10px 16px; }
    .topbar .brand { display: inline-flex; margin-inline-end: auto; }
    /* The page's own heading says where you are, so the bar shows the logo;
       its title stays for screen readers. */
    .app:not(.admin-app) .topbar h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .mobile-only { display: inline-flex; }
    .content { padding: 18px 16px 110px; }
    .bottom-nav { position: fixed; z-index: 40; inset: auto 0 0 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
    .bottom-nav a, .bottom-nav button { display: grid; justify-items: center; gap: 3px; padding: 7px 4px; border-radius: 12px; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 650; border: 0; background: none; font-family: inherit; cursor: pointer; }
    .bottom-nav [aria-current="page"], .bottom-nav [aria-selected="true"] { color: var(--primary-text); background: var(--primary-soft); }
}

/* ---------- Codes ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .input-icon { flex: 1 1 240px; }
/* Folder chips above the codes. */
.folder-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; }
.inbox-filter { margin-bottom: 18px; gap: 8px; }
/* Filters that apply as you type: no Search button needed; a soft fade while loading. */
.js form[data-live] .live-submit { display: none; }
[data-live-part] { transition: opacity .15s; }
body:has(form[data-live].is-loading) [data-live-part] { opacity: .55; }
.inbox-filter .input-icon { min-width: 220px; }
.chip span { font-size: .75rem; color: var(--muted); font-weight: 700; }
.chip:hover { border-color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip[aria-pressed="true"] span { color: inherit; opacity: .8; }
.codes { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
/* Wide screens: My codes uses the room (four cards a row on a 1920 screen). */
@media (min-width: 1500px) { .content:has([data-panel="codes"].active) { max-width: 1480px; } }
.code-card { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
.code-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.code-card.is-fav { border-color: color-mix(in srgb, #f59e0b 45%, var(--border)); }
.code-top { display: flex; align-items: center; gap: 12px; }
.code-names { flex: 1; min-width: 0; }
/* The name may take two lines rather than be cut ("Google YDonate Multi-org"). */
.code-names strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: 1.02rem; line-height: 1.3; }
.code-names span:not(.card-icon, .avatar, .av-letter, .badge, .ic-tile, .tone-dot, .dot) { display: block; font-size: .83rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-actions { display: flex; align-items: center; gap: 2px; align-self: flex-start; }
.code-actions .icon-btn { width: 36px; height: 36px; }
.card-menu .menu-list { min-width: 190px; }
.code-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.code-value { display: inline-flex; align-items: center; gap: 12px; padding: 4px 8px; margin: -4px -8px; border: 0; border-radius: 12px; background: none; color: var(--code); cursor: pointer; font-family: var(--mono); font-weight: 700; font-size: 2rem; letter-spacing: .08em; direction: ltr; line-height: 1.1; }
.code-value:hover { background: var(--surface-2); }
.code-value .copy-ico { color: var(--muted); opacity: 0; transition: opacity .15s; }
.code-value:hover .copy-ico, .code-value:focus-visible .copy-ico { opacity: 1; }
.code-value.copied { color: var(--success); }
.code-value.stale { opacity: .45; }
.timer { position: relative; width: 42px; height: 42px; flex-shrink: 0; }
.timer svg { width: 42px; height: 42px; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 4; }
.timer .track { stroke: var(--surface-3); }
.timer .bar { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .3s; }
.timer.warn .bar { stroke: #f59e0b; }
.timer.low .bar { stroke: var(--danger); }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.code-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.badge-icon { padding: 4px 7px; }
/* A short explanation over an icon-only badge, on hover, keyboard focus or tap. */
[data-tip] { position: relative; cursor: help; }
[data-tip]:hover::after, [data-tip]:focus::after {
    content: attr(data-tip); position: absolute; top: calc(100% + 7px); inset-inline-start: 0; z-index: 50;
    width: max-content; max-width: 220px; padding: 6px 10px; border-radius: 9px; background: var(--text); color: var(--bg);
    font-size: .76rem; font-weight: 600; line-height: 1.35; letter-spacing: 0; text-transform: none; white-space: normal;
    box-shadow: var(--shadow); pointer-events: none;
}
[data-tip]:focus { outline: none; }
.order-tools { display: none; gap: 2px; }
.reordering .order-tools { display: flex; }
.reordering .code-actions { display: none; }
.reordering .code-value { pointer-events: none; }
.position { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 7px; background: var(--surface-3); font-weight: 700; color: var(--text-2); font-size: .75rem; }
.no-results { display: none; }
.stat-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); margin-bottom: 22px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.stat strong { display: block; font-size: 1.5rem; line-height: 1.1; }
.stat span:not(.card-icon, .avatar, .av-letter, .badge, .ic-tile, .tone-dot, .dot) { font-size: .82rem; color: var(--muted); line-height: 1.3; }
.stat > div { min-width: 0; }
/* Two tiles per row on phones, not one tall column. */
@media (max-width: 640px) {
    .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
    .stat .card-icon { width: 34px; height: 34px; }
}
a.stat { color: inherit; text-decoration: none; transition: border-color .15s; }
a.stat:hover { border-color: var(--primary); }
.list { display: grid; }
/* Single-column grids: without this their one column grows to fit the widest
   line (a long address, an email) and pushes past the screen. */
.list, .step-list, .ticks, .field, .pick-list, .faq, .side-card, .footer-col, .xm-body, .toc { grid-template-columns: minmax(0, 1fr); }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-item .grow strong { display: block; }
.list-item .grow span:not(.card-icon, .avatar, .av-letter, .badge, .ic-tile, .tone-dot, .dot) { font-size: .85rem; color: var(--muted); }
/* The list grows with its codes (no box scrolling both ways); long names wrap. */
.pick-list { display: grid; gap: 2px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.pick-list .check > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.pick-list .check { padding: 9px 10px; border-radius: 10px; }
.pick-list .check:hover { background: var(--surface); }
/* A code's websites, only while it is shown in the extension: tags under its
   name, an add button at the row's side, and a field that opens from it. */
.pick-row { position: relative; display: grid; min-width: 0; }
.pick-row .check { padding-inline-end: 62px; }
.pick-row:not(:has(input[name="shown[]"]:checked)) .pick-sites { display: none; }
.pick-sites { padding-inline: 10px; }
.js .pick-sites-all { display: none; }
.pick-sites-all { width: 100%; min-height: 34px; margin-bottom: 8px; font-size: .84rem; }
.site-add { position: absolute; top: 7px; inset-inline-end: 8px; display: inline-flex; align-items: center; gap: 3px; height: 30px; padding: 0 9px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--primary-text); cursor: pointer; transition: background-color .15s, border-color .15s; }
.site-add:hover { background: var(--primary-soft); border-color: var(--primary); }
.site-add svg { flex: none; }
html:not(.js) .site-add, html:not(.js) .site-chips { display: none; }
.site-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-inline-start: 62px; }
.site-chips:not(:empty) { margin-bottom: 9px; margin-top: -3px; }
.site-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 1px 3px 1px 9px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-text); font-size: .78rem; font-weight: 600; overflow-wrap: anywhere; }
[dir="rtl"] .site-chip { padding: 1px 9px 1px 3px; }
.site-chip button { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.site-chip button:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.site-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; margin-inline-start: 62px; }
.site-editor[hidden] { display: none; }
.site-editor input { flex: 1 1 120px; width: auto; min-width: 0; min-height: 34px; padding: 5px 10px; font-size: .86rem; border-radius: 9px; }
.site-error { flex-basis: 100%; margin: 0; color: var(--danger); font-size: .8rem; }
@media (max-width: 640px) { .site-chips, .site-editor { margin-inline-start: 0; } .site-add { height: 36px; padding: 0 11px; } .pick-row .check { padding-inline-end: 72px; } .site-editor input { font-size: 16px; } }
.pair-code { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 18px; border-radius: 16px; border: 2px dashed var(--border-strong); background: var(--surface-2); }
.pair-code strong { font-family: var(--mono); font-size: 2rem; letter-spacing: .14em; direction: ltr; user-select: all; }

/* Scanner */
.scanner { position: relative; aspect-ratio: 1; max-width: 360px; margin: 0 auto; border-radius: 20px; overflow: hidden; background: #000; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 14%; border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.45); border: 3px solid rgba(255,255,255,.9); }
.scanner .laser { position: absolute; inset-inline: 16%; top: 16%; height: 2px; background: #60a5fa; box-shadow: 0 0 12px #60a5fa; animation: laser 2s ease-in-out infinite alternate; }
@keyframes laser { to { top: 84%; } }
.dropzone { display: grid; place-items: center; gap: 10px; text-align: center; padding: 34px 18px; border: 2px dashed var(--border-strong); border-radius: 18px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background-color .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .card-icon { width: 52px; height: 52px; }
.choice-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.choice { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: start; cursor: pointer; transition: border-color .15s, background-color .15s; }
.choice:hover { border-color: var(--primary); background: var(--primary-soft); }
.choice strong { display: block; font-size: .95rem; }
.choice span:not(.card-icon, .avatar, .av-letter, .badge, .ic-tile, .tone-dot, .dot) { display: block; font-size: .8rem; color: var(--muted); }
@media (max-width: 480px) { .choice-grid { grid-template-columns: 1fr; } }
details.more { border-top: 1px solid var(--border); padding-top: 12px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--text-2); }

/* ---------- Tables (admin) ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: start; padding: 12px 16px; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .user-cell { display: flex; align-items: center; gap: 12px; }
.table .user-cell strong { display: block; }
.table .user-cell .uc-text > span { display: block; font-size: .8rem; color: var(--muted); }
/* Phones: each row becomes a card - the person and Manage on top, the rest below. */
@media (max-width: 640px) {
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody { display: block; }
    .table-cards tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
    .table-cards tr:last-child { border-bottom: 0; }
    .table-cards td { display: block; padding: 0; border: 0; order: 3; }
    .table-cards td:first-child { order: 1; flex: 1 1 0; min-width: 0; }
    .table-cards td:last-child { order: 2; }
    .table-cards td.tc-full { flex-basis: 100%; overflow-wrap: anywhere; }
    .table-cards td:empty { display: none; }
}
/* The activity log as cards: what happened, then when and who, then the details. */
@media (max-width: 640px) {
    .audit-cards td:nth-child(2) { order: 1; flex-basis: 100%; font-weight: 600; }
    .audit-cards td:first-child { order: 2; flex: none; }
    .audit-cards td.au-by { order: 3; }
    .audit-cards td.au-by::before { content: "· "; color: var(--muted); }
    .audit-cards td.au-target { order: 4; color: var(--muted); }
    .audit-cards td.au-target::before { content: "→ "; }
    .audit-cards td.tc-full { order: 5; }
    .table-wrap:has(.audit-cards) { overflow-x: visible; }
}
.table th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 22px; margin: 0; }
@media (max-width: 480px) { .kv:not(.kv-split) { grid-template-columns: minmax(0, 1fr); gap: 2px; } .kv:not(.kv-split) dd { margin-bottom: 10px; } }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; font-weight: 550; word-break: break-word; }
.kv-split { grid-template-columns: minmax(0, 1fr) auto; }
.kv-split dd { text-align: end; white-space: nowrap; }
.msg-card { padding: 18px 20px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); }
.msg-card + .msg-card { margin-top: 12px; }
.msg-card.unread { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: inset 3px 0 0 var(--primary); }
[dir="rtl"] .msg-card.unread { box-shadow: inset -3px 0 0 var(--primary); }
.msg-body { white-space: pre-wrap; word-break: break-word; color: var(--text-2); margin: 12px 0 0; font-size: .94rem; }
.recovery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.recovery code { padding: 9px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); text-align: center; letter-spacing: .06em; }
.qr-box { background: #fff; padding: 12px; border-radius: 14px; display: inline-block; }
.source { font-size: .75rem; }
.step-list { counter-reset: s; list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.step-list li { position: relative; padding-inline-start: 38px; color: var(--text-2); font-size: .93rem; overflow-wrap: anywhere; }
.hint code, .step-list code, .prose code { overflow-wrap: anywhere; }
.step-list li::before { counter-increment: s; content: counter(s); position: absolute; inset-inline-start: 0; top: 0; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-text); font-weight: 750; font-size: .8rem; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: var(--mono); font-size: .88rem; }

/* ---------- 404 ---------- */
.not-found { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 40px 20px; }
.not-found .big { font-size: clamp(5rem, 18vw, 9rem); font-weight: 800; line-height: 1; background: linear-gradient(100deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (max-width: 640px) {
    .demo { padding: 16px; border-radius: 22px; }
    .demo-row { padding: 12px; gap: 10px; }
    .demo-code { font-size: 1.2rem; }
    .code-value { font-size: 1.75rem; }
}

/* ---------- Account pages ---------- */
.profile-head { display: flex; align-items: center; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.profile-head h2 { margin: 0 0 2px; }
.profile-head p { margin: 0 0 10px; }
/* Phones: the avatar beside the name, so the tabs start on the first screen. */
@media (max-width: 640px) {
    .profile-head { flex-wrap: nowrap; align-items: flex-start; gap: 14px; padding: 16px; }
    .profile-head .avatar-xl { width: 52px; height: 52px; border-radius: 16px; font-size: 1.3rem; }
    .profile-head h2 { font-size: 1.15rem; }
    .profile-head p { font-size: .82rem; margin-bottom: 8px; overflow-wrap: anywhere; }
    .profile-head .badge { font-size: .72rem; }
}
.avatar-xl { width: 72px; height: 72px; border-radius: 22px; font-size: 1.8rem; }
.section-nav { position: sticky; top: var(--header-h); z-index: 20; margin-bottom: 8px; box-shadow: var(--shadow-sm); }
.section-nav .tab { flex: 1 0 auto; }
.tab-danger { color: var(--danger) !important; }
.acct-section { padding-top: 4px; scroll-margin-top: calc(var(--header-h) + 64px); }
.acct-section > h2 { font-size: 1.15rem; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.danger-title { color: var(--danger) !important; }
.settings-grid > .stack > * + * { margin-top: 20px; }
.settings-grid .stack .card + .card { margin-top: 20px; }
.theme-choice { grid-template-columns: repeat(3, 1fr); }
.theme-choice .choice { flex-direction: column; text-align: center; gap: 8px; }
.choice.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.choice:has(input:focus-visible) { box-shadow: var(--ring); }
.ticks .icon-x { color: var(--danger); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
@media (max-width: 900px) { .section-nav { top: var(--header-h); } }
@media (max-width: 480px) { .theme-choice { grid-template-columns: 1fr 1fr 1fr; } .theme-choice .choice { padding: 10px 6px; } }

/* ---------- Announcement banner ---------- */
.announce { position: relative; z-index: 60; font-size: .92rem; border-bottom: 1px solid var(--border); }
.announce-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-block: 8px; }
.announce-row p { margin: 0; flex: 1; }
@media (max-width: 640px) { .announce { font-size: .82rem; } .announce-row { min-height: 40px; padding-block: 4px; gap: 8px; } }
.announce-info { background: var(--primary-soft); color: var(--primary-text); }
.announce-warning { background: var(--warning-soft); color: var(--warning); }
.announce-maintenance { background: var(--danger-soft); color: var(--danger); }
.announce .icon-btn { color: inherit; }
/* Inside the dashboard/admin content column: lined up with the page, not the site container. */
.app-main > .announce .container { max-width: none; padding-inline: 28px; }
@media (max-width: 900px) { .app-main > .announce .container { padding-inline: 16px; } }

/* ---------- Activity ---------- */
.day-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 24px 0 10px; }
.activity-list { padding-block: 10px; }
.activity-list .list-item { padding: 12px 0; }
.activity-list .list-item:first-child { padding-top: 12px; }

/* ---------- Sharing ---------- */
.invite { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.code-card.is-shared { border-style: dashed; }
#shared-title { display: flex; align-items: center; gap: 8px; margin-top: 30px; }

/* ---------- Admin tools ---------- */
.chart { width: 100%; height: auto; margin: 10px 0 4px; overflow: visible; }
.chart .bar { fill: var(--primary); }
.chart .bar-col:hover .bar { fill: var(--primary-hover); }
.chart .hit { fill: transparent; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .val { fill: var(--text-2); font-size: 11px; font-weight: 650; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.filters { display: grid; grid-template-columns: 2fr 1.4fr 1fr; grid-auto-columns: auto; grid-auto-flow: column; gap: 12px; align-items: start; margin-bottom: 18px; padding: 18px; }
.filters .field { margin-bottom: 0; }
/* Filtering as you type hides the Filter button: drop its empty column too, until Clear shows. */
.js .filters > .row:has(> .live-submit):not(:has(> [data-live-clear]:not([hidden]))) { display: none; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; grid-auto-flow: row; } }
.err-detail { margin: 8px 0 0; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-family: var(--mono); font-size: .78rem; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; direction: ltr; text-align: left; }
.toolbar select { min-height: 44px; }
.chart-empty { margin: 18px 0; padding: 26px; text-align: center; border: 1px dashed var(--border-strong); border-radius: 12px; }

/* ---------- Copied: icons turn into a green check ---------- */
.copied, .copied svg, .icon-btn.copied, .btn.copied { color: var(--success) !important; }
.code-value.copied .copy-ico { opacity: 1; }

/* ---------- Page tabs ---------- */
.page-tabs { margin-bottom: 22px; position: sticky; top: var(--header-h); z-index: 20; box-shadow: var(--shadow-sm); }
.page-tabs .tab { flex: 1 0 auto; }

/* ---------- Saved cards with an Edit button ---------- */
.edit-card .card-head .btn { margin-inline-start: auto; }
/* Phones: the description keeps a readable width; the button drops below it. */
@media (max-width: 640px) {
    .edit-card .card-head, .card-head-wrap { flex-wrap: wrap; }
    .edit-card .card-head > .grow, .card-head-wrap > .grow { flex: 1 1 0; min-width: 62%; }
    .card-head-wrap > .btn { margin-inline-start: auto; }
    /* Service icons: the Edit button stays beside the name - the tile is narrow anyway. */
    .icon-admin-grid .edit-card .card-head { flex-wrap: nowrap; }
    .icon-admin-grid .edit-card .card-head > .grow { min-width: 0; }
    /* Sign out stays beside the device (on a line of its own it doubled each row). */
    .device-row { align-items: flex-start; }
    .device-row .grow { flex: 1 1 0; min-width: 0; }
    .device-row form { flex: none; }
}
.js .edit-card .edit-pane { display: none; }
/* In the Edit popup (app.js moves the pane there). */
#edit-card-dialog .edit-pane { display: block; }
#edit-card-dialog .ec-icon:empty { display: none; }
/* A popup with a second, destructive form (Remove / Delete): the main footer
   stays in place and the destructive action gets its own row, apart. */
#edit-card-dialog .edit-pane:has(> form + form) > form:first-child .card-foot { position: static; margin: 18px 0 0; padding: 0; border: 0; background: none; }
#edit-card-dialog .edit-pane > form + form { margin-top: 18px !important; padding-top: 16px; border-top: 1px solid var(--border); }
#edit-card-dialog .ec-icon .card-icon, #edit-card-dialog .ec-icon .avatar { width: 36px; height: 36px; }
#edit-card-dialog .edit-pane .card-foot { position: sticky; bottom: -20px; margin: 18px -20px -20px; padding: 14px 20px; background: var(--surface-2); border-top: 1px solid var(--border); }
/* Every popup's buttons read the same way as the dashboard's own popups:
   on the right, Cancel first and the main action last. */
.modal .card-foot, .modal .edit-pane .card-foot { justify-content: flex-end; }
.modal .card-foot > .btn-ghost { order: -1; }
.js .edit-card.editing .view-pane, .js .edit-card.editing [data-edit-open] { display: none; }
.view-pane .kv { margin: 0; }
.view-pane .empty-value { color: var(--muted); font-weight: 400; font-style: italic; }
.edit-pane .card-foot { justify-content: flex-start; }
.kv dd .badge { margin-inline-start: 6px; }
.secret-line { display: flex; gap: 8px; align-items: stretch; }
/* An address on one line that scrolls sideways, rather than broken mid-word. */
.secret-line code { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: .82rem; white-space: nowrap; overflow-x: auto; direction: ltr; text-align: left; }
.ivr-part + .ivr-part { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.ext-chip { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 9px; background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: .9rem; direction: ltr; }

/* ---------- Drop-down menu ---------- */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 80; min-width: 230px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: grid; gap: 2px; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font: inherit; font-size: .93rem; background: none; border: 0; cursor: pointer; width: 100%; text-align: start; }
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); text-decoration: none; }
.menu-list form { margin: 0; }
.menu-list .menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.menu-list .danger { color: var(--danger); }

/* Date inputs: same look as the other fields, and a calendar icon that shows on dark */
input[type=date] { min-width: 150px; font-variant-numeric: tabular-nums; }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; border-radius: 6px; padding: 2px; }
input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: 1; background: var(--surface-3); }
:root[data-theme="dark"] input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.85); }
.date-range .row input { flex: 1; }
.dial-hint { display: flex; align-items: center; gap: 8px; margin-top: 8px !important; color: var(--text) !important; font-weight: 600; }

/* A removal shown at once (data-remove in app.js): the item fades out while the server confirms. */
.is-leaving { opacity: 0; transform: scale(.98); transition: opacity .17s ease, transform .17s ease; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .is-leaving { transition: none; } }
