:root {
    color-scheme: light;
    --navy: #073452;
    --navy-2: #0b4c72;
    --blue: #0878b9;
    --cyan: #10cce2;
    --yellow: #ffd228;
    --ink: #132b3b;
    --muted: #607887;
    --line: #d7e4eb;
    --surface: #ffffff;
    --surface-2: #f1f6f9;
    --page: #eaf1f5;
    --shadow: 0 18px 48px rgba(6, 45, 69, .13);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #eff8fc;
    --muted: #9fb5c1;
    --line: #244b61;
    --surface: #0b2232;
    --surface-2: #0f2c40;
    --page: #061722;
    --shadow: 0 18px 48px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html, body { width: 100%; min-height: 100%; margin: 0; }

body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    color: var(--ink);
    background: var(--page);
}

button, a { font: inherit; }

button { color: inherit; }

.site-header {
    position: relative;
    z-index: 30;
    height: 78px;
    padding: max(10px, env(safe-area-inset-top)) 22px 10px;
    display: flex;
    align-items: center;
    gap: 20px;
    color: #fff;
    background: linear-gradient(108deg, #052e49 0%, #07517a 66%, #063c5c 100%);
    border-bottom: 3px solid var(--yellow);
    box-shadow: 0 6px 22px rgba(3, 33, 51, .22);
}

.site-header::after {
    content: "";
    position: absolute;
    right: 27%;
    bottom: -3px;
    width: 130px;
    height: 3px;
    background: var(--cyan);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 266px;
    padding: 0;
    border: 0;
    color: #fff;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.brand img {
    width: 48px;
    height: 58px;
    object-fit: contain;
    filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .18));
}

.brand-copy { display: grid; gap: 3px; }

.brand-copy strong {
    font-size: 16px;
    letter-spacing: .045em;
    line-height: 1;
}

.brand-copy em { color: var(--cyan); font-style: normal; }

.brand-copy small {
    color: #b8d5e4;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .18em;
}

.channel-links {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
}

.channel-link {
    min-height: 34px;
    padding: 8px 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    color: #dbeaf2;
    background: rgba(255, 255, 255, .06);
    font-size: 11px;
    font-weight: 750;
    text-decoration: none;
    transition: border-color .2s, background .2s, transform .2s;
}

.channel-link:hover { border-color: var(--cyan); background: rgba(16, 204, 226, .12); transform: translateY(-1px); }

