/*
 * Device Trade-In Calculator — Styles
 * ------------------------------------------------------------------
 * Scoped under .dtc-wrapper to avoid bleeding into theme styles.
 * Neutral, confident palette with a single emerald accent.
 * Plays well on any modern WordPress theme.
 */

.dtc-wrapper {
    --dtc-bg:         #ffffff;
    --dtc-surface:    #fafaf7;
    --dtc-surface-2:  #f4f3ef;
    --dtc-border:     #e4e2db;
    --dtc-border-2:   #d4d2c9;
    --dtc-ink:        #14181a;
    --dtc-ink-2:      #414449;
    --dtc-muted:      #7a7c7f;
    --dtc-accent:     #0f6b4a;
    --dtc-accent-2:   #0d5a3e;
    --dtc-accent-soft:#e8f2ed;
    --dtc-danger:     #b0282d;
    /* Icon color used inside device tiles (Step 1). Change this one line
     * to recolor the phone/laptop/etc. icons — e.g. #ffffff (white),
     * #111827 (near black), #FFD166 (amber). */
    --dtc-tile-icon-color: #FDD85D;
    /* Hover / selected text color for the condition + storage cards
     * (used when the host theme paints the cards in a dark brand color
     * like purple). Change this line to adjust the highlight tone. */
    --dtc-card-hover-color: #FDD85D;
    --dtc-radius:     14px;
    --dtc-radius-sm:  10px;
    --dtc-shadow:     0 1px 2px rgba(20,24,26,.04), 0 8px 24px -12px rgba(20,24,26,.12);
    --dtc-shadow-lg:  0 20px 60px -30px rgba(20,24,26,.25);
    --dtc-font:       ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --dtc-font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;

    font-family: var(--dtc-font);
    color: var(--dtc-ink);
    width: 100%;
    max-width: 760px;
    margin: 2rem auto;
    box-sizing: border-box;
    line-height: 1.5;
    /* Enable container queries so step layouts (tiles, grade cards, storage
     * buttons) respond to the calculator's *actual* container width, not the
     * viewport. Without this, the form breaks when embedded inside narrow
     * columns (e.g. tablet sidebars where viewport ≥ 640px but the column
     * is only ~300px), because viewport-based media queries fire too early. */
    container-type: inline-size;
    container-name: dtc;
}

.dtc-wrapper *,
.dtc-wrapper *::before,
.dtc-wrapper *::after { box-sizing: border-box; }

/* ------------------------------------------------------------------
 * THEME ISOLATION
 * ------------------------------------------------------------------
 * Prevents the host theme's button/link styles from breaking text
 * visibility inside the calculator (e.g. themes that force white text
 * on every button:hover). We re-assert our own colors on every
 * interactive state. !important is used surgically here because we
 * are competing with theme rules of unknown specificity.
 * ------------------------------------------------------------------ */
.dtc-wrapper button,
.dtc-wrapper button:hover,
.dtc-wrapper button:focus,
.dtc-wrapper button:active,
.dtc-wrapper button:visited {
    text-decoration: none !important;
    text-shadow: none !important;
    text-transform: none;
    letter-spacing: normal;
    font-family: inherit;
}
.dtc-wrapper select,
.dtc-wrapper input,
.dtc-wrapper textarea {
    font-family: inherit;
    text-transform: none;
    letter-spacing: normal;
}

/* If host theme exposes a primary color CSS variable, opt in to it.
 * Site builders can override --dtc-accent in their own stylesheet
 * (e.g. .dtc-wrapper { --dtc-accent: var(--theme-primary); }) to
 * make the form pick up the site's brand color. */

/* ------------------------------ CARD SHELL */
.dtc-card {
    background: var(--dtc-bg);
    border: 1px solid var(--dtc-border);
    border-radius: var(--dtc-radius);
    padding: clamp(1.25rem, 3vw, 2.5rem);
    box-shadow: var(--dtc-shadow);
    position: relative;
    overflow: hidden;
}
.dtc-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--dtc-accent) 0%, #57a986 50%, var(--dtc-accent) 100%);
}

