/* Transcribe7 LinguaCall — Transcribe7 brand (blue #007FF3 / cyan #00B3FF), mobile-first. */
:root {
    --brand: #007FF3;
    --brand-hover: #0066CC;
    --brand-cyan: #00B3FF;
    --brand-soft: #EEF7FF;
    --brand-soft-2: #D9EDFF;
    --brand-gradient: radial-gradient(130% 90% at 0% 0%, #1E9FEA 0%, #0A6CCF 52%, #0A4A96 100%);

    --bg: #F4F6FA;
    --surface: #FFFFFF;
    --surface-2: #F7FAFE;
    --border: #E5E7EB;
    --text: #1F1A33;
    --muted: #5E6B82;
    --success: #16A34A;
    --success-hover: #15803D;
    --danger: #E11D48;
    --danger-hover: #BE123C;

    /* Translated text is ALWAYS this colour, everywhere. */
    --translation: #0891B2;          /* on light backgrounds */
    --translation-dark: #67E8F9;     /* on the dark call screen */

    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04);
    --sidebar-w: 280px;
    --tabbar-h: 64px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { overscroll-behavior-y: none; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .2rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
code { font-size: .85em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0 .3rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.translation { color: var(--translation); font-weight: 500; }

/* ---------- top bar ---------- */
.topbar { background: var(--brand-gradient); color: #fff; position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: .65rem 1.25rem; display: flex; align-items: center; gap: 1.5rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-tile { width: 38px; height: 38px; border-radius: 11px; background: #fff; display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); flex-shrink: 0; }
.brand-tile img { width: 26px; height: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 1.05rem; }
.brand-sub { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .7); font-weight: 600; }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a { color: rgba(255, 255, 255, .8); padding: .45rem .8rem; border-radius: 10px; font-weight: 600; font-size: .92rem; }
.nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
.nav a.active { background: #fff; color: var(--brand); }
.userbox { display: flex; align-items: center; gap: .65rem; margin-left: auto; }
.userbox .who { font-size: .88rem; font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .35); display: inline-block; flex-shrink: 0; }
.conn-dot.on { background: #4ADE80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .25); }
.topbar .btn { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .25); color: #fff; }
.topbar .btn:hover { background: rgba(255, 255, 255, .24); }
.topbar .btn-primary { background: #fff; color: var(--brand); border-color: #fff; }

/* ---------- Transcribe7 sidebar (desktop, signed in) ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 25; color: #fff;
    background: var(--brand-gradient); padding: 1.1rem 1rem; display: flex; flex-direction: column; gap: 1.1rem; overflow-y: auto;
}
.sb-brand { display: flex; align-items: center; gap: .65rem; color: #fff; padding: 0 .25rem; }
.sb-brand:hover { text-decoration: none; }
.sb-brand .brand-tile { width: 42px; height: 42px; border-radius: 12px; }
.sb-brand .brand-tile img { width: 28px; height: 28px; }
.sb-brand .brand-name { font-size: 1.2rem; }
.sb-brand .brand-sub { font-size: .62rem; color: rgba(255, 255, 255, .55); }
.sb-user { display: flex; align-items: center; gap: .75rem; color: #fff; padding: .35rem .25rem; border-radius: 12px; }
.sb-user:hover { text-decoration: none; background: rgba(255, 255, 255, .08); }
.sb-avatar {
    width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
    font-weight: 700; font-size: 1.05rem; color: #fff; background: rgba(255, 255, 255, .14);
    box-shadow: 0 0 0 3px rgba(0, 179, 255, .9), 0 0 0 6px rgba(255, 255, 255, .12);
}
.sb-user-text { display: flex; flex-direction: column; min-width: 0; }
.sb-user-name { font-weight: 600; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-status { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: rgba(255, 255, 255, .7); }
.sb-nav { display: flex; flex-direction: column; gap: .25rem; }
.sb-nav a { display: flex; align-items: center; gap: .75rem; color: #fff; font-size: 1.02rem; padding: .55rem .65rem; border-radius: 12px; }
.sb-nav a:hover { background: rgba(255, 255, 255, .1); text-decoration: none; }
.sb-nav a.active { background: rgba(255, 255, 255, .18); }
.t7-tile { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex-shrink: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.t7-tile .icon { width: 17px; height: 17px; }
.sb-bottom { margin-top: auto; display: flex; flex-direction: column; gap: .6rem; }
.sb-card {
    display: flex; align-items: center; gap: .7rem; color: #fff; padding: .7rem .8rem; border-radius: 12px;
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22);
}
.sb-card:hover { text-decoration: none; background: rgba(255, 255, 255, .16); }
.sb-card strong { display: block; font-size: .9rem; }
.sb-card small { display: block; font-size: .74rem; color: rgba(255, 255, 255, .7); }
.sb-card-ico { width: 34px; height: 34px; border-radius: 9px; background: rgba(255, 255, 255, .18); display: grid; place-items: center; flex-shrink: 0; }
.sb-card-ico .icon { width: 18px; height: 18px; }
.sb-signout {
    width: 100%; min-height: 42px; border: 0; border-radius: 12px; cursor: pointer; font: inherit; font-size: .95rem;
    color: #fff; background: rgba(255, 255, 255, .16);
}
.sb-signout:hover { background: rgba(255, 255, 255, .24); }

body.signed-in .app-main { margin-left: var(--sidebar-w); }
body.signed-in .topbar { display: none; }
body.signed-in main { max-width: 1200px; margin: 0; padding: 1.5rem 1.75rem 3rem; }

/* bottom tab bar (phones) */
.tabbar { display: none; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.card + .card { margin-top: 1rem; }

.banner { border-radius: 12px; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .92rem; }
.banner.warn { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.banner.info { background: var(--brand-soft); border: 1px solid var(--brand-soft-2); color: #0052A3; }
.banner.error { background: #FFF1F2; border: 1px solid #FECDD3; color: #9F1239; }

/* ---------- buttons & forms ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 38px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    padding: .45rem .95rem; border-radius: 12px; font: inherit; font-weight: 600; font-size: .9rem;
    cursor: pointer; transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible { outline: 2px solid rgba(0, 127, 243, .45); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { min-height: 32px; padding: .3rem .7rem; font-size: .82rem; border-radius: 10px; }
.btn-block { width: 100%; min-height: 44px; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.input, select.input {
    width: 100%; min-height: 42px; padding: .55rem .8rem; border: 1px solid var(--border); border-radius: 11px;
    font: inherit; background: var(--surface); color: var(--text); outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 127, 243, .15); }
input[type=range] { width: 100%; accent-color: var(--brand); }
input[type=checkbox] { accent-color: var(--brand); }
.check-row { display: flex; align-items: center; gap: .55rem; cursor: pointer; font-weight: 600; font-size: .9rem; }
.check-row input { width: 18px; height: 18px; }

.auth-wrap { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); display: grid; place-items: center; margin-bottom: 1rem; }
.auth-logo img { width: 36px; height: 36px; }
.auth-card .sub { color: var(--muted); margin-bottom: 1.25rem; }

/* ---------- lander (sign in / sign up) ---------- */
body.anon .topbar { display: none; }
body.anon { background: #0A4A96 radial-gradient(130% 90% at 0% 0%, #1E9FEA 0%, #0A6CCF 45%, #0A4A96 80%, #08397A 100%) fixed; color: #fff; }
.lander {
    max-width: 1180px; margin: 0 auto; padding: 3rem 1.75rem 2rem; min-height: calc(100vh - 48px);
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); column-gap: 4rem; row-gap: 1.75rem;
    grid-template-areas: "top form" "more form"; align-items: start;
}
.ld-top { grid-area: top; }
.ld-form { grid-area: form; position: sticky; top: 2rem; align-self: start; }
.ld-more { grid-area: more; display: grid; gap: 1.6rem; }
.ld-brand { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; margin-bottom: 2.2rem; }
.ld-brand .brand-tile { width: 44px; height: 44px; border-radius: 12px; }
.ld-brand .brand-tile img { width: 30px; height: 30px; }
.ld-brand .brand-name { font-size: 1.25rem; }
.ld-pill { margin-left: .5rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .25rem .65rem; border-radius: 999px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28); }
.ld-title { font-size: clamp(2rem, 4.2vw, 3.3rem); line-height: 1.08; letter-spacing: -.025em; margin: 0 0 1rem; color: #fff; }
.ld-hl { color: var(--translation-dark); }
.ld-lead { font-size: 1.08rem; line-height: 1.6; color: rgba(255, 255, 255, .82); max-width: 560px; margin: 0; }

.ld-demo { background: linear-gradient(180deg, #0A3F82, #061A3A); border: 1px solid rgba(255, 255, 255, .14); border-radius: 18px; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); max-width: 560px; color: #E2ECF8; }
.ld-demo-head { display: flex; align-items: center; gap: .65rem; padding-bottom: .4rem; }
.ld-demo-head strong { display: block; color: #fff; font-size: .95rem; }
.ld-demo-head small { display: block; color: #9CCBFF; font-size: .78rem; }
.ld-demo-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: linear-gradient(135deg, #00B3FF, #007FF3); color: #fff; }
.ld-demo .cap { width: 86%; font-size: .9rem; white-space: normal; }

.ld-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; max-width: 560px; }
.ld-steps li { display: flex; gap: .8rem; align-items: flex-start; color: rgba(255, 255, 255, .85); }
.ld-steps li > span { width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: #fff; color: var(--brand); }
.ld-steps strong { color: #fff; }
.ld-langs { display: flex; flex-wrap: wrap; gap: .4rem; max-width: 560px; }
.ld-chip { font-size: .8rem; padding: .25rem .65rem; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); color: #fff; }
.ld-chip.more { background: transparent; border-style: dashed; color: rgba(255, 255, 255, .75); }
.ld-tips { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; color: rgba(255, 255, 255, .8); padding: .85rem 1rem; border-radius: 14px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); max-width: 560px; }
.ld-tips strong { color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .15rem; }

.lander .auth-card { max-width: none; padding: 1.75rem; border: 0; border-radius: 20px; box-shadow: 0 30px 70px rgba(4, 20, 50, .35); color: var(--text); }
.lander .auth-card h1 { font-size: 1.45rem; }
.auth-switch { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--border); font-size: .85rem; color: var(--muted); display: grid; gap: .5rem; }
.ld-foot { text-align: center; font-size: .78rem; color: rgba(255, 255, 255, .55); padding: 0 1rem 1.5rem; }

@media (max-width: 900px) {
    body.anon { background-attachment: scroll; }
    .lander { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "form" "more"; padding: 1.5rem 1rem 1.5rem; column-gap: 0; min-height: 0; }
    .ld-form { position: static; }
    .ld-brand { margin-bottom: 1.4rem; }
    .ld-pill { margin-left: 0; }
    .ld-lead { font-size: 1rem; }
    .ld-demo, .ld-steps, .ld-langs, .ld-tips { max-width: none; }
    .lander .auth-card { padding: 1.35rem 1.15rem; }
}

/* ---------- settings ---------- */
.engine-card h2 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .25rem; }
.engine-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.engine-kv { grid-template-columns: 120px 1fr; }
@media (max-width: 680px) { .engine-head .page-actions .btn { flex: 1 1 45%; } }

/* ---------- key/value ---------- */
.kv { display: grid; grid-template-columns: 200px 1fr; gap: .6rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge.green { background: #F0FDF4; border-color: #BBF7D0; color: #15803D; }
.badge.amber { background: #FFFBEB; border-color: #FDE68A; color: #B45309; }
.badge.red { background: #FFF1F2; border-color: #FECDD3; color: #BE123C; }
.badge.blue { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- tables (data-tool) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.dt { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.dt th, table.dt td { text-align: left; padding: .65rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.dt thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: var(--surface-2); user-select: none; white-space: nowrap; }
table.dt thead th.sortable { cursor: pointer; }
table.dt thead th.sortable:hover { color: var(--text); }
table.dt thead th .sort-ind { opacity: .35; margin-left: .25rem; font-size: .7rem; }
table.dt thead th.sorted { color: var(--brand); }
table.dt thead th.sorted .sort-ind { opacity: 1; }
table.dt tbody tr:hover { background: var(--surface-2); }
table.dt .dt-num { width: 1%; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
table.dt td.actions { text-align: right; white-space: nowrap; }
table.dt td.actions .btn + .btn { margin-left: .35rem; }
.dt-toolbar { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.dt-filter { max-width: 280px; }
.dt-count { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem !important; }
.cell-sub { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; }
.only-sm, .cell-sub.only-sm { display: none; }
.nowrap { white-space: nowrap; }

/* ---------- modal (Dialog) ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 25, 50, .5); }
.modal {
    position: relative; z-index: 1; width: 100%; max-width: 460px; max-height: calc(100vh - 2rem); overflow: auto;
    background: var(--surface); border-radius: 18px; box-shadow: 0 20px 60px rgba(10, 25, 50, .3); padding: 1.35rem;
}
.modal.wide { max-width: 880px; }
.modal h3 { margin: 0 0 .5rem; font-size: 1.08rem; }
.modal .msg { color: var(--muted); white-space: pre-line; margin: 0; }
.modal .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }
.modal .form-error { color: var(--danger); font-size: .85rem; min-height: 1.2em; margin-top: .25rem; }

/* ---------- call screen ---------- */
.call-overlay { position: fixed; inset: 0; z-index: 60; display: none; background: rgba(6, 20, 46, .7); backdrop-filter: blur(4px); align-items: center; justify-content: center; padding: 1rem; }
.call-overlay.open { display: flex; }
.call-panel {
    width: 100%; max-width: 720px; height: min(820px, calc(100vh - 2rem)); height: min(820px, calc(100dvh - 2rem));
    background: linear-gradient(180deg, #0A4A96 0%, #082C5E 45%, #061A3A 100%); color: #E2ECF8;
    border-radius: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); display: flex; flex-direction: column; overflow: hidden;
}
.call-head { padding: 1.4rem 1.5rem .9rem; text-align: center; flex-shrink: 0; }
.call-brand { display: flex; align-items: center; justify-content: center; gap: .4rem; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .55); font-weight: 700; margin-bottom: .8rem; }
.call-brand img { width: 16px; height: 16px; background: #fff; border-radius: 5px; padding: 2px; }
.call-avatar {
    width: 80px; height: 80px; border-radius: 50%; margin: 0 auto .7rem; display: grid; place-items: center;
    font-size: 1.9rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, #00B3FF, #007FF3);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .08);
}
.call-avatar.ringing { animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(0, 179, 255, .6); } 70% { box-shadow: 0 0 0 22px rgba(0, 179, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 179, 255, 0); } }
.call-name { font-size: 1.35rem; font-weight: 700; color: #fff; }
.call-status { color: #9CCBFF; font-size: .95rem; margin-top: .1rem; font-variant-numeric: tabular-nums; }
.call-langs { margin-top: .6rem; display: flex; justify-content: center; gap: .4rem; flex-wrap: wrap; }
.call-langs .pill { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px; padding: .15rem .65rem; font-size: .78rem; }
.call-langs .pill.tr { color: var(--translation-dark); border-color: rgba(103, 232, 249, .35); }
.call-meter { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; width: 120px; margin: .6rem auto 0; }
.call-meter span { display: block; height: 100%; width: 0; background: #4ADE80; transition: width .08s; }

.call-captions { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: .6rem 1.1rem 1rem; display: flex; flex-direction: column; gap: .6rem; }
.call-captions .placeholder { color: #8BA3C4; text-align: center; margin: auto; font-size: .9rem; max-width: 420px; }
.cap-legend { text-align: center; font-size: .72rem; color: #8BA3C4; padding: 0 1rem .35rem; flex-shrink: 0; }
.cap-legend .tr { color: var(--translation-dark); font-weight: 600; }
.cap { width: 80%; flex-shrink: 0; padding: .6rem .85rem; border-radius: 16px; font-size: .95rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.cap .lang { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; opacity: .6; margin-bottom: .15rem; font-weight: 700; }
.cap .line-orig { color: #fff; }
.cap .line-tr { color: var(--translation-dark); font-weight: 500; }
.cap .line-sub { font-size: .82rem; margin-top: .25rem; opacity: .85; }
.cap .live { opacity: .55; font-style: italic; }
.cap.me { align-self: flex-end; background: rgba(0, 127, 243, .35); border: 1px solid rgba(0, 179, 255, .35); border-bottom-right-radius: 5px; }
.cap.peer { align-self: flex-start; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); border-bottom-left-radius: 5px; }

.call-mix { padding: .75rem 1.5rem .3rem; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: .6rem; flex-shrink: 0; }
.mix-row { display: grid; grid-template-columns: minmax(0, 1fr) 170px 42px; align-items: center; gap: .75rem; }
.mix-check { display: flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .9rem; color: #E2ECF8; font-weight: 600; min-height: 36px; }
.mix-check input { width: 20px; height: 20px; accent-color: #00B3FF; flex-shrink: 0; }
.mix-check small { display: block; font-size: .72rem; color: #8BA3C4; font-weight: 400; }
.mix-row input[type=range] { accent-color: #00B3FF; height: 28px; }
.mix-row input[type=range]:disabled { opacity: .3; }
.mix-val { font-size: .8rem; color: #8BA3C4; text-align: right; font-variant-numeric: tabular-nums; }

.call-controls { padding: .9rem 1.5rem 1.3rem; padding-bottom: max(1.3rem, env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, .08); display: flex; align-items: flex-start; justify-content: center; gap: 1.6rem; flex-shrink: 0; }
.call-controls:empty { display: none; }
.call-btn {
    width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
    font-size: 1.45rem; color: #fff; background: rgba(255, 255, 255, .13); transition: transform .1s, background .15s;
}
.call-btn:hover { transform: scale(1.05); background: rgba(255, 255, 255, .22); }
.call-btn:active { transform: scale(.96); }
.call-btn.red { background: var(--danger); }
.call-btn.red:hover { background: var(--danger-hover); }
.call-btn.green { background: var(--success); }
.call-btn.green:hover { background: var(--success-hover); }
.call-btn.off { background: #F59E0B; }
.icon { display: block; flex-shrink: 0; }
.btn .icon { display: inline-block; vertical-align: -3px; }
.call-btn-label { display: block; text-align: center; font-size: .74rem; color: #A9BEDB; margin-top: .35rem; }

/* ---------- phones ---------- */
@media (max-width: 680px) {
    body { font-size: 15px; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
    .sidebar { display: none; }
    body.signed-in .app-main { margin-left: 0; }
    body.signed-in .topbar { display: block; }
    body.signed-in main { padding: 1rem .75rem 2rem; }
    body.anon { padding-bottom: 0; }
    .topbar-inner { padding: .55rem 1rem; gap: .75rem; }
    .topbar .nav { display: none; }
    .userbox .who { display: none; }
    .brand-tile { width: 34px; height: 34px; border-radius: 10px; }
    .brand-tile img { width: 23px; height: 23px; }

    .tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
        background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
    }
    .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; color: var(--muted); font-size: .72rem; font-weight: 600; }
    .tabbar a:hover { text-decoration: none; }
    .tabbar a .icon { width: 23px; height: 23px; }
    .tabbar a.active { color: var(--brand); }

    main { padding: 1rem .75rem 2rem; }
    h1 { font-size: 1.3rem; }
    .page-head { margin-bottom: .9rem; align-items: stretch; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; }
    .card { padding: .9rem; border-radius: 12px; }
    .kv { grid-template-columns: 1fr; gap: .15rem; }
    .kv dd { margin-bottom: .6rem; }

    /* iOS zooms into inputs below 16px */
    .input, select.input, .dt-filter { font-size: 16px; }
    .dt-toolbar { flex-wrap: wrap; }
    .dt-filter { max-width: none; flex: 1; }
    table.dt { font-size: .9rem; }
    table.dt th, table.dt td { padding: .6rem .45rem; }
    .hide-sm { display: none; }
    .only-sm, .cell-sub.only-sm { display: block; }
    table.dt td.actions .btn { min-height: 38px; }

    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal { max-width: none !important; border-radius: 20px 20px 0 0; max-height: 92vh; max-height: 92dvh; padding: 1.2rem 1.1rem calc(1.2rem + env(safe-area-inset-bottom)); }
    .modal .actions .btn { flex: 1; min-height: 44px; }

    .call-overlay { padding: 0; }
    .call-panel { max-width: none; height: 100vh; height: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top); }
    .call-head { padding: 1rem 1rem .6rem; }
    .call-brand { margin-bottom: .5rem; }
    .call-avatar { width: 64px; height: 64px; font-size: 1.5rem; margin-bottom: .5rem; }
    .call-name { font-size: 1.2rem; }
    .call-captions { padding: .5rem .75rem .75rem; }
    .cap { width: 86%; font-size: .93rem; }
    .call-mix { padding: .65rem 1rem .2rem; gap: .35rem; }
    .mix-row { grid-template-columns: minmax(0, 1fr) 110px 36px; gap: .5rem; }
    .call-controls { gap: 2.2rem; padding: .75rem 1rem; padding-bottom: max(.9rem, env(safe-area-inset-bottom)); }
    .call-btn { width: 64px; height: 64px; }

    /* During an active call, give the captions the room: drop the avatar and tighten the header. */
    .call-panel.in-call .call-avatar { display: none; }
    .call-panel.in-call .call-head { padding-top: .6rem; padding-bottom: .4rem; }
    .call-panel.in-call .call-brand { margin-bottom: .25rem; }
    .call-panel.in-call .call-name { font-size: 1.1rem; }
    .call-panel.in-call .call-langs .pill { font-size: .72rem; padding: .1rem .5rem; }
    .call-panel.in-call .call-meter { margin-top: .4rem; }

    table.dt td.actions .btn { display: flex; margin: 0 0 0 auto; min-width: 42px; }
    table.dt td.actions .btn + .btn { margin: .35rem 0 0 auto; }
}

@media (max-width: 380px) {
    .mix-row { grid-template-columns: minmax(0, 1fr) 84px 34px; }
    .mix-check small { display: none; }
}

/* guests (joined through a call link): plain top bar, no sidebar */
.userbox .guest-name { font-weight: 600; font-size: .9rem; color: #fff; opacity: .95; }
.join-wrap { max-width: 560px; margin: 0 auto; padding: 2rem 1rem 3rem; }
.join-host { display: flex; align-items: center; gap: .9rem; }
.join-avatar { width: 52px; height: 52px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.15rem; flex: none; }
.join-status { display: flex; align-items: center; gap: .6rem; margin-top: 1rem; }
.join-link { display: flex; gap: .5rem; align-items: center; }
.join-link input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
