:root {
  --bg: #f6f5f2; --card: #fff; --text: #1c1c1e; --muted: #6b6b70; --line: #e6e4df;
  --accent: #ff5a36; --accent-dark: #e4441f; --ok: #1f9d55; --bad: #d93025; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121214; --card: #1c1c1f; --text: #f2f2f3; --muted: #9a9aa1; --line: #2c2c31; }
}
/* Appearance setting (Settings → Appearance) overrides the system: html[data-theme="light" | "dark"] */
:root[data-theme="light"] { --bg: #f6f5f2; --card: #fff; --text: #1c1c1e; --muted: #6b6b70; --line: #e6e4df; color-scheme: light; }
:root[data-theme="dark"]  { --bg: #121214; --card: #1c1c1f; --text: #f2f2f3; --muted: #9a9aa1; --line: #2c2c31; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { -webkit-overflow-scrolling: touch; }
/* Use reliable custom overlays instead of browser/OS scrollbars, which may not
   expose their hover area to the page (especially with macOS overlay bars). */
/* Custom scrollbar only with a mouse/trackpad. Phones & tablets keep their own smooth, native scroll indicator. */
@media (hover: hover) and (pointer: fine) {
  * { scrollbar-width: none !important; -ms-overflow-style: none !important; }
  *::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
}
@media (hover: none), (pointer: coarse) {
  .site-scrollbar, #calls-scrollbar { display: none !important; }
  #calls-scroll-area.expanded { padding-right: 0 !important; }
}
.site-scrollbar { position: fixed; z-index: 10000; width: 14px; min-height: 36px; border-radius: 999px;
  opacity: 0; pointer-events: none; touch-action: none; transition: opacity .65s ease; }
.site-scrollbar.visible { opacity: 1; pointer-events: auto; }
.site-scrollbar::before { content: ""; position: absolute; inset: 0 5px; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  border-radius: inherit; background: color-mix(in srgb, var(--text) 8%, transparent); box-shadow: inset 0 1px 2px rgba(0,0,0,.14); }
.site-scroll-thumb { position: absolute; top: 0; left: 3px; width: 8px; min-height: 34px; border: 1px solid color-mix(in srgb, var(--accent) 80%, white);
  border-radius: 999px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 72%, white), var(--accent));
  box-shadow: 0 2px 7px color-mix(in srgb, var(--accent) 38%, transparent), 0 1px 3px rgba(0,0,0,.28);
  transition: box-shadow .5s, border-color .5s; cursor: grab; }
.site-scroll-thumb::after, #calls-scroll-thumb::after { content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark)); opacity: 0; pointer-events: none; transition: opacity .5s; }
.site-scroll-thumb.is-dragging::after, #calls-scroll-thumb:active::after { opacity: 1; }
.site-scrollbar:hover .site-scroll-thumb { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 58%, white), var(--accent));
  box-shadow: 0 2px 11px color-mix(in srgb, var(--accent) 52%, transparent), 0 1px 3px rgba(0,0,0,.28); }
.site-scrollbar .site-scroll-thumb.is-dragging, #calls-scroll-thumb:active { border-color: var(--accent-dark);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--accent) 62%, transparent); cursor: grabbing; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
main { max-width: 560px; margin: 0 auto; padding: 48px 20px 64px; }

header { margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-size: 28px; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 14px; font-weight: 600; }
.lead { color: var(--muted); margin: 6px 0 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }

label { display: block; margin: 0 0 16px; font-size: 14px; font-weight: 600; }
input, select { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; font: inherit; font-weight: 400; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { display: block; width: 100%; min-height: 110px; margin-top: 6px; padding: 11px 12px; font: inherit; font-weight: 400; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; outline: none; resize: vertical; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
label select + select, label input + select { margin-top: 8px; }

label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--muted); }
label.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }

button { font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 11px 18px; cursor: pointer; background: var(--accent); color: #fff; transition: background .15s, opacity .15s; }
button:hover { background: var(--accent-dark); }
button:disabled { opacity: .5; cursor: default; }
#call.call-busy, #call.call-busy:hover { background: color-mix(in srgb, var(--line) 82%, var(--bg)); color: var(--muted);
  border: 1px solid var(--line); box-shadow: none; opacity: 1; cursor: not-allowed; }
button.ghost, #calls button, #forget, #stop, #end { background: transparent; color: var(--text); border: 1px solid var(--line); padding: 7px 12px; font-size: 14px; }
button.ghost:hover, #calls button:hover, #forget:hover, #stop:hover { background: var(--bg); }
#end { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
button.full { width: 100%; padding: 13px; }

.msg { margin: 12px 0 0; font-size: 14px; min-height: 0; }
.msg:empty { display: none; }
.small { font-size: 13px; color: var(--muted); }
a { color: var(--muted); }

#opener { background: var(--bg); border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; font-style: italic; }
#opener:empty { display: none; }

.status { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.status:has(span:empty) { display: none; }
.status + .status { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
#live-card:not(:has(span:not(:empty))) { display: none; }

#calls { list-style: none; margin: 0; padding: 0; }
#calls li { padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
#calls li:first-child { border-top: 0; padding-top: 0; }
#calls li button { margin-left: 0 !important; }
#calls audio { width: 100%; margin-top: 4px; }

details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details[open] summary { margin-bottom: 14px; }
footer { text-align: center; margin-top: 24px; }

.row { display: flex; gap: 12px; align-items: flex-end; }
.row > label { flex: 1; min-width: 0; }
.row > input { flex: 1; }
@media (max-width: 480px) { .row { flex-direction: column; align-items: stretch; } }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-size: 14px; }
.list li:first-child { border-top: 0; padding-top: 0; }
.list li button { background: transparent; color: var(--text); border: 1px solid var(--line); padding: 6px 11px; font-size: 13px; margin-left: 0 !important; }
.list li button:hover { background: var(--bg); }

/* ---- Step flow ---- */
.step { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; margin: 26px 0 12px; }
.step:first-child { margin-top: 0; }
.step span { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; display: grid; place-items: center; flex: none; }
.center { text-align: center; }
.contacts-more { grid-column: 1 / -1; width: 100%; padding: 10px !important; font-size: 14px; }
.linkish { background: none !important; color: var(--muted) !important; border: 0 !important; padding: 6px 4px !important; font-weight: 500; font-size: 13px; text-decoration: underline; grid-column: 1 / -1; justify-self: start; }

/* ---- Contact tiles ---- */
#contact-search { margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 4px; }
.contact { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--bg) !important; color: var(--text) !important;
  border: 2px solid transparent !important; border-radius: 12px; padding: 10px !important; font-weight: 400; position: relative; min-width: 0; }
