/* Стили для /demo/calculator и /embed/{public_key} — полностью автономны, без Tailwind CDN. */

.hidden { display: none !important; }

.demo-main {
    width: 100%;
    max-width: 76rem;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3.5rem;
    flex: 1 0 auto;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: clip;
}

/* Top B2B Context Bar & Intro */
.demo-subnav {
    background: var(--surface-alt);
    border-bottom: 1px solid var(--line);
}

.demo-subnav-inner {
    max-width: 76rem;
    margin: 0 auto;
    padding: 0.55rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    font-size: 0.85rem;
}

.demo-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
    align-items: center;
}

.demo-quick-links a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
}

.demo-quick-links a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.demo-brand-strip {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.demo-brand-left {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.demo-company-badge {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    background: var(--dark);
    color: #ffffff;
    font-weight: 800;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.demo-brand-name {
    margin: 0;
    font-size: 1.075rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.25;
}

.demo-brand-sub {
    margin: 0.15rem 0 0;
    font-size: 0.825rem;
    color: var(--muted);
}

.demo-brand-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.demo-phone-link {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

.demo-phone-muted {
    font-size: 0.825rem;
    color: var(--subtle);
}

.demo-intro {
    margin-bottom: 1.5rem;
}

.demo-intro h2 {
    margin: 0.55rem 0 0.45rem;
    font-size: clamp(1.5rem, 2.8vw, 2.15rem);
    letter-spacing: -0.025em;
    line-height: 1.18;
    color: var(--ink);
}

.demo-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    max-width: 44rem;
}

/* Two-Column Workbench Layout */
.demo-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.28fr) minmax(0, 0.92fr);
    gap: 1.5rem;
    align-items: start;
}

.demo-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    display: grid;
    gap: 1.25rem;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.demo-sidebar {
    display: grid;
    gap: 1.15rem;
    position: sticky;
    top: 5.25rem;
}

.step-label {
    display: block;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--subtle);
    margin-bottom: 0.5rem;
    overflow-wrap: anywhere;
    max-width: 100%;
}

/* Section Selector */
.trade-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.trade-btn {
    min-height: 48px;
    padding: 0.65rem 0.9rem;
    border-radius: 0.75rem;
    border: 2px solid var(--line);
    background: var(--surface-alt);
    color: var(--ink-soft);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    transition: all 0.15s ease;
}

.trade-btn:hover {
    border-color: var(--accent-border);
    background: var(--surface);
}

.trade-btn.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow: 0 4px 12px -4px rgba(29, 78, 216, 0.25);
}

/* Object Type Cards */
.obj-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.obj-card {
    position: relative;
    border: 1.5px solid var(--line-strong);
    border-radius: 0.75rem;
    background: var(--surface);
    padding: 0.7rem 0.65rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.2rem;
    min-height: 68px;
    transition: all 0.15s ease;
}

.obj-card:hover {
    border-color: var(--accent);
}

.obj-card:has(input:checked),
.obj-card.is-checked {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.obj-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
}

.obj-card:has(input:checked) .obj-title,
.obj-card.is-checked .obj-title {
    color: var(--accent);
}

.obj-sub {
    font-size: 0.76rem;
    color: var(--subtle);
    font-weight: 500;
}

/* Inputs & Selects */
.demo-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.demo-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.demo-field {
    display: grid;
    gap: 0.35rem;
}

.demo-field label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.demo-input,
.demo-select {
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.65rem;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.demo-input:focus,
.demo-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.demo-subbox {
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 0.85rem;
}

.demo-check-card {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 44px;
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.65rem;
    background: var(--surface-alt);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
}

.demo-check-card input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent);
    margin: 0;
    flex-shrink: 0;
}

/* Markup Box */
.markup-box {
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    border-radius: var(--radius-md);
    padding: 0.95rem 1.05rem;
    display: grid;
    gap: 0.45rem;
}

.markup-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--warn-ink);
}

.markup-val {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    padding: 0.15rem 0.5rem;
    border-radius: 0.4rem;
    background: #fef3c7;
}

.markup-box input[type="range"] {
    width: 100%;
    min-height: 36px;
    accent-color: #d97706;
    cursor: pointer;
}

.markup-note {
    margin: 0;
    font-size: 0.78rem;
    color: #92400e;
    line-height: 1.4;
}

/* Tier Cards */
.tiers-stack {
    display: grid;
    gap: 0.7rem;
    min-width: 0;
    max-width: 100%;
}

.tier-card {
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.tier-card:hover {
    border-color: var(--accent-border);
}

.tier-card.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 10px 22px -10px rgba(29, 78, 216, 0.32);
}

.tier-row-top {
    min-width: 0;
    flex-wrap: wrap;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
}

.tier-label {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--ink-soft);
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    flex: 1 1 auto;
}

.tier-card.selected .tier-label {
    color: var(--accent);
}

.tier-label-premium {
    color: #4f46e5;
}

.tier-total {
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--ink);
    flex-shrink: 0;
}

.tier-card.selected .tier-total {
    color: var(--accent);
}