/* ------------------------------ HEADER */
.dtc-header { margin-bottom: 1.75rem; }
.dtc-title {
    font-family: var(--dtc-font-display);
    font-size: clamp(1.5rem, 2.5vw, 1.9rem);
    font-weight: 600;
    color: var(--dtc-ink);
    margin: 0 0 .5rem;
    letter-spacing: -.01em;
}
.dtc-subtitle {
    color: var(--dtc-muted);
    font-size: .95rem;
    margin: 0;
    max-width: 58ch;
}

/* ------------------------------ STEP INDICATOR */
.dtc-steps {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--dtc-border);
    overflow-x: auto;
    scrollbar-width: none;
}
.dtc-steps::-webkit-scrollbar { display: none; }

.dtc-step {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .82rem;
    font-weight: 500;
    color: var(--dtc-muted);
    white-space: nowrap;
    padding: .35rem .65rem;
    border-radius: 100px;
    transition: color .25s ease, background .25s ease;
}
.dtc-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--dtc-surface-2);
    color: var(--dtc-muted);
    font-size: .75rem;
    font-weight: 600;
    transition: background .25s ease, color .25s ease;
}
.dtc-step.is-active        { color: var(--dtc-ink); background: var(--dtc-accent-soft); }
.dtc-step.is-active span   { background: var(--dtc-accent); color: #fff; }
.dtc-step.is-completed span{ background: var(--dtc-ink); color: #fff; }
.dtc-step.is-completed     { color: var(--dtc-ink-2); }

/* ------------------------------ SECTIONS */
.dtc-section {
    display: none;
    animation: dtc-fade .3s ease;
}
.dtc-section.is-active { display: block; }

@keyframes dtc-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dtc-label {
    display: block;
    font-size: .95rem;
    font-weight: 600;
    color: var(--dtc-ink);
    margin-bottom: 1rem;
}
.dtc-required { color: var(--dtc-danger); margin-left: 2px; }

/* ------------------------------ DEVICE TILES (STEP 1) */
.dtc-tiles {
    display: grid;
    /* `minmax(0, 1fr)` (vs. plain `1fr`) lets columns shrink below their
     * content's min-width, so long device labels can never push the grid
     * past its container. */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}
/* When the calculator itself is narrow (e.g. embedded in a 280–360px
 * sidebar), keep tiles legible by dropping to two columns. */
@container dtc (max-width: 360px) {
    .dtc-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.dtc-tile {
    appearance: none;
    background: var(--dtc-surface);
    border: 1.5px solid var(--dtc-border);
    border-radius: var(--dtc-radius-sm);
    padding: 1.5rem 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    font-family: inherit;
    color: var(--dtc-ink-2);
    transition: all .2s ease;
    position: relative;
}
.dtc-tile:hover {
    border-color: var(--dtc-ink);
    background: var(--dtc-bg) !important;
    color: var(--dtc-ink) !important;
    transform: translateY(-1px);
    box-shadow: var(--dtc-shadow);
}
.dtc-tile:focus,
.dtc-tile:focus-visible {
    color: var(--dtc-ink) !important;
    background: var(--dtc-bg) !important;
    outline: none;
    border-color: var(--dtc-accent);
    box-shadow: 0 0 0 3px var(--dtc-accent-soft);
}
.dtc-tile.is-active,
.dtc-tile.is-active:hover,
.dtc-tile.is-active:focus {
    border-color: var(--dtc-accent) !important;
    background: var(--dtc-accent-soft) !important;
    color: var(--dtc-accent-2) !important;
}
.dtc-tile-icon,
.dtc-tile-label { color: inherit !important; }
.dtc-tile.is-active::after {
    content: '✓';
    position: absolute;
    top: 8px; right: 10px;
    font-size: .85rem;
    color: var(--dtc-accent);
    font-weight: 700;
}
.dtc-tile-icon { color: currentColor; }

/* Force icon size + color so the host theme can't shrink or recolor them.
 * We target the <svg> inside .dtc-tile-icon with high specificity and
 * !important because some themes force `color: inherit` or `width: auto`
 * on button descendants. */
.dtc-wrapper .dtc-tile .dtc-tile-icon svg {
    width: 44px !important;
    height: 44px !important;
    color: var(--dtc-tile-icon-color) !important;
    stroke: var(--dtc-tile-icon-color) !important;
}
/* Uploaded raster icons (PNG / JPG / WebP) — sized to match the SVG presets
 * so categories with mixed icon sources still line up visually. */
.dtc-wrapper .dtc-tile .dtc-tile-icon .dtc-tile-img {
    display: block;
    width: 44px;
    height: 44px;
    object-fit: contain;
}
.dtc-wrapper .dtc-tile .dtc-tile-label {
    display: block;
    font-weight: 600;
    font-size: .95rem;
    /* Allow long device names ("MacBook Pro 16") to wrap onto two lines
     * inside narrow tiles instead of forcing the column wider. The
     * `!important` on white-space defeats themes that apply nowrap to
     * buttons/button children. */
    text-align: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: anywhere;
    -webkit-hyphens: auto;
    hyphens: auto;
}

/* ------------------------------ SELECT (STEP 2) */
.dtc-select {
    width: 100%;
    padding: .85rem 2.5rem .85rem 1rem;
    font-size: .95rem;
    font-family: inherit;
    line-height: 1.4;
    min-height: 48px;
    color: var(--dtc-ink);
    background: var(--dtc-bg);
    border: 1.5px solid var(--dtc-border);
    border-radius: var(--dtc-radius-sm);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2314181a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.dtc-select:focus {
    outline: none;
    border-color: var(--dtc-accent);
    box-shadow: 0 0 0 3px var(--dtc-accent-soft);
}

/* ------------------------------ GRADE CARDS (STEP 3) */
.dtc-grades {
    display: grid;
    /* Default: vertical / single column. Stays this way on phones AND
     * tablets, so the three condition cards (Excellent / Good / Poor)
     * stack neatly down the page and never clip on the right edge.
     *
     * The cards are tall enough to be tap-friendly and the user can read
     * the full grade description without horizontal cramming, which is
     * what most modern checkout flows do anyway. */
    grid-template-columns: minmax(0, 1fr);
    gap: .75rem;
}
/* PRIMARY: Only switch to a 3-column row when the *calculator's container*
 * is genuinely desktop-wide (≥ 720px). Previously this threshold was
 * 480px, which still fired on tablets when the form sat inside a wider
 * content column and clipped the third card. Tablets are now reliably
 * vertical. */
@container dtc (min-width: 720px) {
    .dtc-grades { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* FALLBACK for browsers without container query support (rare in 2026 —
 * Chrome 105+, Safari 16+, Firefox 110+ all support them). Use a wide
 * viewport breakpoint so a narrow embed on a tablet/laptop still stacks
 * the cards rather than clipping. */
@supports not (container-type: inline-size) {
    @media (min-width: 1100px) {
        .dtc-grades { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
}
.dtc-grade-card {
    appearance: none;
    background: var(--dtc-surface);
    border: 1.5px solid var(--dtc-border);
    border-radius: var(--dtc-radius-sm);
    padding: 1.25rem 1rem;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    color: var(--dtc-ink);
    transition: all .2s ease;
    min-height: 110px;
}
.dtc-grade-card:hover:not(.is-disabled) {
    border-color: var(--dtc-ink);
    background: var(--dtc-bg) !important;
    color: var(--dtc-ink) !important;
    transform: translateY(-1px);
    box-shadow: var(--dtc-shadow);
}
.dtc-grade-card:focus,
.dtc-grade-card:focus-visible {
    color: var(--dtc-ink) !important;
    background: var(--dtc-bg) !important;
    outline: none;
    border-color: var(--dtc-accent);
    box-shadow: 0 0 0 3px var(--dtc-accent-soft);
}
.dtc-grade-card.is-active,
.dtc-grade-card.is-active:hover,
.dtc-grade-card.is-active:focus {
    border-color: var(--dtc-accent) !important;
    background: var(--dtc-accent-soft) !important;
    color: var(--dtc-ink) !important;
}
.dtc-grade-card.is-disabled {
    opacity: .5;
    cursor: not-allowed;
    background: var(--dtc-surface-2);
}
/* Card body — give the flex children block-level behaviour with a hard
 * width cap so long titles or subtitles wrap onto a second/third line
 * inside the card instead of overflowing into the neighbouring card.
 *
 * `white-space: normal !important` is needed because some host themes
 * apply `white-space: nowrap` to buttons or button descendants, which
 * would prevent wrapping no matter what `overflow-wrap` says.
 *
 * `overflow-wrap: anywhere` lets words break mid-character if a single
 * word is wider than the card (e.g. extremely long model names). */
.dtc-wrapper .dtc-grade-card .dtc-grade-title,
.dtc-wrapper .dtc-grade-card .dtc-grade-sub {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: anywhere;
    -webkit-hyphens: auto;
    hyphens: auto;
}
.dtc-grade-card { min-width: 0; }

.dtc-grade-title {
    font-weight: 600;
    font-size: .95rem;
}
.dtc-grade-sub {
    font-size: .82rem;
    color: var(--dtc-muted);
    line-height: 1.4;
}
.dtc-grade-na {
    display: inline-block;
    margin-top: .25rem;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--dtc-danger);
    font-weight: 600;
}

/* ------------------------------ STORAGE BUTTONS (STEP 4) */
.dtc-storage {
    display: grid;
    /* 110px minimum (down from 150px) keeps two columns visible inside
     * narrow embeds (~280px) instead of falling back to a single column.
     * `auto-fit` still expands to more columns when there's room. */
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: .6rem;
}
/* In genuinely narrow containers, drop to a single column rather than
 * cramming an unreadable two-column layout. */
@container dtc (max-width: 280px) {
    .dtc-storage { grid-template-columns: minmax(0, 1fr); }
}
.dtc-storage-btn {
    appearance: none;
    background: var(--dtc-surface);
    border: 1.5px solid var(--dtc-border);
    border-radius: var(--dtc-radius-sm);
    padding: .9rem .75rem;
    cursor: pointer;
    font-family: inherit;
    color: var(--dtc-ink);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    transition: all .2s ease;
}
.dtc-storage-btn:hover:not(.is-disabled) {
    border-color: var(--dtc-ink);
    background: var(--dtc-bg) !important;
    color: var(--dtc-ink) !important;
}
.dtc-storage-btn:focus,
.dtc-storage-btn:focus-visible {
    color: var(--dtc-ink) !important;
    background: var(--dtc-bg) !important;
    outline: none;
    border-color: var(--dtc-accent);
    box-shadow: 0 0 0 3px var(--dtc-accent-soft);
}
.dtc-storage-btn.is-active,
.dtc-storage-btn.is-active:hover,
.dtc-storage-btn.is-active:focus {
    border-color: var(--dtc-accent) !important;
    background: var(--dtc-accent-soft) !important;
    color: var(--dtc-accent-2) !important;
}
.dtc-storage-btn.is-disabled {
    opacity: .45;
    cursor: not-allowed;
}
.dtc-storage-btn { min-width: 0; }
.dtc-wrapper .dtc-storage-btn .dtc-storage-cap,
.dtc-wrapper .dtc-storage-btn .dtc-storage-preview {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    text-align: center;
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: anywhere;
}
.dtc-storage-cap {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -.01em;
}
.dtc-storage-preview {
    font-size: .78rem;
    color: var(--dtc-muted);
}
.dtc-storage-na {
    font-size: .7rem;
    color: var(--dtc-danger);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
}
.dtc-charger-notice {
    margin-top: 1rem;
    padding: .75rem 1rem;
    background: var(--dtc-surface-2);
    border-left: 3px solid var(--dtc-accent);
    border-radius: 6px;
    font-size: .82rem;
    color: var(--dtc-ink-2);
}

/* ------------------------------ DARK-TILE TEXT OVERRIDES
 * When the host theme paints .dtc-grade-card / .dtc-storage-btn in a
 * solid dark brand color (e.g. purple), the default muted subtext
 * (grey on purple) becomes unreadable. Force white at rest and a
 * bright accent on hover / selected so both lines stay visible.
 * Disabled state keeps its own opacity treatment from above.
 * ------------------------------------------------------------------ */

/* Default — white on the painted card */
.dtc-wrapper .dtc-grade-card .dtc-grade-title,
.dtc-wrapper .dtc-grade-card .dtc-grade-sub,
.dtc-wrapper .dtc-storage-btn .dtc-storage-cap,
.dtc-wrapper .dtc-storage-btn .dtc-storage-preview {
    color: #ffffff !important;
}

/* Hover + selected — switch to the highlight tone */
.dtc-wrapper .dtc-grade-card:hover:not(.is-disabled) .dtc-grade-title,
.dtc-wrapper .dtc-grade-card:hover:not(.is-disabled) .dtc-grade-sub,
.dtc-wrapper .dtc-grade-card.is-active .dtc-grade-title,
.dtc-wrapper .dtc-grade-card.is-active .dtc-grade-sub,
.dtc-wrapper .dtc-storage-btn:hover:not(.is-disabled) .dtc-storage-cap,
.dtc-wrapper .dtc-storage-btn:hover:not(.is-disabled) .dtc-storage-preview,
.dtc-wrapper .dtc-storage-btn.is-active .dtc-storage-cap,
.dtc-wrapper .dtc-storage-btn.is-active .dtc-storage-preview {
    color: var(--dtc-card-hover-color) !important;
}

/* ------------------------------ QUOTE CARD (STEP 5) */
.dtc-quote-card {
    background: linear-gradient(180deg, var(--dtc-surface) 0%, var(--dtc-bg) 100%);
    border: 1px solid var(--dtc-border);
    border-radius: var(--dtc-radius);
    padding: 1.75rem 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.dtc-quote-summary {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    margin-bottom: 1.25rem;
}
.dtc-quote-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--dtc-muted);
    font-weight: 600;
}
.dtc-quote-device {
    font-family: var(--dtc-font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--dtc-ink);
}
.dtc-quote-config {
    font-size: .85rem;
    color: var(--dtc-muted);
}

/* Cash / Voucher toggle */
.dtc-quote-toggle {
    display: inline-flex;
    background: var(--dtc-surface-2);
    border-radius: 100px;
    padding: 4px;
    margin-bottom: 1.25rem;
}
.dtc-toggle-btn {
    appearance: none;
    background: transparent !important;
    border: 0;
    padding: .5rem 1.25rem;
    font-family: inherit;
    font-weight: 600;
    font-size: .85rem;
    color: var(--dtc-muted) !important;
    cursor: pointer;
    border-radius: 100px;
    transition: all .25s ease;
}
.dtc-toggle-btn:hover,
.dtc-toggle-btn:focus {
    color: var(--dtc-ink) !important;
    background: transparent !important;
}
.dtc-toggle-btn.is-active,
.dtc-toggle-btn.is-active:hover,
.dtc-toggle-btn.is-active:focus {
    background: var(--dtc-ink) !important;
    color: #fff !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

/* Price display */
.dtc-price-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: .15rem;
    margin-bottom: .5rem;
    font-family: var(--dtc-font-display);
}
.dtc-price-currency {
    font-size: 1.75rem;
    color: var(--dtc-accent);
    font-weight: 500;
}
.dtc-price-amount {
    font-size: clamp(2.5rem, 6vw, 3.75rem);
    font-weight: 600;
    color: var(--dtc-accent);
    letter-spacing: -.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.dtc-price-note {
    font-size: .85rem;
    color: var(--dtc-muted);
    margin: 0;
}

/* ------------------------------ CONTACT FIELDSET */
.dtc-contact {
    border: 1px solid var(--dtc-border);
    border-radius: var(--dtc-radius-sm);
    padding: 1.25rem;
    margin: 0 0 1.25rem;
    background: var(--dtc-bg);
}
.dtc-contact legend {
    padding: 0 .5rem;
    font-weight: 600;
    font-size: .9rem;
    color: var(--dtc-ink);
}
.dtc-field { display: flex; flex-direction: column; margin-bottom: 1rem; }
.dtc-field:last-child { margin-bottom: 0; }
.dtc-field label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--dtc-ink-2);
    margin-bottom: .4rem;
}
.dtc-field input,
.dtc-field textarea {
    width: 100%;
    padding: .75rem .9rem;
    font-size: .95rem;
    font-family: inherit;
    color: var(--dtc-ink);
    background: var(--dtc-bg);
    border: 1.5px solid var(--dtc-border);
    border-radius: var(--dtc-radius-sm);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.dtc-field input:focus,
.dtc-field textarea:focus {
    outline: none;
    border-color: var(--dtc-accent);
    box-shadow: 0 0 0 3px var(--dtc-accent-soft);
}
.dtc-field textarea { resize: vertical; min-height: 80px; }
.dtc-field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}
/* Two-up only when the calculator itself has the room. */
@container dtc (min-width: 480px) {
    .dtc-field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dtc-field-row .dtc-field { margin-bottom: 0; }
}
@supports not (container-type: inline-size) {
    @media (min-width: 720px) {
        .dtc-field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .dtc-field-row .dtc-field { margin-bottom: 0; }
    }
}

/* ------------------------------ ACTIONS & BUTTONS */
.dtc-actions {
    display: flex;
    gap: .6rem;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}
.dtc-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .85rem 1.5rem;
    font-family: inherit;
    font-size: .93rem;
    font-weight: 600;
    border-radius: var(--dtc-radius-sm);
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .2s ease;
    position: relative;
    min-height: 44px;
}
.dtc-btn-ghost {
    background: transparent !important;
    color: var(--dtc-ink-2) !important;
    border-color: var(--dtc-border);
}
.dtc-btn-ghost:hover,
.dtc-btn-ghost:focus {
    border-color: var(--dtc-ink);
    color: var(--dtc-ink) !important;
    background: transparent !important;
}

.dtc-btn-primary {
    background: var(--dtc-ink) !important;
    color: #fff !important;
    border-color: var(--dtc-ink);
    margin-left: auto;
}
.dtc-btn-primary:hover,
.dtc-btn-primary:focus {
    background: #000 !important;
    border-color: #000;
    color: #fff !important;
}
.dtc-btn-primary:disabled { opacity: .7; cursor: wait; }

.dtc-btn-spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    display: none;
    animation: dtc-spin .8s linear infinite;
}
.dtc-btn.is-loading .dtc-btn-label  { display: none; }
.dtc-btn.is-loading .dtc-btn-spinner { display: inline-block; }
@keyframes dtc-spin { to { transform: rotate(360deg); } }

/* ------------------------------ FEEDBACK */
.dtc-feedback {
    margin-top: 1rem;
    padding: .85rem 1rem;
    border-radius: var(--dtc-radius-sm);
    font-size: .88rem;
}
.dtc-feedback.is-error {
    background: #fdecec;
    border: 1px solid #f2b6b8;
    color: var(--dtc-danger);
}
.dtc-feedback.is-info {
    background: var(--dtc-accent-soft);
    border: 1px solid #bfe0d0;
    color: var(--dtc-accent-2);
}

/* ------------------------------ SUCCESS SCREEN */
.dtc-success {
    text-align: center;
    padding: 2rem 1rem;
    animation: dtc-fade .4s ease;
}
.dtc-success-icon {
    display: inline-flex;
    padding: 1rem;
    margin-bottom: 1rem;
    color: var(--dtc-accent);
    background: var(--dtc-accent-soft);
    border-radius: 50%;
}
.dtc-success-icon .dtc-success-img {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: contain;
}
.dtc-success h3 {
    font-family: var(--dtc-font-display);
    font-size: 1.6rem;
    color: var(--dtc-ink);
    margin: 0 0 .5rem;
}
.dtc-success p {
    color: var(--dtc-muted);
    max-width: 40ch;
    margin: 0 auto 1.25rem;
}

/* ------------------------------ SMALL SCREENS / NARROW CONTAINERS */
/* Container query — fires whenever the calculator itself is narrow,
 * regardless of viewport. This is what fixes embeds in tablet sidebars. */
@container dtc (max-width: 480px) {
    .dtc-tile  { padding: 1rem .5rem; }
    .dtc-tile-label { font-size: .85rem; }
    .dtc-actions { flex-direction: column-reverse; }
    .dtc-btn { width: 100%; }
    .dtc-grade-card { padding: 1rem .85rem; min-height: 0; }
    .dtc-card { padding: 1.1rem; }
    .dtc-title { font-size: 1.35rem; }
    .dtc-quote-card { padding: 1.25rem 1rem; }
}

/* Viewport fallback for browsers without container query support, and a
 * final safety net for genuinely tiny phone viewports. */
@media (max-width: 480px) {
    .dtc-tiles { gap: .5rem; }
    .dtc-tile  { padding: 1rem .5rem; }
    .dtc-tile-label { font-size: .85rem; }
    .dtc-actions { flex-direction: column-reverse; }
    .dtc-btn { width: 100%; }
    .dtc-wrapper { margin: 1rem auto; }
}