.contact:hover { border-color: var(--line) !important; }
.contact.selected { border-color: var(--accent) !important; background: color-mix(in srgb, var(--accent) 8%, var(--card)) !important; }
.contact.off { opacity: .45; cursor: default; }
.contact .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex: none; }
.contact.selected .avatar { background: var(--accent); color: #fff; border-color: var(--accent); }
.contact .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.contact .who strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.contact .who .small { font-size: 12px; }
.contact.add .avatar { font-size: 18px; color: var(--accent); }
.contact .del { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; }
#manual { margin-top: 12px; }

/* ---- Scenario tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 16px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px !important; text-align: center; font-size: 13px; font-weight: 600;
  background: var(--bg) !important; color: var(--text) !important; border: 2px solid transparent !important; border-radius: 12px; line-height: 1.25; }
.tile:hover { border-color: var(--line) !important; }
.tile.selected { border-color: var(--accent) !important; background: color-mix(in srgb, var(--accent) 8%, var(--card)) !important; }
.tile .icon { font-size: 28px; }
.tile .small { font-size: 11px; font-weight: 500; }

/* ---- Live call bar sticks to the top while a call is going ---- */
.card.live { position: sticky; top: 10px; z-index: 5; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 6px 20px rgba(0,0,0,.08); }

details.card summary { font-weight: 600; color: var(--text); }

.contact .ren { position: absolute; top: -6px; right: 20px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: var(--card); font-size: 12px; display: grid; place-items: center; }

[hidden] { display: none !important; }

/* ---- Desktop: use the width ---- */
body.wide main { max-width: 1180px; }
body.wide #login { max-width: 420px; margin-left: auto; margin-right: auto; }
.layout { display: grid; gap: 16px; align-items: start; }
.layout > div > .card:last-child { margin-bottom: 0; }
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); }
  .col-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
  /* step 2 options sit side by side */
  #fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .tiles { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) { body.wide main { padding-top: 32px; } }

#calls li > div:first-child { flex: 1 1 100%; }
#calls li button { padding: 6px 10px; font-size: 13px; }

/* Recent calls: details on the left, buttons stacked on the right */
#calls li { flex-wrap: nowrap; align-items: center; gap: 12px; }
#calls li .info { flex: 1; min-width: 0; }
#calls li .actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
#calls li .actions button { width: 100%; text-align: left; white-space: nowrap; }
#calls li .actions audio { width: 200px; }
#calls-search { height: 30px; padding: 4px 9px; }
#calls-delete-all { padding: 6px 10px; font-size: 13px; }

.who-bar { display: flex; align-items: center; gap: 10px; }
#login { max-width: 420px; margin-left: auto; margin-right: auto; }

.hint { margin: -6px 0 12px; }

/* Logged-in badge + log out, lined up as a matching pair */
.who-bar { display: flex; align-items: center; gap: 8px; }
#who-name { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--text); line-height: 1; margin: 0; }
.who-bar #forget { height: 38px; padding: 0 14px; display: inline-flex; align-items: center; font-size: 14px; line-height: 1; margin: 0; }
.who-bar { gap: 14px !important; }
.who-bar #who-name { margin-right: 2px; }

/* Compact name + number row */
.row.compact { gap: 10px; }
.row.compact > label { margin-bottom: 10px; font-size: 13px; }
.row.compact > label .small { font-size: 12px; font-weight: 400; }
.row.compact input { padding: 8px 10px; margin-top: 4px; font-size: 15px; border-radius: 8px; }
.row.compact > label.phone-col { flex: 1.3; }
#manual .hint { margin: 0 0 10px; font-size: 12px; }
#manual label.check { margin-bottom: 4px; font-size: 13px; }
.row.compact > .names { flex: 2; min-width: 0; }
.row.compact > .names .row.compact > label { margin-bottom: 4px; }
.row.compact > .names .hint { margin: 2px 0 10px; }
.row.compact > label.phone-col { align-self: flex-start; }
@media (max-width: 480px) { .row.compact > .names .row.compact { flex-direction: row; } }

/* Name + number: First | Last | Number, with the note under the two name boxes */
.who-grid { display: grid; grid-template-columns: 1fr 1fr 1.15fr; grid-template-areas: "first last phone" "hint hint ."; gap: 0 12px; }
.who-grid > label { margin: 0 0 6px; font-size: 13px; min-width: 0; }
.who-grid > label .small { font-size: 12px; font-weight: 400; }
.who-grid input { padding: 9px 11px; margin-top: 4px; font-size: 15px; border-radius: 8px; width: 100%; }
.g-first { grid-area: first; } .g-last { grid-area: last; } .g-phone { grid-area: phone; }
.who-grid .g-hint { grid-area: hint; margin: 0 0 12px; font-size: 12px; }
@media (max-width: 600px) {
  .who-grid { grid-template-columns: 1fr 1fr; grid-template-areas: "first last" "hint hint" "phone phone"; }
}

/* Name + number boxes: normal size, just sitting close together */
.who-grid { gap: 0 6px !important; }

/* Logged-in pill: [avatar] name | Log out */
.who-bar { gap: 0 !important; height: 40px; padding: 0 4px 0 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.who-bar .who-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; }
.who-bar .who-avatar.crown { background: var(--bg); font-size: 16px; }
.who-bar #who-name { height: auto !important; padding: 0 10px 0 9px !important; border: 0 !important; background: none !important; border-radius: 0 !important;
  font-size: 14px; font-weight: 600; margin: 0 !important; }
