/* Shared public UI: stable geometry, quiet surfaces and native text metrics. */
html { scrollbar-gutter: stable; }
.public-app-shell {
    --ui-ink: #172238;
    --ui-muted: #526176;
    --ui-line: #dce3ec;
    --ui-focus: #2563eb;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.public-app-shell :is(h1, h2, h3, h4, button, input, select, textarea) {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}
.public-app-shell .app-shell-header {
    background: #fff;
    border-bottom-color: var(--ui-line);
    box-shadow: 0 1px 4px rgba(23, 34, 56, .03);
}
.public-app-shell .app-shell-search input {
    border-radius: 10px;
    height: 44px;
    min-width: 0;
}
.public-app-shell .app-shell-language summary { border-radius: 10px; min-height: 44px; }
.public-app-shell .app-shell-language summary > i { width: 1em; text-align: center; }
.public-app-shell :is(.app-shell-nav a, .category-card, .calculator-card, .calculator-memory-item) {
    transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.public-app-shell :is(.category-card, .calculator-card):hover { transform: none; }
.public-app-shell :is(.category-card, .calculator-memory-item) { border-radius: 12px; }
.public-app-shell :is(.app-shell-nav a, .app-shell-brand, .category-card, .calculator-memory-item):focus-visible {
    outline: 3px solid var(--ui-focus);
    outline-offset: 3px;
}
.public-app-shell .calculator-intro-band { background: #f8fafc; border-bottom-color: var(--ui-line); }
.public-app-shell .calculator-intro h1 { line-height: 1.2; letter-spacing: -.025em; }
.public-app-shell .calculator-intro p { color: var(--ui-muted); }
.public-app-shell .calculator-intro__row { align-items: start; }
.public-app-shell .calculator-intro h1 { text-wrap: balance; }
.public-app-shell .calculator-intro__copy { overflow-wrap: anywhere; }
.public-app-shell .calculator-cover-image {
    border: 1px solid #e4e8ec;
    border-radius: 10px;
    background: #fff;
    object-fit: contain;
}
/* Installation stays available without competing with the calculation. */
.public-app-shell .calculator-install {
    background: #fff; border-color: var(--ui-line); color: var(--ui-ink); box-shadow: none;
}
.public-app-shell .calculator-install__icon { background: #edf2f8; color: var(--ui-muted); }
.public-app-shell :is(.calculator-install__eyebrow, .calculator-install__meta) { color: var(--ui-muted); }
.public-app-shell .calculator-install:hover { background: #f1f5f9; box-shadow: none !important; }
.public-app-shell .calculator-install:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 3px; }
/* Shared intro uses independent title, description and action rows. */
.calculator-action-compact { display: none; }
@media all {
    .public-app-shell .calculator-intro { padding: 16px 14px; }
    .public-app-shell .calculator-breadcrumbs { margin-bottom: 14px; font-size: 12px; line-height: 1.5; }
    .public-app-shell .calculator-intro__row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 40px;
        align-items: start;
        gap: 12px;
    }
    .public-app-shell .calculator-intro__copy { display: contents; }
    .public-app-shell .calculator-cover-image { grid-column: 2; grid-row: 1; width: 40px; height: 40px; }
    .public-app-shell .calculator-intro h1 {
        grid-column: 1; grid-row: 1;
        font-size: 22px; line-height: 1.25; margin: 0;
        text-wrap: pretty; overflow-wrap: anywhere;
    }
    .public-app-shell .calculator-intro__row--no-cover h1 { grid-column: 1 / -1; }
    .public-app-shell .calculator-intro p {
        grid-column: 1 / -1;
        display: block; overflow: visible; line-height: 1.55; margin: 0;
        overflow-wrap: anywhere;
    }
    .public-app-shell .calculator-intro__rating,
    .public-app-shell .calculator-intro__cluster-link { grid-column: 1 / -1; justify-self: start; margin: 0; }
    .public-app-shell .calculator-intro__rating[hidden] { display: none; }
    .public-app-shell .calculator-intro__actions {
        grid-column: 1 / -1; grid-row: auto;
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%; min-width: 0; max-width: 400px; gap: 8px;
        align-items: stretch;
    }
    .public-app-shell .calculator-intro__actions .calculator-save,
    .public-app-shell .calculator-install {
        display: flex; justify-content: center; align-items: center; gap: 8px;
        min-height: 44px; height: auto; min-width: 0; width: 100%;
        padding: 10px 8px; border-radius: 9px; text-align: center;
    }
    .public-app-shell .calculator-action-compact {
        display: block; font-size: 13px; font-weight: 600; line-height: 1.4;
        overflow-wrap: anywhere;
    }
    .public-app-shell .calculator-install__icon { height: 18px; width: 18px; flex: 0 0 18px; background: transparent; }
    .public-app-shell .calculator-install__icon svg { height: 18px; width: 18px; }
    .public-app-shell .calculator-install__eyebrow,
    .public-app-shell .calculator-save__label {
        position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
        overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
    }
    .public-app-shell .calculator-install__meta { display: none; }
}
@media (min-width: 761px) {
    .public-app-shell .calculator-intro { padding: 22px 18px 24px; }
    .public-app-shell .calculator-breadcrumbs { margin-bottom: 18px; }
    .public-app-shell .calculator-breadcrumbs__current-separator,
    .public-app-shell .calculator-breadcrumbs [aria-current="page"] { display: none; }
    .public-app-shell .calculator-intro__row {
        grid-template-columns: 80px minmax(0, 1fr);
        gap: 12px 20px;
    }
    .public-app-shell .calculator-cover-image {
        grid-column: 1; grid-row: 1 / span 2;
        width: 80px; height: 80px; border-radius: 14px;
    }
    .public-app-shell .calculator-intro h1 {
        grid-column: 2; font-size: clamp(26px, 2.5vw, 32px);
        max-width: 32ch; line-height: 1.2;
    }
    .public-app-shell .calculator-intro p {
        grid-column: 2; font-size: 15px; max-width: 78ch;
    }
    .public-app-shell .calculator-intro__rating,
    .public-app-shell .calculator-intro__cluster-link,
    .public-app-shell .calculator-intro__actions { grid-column: 2; }
    .public-app-shell .calculator-intro__actions { max-width: 340px; margin-top: 2px; }
    .public-app-shell .calculator-intro__row--no-cover { grid-template-columns: minmax(0, 1fr); }
    .public-app-shell .calculator-intro__row--no-cover > .calculator-intro__actions,
    .public-app-shell .calculator-intro__row--no-cover .calculator-intro__copy > * { grid-column: 1; }
}
.calculator-render :is(input, output, strong) { font-variant-numeric: tabular-nums; }
.calculator-render :is(input, select, textarea) { transition-property: border-color, background-color, box-shadow; }
@media (prefers-reduced-motion: reduce) {
    .public-app-shell *, .public-app-shell *::before, .public-app-shell *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Installation and phone handoff are separate, stable-size actions. */
.public-app-shell .calculator-install-group { display:flex; align-items:stretch; gap:10px; min-width:0; }
.public-app-shell .calculator-install:is(:hover, :focus-visible, :active),
.public-app-shell .calculator-install:is(:hover, :focus-visible, :active) span { color:#475569; }
.public-app-shell .calculator-install-group .calculator-install { flex:1; }
.public-app-shell .calculator-qr { display:none; }
@media (min-width:768px) and (hover:hover) and (pointer:fine) {
 .public-app-shell .calculator-intro__actions { max-width:400px; grid-template-columns:minmax(0,1fr) minmax(0,1.4fr); align-items:center; }
 .public-app-shell .calculator-qr:not([hidden]) { display:flex; align-items:center; justify-content:center; flex:0 0 44px; width:44px; min-height:44px; height:auto; box-sizing:border-box; padding:0; border:1px solid #cbd5e1; border-radius:9px; background:#fff; cursor:pointer; color:#475569; }
 .public-app-shell .calculator-qr [data-qr-preview], .public-app-shell .calculator-qr svg { display:block; width:24px; height:24px; }
 .public-app-shell .calculator-qr:focus-visible { outline:3px solid #1767e8; outline-offset:3px; }
 .public-app-shell .calculator-qr:hover { border-color:#64748b; background:#fff; }
}