.courses-link { color: #112a3a; background: var(--yellow); border-color: var(--yellow); }
.courses-link:hover { color: #112a3a; background: #ffe16a; border-color: #ffe16a; }

.header-actions { display: flex; align-items: center; gap: 9px; }

.account-chip {
    max-width: 130px;
    padding: 7px 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    color: #dbeaf2;
    background: rgba(255, 255, 255, .06);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
}

.plans-button,
.compact-tool-button,
.dialog-primary {
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 800;
}

.plans-button {
    min-height: 40px;
    padding: 0 18px;
    color: #09283a;
    background: var(--yellow);
    box-shadow: 0 8px 20px rgba(255, 210, 40, .18);
}

.theme-control {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 12px;
    color: #dbeaf2;
    background: rgba(255, 255, 255, .07);
    cursor: pointer;
}

.theme-track {
    width: 35px;
    height: 20px;
    padding: 2px;
    display: block;
    border-radius: 999px;
    background: #86a7b9;
}

.theme-thumb {
    width: 16px;
    height: 16px;
    display: block;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
    transition: transform .22s ease;
}

html[data-theme="dark"] .theme-track { background: var(--cyan); }
html[data-theme="dark"] .theme-thumb { transform: translateX(15px); background: #09283a; }
.theme-label { font-size: 11px; font-weight: 800; }

.icon-button { display: none; }

.app-layout {
    height: calc(100vh - 78px);
    height: calc(100dvh - 78px);
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr);
}

.sidebar {
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 28px rgba(7, 52, 82, .05);
}

.sidebar-heading { padding: 24px 22px 17px; border-bottom: 1px solid var(--line); }

.sidebar-heading > span,
.workspace-kicker,
.dialog-kicker {
    color: var(--blue);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .18em;
}

.sidebar-heading h2 { margin: 6px 0 5px; font-size: 21px; letter-spacing: -.02em; }
.sidebar-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.tool-navigation {
    min-height: 0;
    overflow-y: auto;
    padding: 10px 10px 18px;
    scrollbar-width: thin;
    scrollbar-color: #afc5d1 transparent;
}

.tool-link {
    width: 100%;
    min-height: 50px;
    padding: 6px 9px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 13px;
    color: var(--ink);
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: color .18s, background .18s, border-color .18s, transform .18s;
}

.tool-link:hover { background: var(--surface-2); border-color: var(--line); transform: translateX(2px); }

.tool-link.active {
    color: #fff;
    background: linear-gradient(110deg, var(--navy), var(--navy-2));
    border-color: transparent;
    box-shadow: 0 7px 18px rgba(7, 52, 82, .18);
}

.tool-code {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #b9d0dc;
    border-radius: 10px;
    color: var(--blue);
    background: var(--surface-2);
    font-size: 10px;
    font-weight: 900;
}

.tool-link.active .tool-code { color: #082e45; background: var(--yellow); border-color: var(--yellow); }
.tool-label { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 7px; font-size: 12px; font-weight: 760; line-height: 1.25; }
.tool-access { padding: 2px 5px; border-radius: 999px; font-size: 7px; font-weight: 900; letter-spacing: .05em; white-space: nowrap; }
/* Neutral entry only: authenticated account/plan presentation stays unchanged. */
body:not(.signed-in) #plansButton,
body:not(.signed-in) .tool-access,
body:not(.signed-in) #plansHeading,
body:not(.signed-in) #planList,
body:not(.signed-in) #webPaymentsStatus,
body:not(.signed-in) #accountDeletionCard { display: none; }
.tool-access.free { color: #08784a; background: rgba(31, 190, 118, .13); }
.tool-access.project {
    color: #082e45;
    background: #ffd228;
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
}

.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #18a965; box-shadow: 0 0 0 4px rgba(24, 169, 101, .12); }
.sidebar-footer div { display: grid; gap: 1px; }
.sidebar-footer strong { font-size: 11px; }
.sidebar-footer small { color: var(--muted); font-size: 9px; }
.support-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-size: 12px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.support-link:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 3px; }
.account-support { margin-top: 12px; text-align: center; }
.account-sign-out { width: 100%; min-height: 44px; font-size: 14px; font-weight: 700; }
.account-deletion-footer { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); text-align: center; }
.account-deletion-footer[hidden] { display: none; }
.account-deletion-footer > button { min-height: 44px; font-size: 12px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.account-deletion-footer .account-deletion-panel { text-align: left; }
[data-theme="dark"] .account-deletion-footer .danger-text-button { color: #ffb4ab; }
.support-dialog .support-address { margin: 18px 0 12px; }
.support-dialog input { font-size: 13px; }
.support-compose { display: flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; }
.support-dialog .support-note { margin-top: 14px; font-size: 12px; }

.sidebar-backdrop { display: none; }

.workspace {
    min-width: 0;
    min-height: 0;
    padding: 20px 22px 22px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
    overflow: hidden;
}

body.trial-active .workspace { grid-template-rows: auto auto minmax(0, 1fr); }

.trial-notice {
    min-height: 48px;
    padding: 9px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid color-mix(in srgb, var(--yellow) 55%, var(--line));
    border-radius: 14px;
    color: var(--text);
    background: color-mix(in srgb, var(--yellow) 10%, var(--surface));
}
.trial-notice[hidden] { display: none; }
.trial-notice div { display: grid; gap: 2px; }
.trial-notice strong { font-size: 12px; }
.trial-notice span { color: var(--muted); font-size: 10px; line-height: 1.35; }
.trial-notice button {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    color: var(--text);
    background: var(--surface);
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.workspace-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.workspace-bar h1 { margin: 4px 0 0; font-size: clamp(18px, 2vw, 26px); letter-spacing: -.025em; }
.workspace-actions { display: flex; gap: 8px; }

.compact-tool-button {
    min-height: 38px;
    padding: 0 14px;
    color: var(--navy-2);
    background: var(--surface);
    border: 1px solid var(--line);
}

#showToolsButton { display: none; }

.calculator-stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.access-gate {
    position: absolute;
    z-index: 5;
    inset: 0;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    backdrop-filter: blur(8px);
}

.access-gate[hidden] { display: none; }
.access-gate img { width: 74px; height: 88px; margin-bottom: 13px; object-fit: contain; }
.access-gate h2 { margin: 7px 0 8px; font-size: clamp(22px, 3vw, 34px); }
.access-gate p { max-width: 520px; margin: 0 0 20px; color: var(--muted); line-height: 1.55; }
.access-gate-button { width: auto; min-width: 210px; padding: 0 22px; }

.stage-accent {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 32px;
    width: 110px;
    height: 4px;
    border-radius: 0 0 8px 8px;
    background: var(--yellow);
}

#calculatorFrame { width: 100%; height: 100%; display: block; border: 0; background: var(--surface); }
/* Mantém a ferramenta oculta enquanto a autenticação carrega ou falha. */
.access-blocked #calculatorFrame { visibility: hidden; pointer-events: none; }
/* Nunca apresenta o documento intermediário, ainda sem seu visual e controles. */
.calculator-stage:not([data-tool-state="ready"]) #calculatorFrame { visibility: hidden; pointer-events: none; }
.tool-loading { display: none; }
body:not(.access-blocked) .calculator-stage:not([data-tool-state="ready"]) .tool-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--muted);
    background: var(--surface);
    text-align: center;
}
.tool-loading button[hidden] { display: none; }

.plans-dialog {
    width: min(540px, calc(100vw - 28px));
    max-height: min(820px, calc(100dvh - 28px));
    overflow-y: auto;
    padding: 30px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .3);
}

.plans-dialog [hidden] {
    display: none !important;
}

.plans-dialog::backdrop { background: rgba(2, 23, 36, .66); backdrop-filter: blur(4px); }
.plans-dialog h2 { margin: 7px 0 8px; font-size: 26px; }
.plans-dialog p { margin: 0; color: var(--muted); line-height: 1.55; }
.dialog-close { position: absolute; top: 12px; right: 15px; border: 0; background: transparent; font-size: 26px; cursor: pointer; }

.android-announcement { width: min(470px, calc(100vw - 28px)); }
.android-announcement .dialog-close { min-width: 44px; min-height: 44px; top: 6px; right: 6px; }
.android-announcement-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 20px; border-radius: 17px; color: #073452; background: var(--yellow); font-size: 30px; font-weight: 800; }
.android-announcement h2 { max-width: 340px; margin-bottom: 14px; line-height: 1.2; }
.android-countdown { display: flex; align-items: center; gap: 16px; margin: 24px 0 14px; padding: 18px 22px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; }
.android-countdown > strong { font-size: 56px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.android-countdown span { display: block; font-weight: 800; }
.android-countdown small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.4; }
.android-announcement p.android-release-note { margin: 14px 0 22px; font-size: 12px; }
.android-announcement button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.auth-panel { margin-top: 18px; display: grid; gap: 11px; }
.google-button,
.secondary-button {
    min-height: 45px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    background: var(--surface-2);
    font-weight: 800;
    cursor: pointer;
}
.google-button { display: flex; align-items: center; justify-content: center; gap: 10px; }
.google-button span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #4285f4; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.auth-field { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .04em; }
.auth-field input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--ink);
    background: var(--surface-2);
    outline: none;
}
.auth-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(8, 120, 185, .12); }
.auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.text-button { justify-self: start; padding: 3px 0; border: 0; color: var(--blue); background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; }
.signed-in-panel { margin-top: 18px; display: grid; gap: 10px; }
.signed-in-panel[hidden] { display: none; }
.account-identity { padding: 12px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.account-avatar { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #082e45; background: var(--yellow); font-size: 12px; font-weight: 900; }
.account-identity div:last-child { min-width: 0; display: grid; gap: 2px; }
.account-identity strong, .account-identity small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.account-identity small { color: var(--muted); }
.access-summary { padding: 11px 12px; border-left: 4px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 11px; font-weight: 750; line-height: 1.45; }
.access-summary[data-state="active"] { border-left-color: #18a965; background: rgba(24, 169, 101, .09); }
.access-summary[data-state="pending"] { border-left-color: #c53636; background: rgba(201, 48, 48, .09); color: #a82222; }
html[data-theme="dark"] .access-summary[data-state="pending"] { border-left-color: #ff8585; color: #ffaaaa; }
.sync-summary { color: var(--muted); font-size: 10px; line-height: 1.45; }
.auth-message { min-height: 18px; margin-top: 10px !important; font-size: 11px; font-weight: 750; }
.auth-message.error { color: #d74747; }
.auth-message.success { color: #15935a; }
.google-login-note { margin: 4px 0 0 !important; font-size: 11px; color: var(--muted); }
.sign-in-status { margin: 0 !important; font-size: 13px; line-height: 1.5; }
.sign-in-status.error { color: #a82222; }
html[data-theme="dark"] .sign-in-status.error { color: #ffaaaa; }
.google-browser-help { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12px; }
.google-browser-help summary { cursor: pointer; font-weight: 750; min-height: 28px; display: list-item; }
.google-browser-help p { font-size: 12px; line-height: 1.5; }
.google-browser-help input { font-size: 16px; }
.google-browser-help button { min-height: 44px; width: 100%; }
.phone-auth-panel {
    display: grid;
    gap: 9px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
}
.phone-auth-panel[hidden],
.phone-code-row[hidden] { display: none; }
.phone-auth-panel small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.phone-code-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(135px, .72fr); gap: 8px; align-items: end; }
.phone-code-dialog { width: min(430px, calc(100vw - 28px)); }
.phone-code-dialog .phone-code-row { grid-template-columns: 1fr; gap: 16px; margin-top: 22px; }
.phone-code-dialog .auth-field { font-size: 12px; }
.phone-code-dialog input { min-height: 54px; font-size: 24px; letter-spacing: .25em; text-align: center; }
.phone-code-dialog .dialog-close { min-width: 44px; min-height: 44px; top: 6px; right: 6px; }
.phone-code-dialog h2 { margin-top: 14px; padding-right: 10px; }
.phone-code-dialog .text-button { min-height: 44px; }
.phone-code-dialog .auth-message.error { color: #ac2626; }
html[data-theme="dark"] .phone-code-dialog .auth-message.error { color: #ffaaaa; }
.phone-auth-panel input { font-size: 16px; }
.phone-recaptcha { min-height: 0; }
.phone-recaptcha:not(:empty) { margin-top: 10px; display: grid; place-items: center; }
.account-security-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-2);
}
.account-security-card[hidden] { display: none; }
.account-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-section-heading > div { min-width: 0; display: grid; gap: 2px; }
.account-section-heading strong { color: var(--ink); font-size: 12px; }
.account-section-heading small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.compact-text-button { flex: 0 0 auto; }
.devices-list { display: grid; gap: 7px; }
.devices-list > span { color: var(--muted); font-size: 10px; }
.purchase-history-item { padding: 10px; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 4px; }
.purchase-history-item strong { color: var(--ink); font-size: 12px; }
.purchase-history-item small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.purchase-history-item[data-status="approved"] { border-left: 3px solid #15935a; }
.device-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}
.device-item-copy { min-width: 0; display: grid; gap: 2px; }
.device-item-copy strong { overflow: hidden; color: var(--ink); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.device-item-copy small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.device-current { color: #15935a; font-weight: 850; }
.device-revoke-button {
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #b43131;
    background: transparent;
    font-size: 9px;
    font-weight: 850;
    cursor: pointer;
}
.device-revoke-button:disabled { color: var(--muted); }
.account-danger-card { border-color: rgba(181, 49, 49, .36); }
.danger-text-button { color: #b43131; }
.account-deletion-panel {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(181, 49, 49, .36);
    border-radius: 11px;
    background: rgba(181, 49, 49, .055);
}
.account-deletion-panel[hidden] { display: none; }
.account-deletion-panel > strong { color: #a52727; font-size: 12px; }
.account-deletion-panel p { color: var(--muted); font-size: 10px; line-height: 1.5; }
.deletion-confirmation { display: flex; align-items: flex-start; gap: 8px; color: var(--ink); font-size: 10px; font-weight: 750; line-height: 1.45; }
.deletion-confirmation input { margin-top: 1px; accent-color: #a52727; }
.account-delete-button {
    min-height: 45px;
    border: 1px solid #a52727;
    border-radius: 12px;
    color: #fff;
    background: #a52727;
    font-weight: 850;
    cursor: pointer;
}
.plans-heading { margin-top: 19px; display: grid; gap: 3px; }
.plans-heading strong { font-size: 13px; }
.plans-heading small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.plan-preview { margin: 12px 0 18px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.plan-card { position: relative; min-height: 73px; padding: 12px; display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--surface-2); font-size: 11px; text-align: left; cursor: pointer; }
.plan-card:hover { border-color: var(--blue); transform: translateY(-1px); }
.plan-card strong { color: var(--ink); font-size: 15px; }
.plan-card small { max-width: 92%; color: var(--muted); font-size: 9px; line-height: 1.35; }
.plan-card.featured { border-color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow); }
.plan-card em { position: absolute; top: 7px; right: 7px; color: #6f5600; font-size: 8px; font-style: normal; font-weight: 900; }
.plans-dialog.is-busy { cursor: progress; }
.plans-dialog button:disabled { opacity: .55; cursor: wait; }
.dialog-primary { width: 100%; min-height: 45px; color: #082e45; background: var(--yellow); }

@media (max-width: 1180px) {
    .site-header { gap: 11px; padding-inline: 14px; }
    .brand { min-width: 234px; }
    .social-link { width: 36px; padding-inline: 0; overflow: hidden; color: transparent; position: relative; }
    .social-link::after { color: #eaf6fb; font-size: 9px; font-weight: 900; }
    .social-link[href*="youtube"]::after { content: "YT"; }
    .social-link[href*="instagram"]::after { content: "IG"; }
    .social-link[href*="tiktok"]::after { content: "TK"; }
}

@media (max-width: 860px) {
    body { overflow: hidden; }
    .site-header { height: 68px; padding: max(7px, env(safe-area-inset-top)) 12px 7px; }
    .site-header::after { display: none; }
    .icon-button {
        width: 40px;
        height: 40px;
        flex: 0 0 auto;
        display: grid;
        place-content: center;
        gap: 4px;
        border: 1px solid rgba(255,255,255,.22);
        border-radius: 12px;
        background: rgba(255,255,255,.07);
        cursor: pointer;
    }
    .icon-button span { width: 17px; height: 2px; display: block; border-radius: 2px; background: #fff; }
    .brand { min-width: 0; margin-right: auto; }
    .brand img { width: 36px; height: 45px; }
    .brand-copy strong { font-size: 12px; }
    .brand-copy small { font-size: 7px; }
    .channel-links { display: none; }
    .theme-label { display: none; }
    .account-chip { display: none; }
    .theme-control { padding: 0 7px; }
    .plans-button { padding: 0 13px; }
    .app-layout { height: calc(100vh - 68px); height: calc(100dvh - 68px); display: block; }
    .sidebar {
        position: fixed;
        z-index: 50;
        top: 68px;
        bottom: 0;
        left: 0;
        width: min(330px, 88vw);
        transform: translateX(-104%);
        transition: transform .24s ease;
        box-shadow: 18px 0 60px rgba(0, 0, 0, .3);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop {
        position: fixed;
        z-index: 40;
        inset: 68px 0 0;
        width: auto;
        height: auto;
        border: 0;
        background: rgba(2, 23, 36, .55);
        backdrop-filter: blur(2px);
    }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .workspace { height: 100%; padding: 12px; gap: 10px; }
    .workspace-bar h1 { font-size: 17px; }
    .workspace-kicker { font-size: 8px; }
    #showToolsButton { display: inline-flex; align-items: center; }
    #reloadButton { display: none; }
    .calculator-stage { border-radius: 16px; }
    .stage-accent { left: 22px; width: 80px; }
}

@media (max-width: 540px) {
    .site-header { gap: 7px; }
    .brand { gap: 6px; }
    .brand-copy strong { max-width: 100px; line-height: 1.08; }
    .brand-copy small { display: none; }
    .plans-button { min-height: 38px; padding: 0 10px; font-size: 11px; }
    .theme-control { min-height: 38px; }
    .workspace { padding: 9px 8px 8px; }
    .workspace-bar { gap: 8px; }
    .workspace-kicker { display: none; }
    .workspace-bar h1 { margin: 0; max-width: 64vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
    .compact-tool-button { min-height: 34px; padding: 0 10px; font-size: 10px; }
    .calculator-stage { border-radius: 13px; }
    .plans-dialog { padding: 26px 20px 20px; }
    .plan-preview { grid-template-columns: 1fr; }
    .auth-actions { grid-template-columns: 1fr; }
    .phone-code-row { grid-template-columns: 1fr; }
    .trial-notice { padding: 8px 10px; }
    .trial-notice button { display: none; }
}