.who-bar .who-sep { width: 1px; height: 20px; background: var(--line); }
.who-bar #forget { height: 32px !important; padding: 0 12px !important; border: 0 !important; border-radius: 999px; background: none !important;
  color: var(--muted) !important; font-weight: 600; margin-left: 4px !important; }
.who-bar #forget:hover { background: var(--bg) !important; color: var(--text) !important; }
.who-bar #settings-open, .who-bar #admin-open { height: 30px; padding: 5px 9px; border: 0; border-radius: 999px; font-size: 13px; white-space: nowrap; }

/* "New number" tile: keep the + visible when selected */
.contact.add.selected .avatar { color: #fff; }

/* Admin user list: details on top, buttons in a row underneath */
#users li.user-row { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 0; }
#users .user-info { line-height: 1.35; }
#users .user-info .small { margin-top: 2px; word-break: break-word; }
#users .tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 2px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
#users .user-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#users .user-actions button { padding: 5px 10px; font-size: 12.5px; white-space: nowrap; }

/* ---------- iPhone / app mode ---------- */
/* Keep content clear of the notch / Dynamic Island and the home bar */
main { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); padding-bottom: max(64px, calc(env(safe-area-inset-bottom) + 24px)); }
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); -webkit-user-select: none; user-select: none; }
  input, textarea { -webkit-user-select: text; user-select: text; }
  .card.live { top: calc(env(safe-area-inset-top) + 8px); }
}
* { -webkit-tap-highlight-color: transparent; }
button, .contact, .tile { touch-action: manipulation; }   /* no double-tap zoom delay */
@media (max-width: 700px) {
  body.wide header { flex-wrap: wrap; }
  body.wide header .who-bar { margin-left: auto; }
  /* iOS zooms into any box with text under 16px, so keep them at 16px on phones */
  input, select, textarea { font-size: 16px !important; }
  main { padding-top: 12px; }
  body.wide header { margin-bottom: 12px; }
  h1 { font-size: 24px; }
  .card { padding: 16px; }
  .who-bar #who-name { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block !important; line-height: 40px !important; }
  .tiles { grid-template-columns: 1fr 1fr !important; }
  .tile { flex-direction: row; justify-content: flex-start; text-align: left; gap: 8px; padding: 10px !important; }
  .tile .icon { font-size: 22px; }
  .grid { grid-template-columns: 1fr 1fr !important; }
  #fields { display: block; }
  #calls li { flex-wrap: wrap; }
  #calls li .actions { flex-direction: row; flex-wrap: wrap; width: 100%; }
  #calls li .actions button { width: auto; }
}

.install-hint { display: flex; align-items: center; gap: 12px; }
.install-hint img { border-radius: 10px; flex: none; }
.install-hint > div { flex: 1; min-width: 0; }
.install-hint .x { background: none !important; color: var(--muted) !important; padding: 6px 8px !important; border: 0 !important; }
.share-ico { display: inline-block; border: 1px solid var(--muted); border-radius: 4px; padding: 0 4px; font-size: 11px; line-height: 1.4; }
@media (max-width: 700px) {
  body.wide header h1 { font-size: 22px; white-space: nowrap; }
  body.wide header { gap: 8px; }
  .who-bar { height: 36px; padding: 0 2px 0 3px; flex: none; }
  .who-bar .who-avatar { width: 28px; height: 28px; font-size: 12px; }
  .who-bar #who-name { max-width: 22vw; padding: 0 6px !important; font-size: 13px; line-height: 36px !important; }
  .who-bar .who-sep { height: 16px; }
  .who-bar #forget { white-space: nowrap; height: 30px !important; padding: 0 9px !important; font-size: 13px; margin-left: 2px !important; }
  .contact { padding: 8px !important; gap: 8px; }
  .contact .avatar { width: 32px; height: 32px; font-size: 12px; }
  .contact .who strong { font-size: 14px; }
}
@media (max-width: 700px) { .contact .who strong { white-space: normal; overflow: visible; } }

/* Admin: big ✕ in the corner of each user card to delete them */
#users li.user-row { position: relative; padding-right: 64px; }
#users li.user-row > .user-x { position: absolute !important; top: 10px; right: 0; width: 52px !important; height: 52px; padding: 0 !important; margin: 0 !important; border-radius: 50%;
  display: grid; place-items: center; font-size: 26px; font-weight: 600; line-height: 1;
  background: transparent !important; color: var(--muted) !important; border: 1px solid var(--line) !important; }
#users .user-x:hover { background: color-mix(in srgb, var(--bad) 15%, transparent) !important; color: var(--bad) !important; border-color: var(--bad) !important; }

/* ---- Admin user cards (polished) ---- */
#users { display: grid; gap: 10px; }
#users li.user-row { position: relative; display: block !important; border: 1px solid var(--line) !important; border-radius: 14px;
  background: var(--bg); padding: 14px 16px 14px 14px !important; margin: 0 !important; }
#users li.user-row:first-child { padding-top: 14px !important; }
#users .user-head { display: flex; gap: 12px; align-items: flex-start; padding-right: 44px; }
#users .user-avatar { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 17px; }
#users .user-info { flex: 1; min-width: 0; }
#users .user-name { display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 1.3; }
#users .user-name .tag { margin: 0; }
#users .user-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--text); opacity: .85; margin-top: 4px; word-break: break-word; }
#users .user-meta.dim { color: var(--muted); opacity: 1; margin-top: 2px; }
#users .user-meta em { font-style: normal; color: var(--muted); }
#users .user-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
#users .user-actions button { padding: 6px 11px !important; font-size: 12.5px !important; font-weight: 600; border-radius: 999px !important;
  background: var(--card) !important; border: 1px solid var(--line) !important; color: var(--text) !important; margin: 0 !important; }
#users .user-actions button:hover { border-color: var(--accent) !important; }
#users li.user-row > .user-x { top: 12px !important; right: 12px !important; width: 36px !important; height: 36px !important; font-size: 18px !important;
  background: var(--card) !important; }

/* Setting with a description and an iOS-style switch on the right */
.setting-row { display: flex !important; align-items: center; justify-content: space-between; gap: 14px; margin: 0 !important;
  padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400; }