.tier-row-sub {
    margin-top: 0.45rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.tier-row-sub strong {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Export Box */
.export-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: 0.65rem;
}

.export-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
}

.export-head strong {
    color: var(--ink);
}

.export-head span {
    color: var(--subtle);
}

.export-btns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.btn-export {
    min-height: 44px;
    padding: 0.55rem 0.85rem;
    border-radius: 0.65rem;
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    transition: all 0.15s ease;
}

.btn-export:disabled {
    opacity: 0.6;
    cursor: wait;
}

.btn-export.is-pdf {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}

.btn-export.is-pdf:hover {
    border-color: #ef4444;
    background: #fee2e2;
}

.btn-export.is-excel {
    color: #047857;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.btn-export.is-excel:hover {
    border-color: #10b981;
    background: #d1fae5;
}

/* Warnings Box */
.warnings-box {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-ink);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    font-size: 0.835rem;
    display: grid;
    gap: 0.45rem;
}

/* Lead Capture Box */
.lead-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
}

.lead-box h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    color: var(--ink);
}

.lead-box p {
    margin: 0 0 0.85rem;
    font-size: 0.84rem;
    color: var(--muted);
}

.lead-form {
    display: grid;
    gap: 0.7rem;
}

.consent-row {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.consent-row input {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.15rem;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.consent-row label {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.35;
}

.lead-success {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--ok-bg);
    border: 1px solid var(--ok-border);
    color: var(--ok-ink);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 700;
    text-align: center;
}

/* =====================================================================
   Embed Partner Widget (/embed/{public_key})
   ===================================================================== */

.embed-body {
    margin: 0;
    padding: 0.85rem;
    font-family: var(--font-sans);
    background: transparent;
    color: var(--ink);
}

.embed-shell {
    max-width: 48rem;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
    display: grid;
    gap: 1.1rem;
}

.embed-body.is-dark .embed-shell {
    background: var(--dark);
    border-color: var(--dark-line);
    color: #f8fafc;
}

.embed-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--line);
}

.embed-body.is-dark .embed-head {
    border-bottom-color: var(--dark-line);
}

.embed-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.embed-logo-img {
    height: 2.15rem;
    max-width: 120px;
    object-fit: contain;
}

.embed-logo-badge {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #ffffff;
    font-size: 0.875rem;
    background-color: var(--brand-color);
    flex-shrink: 0;
}

.embed-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.2;
}

.embed-sub {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    color: var(--subtle);
}

.embed-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.calc-tab {
    min-height: 44px;
    padding: 0.5rem 0.9rem;
    border-radius: 0.65rem;
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink-soft);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.calc-tab.is-active {
    border-color: var(--brand-color);
    background: var(--accent-soft);
    color: var(--brand-color);
}

.embed-panel {
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 0.95rem;
    display: grid;
    gap: 0.75rem;
}

.embed-body.is-dark .embed-panel {
    background: var(--dark-card);
    border-color: var(--dark-line);
}

.embed-panel-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--subtle);
}

.embed-tiers {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

.embed-tiers .tier-card {
    padding: 0.85rem;
}

.embed-tiers .tier-total {
    font-size: 1.15rem;
    margin-top: 0.25rem;
}

.embed-tiers .tier-desc {
    margin-top: 0.25rem;
    font-size: 0.76rem;
    color: var(--subtle);
}

.embed-summary {
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.8rem 0.95rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 1rem;
    font-size: 0.84rem;
}

.embed-summary b {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.btn-brand {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 1.1rem;
    border: 0;
    border-radius: 0.7rem;
    background-color: var(--brand-color);
    color: #ffffff;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    transition: filter 0.15s ease;
}

.btn-brand:hover {
    filter: brightness(0.92);
}

.embed-divider {
    border-top: 1px solid var(--line);
    padding-top: 1rem;
    display: grid;
    gap: 0.75rem;
}

@media (max-width: 960px) {
    .demo-layout {
        grid-template-columns: 1fr;
    }
    .demo-sidebar {
        position: static;
    }
}

.demo-composition {
    margin: 1.25rem 0;
}

.composition-title {
    font-size: 1rem;
    margin: 0 0 0.75rem;
}

.composition-scroll {
    overflow-x: auto;
}

.composition-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.composition-table th,
.composition-table td {
    border: 1px solid #e2e8f0;
    padding: 0.4rem 0.5rem;
    text-align: left;
}

.contractor-only {
    margin-top: 1rem;
    border: 1px dashed #cbd5e1;
    padding: 0.75rem;
    border-radius: 8px;
}

body.site-body {
    overflow-x: clip;
    max-width: 100vw;
}

@media (max-width: 640px) {
    .demo-main {
        padding: 1rem 0.65rem 2.5rem;
    }
    .demo-card {
        padding: 1.1rem;
    }
    .trade-toggle,
    .obj-grid,
    .demo-grid-2,
    .demo-grid-3,
    .export-btns,
    .embed-tiers {
        grid-template-columns: 1fr;
    }
    .embed-shell {
        padding: 1rem;
    }
}
