/* Design tokens - the ShipYrd.AI portal: pale canvas, white cards, one violet accent. Everything below uses
   these; change the brand here, not in the rules. */
:root {
    --tg-bg: #f7f8fc;
    --tg-surface: #ffffff;
    --tg-border: #e6e8f0;
    --tg-text: #111827;
    --tg-muted: #64748b;
    --tg-ink-2: #475569;
    --tg-accent: #5b3fe6;
    --tg-accent-hover: #4a2fd0;
    --tg-accent-soft: #f0edff;
    --tg-success: #15803d;
    --tg-success-soft: #eafaf0;
    --tg-warn: #c2410c;
    --tg-warn-soft: #fff4e8;
    --tg-danger: #b91c1c;
    --tg-danger-soft: #fef2f2;
    --tg-radius: 14px;
    --tg-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06);
    --tg-shadow-pop: 0 12px 36px rgba(15, 23, 42, .14);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--tg-bg);
    color: var(--tg-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--tg-accent); }

h1, h2 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 700; }
/* FocusOnNavigate moves focus to the heading after each navigation (for screen readers); no ring needed. */
h1:focus { outline: none; }
h2 { font-size: 1.05rem; font-weight: 650; }

/* Shell: fixed left sidebar (logo + navigation), header with account controls, content */
.tg-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.tg-sidebar {
    position: sticky; top: 0; height: 100vh; padding: 1.1rem 1rem;
    background: var(--tg-surface); border-right: 1px solid var(--tg-border);
    display: flex; flex-direction: column; gap: 1.5rem;
}
.tg-content { display: flex; flex-direction: column; min-width: 0; }

.tg-header {
    display: flex; align-items: center; justify-content: flex-end;
    padding: 0 2rem; height: 60px;
    background: var(--tg-surface); border-bottom: 1px solid var(--tg-border);
    position: sticky; top: 0; z-index: 10;
}
.tg-brand { display: inline-flex; align-items: center; color: var(--tg-text); text-decoration: none; }
.tg-brand-compact { display: none; margin-right: auto; }
.tg-logo { display: inline-flex; align-items: center; gap: .6rem; }
.tg-logo svg { flex: none; }
.tg-logo-word { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; color: var(--tg-text); }
.tg-logo-ai { color: var(--tg-accent); }
.tg-nav a { color: var(--tg-muted); text-decoration: none; font-weight: 500; }
.tg-nav a:hover, .tg-nav a.active { color: var(--tg-text); }

.tg-side-nav { display: flex; flex-direction: column; gap: .2rem; }
.tg-side-nav a {
    display: flex; align-items: center; gap: .65rem;
    padding: .55rem .75rem; border-radius: 10px;
    color: var(--tg-muted); text-decoration: none; font-weight: 500;
}
.tg-side-nav a:hover { color: var(--tg-text); background: var(--tg-bg); }
.tg-side-nav a.active { color: var(--tg-accent); background: var(--tg-accent-soft); font-weight: 600; }
.tg-side-icon { width: 1.2rem; text-align: center; font-size: .95rem; opacity: .85; }
.tg-side-heading { margin: 1rem .75rem .25rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tg-muted); }

.tg-main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 2.5rem 2rem 4rem; }

/* Typography helpers */
.tg-eyebrow { margin: 0 0 .5rem; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tg-accent); }
.tg-lede { margin: .75rem 0 0; color: var(--tg-muted); font-size: 1.05rem; max-width: 60ch; }
.tg-brief { font-style: italic; }
.tg-muted { color: var(--tg-muted); }

/* Home */
.tg-hero { max-width: 820px; margin: 6vh auto 0; }
.tg-form { margin-top: 2rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow); padding: 1.25rem; }
.tg-textarea {
    width: 100%; resize: vertical; min-height: 120px;
    border: 1px solid var(--tg-border); border-radius: 10px; padding: .9rem 1rem;
    font: inherit; font-size: 1.05rem; color: var(--tg-text); background: #fbfbfe;
}
.tg-textarea:focus { outline: 2px solid var(--tg-accent); outline-offset: 1px; border-color: transparent; }
.tg-validation { display: block; margin-top: .5rem; color: var(--tg-danger); font-size: .9rem; }
.tg-form-footer { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-top: 1rem; }
.tg-examples { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; color: var(--tg-muted); font-size: .85rem; }
.tg-chip {
    border: 1px solid var(--tg-border); background: var(--tg-surface); color: var(--tg-text);
    border-radius: 999px; padding: .25rem .7rem; font: inherit; font-size: .82rem; cursor: pointer;
}
.tg-chip:hover { border-color: var(--tg-accent); color: var(--tg-accent); }