.setting-row .setting-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 15px; }
.setting-row .setting-text .small { line-height: 1.4; }
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 46px !important; height: 28px; margin: 0 !important; padding: 0 !important;
  border-radius: 999px; background: var(--line); border: 0 !important; position: relative; cursor: pointer; transition: background .2s; box-shadow: none !important; }
input.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
input.switch:checked { background: #34c759; }
input.switch:checked::after { transform: translateX(18px); }

/* Pop-up dialog (e.g. a user's calls) */
dialog.modal { width: min(640px, calc(100vw - 24px)); max-height: min(80vh, 760px); padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--card); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.5); overflow: hidden; display: flex; flex-direction: column; }
dialog.settings-dialog, dialog.admin-dialog { height: min(80vh, 760px); height: min(80dvh, 760px); max-height: calc(100dvh - 24px); }
dialog.modal:not([open]) { display: none; }
dialog.modal::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--text); }
.modal-x { position: static !important; width: 36px !important; height: 36px !important; font-size: 18px !important; padding: 0 !important; border-radius: 50% !important;
  display: flex !important; align-items: center; justify-content: center; line-height: 1; font-family: Arial, sans-serif;
  background: var(--bg) !important; color: var(--muted) !important; border: 1px solid var(--line) !important; flex: none; }
.modal-x:hover { background: color-mix(in srgb, var(--bad) 13%, var(--bg)) !important; color: var(--bad) !important; border-color: var(--bad) !important; }
.admin-content, .settings-content { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 16px 20px 20px; }
.settings-content .row, .admin-content .row { flex-wrap: wrap; }
.settings-content .row > input, .admin-content .row > input { min-width: 0; flex: 1 1 160px; }
.uc-list { list-style: none; margin: 0; padding: 12px 20px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; display: grid; gap: 10px; }
.uc-list li { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.uc-top { display: flex; gap: 10px; align-items: flex-start; }
.uc-icon { font-size: 22px; line-height: 1.2; }
.uc-actions { margin-top: 10px; display: flex; gap: 6px; align-items: center; }
.uc-actions button { padding: 6px 12px !important; font-size: 13px !important; border-radius: 999px !important; background: var(--card) !important;
  border: 1px solid var(--line) !important; color: var(--text) !important; margin: 0 !important; }
.uc-actions audio { width: 100%; }
.uc-list details { margin-top: 8px; }
.uc-transcript { white-space: pre-wrap; font: 12.5px/1.5 ui-monospace, Menlo, monospace; color: var(--muted); background: var(--card);
  border-radius: 8px; padding: 10px; margin: 6px 0 0; max-height: 260px; overflow-y: auto; }

/* ---- Prankstar logo (same as the app's top-left): glowing icon + rounded gradient name ---- */
@font-face { font-family: "Prankstar Rounded"; src: url("/fonts/Nunito.ttf") format("truetype"); font-weight: 200 1000; font-display: swap; }
.brand-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; line-height: 1; }
.brand-logo img { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 3px 12px rgba(255, 90, 54, .45); flex: none; }
.brand-logo span { font-family: "Prankstar Rounded", ui-rounded, "SF Pro Rounded", -apple-system, sans-serif; font-weight: 900;
  font-size: 26px; letter-spacing: -0.3px; padding-bottom: 2px;
  background: linear-gradient(90deg, #FFC733, #FF5A36); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-logo.small img { width: 30px; height: 30px; border-radius: 8px; }
.brand-logo.small span { font-size: 22px; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .brand-logo span { background-image: linear-gradient(90deg, #F2A000, #E8381A); }   /* deeper so it reads on white */
}
:root[data-theme="light"] .brand-logo span { background-image: linear-gradient(90deg, #F2A000, #E8381A); }
h1 .brand-logo { vertical-align: middle; }
@media (max-width: 700px) { .brand-logo img { width: 30px; height: 30px; border-radius: 8px; } .brand-logo span { font-size: 21px; } .brand-logo { gap: 8px; } }

/* Recent calls: keep call details full-width and group actions neatly below. */
#calls li { flex-direction: column; align-items: stretch; gap: 8px; }
#calls li .info { flex: none; width: 100%; min-width: 0; }
#calls li .actions { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
#calls li .actions button { width: auto; min-height: 36px; display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 12px; text-align: center; white-space: nowrap; border-radius: 10px; }
#calls li .actions audio { width: min(100%, 280px); }
.recording-player { width: min(100%, 420px); min-width: 0; flex: 1 1 300px; display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--bg) 75%, var(--card)); }
.recording-player audio { display: none; }
.recording-play { width: 28px !important; height: 28px; flex: none; display: grid; place-items: center; padding: 0 !important; margin: 0 !important;
  border: 0 !important; border-radius: 7px !important; background: transparent !important; color: var(--text) !important; line-height: 1; }
.recording-play:hover { background: color-mix(in srgb, var(--text) 9%, transparent) !important; }
.recording-play svg { display: block; width: 15px; height: 15px; fill: currentColor; }
.recording-time { flex: none; min-width: 32px; color: var(--text); font-size: 12px; line-height: 1; font-variant-numeric: tabular-nums; text-align: center; }
.recording-seek { appearance: none; -webkit-appearance: none; flex: 1 1 48px; min-width: 38px; width: auto !important; height: 16px; margin: 0 !important; padding: 0 !important;
  border: 0 !important; border-radius: 0 !important; outline: 0; background: transparent !important; box-shadow: none !important; cursor: pointer; }
.recording-seek::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, #0a84ff var(--progress, 0%), color-mix(in srgb, var(--text) 18%, transparent) var(--progress, 0%)); }
.recording-seek::-moz-range-track { height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--text) 18%, transparent); }
.recording-seek::-moz-range-progress { height: 4px; border-radius: 4px; background: #0a84ff; }
.recording-seek::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 13px; height: 13px; margin-top: -4.5px; border: 0; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.recording-seek::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.recording-seek:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.recording-volume { flex: none; display: flex !important; align-items: center; gap: 4px; margin: 0 !important; color: var(--muted); }
.recording-volume-icon { font-size: 14px; line-height: 1; }
.recording-volume-slider { appearance: none; -webkit-appearance: none; width: 58px !important; height: 16px; margin: 0 !important; padding: 0 !important;
  border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; accent-color: #0a84ff; cursor: pointer; }
.recording-volume-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--text) 18%, transparent); }
.recording-volume-slider::-moz-range-track { height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--text) 18%, transparent); }
.recording-volume-slider::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 13px; height: 13px; margin-top: -4.5px; border: 0; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.recording-volume-slider::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.recording-volume-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#calls .actions .recording-player { box-sizing: border-box; display: flex; flex-flow: row nowrap; align-items: center; gap: 7px;
  width: min(100%, 420px); min-width: 0; flex: 1 1 300px; padding: 6px 8px; overflow: hidden; }
#calls .actions .recording-play { display: flex !important; align-items: center; justify-content: center; flex: 0 0 28px; width: 28px !important;
  min-width: 28px !important; min-height: 28px !important; height: 28px !important; padding: 0 !important; }
#calls .actions .recording-time { flex: 0 0 32px; min-width: 32px; }
#calls .actions .recording-seek { flex: 1 1 38px; min-width: 24px; width: auto !important; }
#calls .actions .recording-volume { flex: 0 0 auto; display: flex !important; flex-flow: row nowrap; align-items: center; }
#calls .actions .recording-volume-slider { flex: 0 0 58px; width: 58px !important; min-width: 58px !important; }
#calls .actions button.is-shared { color: var(--ok) !important; border-color: color-mix(in srgb, var(--ok) 42%, var(--line)) !important;
  background: color-mix(in srgb, var(--ok) 12%, transparent) !important; }
#calls .actions button.is-shared:hover { background: color-mix(in srgb, var(--ok) 22%, transparent) !important; }
#calls-card { display: flex; flex-direction: column; max-height: var(--calls-card-height, calc(100dvh - 32px)); overflow: hidden; }
#calls-card > h2, #calls-card > .row, #calls-card > #calls-msg { flex: 0 0 auto; }
#calls-card #calls-list-wrap { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
#calls-card #calls-list-frame { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
#calls-scroll-area { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none !important; -ms-overflow-style: none !important; }
#calls-scroll-area::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
#calls-card.expanded { height: var(--calls-card-height, calc(100dvh - 32px)); }
#calls-scroll-area.expanded { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding-right: 14px;
  scrollbar-width: none; }
#calls-scroll-area.expanded::-webkit-scrollbar { display: none; }
#calls-scroll-area:not(.expanded) { scrollbar-width: none; }
#calls-scroll-area:not(.expanded)::-webkit-scrollbar { display: none; }
#calls-list-frame.has-fade #calls-scroll-area { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - var(--calls-fade-height, 100px)), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 calc(100% - var(--calls-fade-height, 100px)), transparent 100%); }
#calls-scrollbar { display: none; position: absolute; z-index: 2; top: 4px; right: 0; bottom: 4px; width: 14px;
  border-radius: 999px; cursor: pointer; touch-action: none; }
#calls-scrollbar::before { content: ""; position: absolute; inset: 0 5px; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  border-radius: inherit; background: color-mix(in srgb, var(--text) 8%, transparent); box-shadow: inset 0 1px 2px rgba(0,0,0,.14);
  transition: background-color .18s, border-color .18s; }
#calls-list-frame.has-overflow #calls-scrollbar { display: block; }
#calls-scroll-thumb { position: absolute; top: 0; left: 3px; width: 8px; min-height: 34px; border: 1px solid color-mix(in srgb, var(--accent) 80%, white);
  border-radius: 999px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 72%, white), var(--accent));
  box-shadow: 0 2px 7px color-mix(in srgb, var(--accent) 38%, transparent), 0 1px 3px rgba(0,0,0,.28);
  transition: box-shadow .5s, border-color .5s; cursor: grab; }
#calls-scroll-thumb:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 58%, white), var(--accent));
  box-shadow: 0 2px 11px color-mix(in srgb, var(--accent) 52%, transparent), 0 1px 3px rgba(0,0,0,.28); }
#calls-scroll-thumb:active { border-color: var(--accent-dark);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--accent) 62%, transparent); cursor: grabbing; }

/* ---------- Login: full-screen welcome, like an app's first screen ---------- */
body.logged-out header { display: none; }
.login-screen { position: relative; min-height: calc(100vh - 40px); min-height: calc(100dvh - 40px); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px 0 32px; text-align: center; overflow: hidden; }
.login-screen[hidden] { display: none !important; }
.login-glow { position: absolute; top: 4%; left: 50%; width: 520px; height: 520px; transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 32%, transparent) 0%, transparent 62%); filter: blur(10px); opacity: .9; }
.login-hero { position: relative; display: flex; flex-direction: column; align-items: center; margin-bottom: 28px; }
.login-icon { width: 112px; height: 112px; border-radius: 26px; box-shadow: 0 18px 50px color-mix(in srgb, var(--accent) 45%, transparent), 0 2px 0 rgba(255,255,255,.12) inset;
  animation: login-float 5s ease-in-out infinite; }
@keyframes login-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { .login-icon { animation: none; } }
.login-name { margin-top: 18px; }
.login-name span { font-size: 42px !important; letter-spacing: -0.8px; }
.login-tag { margin: 6px 0 0; color: var(--muted); font-size: 17px; }
.login-card { position: relative; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; }
.login-input { margin: 0 !important; padding: 15px 16px !important; font-size: 17px !important; border-radius: 14px !important; background: var(--card) !important;
  border: 1px solid var(--line) !important; text-align: left; }
.login-input[hidden] { display: none !important; }
.login-input:focus { border-color: var(--accent) !important; }
.login-btn { margin-top: 6px; padding: 16px !important; font-size: 17px !important; border-radius: 14px !important; width: 100%;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 35%, transparent); }
.login-alt { background: transparent !important; color: var(--accent) !important; font-weight: 600; padding: 8px !important; font-size: 15px !important; }
.login-alt[hidden] { display: none !important; }
.login-remember { display: flex !important; align-items: center; justify-content: center; gap: 8px; margin: 2px 0 0 !important; font-weight: 400 !important;
  font-size: 14px !important; color: var(--muted); }