/* Buttons */
.tg-btn {
    display: inline-flex; align-items: center; gap: .4rem;
    border-radius: 10px; padding: .6rem 1.05rem; font: inherit; font-weight: 600; font-size: .95rem;
    cursor: pointer; text-decoration: none; border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.tg-btn:disabled { opacity: .5; cursor: not-allowed; }
.tg-btn-primary { background: var(--tg-accent); color: #fff; }
.tg-btn-primary:not(:disabled):hover { background: var(--tg-accent-hover); }
.tg-btn-ghost { background: var(--tg-surface); color: var(--tg-text); border-color: var(--tg-border); }
.tg-btn-ghost:not(:disabled):hover { border-color: var(--tg-accent); color: var(--tg-accent); }

/* Alerts & badges */
.tg-alert { margin-top: 1.25rem; padding: .9rem 1.1rem; border-radius: 12px; border: 1px solid; display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.tg-alert-error { background: var(--tg-danger-soft); border-color: #fecaca; color: var(--tg-danger); }
.tg-alert-success { background: var(--tg-success-soft); border-color: #bbf7d0; color: var(--tg-success); }
.tg-alert-success .tg-btn { margin-left: auto; }
.tg-alert-info { background: var(--tg-accent-soft); border-color: #c7d2fe; color: #3730a3; }
.tg-tech-note { display: block; max-width: 60ch; font-size: .92rem; margin-top: .75rem; }

.tg-badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--tg-accent-soft); color: var(--tg-accent); white-space: nowrap; }
.tg-badge-success { background: var(--tg-success-soft); color: var(--tg-success); }

/* Templates page */
.tg-templates-header { display: flex; flex-wrap: wrap; gap: 2rem; align-items: flex-end; justify-content: space-between; }
.tg-progress { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; color: var(--tg-muted); font-size: .95rem; min-width: 280px; }
.tg-progress-bar { flex-basis: 100%; height: 6px; border-radius: 999px; background: var(--tg-border); overflow: hidden; }
.tg-progress-fill { height: 100%; background: var(--tg-accent); transition: width .4s ease; }

.tg-spinner {
    width: 16px; height: 16px; border-radius: 50%; display: inline-block;
    border: 2px solid var(--tg-border); border-top-color: var(--tg-accent);
    animation: tg-spin .8s linear infinite;
}
@keyframes tg-spin { to { transform: rotate(360deg); } }

.tg-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); margin-top: 2rem; }

.tg-card {
    background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius);
    box-shadow: var(--tg-shadow); overflow: hidden; display: flex; flex-direction: column;
    transition: border-color .15s, transform .15s;
}
.tg-card:hover { transform: translateY(-2px); }
.tg-card-selected { border-color: var(--tg-success); box-shadow: 0 0 0 3px rgba(21, 128, 61, .18), var(--tg-shadow); }

/* Scaled-down desktop viewport: iframe is 1280px wide, shrunk to fit the card. */
.tg-card-preview { position: relative; aspect-ratio: 16 / 10; background: #eceef4; overflow: hidden; border-bottom: 1px solid var(--tg-border); }
.tg-card-preview iframe {
    position: absolute; top: 0; left: 0;
    width: 1280px; height: 800px; border: 0; background: #fff;
    transform-origin: top left;
    transform: scale(0.3); /* fallback; the container query below computes the exact ratio */
    pointer-events: none;
}
/* container-relative scale: card width / 1280 */
.tg-card-preview { container-type: inline-size; }
@container (min-width: 0px) {
    .tg-card-preview iframe { transform: scale(calc(100cqw / 1280px)); }
}

.tg-card-placeholder {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .6rem; color: var(--tg-muted); text-align: center; padding: 1rem;
}
.tg-card-placeholder p { margin: 0; }
.tg-card-placeholder small { font-size: .75rem; opacity: .8; max-width: 90%; word-break: break-word; }
.tg-card-failed { color: var(--tg-danger); }

.tg-card-body { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.tg-card-title-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.tg-card-tagline { margin: 0; color: var(--tg-muted); font-size: .92rem; flex: 1; }
.tg-card-actions { display: flex; gap: .6rem; justify-content: flex-end; align-items: center; }

.tg-retry { margin-top: 1.5rem; text-align: center; }

/* Preview modal */
.tg-modal-backdrop { position: fixed; inset: 0; background: rgba(15, 17, 26, .6); display: flex; align-items: center; justify-content: center; padding: 2rem; z-index: 50; }
.tg-modal { background: var(--tg-surface); border-radius: var(--tg-radius); width: min(1400px, 100%); height: 100%; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
.tg-modal-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--tg-border); }
.tg-modal-header p { margin: .15rem 0 0; font-size: .9rem; }
.tg-modal-actions { display: flex; gap: .5rem; align-items: center; }
.tg-modal iframe { flex: 1; width: 100%; border: 0; background: #fff; }

/* Category tabs */
.tg-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: 1.75rem; padding-bottom: .75rem; border-bottom: 1px solid var(--tg-border); }
.tg-tab {
    display: inline-flex; align-items: center; gap: .45rem;
    background: transparent; border: 1px solid transparent; border-radius: 999px;
    padding: .45rem .95rem; font: inherit; font-weight: 600; font-size: .9rem; color: var(--tg-muted); cursor: pointer;
}
.tg-tab:hover:not(:disabled) { color: var(--tg-text); background: var(--tg-surface); border-color: var(--tg-border); }
.tg-tab-active, .tg-tab-active:hover:not(:disabled) { background: var(--tg-accent); color: #fff; border-color: var(--tg-accent); }
.tg-tab:disabled { opacity: .6; cursor: wait; }
.tg-tab-hint { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .75; }
.tg-tab-bespoke { color: var(--tg-accent); }
.tg-tab-count { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 999px; background: var(--tg-accent-soft); color: var(--tg-accent); font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.5; }
.tg-tab-active .tg-tab-count { background: rgba(255, 255, 255, .25); color: #fff; }
.tg-card-origin { margin: 0; font-size: .8rem; color: var(--tg-muted); font-style: italic; }
.tg-empty { margin-top: 2rem; padding: 2.5rem 1.5rem; text-align: center; background: var(--tg-surface); border: 1px dashed var(--tg-border); border-radius: var(--tg-radius); }
.tg-empty-mark { display: block; font-size: 2rem; color: var(--tg-accent); margin-bottom: .5rem; }
.tg-empty h2 { font-size: 1.2rem; }
.tg-empty p { margin: .5rem auto 0; max-width: 52ch; }
.tg-tab-spacer { flex: 1; }
.tg-tab-action { font-size: .88rem; padding: .45rem .95rem; border-radius: 999px; }
.tg-pack-line { margin-top: .5rem; font-size: .92rem; }
.tg-badge-muted { background: #eef0f4; color: var(--tg-muted); }
.tg-preparing { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 12vh; }

/* Confirm dialog */
.tg-dialog { background: var(--tg-surface); border-radius: var(--tg-radius); width: min(520px, 100%); padding: 1.5rem 1.6rem; box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
.tg-dialog h2 { font-size: 1.3rem; margin-bottom: .75rem; }
.tg-dialog p { margin: 0 0 .75rem; line-height: 1.55; }
.tg-dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; }

/* Reconnect dialog (App.razor + connection.js). Sits above everything while the link to the server is rejoined. */
.tg-reconnect {
    border: 0; padding: 0; background: var(--tg-surface); color: var(--tg-text); border-radius: var(--tg-radius);
    width: min(460px, calc(100% - 2rem)); box-shadow: 0 24px 64px rgba(0, 0, 0, .35); z-index: 10000;
}
.tg-reconnect::backdrop { background: rgba(15, 17, 26, .6); }
.tg-reconnect-body { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 1rem; padding: 1.5rem 1.6rem; }
.tg-reconnect-body > :not(.tg-reconnect-spinner) { grid-column: 2; }
.tg-reconnect-spinner { width: 22px; height: 22px; margin-top: .15rem; }
.tg-reconnect h2 { font-size: 1.2rem; margin: 0 0 .5rem; }
.tg-reconnect p { margin: 0 0 .6rem; line-height: 1.5; }
.tg-reconnect-attempt { font-size: .9rem; }
.tg-reconnect-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .75rem; }
.tg-reconnect [hidden] { display: none !important; }

/* Admin catalog matrix */
.tg-admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.tg-matrix-wrap { overflow-x: auto; margin-top: 1.5rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); }
.tg-matrix { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tg-matrix th, .tg-matrix td { padding: .7rem .9rem; border-bottom: 1px solid var(--tg-border); text-align: left; white-space: nowrap; }
.tg-matrix thead th { background: var(--tg-bg); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tg-muted); }
.tg-matrix tbody th { font-weight: 600; }
.tg-cell { min-width: 140px; }
.tg-cell a, .tg-link { color: var(--tg-accent); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; margin-right: .6rem; }
.tg-link:disabled { opacity: .4; cursor: not-allowed; }
.tg-cell-ready { background: var(--tg-success-soft); }
.tg-cell-failed { background: var(--tg-danger-soft); }
.tg-cell-generating { background: var(--tg-accent-soft); }
.tg-alert-block { display: block; }
.tg-alert-block ul { margin: .5rem 0 0; padding-left: 1.2rem; }
.tg-alert-block li { margin: .25rem 0; word-break: break-word; }

/* Custom mockups toggle (home) */
.tg-toggle { position: relative; display: flex; align-items: center; gap: .85rem; margin-top: 1rem; padding: .85rem 1rem; border: 1px solid var(--tg-border); border-radius: 12px; background: #fbfbfe; cursor: pointer; }
.tg-toggle-on { border-color: #c7d2fe; background: var(--tg-accent-soft); }
.tg-toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tg-toggle-track { position: relative; flex: none; width: 44px; height: 24px; border-radius: 999px; background: #cfd3de; transition: background .15s; }
.tg-toggle-thumb { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.tg-toggle-on .tg-toggle-track { background: var(--tg-accent); }
.tg-toggle-on .tg-toggle-thumb { transform: translateX(20px); }
.tg-toggle:focus-within .tg-toggle-track { outline: 2px solid var(--tg-accent); outline-offset: 2px; }
.tg-toggle-text { display: flex; flex-direction: column; gap: .1rem; font-size: .92rem; line-height: 1.4; }

/* Mockup cards: real images rather than scaled iframes */
.tg-grid-mockups { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.tg-mockup-preview { aspect-ratio: 3 / 2; background: #eceef4; }
.tg-mockup-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.tg-mockup-portrait img { object-fit: contain; }
.tg-card-overlay { background: rgba(246, 247, 251, .88); backdrop-filter: blur(2px); color: var(--tg-text); }
.tg-tab-link { text-decoration: none; }
.tg-modal-image-body { flex: 1; overflow: auto; background: #eceef4; display: flex; align-items: flex-start; justify-content: center; padding: 1rem; }
.tg-modal-image-body img { max-width: 100%; height: auto; border-radius: 8px; box-shadow: var(--tg-shadow); }

/* Art-direction placeholder while an image is drawing */
.tg-direction-swatch p { font-weight: 600; }
.tg-swatches { display: flex; gap: .35rem; margin-top: .25rem; }
.tg-swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .7); box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }

/* Built template beside the mockup it came from */
.tg-modal-split { flex: 1; display: flex; min-height: 0; }
.tg-modal-split iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.tg-modal-split-on iframe { flex: 3; }
.tg-modal-split-image { flex: 2; min-width: 0; overflow: auto; background: #eceef4; border-left: 1px solid var(--tg-border); padding: .75rem 1rem; }
.tg-modal-split-image p { margin: 0 0 .5rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.tg-modal-split-image img { width: 100%; height: auto; border-radius: 8px; box-shadow: var(--tg-shadow); }
.tg-btn-on { border-color: var(--tg-accent); color: var(--tg-accent); }

/* Community sharing controls */
.tg-check { display: flex; gap: .7rem; align-items: flex-start; margin-top: .75rem; padding: .75rem .9rem; border: 1px solid var(--tg-border); border-radius: 10px; background: #fbfbfe; cursor: pointer; font-size: .92rem; line-height: 1.4; }
.tg-check input { margin-top: .25rem; accent-color: var(--tg-accent); }
.tg-check span > span { display: block; }
.tg-share-row { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.tg-share-row .tg-link { margin: 0; font-size: .85rem; }
.tg-badge-heart { background: #fdf2f8; color: #be185d; }

/* Header account controls */
.tg-nav { display: flex; align-items: center; gap: 1.25rem; }
.tg-nav-account { font-size: .9rem; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-signout { display: inline; margin: 0; }
.tg-signout .tg-link { color: var(--tg-muted); text-decoration: none; margin: 0; font-weight: 500; }
.tg-signout .tg-link:hover { color: var(--tg-text); }

/* Account pages (sign in, register, reset, verification) */
.tg-auth { max-width: 520px; }
.tg-auth .tg-form { margin-top: 1.5rem; }
.tg-field { display: block; margin-top: 1rem; }
.tg-field:first-child { margin-top: 0; }
.tg-field > span { display: block; margin-bottom: .4rem; font-weight: 600; font-size: .92rem; }
.tg-field > span .tg-muted { font-weight: 400; }
.tg-input {
    width: 100%; box-sizing: border-box;
    border: 1px solid var(--tg-border); border-radius: 10px; padding: .75rem 1rem;
    font: inherit; font-size: 1rem; color: var(--tg-text); background: #fbfbfe;
}
.tg-input:focus { outline: 2px solid var(--tg-accent); outline-offset: 1px; border-color: transparent; }
.tg-input-code { font-size: 1.4rem; letter-spacing: .25em; font-variant-numeric: tabular-nums; max-width: 14ch; }
.tg-auth-links { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .9rem; }
.tg-auth .tg-lede a, .tg-auth .tg-muted a, .tg-auth-links a, .tg-form-footer > a:not(.tg-btn) { color: var(--tg-accent); }
.tg-steps { margin: 1.5rem 0 0; padding-left: 1.4rem; line-height: 1.55; }
.tg-steps > li { margin-bottom: 1.25rem; }
.tg-steps .tg-form { margin-top: .75rem; }
.tg-qr { margin: .75rem 0; width: 200px; height: 200px; padding: 8px; background: #fff; border: 1px solid var(--tg-border); border-radius: 12px; }
.tg-qr svg { width: 100%; height: 100%; display: block; }
.tg-shared-key { display: inline-block; margin-top: .4rem; padding: .35rem .6rem; background: #eef0f4; border-radius: 8px; font-size: .95rem; letter-spacing: .05em; user-select: all; }
.tg-recovery-codes { list-style: none; margin: 1.25rem 0 0; padding: 1rem 1.25rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1.5rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); }
.tg-recovery-codes code { font-size: 1.05rem; letter-spacing: .08em; user-select: all; }

/* Account management: side navigation plus content */
.tg-manage { max-width: 960px; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.tg-manage > .tg-manage-body:only-child { grid-column: 1 / -1; max-width: 620px; }
.tg-manage-nav { display: flex; flex-direction: column; gap: .2rem; position: sticky; top: 84px; }
.tg-manage-nav a { color: var(--tg-muted); text-decoration: none; padding: .5rem .75rem; border-radius: 8px; font-weight: 500; }
.tg-manage-nav a:hover { color: var(--tg-text); background: var(--tg-surface); }
.tg-manage-nav a.active { color: var(--tg-accent); background: var(--tg-accent-soft); }
.tg-manage-body .tg-form { margin-top: 1.5rem; }
.tg-form-inline { max-width: 420px; }
.tg-account-summary { margin: 1.5rem 0 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .9rem 1.5rem; padding: 1.25rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); }
.tg-account-summary dt { color: var(--tg-muted); font-weight: 600; font-size: .9rem; }
.tg-account-summary dd { margin: 0; display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; }
.tg-account-summary dd a { color: var(--tg-accent); }
.tg-inline-form { display: inline; }

/* Credits and billing */
.tg-nav-credits { text-decoration: none; font-size: .8rem; }
.tg-nav-credits:hover { background: #dfe3ff; }
.tg-billing-balance { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.5rem; align-items: start; margin-top: 1rem; }
.tg-billing-figure { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 160px; padding: 1.25rem; background: var(--tg-accent-soft); border-radius: var(--tg-radius); text-align: center; }
.tg-billing-number { font-size: 2.4rem; font-weight: 700; color: var(--tg-accent); line-height: 1.1; }
.tg-billing-balance .tg-account-summary { margin-top: 0; }
.tg-manage-body h2 { margin-top: 2rem; font-size: 1.2rem; }
.tg-packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; margin-top: 1rem; }
.tg-pack { display: flex; flex-direction: column; gap: .35rem; padding: 1rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); }
.tg-pack strong { font-size: 1.1rem; }
.tg-pack .tg-btn { margin-top: .5rem; justify-content: center; }
.tg-ledger-wrap { overflow-x: auto; margin-top: 1rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); }
.tg-ledger { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tg-ledger th, .tg-ledger td { padding: .6rem .9rem; border-bottom: 1px solid var(--tg-border); text-align: left; white-space: nowrap; }
.tg-ledger thead th { background: var(--tg-bg); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tg-muted); }
.tg-ledger tbody tr:last-child td { border-bottom: 0; }
.tg-ledger .tg-num { text-align: right; font-variant-numeric: tabular-nums; }
.tg-ledger-debit { color: var(--tg-danger); }
.tg-ledger-credit { color: var(--tg-success); }

/* Blazor error UI */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    box-sizing: border-box; display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem;
    position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* Admin reporting */
.tg-report-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; font-size: .85rem; }
.tg-report-filter { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem 1rem; margin-top: 1.25rem; padding: .9rem 1rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); }
.tg-report-filter label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; }
.tg-report-filter .tg-input { width: auto; padding: .5rem .7rem; font-size: .95rem; }
.tg-report-presets { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-left: auto; font-size: .9rem; }
.tg-report-headline { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.tg-report-big { display: flex; flex-direction: column; gap: .25rem; padding: 1.4rem 1.5rem; border-radius: var(--tg-radius); border: 1px solid var(--tg-border); background: var(--tg-surface); }
.tg-report-big-cost { border-left: 6px solid var(--tg-danger); }
.tg-report-big-revenue { border-left: 6px solid var(--tg-success); }
.tg-report-label { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tg-muted); }
.tg-report-huge { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tg-report-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; margin-top: 1.5rem; }
.tg-report-tile { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); }
.tg-report-number { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tg-report-off td { background: #fff7ed; }
.tg-main h2 + .tg-ledger-wrap { margin-top: .75rem; }
.tg-main > h2 { margin-top: 2rem; }
.tg-projects .tg-project-title { white-space: normal; min-width: 260px; }
.tg-project-title strong { display: block; }
.tg-project-title .tg-muted { font-size: .85rem; }

/* Plan page (stage 2): the plan in the main column, questions / build in a side column */
.tg-plan-start, .tg-plan-working { margin-top: 1.5rem; padding: 1.5rem 1.75rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow); max-width: 720px; }
.tg-plan-start h2 { margin-top: 0; font-size: 1.2rem; }
.tg-plan-start .tg-form-footer { margin-top: 1rem; }
.tg-plan-working { display: flex; gap: 1rem; align-items: flex-start; }
.tg-plan-working .tg-spinner { margin-top: .3rem; }
.tg-plan-working p { margin: 0 0 .35rem; }
.tg-plan { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; margin-top: 1.5rem; align-items: start; }
.tg-plan-main, .tg-plan-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.tg-plan-side { position: sticky; top: 76px; }
.tg-plan-card { padding: 1.25rem 1.5rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); }
.tg-plan-card h2 { margin: 0 0 .6rem; font-size: 1.05rem; }
.tg-plan-card p { margin: .35rem 0; }
.tg-plan-card .tg-btn { margin-top: .75rem; }
.tg-plan-screens { padding-left: 1.25rem; margin: 0; display: flex; flex-direction: column; gap: .75rem; }
.tg-plan-screens ul { margin: .3rem 0 0; padding-left: 1.1rem; color: var(--tg-muted); font-size: .92rem; }
.tg-plan-data { padding-left: 1.1rem; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.tg-plan-data small { display: block; color: var(--tg-muted); }
.tg-plan-question { border: 0; padding: 0; margin: 1rem 0 0; }
.tg-plan-question legend { font-weight: 600; padding: 0; margin-bottom: .2rem; }
.tg-plan-question .tg-input { margin-top: .4rem; }
.tg-plan .tg-alert { margin-top: 0; }

/* App workspace (stage 2): the running app beside its summary, conversation and versions */
.tg-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.5rem; margin-top: -.5rem; align-items: start; }
.tg-workspace-preview { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.tg-workspace-toolbar { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between; }
.tg-workspace-title { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.tg-workspace-title h1 { margin: 0; font-size: 1.4rem; }
.tg-workspace-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.tg-workspace-actions .tg-btn { padding: .4rem .75rem; font-size: .85rem; }
.tg-app-stage { background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow); overflow: hidden; height: calc(100vh - 170px); min-height: 520px; display: flex; justify-content: center; }
.tg-app-frame { border: 0; width: 100%; height: 100%; display: block; background: #fff; }
.tg-app-stage-phone { background: var(--tg-bg); padding: 1rem 0; }
.tg-app-stage-phone .tg-app-frame { width: 390px; max-width: 100%; border: 1px solid var(--tg-border); border-radius: 24px; }
.tg-workspace-panel { display: flex; flex-direction: column; gap: 1rem; min-width: 0; position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; }
.tg-workspace-panel .tg-alert { margin-top: 0; }
.tg-chat .tg-textarea { margin-top: .5rem; }
/* Conversation: column-reverse so the newest message sits at the bottom and the box opens scrolled to it. */
.tg-chat-log { display: flex; flex-direction: column-reverse; gap: .5rem; max-height: 340px; overflow-y: auto; padding: .25rem 0; }
.tg-msg { max-width: 92%; padding: .55rem .8rem; border-radius: 12px; font-size: .92rem; line-height: 1.45; }
.tg-msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tg-msg small { display: block; margin-top: .3rem; font-size: .78rem; }
.tg-msg-user { align-self: flex-end; background: var(--tg-accent); color: #fff; border-bottom-right-radius: 4px; }
.tg-msg-user small { color: rgba(255, 255, 255, .8); }
.tg-msg-engine { align-self: flex-start; background: var(--tg-bg); border: 1px solid var(--tg-border); border-bottom-left-radius: 4px; }
.tg-msg-failed { background: var(--tg-danger-soft); color: var(--tg-text); border: 1px solid #fecaca; }
.tg-msg-failed small { color: var(--tg-muted); }
.tg-msg-error { margin-top: .35rem !important; color: var(--tg-danger); font-size: .85rem; }
.tg-chat-working { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: .9rem; }
.tg-chat-hint { margin: .5rem 0 0; }
.tg-version-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; flex-shrink: 0; }
/* Share card: the public link with copy/open beside it. */
.tg-share p { margin: .35rem 0 .6rem; }
.tg-share-link { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.tg-share-link .tg-input { flex: 1 1 200px; min-width: 0; font-size: .9rem; padding: .5rem .7rem; }
.tg-share-link .tg-btn { margin-top: 0; padding: .45rem .8rem; font-size: .85rem; }
.tg-share .tg-btn-primary { margin-top: .25rem; }
.tg-share-stop { display: block; margin-top: .6rem; font-size: .85rem; color: var(--tg-muted); }
.tg-badge-link { text-decoration: none; margin-left: .35rem; }
.tg-badge-link:hover { text-decoration: underline; }
.tg-version-actions .tg-link:disabled { opacity: .5; cursor: default; }
.tg-chat-send { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin-top: .6rem; font-size: .9rem; }
.tg-chat-send .tg-btn { margin-top: 0; }
.tg-versions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.tg-versions li { display: flex; gap: .75rem; align-items: flex-start; justify-content: space-between; padding: .6rem .75rem; border: 1px solid var(--tg-border); border-radius: 10px; font-size: .9rem; }
.tg-versions li.tg-version-current { border-color: var(--tg-accent); background: var(--tg-accent-soft); }
.tg-version-summary { margin: .2rem 0 0; font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tg-plan-question .tg-check { margin-top: .35rem; padding: .5rem .7rem; }

/* What the plan gives beyond credits, on the billing page. */
.tg-plan-perks { list-style: none; padding: 0; margin: .75rem 0 1rem; display: grid; gap: .5rem; }
.tg-plan-perks li { padding: .6rem .8rem; border: 1px solid var(--tg-border); border-radius: 10px; background: var(--tg-surface); font-size: .92rem; }
.tg-plan-perks strong { display: block; }

/* What an app collected: the account's usage meter, then a card per kind of entry. */
.tg-usage { margin: 1.25rem 0 1.5rem; }
.tg-usage-bar { height: 8px; border-radius: 999px; background: var(--tg-border); overflow: hidden; }
.tg-usage-fill { display: block; height: 100%; background: var(--tg-accent); border-radius: 999px; transition: width .3s; }
.tg-usage-fill.tg-usage-high { background: #d97706; }
.tg-usage p { margin: .5rem 0 0; font-size: .9rem; }
.tg-collection { margin-top: 1.25rem; }
.tg-collection-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: baseline; justify-content: space-between; }
.tg-collection-head h2 { margin: 0; }
.tg-collection-head span { font-size: .85rem; }
.tg-collection .tg-ledger-wrap { margin-top: .75rem; }
.tg-collection-pages { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: .6rem; font-size: .85rem; }
.tg-collection-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.tg-collection-actions .tg-share-stop { margin-top: 0; margin-left: auto; }

@media (max-width: 1100px) {
    .tg-plan, .tg-workspace { grid-template-columns: 1fr; }
    .tg-plan-side, .tg-workspace-panel { position: static; max-height: none; }
    .tg-app-stage { height: 70vh; }
}

@media (max-width: 900px) {
    .tg-shell { grid-template-columns: 1fr; }
    .tg-sidebar { display: none; }
    .tg-brand-compact { display: inline-flex; }
    .tg-header { justify-content: space-between; }
}

@media (max-width: 640px) {
    .tg-header, .tg-main { padding-left: 1rem; padding-right: 1rem; }
    .tg-grid, .tg-grid-mockups { grid-template-columns: 1fr; }
    .tg-modal-backdrop { padding: .5rem; }
    .tg-nav-account { display: none; }
    .tg-manage { grid-template-columns: 1fr; gap: 1.25rem; }
    .tg-manage-nav { position: static; flex-direction: row; flex-wrap: wrap; }
    .tg-recovery-codes { grid-template-columns: 1fr; }
    .tg-billing-balance { grid-template-columns: 1fr; }
}

/* Test data: the note under the preview, and the live/test switch on the information page */
.tg-preview-note { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; margin: .6rem 0; font-size: .85rem; color: var(--tg-muted); }
.tg-preview-note .tg-link { font-size: .85rem; }
.tg-data-modes { display: inline-flex; gap: .25rem; margin: 1rem 0 .5rem; padding: .25rem; border: 1px solid var(--tg-border); border-radius: 10px; background: var(--tg-surface); }
.tg-data-modes a { padding: .4rem .9rem; border-radius: 8px; color: var(--tg-muted); text-decoration: none; font-weight: 500; font-size: .92rem; }
.tg-data-modes a.tg-data-mode-on { background: var(--tg-accent-soft); color: var(--tg-accent); font-weight: 600; }

/* Problems in the live app, and automatic fixes */
.tg-problem-list { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .9rem; }
.tg-problem-list li { display: flex; flex-direction: column; gap: .3rem; padding-bottom: .9rem; border-bottom: 1px solid var(--tg-border); }
.tg-problem-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.tg-problem-list p { margin: .2rem 0 0; font-size: .92rem; }
.tg-problem-text { display: block; font: .85rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--tg-danger); background: var(--tg-danger-soft); border-radius: 8px; padding: .45rem .6rem; word-break: break-word; }
.tg-problem-text::before, .tg-problem-text::after { content: ""; }
.tg-problem-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-top: .3rem; }
.tg-problem-actions .tg-btn { padding: .4rem .8rem; font-size: .88rem; }
.tg-check-compact { margin-top: .4rem; padding: .45rem .7rem; font-size: .85rem; }
.tg-autofix-cap { margin-top: .6rem; display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
.tg-autofix-cap .tg-input { width: 6.5rem; display: inline-block; margin: 0 .35rem; padding: .3rem .5rem; }

/* Your pictures (workspace and plan page) */
.tg-picture-list { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem; }
.tg-picture-list li { display: flex; flex-direction: column; gap: .35rem; }
.tg-picture-list img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--tg-border); background: #f1f2f6; }
.tg-picture-list .tg-input { padding: .3rem .5rem; font-size: .85rem; }
.tg-picture-delete { align-self: flex-start; font-size: .8rem; color: var(--tg-muted); }
.tg-picture-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .9rem; font-size: .88rem; }
.tg-upload { position: relative; overflow: hidden; cursor: pointer; }
.tg-upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tg-upload-busy { opacity: .6; pointer-events: none; }
.tg-cell-picture { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--tg-border); vertical-align: middle; }

/* Information page: who can use a collection */
.tg-access { margin-top: .9rem; max-width: 420px; }
.tg-access select { font-size: .92rem; }

/* Delete account */
.tg-btn-danger { background: var(--tg-danger); color: #fff; }
.tg-btn-danger:not(:disabled):hover { background: #991b1b; }
.tg-delete-summary ul { margin-bottom: .6rem; }
.tg-delete-summary > span { display: block; font-size: .9rem; }

/* Landing: said goodbye */
.lp-deleted { max-width: 860px; margin: 1.5rem auto 0; padding: 0 1rem; }

/* "Make one like this": the copy page, and the maker's note on the share card */
.tg-share-note { margin: .4rem 0 0; font-size: .85rem; }
.tg-copy-card { max-width: 640px; }
.tg-copy-points { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .55rem; color: var(--tg-muted); }
.tg-copy-points strong { color: var(--tg-text); }

/* Workspace: the app reported a problem */
.tg-app-problem { border-color: #f5c2c2; background: var(--tg-danger-soft); }
.tg-app-problem h2 { color: var(--tg-danger); }
.tg-app-problem-detail { margin: .6rem 0; font-size: .9rem; }
.tg-app-problem-detail summary { cursor: pointer; color: var(--tg-muted); }
.tg-app-problem-detail pre {
    margin: .5rem 0 0; padding: .6rem .75rem; max-height: 10rem; overflow: auto;
    white-space: pre-wrap; word-break: break-word; font-size: .82rem;
    background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: 8px;
}
.tg-app-problem-dismiss { margin-top: .5rem; font-size: .85rem; }

/* New-project page: the idea carried over from the front page, and the "Just build it" route */
.tg-carried { margin: .5rem 0 0; font-size: .9rem; }
.tg-quick {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem;
    margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--tg-border); font-size: .92rem;
}
.tg-quick > div { flex: 1 1 320px; }
.tg-quick .tg-btn { flex: none; }

/* Front page (LandingLayout + Landing.razor): public, no sidebar */
.lp { min-height: 100vh; display: flex; flex-direction: column; }
.lp-bar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem max(1rem, calc((100vw - 1120px) / 2));
    background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--tg-border);
}
.lp-bar-links { display: flex; align-items: center; gap: 1.25rem; }
.lp-bar-links a:not(.tg-btn) { color: var(--tg-muted); text-decoration: none; font-weight: 500; }
.lp-bar-links a:not(.tg-btn):hover { color: var(--tg-text); }
.lp-bar-cta { padding: .45rem .9rem; }

.lp-hero {
    width: 100%; max-width: 860px; margin: 0 auto; padding: 4.5rem 1rem 3rem; text-align: center;
}
.lp-hero h1 { font-size: clamp(2rem, 5vw, 3.3rem); line-height: 1.1; letter-spacing: -0.025em; }
.lp-lede { margin: 1.1rem auto 0; max-width: 58ch; color: var(--tg-muted); font-size: 1.12rem; }
.lp-start { text-align: left; margin-top: 2.25rem; }
.lp-start .tg-textarea { min-height: 96px; }
.lp-start-btn { padding: .7rem 1.2rem; font-size: 1rem; margin-left: auto; }
.lp-assurances {
    list-style: none; padding: 0; margin: 1.1rem 0 0;
    display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.4rem;
    color: var(--tg-muted); font-size: .9rem;
}
.lp-assurances li::before { content: "✓"; color: var(--tg-success); font-weight: 700; margin-right: .4rem; }
.lp-signin { margin: .75rem 0 0; color: var(--tg-muted); font-size: .9rem; }
.lp-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.lp-section { width: 100%; max-width: 1120px; margin: 0 auto; padding: 3.5rem 1rem; scroll-margin-top: 3rem; }
.lp-h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 700; text-align: center; }
.lp-section .lp-section-lede { margin: .75rem auto 0; max-width: 62ch; text-align: center; color: var(--tg-muted); }
.lp-section h3 { margin: 0; font-size: 1.05rem; }
.lp-section p { margin: .45rem 0 0; color: var(--tg-muted); }

.lp-steps { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.lp-steps li { background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); padding: 1.25rem; }
.lp-step-num {
    display: inline-grid; place-items: center; width: 2rem; height: 2rem; margin-bottom: .75rem;
    border-radius: 999px; background: var(--tg-accent-soft); color: var(--tg-accent); font-weight: 700;
}

.lp-features { margin-top: 2rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem 2rem; }
.lp-features article { border-top: 2px solid var(--tg-accent-soft); padding-top: 1rem; }

.lp-showcase { margin-top: 2rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.lp-show {
    display: flex; align-items: center; gap: .9rem; padding: 1rem;
    background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius);
    color: var(--tg-text); text-decoration: none; transition: border-color .15s, transform .15s;
}
.lp-show:hover { border-color: var(--tg-accent); transform: translateY(-2px); }
.lp-show-icon { flex: none; width: 52px; height: 52px; border-radius: 12px; overflow: hidden; }
.lp-show-icon svg { display: block; width: 100%; height: 100%; }
.lp-show-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lp-show-text .tg-muted { font-size: .9rem; }
.lp-show-open { color: var(--tg-muted); }

.lp-prices { margin: 2rem auto 0; max-width: 860px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.lp-price {
    display: flex; flex-direction: column; gap: .5rem; padding: 1.5rem;
    background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius);
}
.lp-price-plan { border-color: var(--tg-accent); box-shadow: 0 0 0 3px var(--tg-accent-soft), var(--tg-shadow); }
.lp-section .lp-price-amount { margin: 0; color: var(--tg-text); font-size: 2.2rem; font-weight: 750; letter-spacing: -0.02em; }
.lp-price-amount span { font-size: 1rem; font-weight: 500; color: var(--tg-muted); }
.lp-price ul { margin: .25rem 0 1rem; padding-left: 1.1rem; color: var(--tg-muted); display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.lp-price .tg-btn { align-self: flex-start; }

.lp-costs { margin: 1.5rem auto 0; max-width: 860px; padding: 1.25rem 1.5rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); }
.lp-costs dl { margin: .75rem 0 0; display: grid; grid-template-columns: 1fr auto; gap: .4rem 1rem; }
.lp-costs dt { color: var(--tg-text); }
.lp-costs dd { margin: 0; color: var(--tg-muted); text-align: right; }
.lp-costs .tg-muted { font-size: .85rem; }

.lp-faq { margin: 2rem auto 0; max-width: 760px; display: flex; flex-direction: column; gap: .6rem; }
.lp-faq details { background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: 12px; padding: .9rem 1.1rem; }
.lp-faq summary { cursor: pointer; font-weight: 600; }
.lp-faq details p { margin-top: .6rem; }

.lp-final {
    width: calc(100% - 2rem); max-width: 1120px; margin: 1.5rem auto 4rem; padding: 3rem 1.5rem; text-align: center;
    border-radius: 20px; background: linear-gradient(135deg, #5b54ee, #4338ca); color: #fff;
}
.lp-final h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.lp-final p { margin: .5rem 0 1.5rem; color: #e0e7ff; }
.lp-final .tg-btn-primary { background: #fff; color: var(--tg-accent-hover); }
.lp-final .tg-btn-primary:hover { background: var(--tg-accent-soft); }

.lp-footer {
    margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem;
    padding: 1.5rem max(1rem, calc((100vw - 1120px) / 2));
    border-top: 1px solid var(--tg-border); background: var(--tg-surface); font-size: .9rem;
}
.lp-footer .tg-logo-word { font-size: 1rem; }
.lp-footer-links { margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.lp-footer-company { flex-basis: 100%; margin: 0; color: var(--tg-muted); font-size: .78rem; }

/* Privacy policy and terms: plain reading width */
.lp-legal { width: 100%; max-width: 760px; margin: 0 auto; padding: 3rem 1rem 4rem; line-height: 1.65; }
.lp-legal h1 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); line-height: 1.15; }
.lp-legal h2 { margin: 2.2rem 0 .5rem; font-size: 1.2rem; }
.lp-legal p, .lp-legal li { color: #2b2f3b; }
.lp-legal ul { padding-left: 1.2rem; display: flex; flex-direction: column; gap: .45rem; }
.lp-legal-updated { margin: .5rem 0 1.5rem; color: var(--tg-muted) !important; font-size: .9rem; }

/* Signed-in sidebar: the legal links sit at the bottom */
.tg-side-legal { margin-top: auto; display: flex; gap: 1rem; padding: 0 .75rem; font-size: .82rem; }
.tg-side-legal a { color: var(--tg-muted); text-decoration: none; }
.tg-side-legal a:hover { color: var(--tg-text); text-decoration: underline; }

@media (max-width: 900px) {
    .lp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lp-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .lp-bar-hide { display: none; }
    .lp-bar-links { gap: .9rem; }
    .lp-hero { padding-top: 2.5rem; }
    .lp-steps, .lp-features, .lp-prices { grid-template-columns: 1fr; }
    .lp-start .tg-form-footer { flex-direction: column; align-items: stretch; }
    .lp-start-btn { justify-content: center; margin-left: 0; }
    .lp-footer-links { margin-left: 0; }
}

/* =====================================================================================================
   The portal shell (Components/Layout/AppShell.razor): sidebar, top bar, menus. Static - the menus are
   <details> elements, so no script is involved.
   ===================================================================================================== */
.sh { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sh-side {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 1.4rem; padding: 1.15rem .9rem 1rem;
    background: var(--tg-surface); border-right: 1px solid var(--tg-border);
}
.sh-brand { display: inline-flex; align-items: center; padding: .25rem .55rem; color: var(--tg-text); text-decoration: none; }
.sh-brand .tg-logo-word { font-size: 1.2rem; }
.sh-nav { display: flex; flex-direction: column; gap: .15rem; }
.sh-nav a {
    display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: 10px;
    color: var(--tg-ink-2); text-decoration: none; font-weight: 500; font-size: .95rem;
}
.sh-nav a:hover { background: var(--tg-bg); color: var(--tg-text); }
.sh-nav a.active { background: var(--tg-accent-soft); color: var(--tg-accent); font-weight: 600; }
.sh-nav .icon { flex: none; }
.sh-nav-heading { margin: .9rem .75rem .2rem; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tg-muted); }
.sh-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .55rem; }
.sh-workspace { display: flex; align-items: center; gap: .7rem; padding: .7rem .75rem; border: 1px solid var(--tg-border); border-radius: 12px; background: var(--tg-bg); min-width: 0; }
.sh-workspace > span:last-child { min-width: 0; }
.sh-workspace-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--tg-surface); border: 1px solid var(--tg-border); color: var(--tg-ink-2); }
.sh-workspace small { display: block; color: var(--tg-muted); font-size: .72rem; }
.sh-workspace strong { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-side-link { display: flex; align-items: center; gap: .65rem; padding: .45rem .75rem; color: var(--tg-ink-2); text-decoration: none; font-size: .9rem; border-radius: 8px; }
.sh-side-link:hover { background: var(--tg-bg); color: var(--tg-text); }
.sh-strap { margin: .4rem .75rem 0; font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: var(--tg-muted); }
.sh-strap::before { content: ""; display: block; width: 18px; height: 2px; margin-bottom: .45rem; background: var(--tg-text); border-radius: 2px; }

.sh-main { display: flex; flex-direction: column; min-width: 0; }
.sh-top {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
    height: 64px; padding: 0 1.75rem; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--tg-border);
}
.sh-brand-compact, .sh-mobile-menu { display: none; }
.sh-search {
    flex: 1 1 420px; max-width: 520px; display: flex; align-items: center; gap: .55rem; height: 40px; padding: 0 .85rem;
    border: 1px solid var(--tg-border); border-radius: 10px; background: #f8f9fc; color: var(--tg-muted);
}
.sh-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: .92rem; color: var(--tg-text); }
.sh-search:focus-within { border-color: var(--tg-accent); box-shadow: 0 0 0 3px var(--tg-accent-soft); background: var(--tg-surface); }
.sh-top-actions { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.sh-mode { display: inline-flex; margin: 0; padding: 3px; border: 1px solid var(--tg-border); border-radius: 999px; background: #f8f9fc; }
.sh-mode button {
    display: inline-flex; align-items: center; gap: .3rem; border: 0; background: transparent; cursor: pointer;
    padding: .3rem .72rem; border-radius: 999px; font: inherit; font-size: .82rem; font-weight: 600; color: var(--tg-muted);
}
.sh-mode button:hover { color: var(--tg-text); }
.sh-mode button.sh-mode-on { background: var(--tg-surface); color: var(--tg-accent); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }

.sh-pop { position: relative; }
.sh-pop > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .55rem; }
.sh-pop > summary::-webkit-details-marker { display: none; }
.sh-bell > summary { position: relative; justify-content: center; width: 40px; height: 40px; border-radius: 10px; color: var(--tg-ink-2); }
.sh-bell > summary:hover, .sh-bell[open] > summary { background: var(--tg-bg); color: var(--tg-text); }
.sh-bell-dot {
    position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center;
    border-radius: 999px; border: 2px solid #fff; background: var(--tg-accent); color: #fff; font-size: .64rem; font-weight: 700;
}
.sh-pop-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 350px; max-height: 70vh; overflow-y: auto;
    padding: .45rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: 14px; box-shadow: var(--tg-shadow-pop);
}
.sh-pop-head { display: flex; justify-content: space-between; align-items: center; padding: .45rem .6rem .6rem; border-bottom: 1px solid var(--tg-border); }
.sh-pop-head form { margin: 0; }
.sh-pop-head .tg-link { font-size: .82rem; }
.sh-pop-empty { margin: 0; padding: 1rem .6rem; font-size: .9rem; color: var(--tg-muted); }
.sh-feed { list-style: none; margin: 0; padding: .3rem 0 0; display: flex; flex-direction: column; }
.sh-feed a { display: flex; align-items: flex-start; gap: .7rem; padding: .6rem; border-radius: 10px; color: var(--tg-text); text-decoration: none; }
.sh-feed a:hover { background: var(--tg-bg); }
.sh-feed strong { display: block; font-size: .9rem; font-weight: 600; line-height: 1.35; }
.sh-feed small { display: block; font-size: .8rem; color: var(--tg-muted); }
.act-icon { flex: none; width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; }
.act-good { background: var(--tg-success-soft); color: var(--tg-success); }
.act-warn { background: var(--tg-warn-soft); color: var(--tg-warn); }
.act-info { background: var(--tg-accent-soft); color: var(--tg-accent); }

.sh-user > summary { padding: .3rem .45rem .3rem .3rem; border-radius: 12px; color: var(--tg-ink-2); }
.sh-user > summary:hover, .sh-user[open] > summary { background: var(--tg-bg); }
.sh-avatar { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; background: linear-gradient(135deg, #8b6cff, #5b3fe6); color: #fff; font-weight: 700; font-size: .8rem; }
.sh-user-text strong { display: block; font-size: .88rem; color: var(--tg-text); line-height: 1.2; }
.sh-user-text small { display: block; font-size: .74rem; color: var(--tg-muted); }
.sh-user-panel { width: 250px; }
.sh-user-email { margin: .3rem .6rem .5rem; font-size: .8rem; color: var(--tg-muted); word-break: break-all; }
.sh-user-panel a, .sh-user-panel button {
    display: flex; align-items: center; gap: .65rem; width: 100%; padding: .55rem .6rem; border: 0; border-radius: 8px;
    background: none; color: var(--tg-text); font: inherit; font-size: .9rem; text-decoration: none; cursor: pointer; text-align: left;
}
.sh-user-panel a:hover, .sh-user-panel button:hover { background: var(--tg-bg); }
.sh-user-panel form { margin: .25rem 0 0; padding-top: .25rem; border-top: 1px solid var(--tg-border); }
.sh-user-panel .icon { color: var(--tg-muted); }
.sh-top .tg-nav-credits { white-space: nowrap; }

.sh-content { flex: 1; width: 100%; margin: 0; padding: 1.75rem 2rem 4rem; }
.sh-mobile-nav { position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; width: 240px; padding: .4rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: 14px; box-shadow: var(--tg-shadow-pop); }
.sh-mobile-nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 8px; color: var(--tg-text); text-decoration: none; }
.sh-mobile-nav a:hover { background: var(--tg-bg); }
.sh-mobile-menu { position: relative; }
.sh-mobile-menu > summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--tg-ink-2); }
.sh-mobile-menu > summary::-webkit-details-marker { display: none; }

/* Signed out, or setting up two-step verification: the brand and the way in, nothing else. */
.sh-plain-top { display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 2rem; background: var(--tg-surface); border-bottom: 1px solid var(--tg-border); }

/* =====================================================================================================
   Home dashboard (Components/Shared/DashboardView.razor)
   ===================================================================================================== */
.pd-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.pd-head h1 { font-size: clamp(1.7rem, 2.6vw, 2.25rem); letter-spacing: -.02em; }
.pd-head .tg-lede { margin-top: .4rem; }
.pd-greeting { display: flex; flex-direction: column; gap: .15rem; padding-left: 1.5rem; border-left: 1px solid var(--tg-border); text-align: left; }
.pd-greeting .tg-muted { font-size: .88rem; }
.pd-greeting strong { font-size: 1.05rem; }
.pd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1.5rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); overflow: hidden; }
.pd-stat { display: flex; align-items: center; gap: .9rem; padding: 1.15rem 1.35rem; color: inherit; text-decoration: none; border-right: 1px solid var(--tg-border); }
.pd-stat:last-child { border-right: 0; }
a.pd-stat:hover { background: #fafbff; }
.pd-stat-icon { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--tg-accent-soft); color: var(--tg-accent); }
.pd-stat strong { display: block; font-size: 1.55rem; font-weight: 700; line-height: 1.1; letter-spacing: -.01em; }
.pd-stat small { display: block; margin-top: .15rem; font-size: .86rem; color: var(--tg-muted); }
.pd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 1.5rem; align-items: start; }
.pd-col { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.pd-card { padding: 1.25rem 1.35rem; background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); }
.pd-card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.pd-card-head h2 { font-size: 1.12rem; font-weight: 700; }
.pd-card-head p { margin: .2rem 0 0; font-size: .88rem; }
.pd-btn-sm { padding: .45rem .85rem; font-size: .88rem; }
.pd-table-wrap { margin: 0 -1.35rem; overflow-x: auto; }
.pd-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.pd-table th { padding: .55rem 1.35rem; text-align: left; font-size: .78rem; font-weight: 600; color: var(--tg-muted); background: #fafbfd; border-top: 1px solid var(--tg-border); border-bottom: 1px solid var(--tg-border); white-space: nowrap; }
.pd-table td { padding: .8rem 1.35rem; border-bottom: 1px solid var(--tg-border); vertical-align: middle; }
.pd-table tr:last-child td { border-bottom: 0; }
.pd-project { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; }
.pd-project:hover strong { color: var(--tg-accent); }
.pd-project strong { display: block; font-size: .93rem; }
.pd-project small { display: block; font-size: .76rem; }
.pd-project-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--tg-accent-soft); color: var(--tg-accent); font-weight: 700; }
.pd-env { display: inline-block; margin: 0 .3rem .15rem 0; padding: .12rem .5rem; border: 1px solid var(--tg-border); border-radius: 6px; background: #f8f9fc; color: var(--tg-ink-2); font-size: .75rem; font-weight: 600; }
.pd-env-live { border-color: #bfe6cc; background: var(--tg-success-soft); color: var(--tg-success); }
.pd-status { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.pd-status::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
.pd-status-live { color: var(--tg-success); }
.pd-status-problem { color: var(--tg-warn); }
.pd-status-fix { color: var(--tg-accent); }
.pd-status-preview { color: #0369a1; }
.pd-status-draft { color: var(--tg-muted); }
.pd-more { display: inline-flex; align-items: center; gap: .3rem; margin-top: 1rem; font-size: .9rem; font-weight: 600; text-decoration: none; }
.pd-empty { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 2rem 1rem; text-align: center; }
.pd-empty p { max-width: 44ch; margin: 0 0 .5rem; }
.pd-empty-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 14px; background: var(--tg-accent-soft); color: var(--tg-accent); }
.pd-explore { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.pd-cap { display: flex; gap: .85rem; padding: 1rem; border: 1px solid var(--tg-border); border-radius: 12px; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.pd-cap:hover { border-color: var(--tg-accent); transform: translateY(-1px); }
.pd-cap-icon { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--tg-accent-soft); color: var(--tg-accent); }
.pd-cap strong { display: block; font-size: .95rem; }
.pd-cap small { display: block; margin-top: .2rem; font-size: .83rem; line-height: 1.45; color: var(--tg-muted); }
.pd-feed { margin: 0 -.6rem; }
.pd-quiet { margin: 0; font-size: .9rem; }
.pd-links { list-style: none; margin: 0 -.6rem; padding: 0; }
.pd-links a { display: flex; align-items: center; gap: .8rem; padding: .6rem; border-radius: 10px; color: inherit; text-decoration: none; }
.pd-links a:hover { background: var(--tg-bg); }
.pd-links .icon { flex: none; color: var(--tg-muted); }
.pd-links strong { display: block; font-size: .9rem; }
.pd-links small { display: block; font-size: .8rem; color: var(--tg-muted); }

@media (max-width: 1200px) {
    .pd-grid { grid-template-columns: 1fr; }
    .pd-explore { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .sh { grid-template-columns: 1fr; }
    .sh-side { display: none; }
    .sh-brand-compact, .sh-mobile-menu { display: inline-flex; }
    .sh-top { padding: 0 1rem; gap: .6rem; }
    .sh-user-text, .sh-user > summary > .icon { display: none; }
    .sh-content { padding: 1.5rem 1rem 3rem; }
    .pd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pd-stat:nth-child(2n) { border-right: 0; }
    .pd-stat:nth-child(-n+2) { border-bottom: 1px solid var(--tg-border); }
    .pd-greeting { padding-left: 0; border-left: 0; }
}
@media (max-width: 640px) {
    .sh-search { display: none; }
    .sh-mode-label { display: none; }
    .sh-top .tg-nav-credits { display: none; }
    .pd-explore { grid-template-columns: 1fr; }
    .pd-stat { padding: .9rem; gap: .65rem; }
    .pd-stat-icon { width: 38px; height: 38px; }
    .pd-stat strong { font-size: 1.3rem; }
    .sh-pop-panel { position: fixed; left: .75rem; right: .75rem; top: 70px; width: auto; }
}
.pd-table td:nth-child(3), .pd-table td:nth-child(4) { white-space: nowrap; }
.sh-user-text strong, .sh-user-text small { white-space: nowrap; }
@media (max-width: 640px) { .pd-table th:nth-child(2), .pd-table td:nth-child(2) { display: none; } }

/* Techy Mode: the technical details card in the workspace */
.tg-tech h2 { display: flex; align-items: center; gap: .45rem; }
.tg-tech-list { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; margin: .6rem 0 0; font-size: .86rem; }
.tg-tech-list dt { color: var(--tg-muted); }
.tg-tech-list dd { margin: 0; min-width: 0; word-break: break-word; }
.tg-tech code, .tg-tech-files code { font: .8rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--tg-bg); border: 1px solid var(--tg-border); border-radius: 5px; padding: .05rem .3rem; }
.tg-tech-files { margin-top: .8rem; font-size: .86rem; }
.tg-tech-files summary { cursor: pointer; color: var(--tg-accent); font-weight: 600; }
.tg-tech-files ul { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.tg-tech-files a { text-decoration: none; }
@media (max-width: 1400px) { .pd-grid { grid-template-columns: 1fr; } .pd-col-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; } }

/* Inside the portal shell, pages use the full width of the window (the owner's call: no big empty margins).
   Older page containers were centred with a cap for the old single-column layout; release them here. */
.sh-content .tg-hero { max-width: none; margin: 0; }
.sh-content .tg-hero .tg-lede { max-width: 80ch; }
.sh-content .tg-manage { max-width: none; }
.sh-content .tg-manage > .tg-manage-body:only-child { max-width: 900px; }