.login-remember input { width: 18px !important; height: 18px; margin: 0 !important; accent-color: var(--accent); }
.login-msg { min-height: 1.4em; margin: 2px 0 0 !important; text-align: center; }
.login-links { position: relative; margin-top: 18px; display: flex; gap: 10px; justify-content: center; font-size: 15px; }
.login-links a { color: var(--muted); text-decoration: none; font-weight: 600; }
.login-links a:hover { color: var(--accent); }
.login-links span { color: var(--line); }
/* let the glow fade out naturally instead of being clipped into a box */
.login-screen { overflow: visible !important; }
body.logged-out { overflow-x: hidden; }
.login-glow { width: min(560px, 140vw); height: min(560px, 140vw); filter: blur(24px); }

/* ---------- Recent calls: tidy rows ---------- */
#calls li.call-row[hidden] { display: none !important; }   /* rows past the first 5 until "Show more" */
#calls li.call-row { display: grid !important; grid-template-columns: 40px 1fr; grid-template-areas: "ico info" "acts acts";
  gap: 4px 12px !important; align-items: center; padding: 12px 0 !important; border-top: 1px solid var(--line); flex-direction: unset !important; }
#calls li.call-row:first-child { border-top: 0; padding-top: 2px !important; }
#calls .call-ico { grid-area: ico; width: 40px; height: 40px; border-radius: 11px; background: var(--bg); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 20px; }
#calls li.call-row .info { grid-area: info; min-width: 0; width: auto !important; }
#calls .call-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
#calls .call-title strong { font-size: 15px; white-space: nowrap; }
#calls .in-tag { color: #0a84ff; font-weight: 600; white-space: nowrap; }
#calls .call-meta .nowrap { white-space: nowrap; }
#calls .call-scen { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#calls .call-meta { margin-top: 1px; display: flex; align-items: center; gap: 6px; }
#calls .live-dot { width: 8px; height: 8px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 3px color-mix(in srgb, #34c759 25%, transparent);
  animation: live-pulse 1.4s ease-in-out infinite; flex: none; }
@keyframes live-pulse { 50% { opacity: .35; } }
#calls li.call-row .actions { grid-area: acts; display: flex !important; flex-flow: row wrap !important; gap: 6px !important; margin: 8px 0 0 52px;
  width: auto !important; align-items: center; }
#calls li.call-row .actions > button { height: 32px; min-height: 32px !important; padding: 0 12px !important; border-radius: 999px !important;
  font-size: 13px !important; font-weight: 600; width: auto !important; white-space: nowrap; display: inline-flex; align-items: center;
  background: var(--bg) !important; border: 1px solid var(--line) !important; color: var(--text) !important; }
#calls li.call-row .actions > button:hover { border-color: var(--accent) !important; }
#calls li.call-row .actions > button.is-danger { color: var(--bad) !important; border-color: color-mix(in srgb, var(--bad) 45%, transparent) !important; }
#calls li.call-row .actions > button.is-shared { color: #1f9d55 !important; border-color: color-mix(in srgb, #1f9d55 45%, transparent) !important;
  background: color-mix(in srgb, #1f9d55 10%, var(--bg)) !important; }
#calls li.call-row .actions > .recording-player { flex: 1 1 100%; order: 10; margin-top: 2px; }
@media (max-width: 480px) { #calls li.call-row .actions { margin-left: 0; } }

/* Phones / narrow screens: normal-height panel; the expanded list scrolls inside a comfortable height. */
@media (max-width: 899px) {
  #calls-card, #calls-card.expanded { max-height: none !important; height: auto !important; overflow: visible !important; }
  #calls-scroll-area.expanded { height: auto !important; max-height: 70dvh; }
}

/* Sign-up / forgot password share the login screen's look */
.login-page { max-width: 560px; }
.login-screen #ask, .login-screen #set { width: 100%; display: flex; flex-direction: column; align-items: center; }
.login-screen #ask[hidden], .login-screen #set[hidden] { display: none; }
.login-icon.small-icon { width: 88px; height: 88px; border-radius: 21px; }
.login-screen .login-tag { font-size: 22px; font-weight: 800; color: var(--text); margin: 4px 0 4px; }
.login-sub { color: var(--muted); margin: 0 0 22px; max-width: 380px; font-size: 15px; }
.login-row { display: flex; gap: 8px; }
.login-row .login-input { flex: 1; min-width: 0; }
.login-side-btn { flex: none; border-radius: 14px !important; padding: 0 14px !important; font-size: 14px !important; white-space: nowrap;
  background: var(--card) !important; color: var(--accent) !important; border: 1px solid var(--line) !important; font-weight: 700; }
.closed-card { text-align: center; border-radius: 18px; padding: 22px; margin-bottom: 14px;
  /* the same see-through glass as the login boxes, never solid */
  background: color-mix(in srgb, var(--card) 52%, transparent); border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent), 0 6px 20px rgba(0, 0, 0, .12); }
:root[data-theme="light"] .closed-card { background: color-mix(in srgb, #fff 62%, transparent); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .closed-card { background: color-mix(in srgb, #fff 62%, transparent); } }
.closed-card[hidden] { display: none !important; }
form[aria-disabled="true"] { opacity: .45; pointer-events: none; }
form#signup[hidden] { display: none !important; }

/* Login, sign-up and forgot password: identical scale */
.login-icon, .login-icon.small-icon { width: 100px !important; height: 100px !important; border-radius: 24px !important; }
.login-name span { font-size: 40px !important; }
.login-name { margin-top: 16px !important; }
.login-hero { margin-bottom: 18px !important; }
.login-screen .login-tag { margin: 0 0 4px !important; }
.login-card { max-width: 380px !important; }
.login-sub { margin-bottom: 20px !important; }
.login-screen > .login-tag:only-of-type { margin-bottom: 26px !important; }

/* Seamless page transitions between login, sign-up and forgot password (Safari 18.2+, Chrome 126+).
   The icon and name stay put; only the form cross-fades. Older browsers just load normally. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .login-icon { view-transition-name: ps-icon; }
  .login-name { view-transition-name: ps-name; }
  /* The glow stays part of the page (no name of its own): a named layer is drawn on top of everything during the
     transition, so it covered the boxes and then jumped behind them when it finished. It's identical on every page, so it just stays put. */
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; animation-timing-function: ease; }
  ::view-transition-group(ps-icon), ::view-transition-group(ps-name) { animation-duration: .35s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
}
/* Logged-out visitors see the login screen straight away (no flash, and page transitions line up). */
html.pre-login #login-screen { display: flex !important; }
html.pre-login header, html.pre-login #panel { display: none !important; }
/* Same icon/name position on all three screens (so the page transition keeps them perfectly still) */
.login-screen { justify-content: flex-start !important; padding-top: max(56px, 9vh) !important; min-height: 100vh; min-height: 100dvh; }
@media (min-width: 900px) { main.login-page { padding-top: 32px !important; } }
.allowance { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--muted); }
.allowance[hidden] { display: none !important; }
.allowance button { padding: 5px 11px !important; font-size: 12.5px !important; border-radius: 999px !important; }

/* ---------- Login / sign-up / forgot password: exactly one screen, no scrolling ---------- */
html.pre-login, html.pre-login body, body.logged-out { height: 100%; overflow: hidden; overscroll-behavior: none; }
html:has(body.logged-out) { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.pre-login main, body.logged-out main { padding-top: 0 !important; padding-bottom: 0 !important; }
.login-screen { height: 100vh; height: 100dvh; min-height: 0 !important; padding-top: max(24px, env(safe-area-inset-top), 7vh) !important;
  padding-bottom: max(16px, env(safe-area-inset-bottom)) !important; box-sizing: border-box; }
@media (min-width: 900px) { main.login-page, html.pre-login main, body.logged-out main { padding-top: 0 !important; } }
/* Shorter screens: tighten everything so it still fits */
@media (max-height: 760px) {
  .login-icon, .login-icon.small-icon { width: 80px !important; height: 80px !important; border-radius: 19px !important; }
  .login-name span { font-size: 34px !important; }
  .login-name { margin-top: 10px !important; }
  .login-hero { margin-bottom: 10px !important; }
  .login-sub { margin-bottom: 12px !important; font-size: 14px; }
  .login-input { padding: 12px 14px !important; font-size: 16px !important; }
  .login-btn { padding: 13px !important; }
  .login-card { gap: 8px !important; }
  .login-links { margin-top: 10px !important; }
}
@media (max-height: 640px) {
  .login-icon, .login-icon.small-icon { width: 60px !important; height: 60px !important; border-radius: 15px !important; }
  .login-name span { font-size: 28px !important; }
  .login-sub { display: none; }
  .login-screen .login-tag { font-size: 18px !important; margin-bottom: 10px !important; }
}
@media (max-height: 700px) {
  .login-screen { padding-top: max(14px, env(safe-area-inset-top), 3vh) !important; }
  .login-card { gap: 6px !important; }
  .login-input { padding: 10px 14px !important; }
  .login-btn { padding: 11px !important; margin-top: 2px !important; }
  .login-hero { margin-bottom: 6px !important; }
  .login-msg:empty { display: none; }
}
/* Incoming call pop-up */
.inbound-modal { max-width: 520px; }
.in-timer { font: 700 22px/1 ui-monospace, Menlo, monospace; color: var(--accent); min-width: 44px; text-align: right; }
.in-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 50vh; overflow-y: auto; }
.in-tile { display: flex; align-items: center; gap: 8px; text-align: left; padding: 10px !important; border-radius: 12px !important; font-size: 13px !important;
  font-weight: 600; background: var(--bg) !important; color: var(--text) !important; border: 1px solid var(--line) !important; }
.in-tile.in-carry { grid-column: 1 / -1; font-weight: 600; border-color: var(--accent) !important; background: color-mix(in srgb, var(--accent) 12%, transparent) !important; }
.in-tile:hover { border-color: var(--accent) !important; }
.in-tile span:first-child { font-size: 20px; }

/* Login / sign-up / reset fields: see-through "liquid glass" that stays the same from the first frame to the last.
   No backdrop-filter: Safari composites it a moment after the page appears, which made the boxes flip from clear to solid black. */
.login-input, .login-side-btn {
  background: color-mix(in srgb, var(--card) 52%, transparent) !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent) !important;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent), 0 6px 20px rgba(0, 0, 0, .12) !important;
  transition: border-color .2s, box-shadow .2s;
}
.login-input:focus { border-color: color-mix(in srgb, var(--accent) 70%, transparent) !important;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 12%, transparent), 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent) !important; }
/* Saved-password autofill: browsers paint their own solid box behind the text. Clip that away and redraw the glass
   with an inset shadow instead, so an autofilled box looks exactly like the others. */
.login-input:-webkit-autofill, .login-input:-webkit-autofill:hover, .login-input:-webkit-autofill:focus {
  -webkit-background-clip: text !important; background-clip: text !important;
  -webkit-text-fill-color: var(--text) !important; caret-color: var(--text);
  box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--card) 52%, transparent), inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent) !important;
}
:root[data-theme="light"] .login-input, :root[data-theme="light"] .login-side-btn { background: color-mix(in srgb, #fff 62%, transparent) !important; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .login-input, :root:not([data-theme="dark"]) .login-side-btn { background: color-mix(in srgb, #fff 62%, transparent) !important; } }

/* "Log in with SMS": a see-through button under Log in, and a phone box with +44 built in */
.login-sms-btn { width: 100%; padding: 14px 16px !important; border-radius: 14px !important; font-size: 16px !important; font-weight: 600;
  color: var(--text) !important; background: color-mix(in srgb, var(--card) 52%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent) !important; box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent) !important; }
.login-sms-btn:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent) !important; }
.phone-box { display: flex !important; align-items: center; gap: 10px; }
.phone-box[hidden] { display: none !important; }
.phone-box:focus-within { border-color: color-mix(in srgb, var(--accent) 70%, transparent) !important;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 12%, transparent), 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent) !important; }
.phone-cc { flex: none; font-weight: 600; padding-right: 10px; border-right: 1px solid color-mix(in srgb, var(--text) 16%, transparent); }
.phone-box input { flex: 1; min-width: 0; margin: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important;
  box-shadow: none !important; font: inherit; font-size: inherit !important; color: var(--text); letter-spacing: .5px; }
.code-input { text-align: center !important; font-size: 24px !important; letter-spacing: 10px; font-variant-numeric: tabular-nums; }
:root[data-theme="light"] .login-sms-btn { background: color-mix(in srgb, #fff 62%, transparent) !important; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .login-sms-btn { background: color-mix(in srgb, #fff 62%, transparent) !important; } }

/* Credits button in the top-right pill, next to the name */
.who-bar .who-credits { height: 28px; padding: 0 10px; margin: 0 6px 0 0; border: 0; border-radius: 999px; font-size: 13px; font-weight: 700;
  white-space: nowrap; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); cursor: pointer; font-variant-numeric: tabular-nums; }
.who-bar .who-credits:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
@media (max-width: 520px) { .who-bar .who-credits { height: 26px; padding: 0 8px; font-size: 12px; margin-right: 3px; } }
@media (max-width: 520px) {
  .who-bar #settings-open, .who-bar #admin-open { padding: 5px 6px; }
  .who-bar #forget { padding: 0 7px !important; }
  .who-bar .who-credits { padding: 0 7px; }
}

/* Custom scenario presets: [Presets ▾] [💾 Save as preset] [🗑] */
.preset-row { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; grid-column: 1 / -1; }
.preset-row .preset-pick { flex: 1; min-width: 0; margin: 0; }
.preset-row button { white-space: nowrap; margin: 0; padding: 8px 12px; font-size: 14px; }
.preset-row .preset-del { padding: 8px 10px; }

/* ---------- Help & support (tickets) ---------- */
.support-cta { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 12px 14px; margin: 0 0 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.support-cta .small { margin-top: 2px; line-height: 1.4; }
.support-cta button { white-space: nowrap; margin: 0; flex: none; }
dialog.support-dialog { height: min(80vh, 760px); height: min(80dvh, 760px); max-height: calc(100dvh - 24px); }
.support-body { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 16px 20px 20px; }
.support-body textarea, .ticket-detail textarea { width: 100%; margin: 10px 0 8px; resize: vertical; }
.back-btn { margin: 0 0 12px !important; padding: 6px 12px !important; font-size: 13px !important; }
.ticket-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.ticket-row { width: 100%; text-align: left; display: grid; gap: 3px; padding: 11px 13px !important; margin: 0 !important; border-radius: 12px !important;
  background: var(--bg) !important; color: var(--text) !important; border: 1px solid var(--line) !important; font-weight: 400 !important; cursor: pointer; }
.ticket-row:hover { border-color: var(--accent) !important; }
.ticket-row .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ticket-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.ticket-status { flex: none; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.st-open { color: #ff9f0a; background: color-mix(in srgb, #ff9f0a 15%, transparent); }
.st-answered { color: #0a84ff; background: color-mix(in srgb, #0a84ff 15%, transparent); }
.st-closed { color: #30d158; background: color-mix(in srgb, #30d158 15%, transparent); }
.ticket-empty { padding: 6px 2px; }
.ticket-subject { margin: 0 0 8px; font-size: 17px; }
.thread { display: grid; gap: 8px; }
.tmsg { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); max-width: 92%; }
.tmsg.from-admin { justify-self: end; background: color-mix(in srgb, var(--accent) 10%, var(--bg)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.tmsg-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tmsg-head strong { color: var(--text); }
.tmsg-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.45; }
.ticket-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 4px; }
.ticket-filter button { margin: 0; padding: 6px 12px; font-size: 13px; border-radius: 999px; background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.ticket-filter button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.ticket-actions { align-items: center; gap: 10px; }
.ticket-actions button { margin: 0; }
.ticket-status-pick { display: flex; align-items: center; gap: 8px; margin: 0 0 0 auto; font-size: 14px; }
.ticket-status-pick select { margin: 0; width: auto; }
.ticket-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 5px; border-radius: 999px;
  background: var(--bad, #ff453a); color: #fff; font-size: 11px; font-weight: 800; line-height: 1; vertical-align: 1px; }
.login-help { margin-top: 6px; }
#help-form label { display: block; }
@media (max-width: 520px) {
  .support-cta { flex-direction: column; align-items: stretch; }
  .ticket-status-pick { margin-left: 0; }
}
/* Ticket reply boxes: compact (about 2 lines), can still be dragged taller */
#sp-reply, #at-reply { min-height: 64px; height: 64px; }

/* Paying inside the "Get more calls" box (Stripe's embedded checkout): wider, scrolls if the form is tall */
#credits-box.paying { max-width: 560px !important; width: calc(100vw - 24px); }
#credits-box.paying #cr-body { max-height: calc(100vh - 160px); overflow: auto; }
#cr-checkout { margin-top: 10px; min-height: 420px; border-radius: 12px; overflow: hidden; background: #fff; }

/* ---------- Prank options (step 2): one tidy column, every box the same width and height ---------- */
#fields { display: flex !important; flex-direction: column; gap: 14px; margin-top: 14px; }
#fields > label, #fields .field-row { display: flex; flex-direction: column; gap: 6px; margin: 0; width: 100%; }
#fields .field-label { font-weight: 600; font-size: 14px; margin: 0; }
#fields input, #fields select, #fields textarea { width: 100%; box-sizing: border-box; margin: 0; }
#fields .field-combo { display: flex; align-items: stretch; width: 100%; }
#fields .field-combo input { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
#fields .field-combo .field-ideas { flex: 0 0 132px; width: 132px; min-width: 0; border-top-left-radius: 0; border-bottom-left-radius: 0;
  border-left: 0; padding-right: 30px; font-weight: 600; cursor: pointer; }
#fields .field-combo input:focus { position: relative; z-index: 1; }
#fields .preset-row { margin: 0; }
@media (max-width: 520px) { #fields .field-combo .field-ideas { flex-basis: 118px; width: 118px; padding-left: 10px; padding-right: 32px; font-size: 14px; } }
