:root {
  --red: #C8453F;
  --red-dark: #A8362F;
  /* Light-blue block palette (was warm cream/beige) */
  --cream: #EEF4FC;   /* lightest blue — large block backgrounds */
  --beige: #DCE9F8;   /* slightly deeper blue — chips, steps, buttons */
  --blue: #DCE9F8;    /* alias for clarity in new rules */
  --blue-d: #C6DBF1;  /* hover / accent blue */
  --teal: #B6CFC4;
  --dark: #2A2A2A;
  --muted: #6E6E6E;
  --line: #CDDCEC;    /* blue-tinted borders */
  --green: #1f7a4d;
  --green-bg: #e5f4ec;
  --error: #b3261e;
  --error-bg: #fce8e6;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { overflow-x: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--dark);
  background: #fff;
  font-size: 15px;
  line-height: 1.45;
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.brand { color: var(--red); font-weight: 700; letter-spacing: 0.5px; text-decoration: none; }
.topnav a { color: var(--dark); text-decoration: none; margin-left: 18px; }
.topnav a:hover { color: var(--red); }
.topnav-user { color: var(--muted); margin-right: 12px; }

/* Burger toggle — hidden on desktop, shown on phones */
.nav-toggle {
    display: none; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 38px; padding: 0 9px; margin-left: auto;
    background: transparent; border: 1px solid var(--line); border-radius: 8px;
    cursor: pointer;
}
.nav-toggle-bar {
    display: block; height: 2px; width: 100%; border-radius: 2px;
    background: var(--dark); transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Header collapses into a burger panel on phones — no horizontal scroll */
@media (max-width: 640px) {
    .topbar-inner { position: relative; padding: 10px 20px; }
    .nav-toggle { display: flex; }
    .topnav {
        display: none; position: absolute; left: 0; right: 0; top: 100%;
        flex-direction: column; align-items: stretch; gap: 0;
        background: #fff; border: 1px solid var(--line); border-top: none;
        border-radius: 0 0 10px 10px; box-shadow: 0 12px 28px rgba(0,0,0,.12);
        padding: 6px 0; z-index: 400;
    }
    .topnav.is-open { display: flex; }
    .topnav a { margin-left: 0; padding: 11px 18px; font-size: 15px; }
    .topnav a:hover { background: var(--blue); }
    .topnav-user {
        margin-right: 0; padding: 9px 18px; font-size: 13px;
        border-bottom: 1px solid var(--line); margin-bottom: 4px;
    }
}

.hero { padding: 60px 0 40px; text-align: center; }
.hero h1 { font-size: 36px; margin: 0 0 14px; }
.hero .lead { color: var(--muted); max-width: 640px; margin: 0 auto 24px; }

.btn { display: inline-block; padding: 10px 22px; border-radius: 6px; text-decoration: none; border: 0; cursor: pointer; font-size: 15px; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary { background: var(--beige); color: var(--dark); }
.btn-secondary:hover { background: var(--cream); }

.alert { padding: 10px 14px; border-radius: 6px; margin: 12px 0; }
.alert-success { background: var(--green-bg); color: var(--green); }
.alert-error { background: var(--error-bg); color: var(--error); }

.footer { border-top: 1px solid var(--line); margin-top: 80px; padding: 22px 0; color: var(--muted); font-size: 13px; text-align: center; }

/* Auth */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 160px); padding: 40px 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--cream); border-radius: 10px; padding: 32px; }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-lead { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.field span { color: var(--muted); }
.field input, .field select, .field textarea {
    border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font-size: 15px; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(200,69,63,.18); }
.btn-block { width: 100%; }
.auth-hint { color: var(--muted); font-size: 13px; margin-top: 14px; text-align: center; }

/* Generic helpers */
.muted { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px; }
.num { text-align: right; }
.warn { color: var(--red-dark); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; margin-left: 6px; vertical-align: middle; }
.badge-complex { background: #fce8e6; color: var(--error); }
.badge-included { background: var(--green-bg); color: var(--green); }

/* Steps progress — sticky strip */
.steps-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid var(--line);
    margin: 0 -20px 16px;
    padding: 0 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.steps { display: flex; gap: 8px; padding: 10px 0; flex-wrap: wrap; margin: 0; }
.step { display: flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px; background: var(--beige); color: var(--dark); text-decoration: none; font-size: 13px; white-space: nowrap; }
.step:hover { background: var(--cream); }
.step.is-active { background: var(--red); color: #fff; }
.step.is-done { background: var(--teal); color: #fff; }
.step-num { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,.4); font-weight: 700; }

/* Calculator layout — left column drives height, right column sticks while scrolling it */
.calc-grid { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }
.calc-main h2 { margin-top: 0; }
/* The whole right column sticks — summary card + nav buttons travel together */
.calc-right-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 60px;
    align-self: start;
}
/* Mobile-only tap handle inside the sticky sheet (injected by calculator.js) */
.calc-sheet-handle { display: none; }

@media (max-width: 980px) {
    .calc-grid { grid-template-columns: 1fr; padding-bottom: 150px; }

    /* Compact stepper so 6 chips don't dominate the top on phones */
    .steps { gap: 6px; padding: 8px 0; }
    .step { padding: 5px 9px; font-size: 12px; gap: 6px; }
    .step-num { width: 19px; height: 19px; font-size: 11px; }

    /* Right column becomes a fixed bottom sheet: live totals + nav always visible,
       full breakdown expands on tap. Collapsed height stays small (≤ ~20vh). */
    .calc-right-col {
        order: 0;
        position: fixed;
        left: 0; right: 0; bottom: 0; top: auto;
        z-index: 200;
        gap: 8px;
        margin: 0;
        background: #fff;
        border-top: 1px solid var(--line);
        box-shadow: 0 -6px 24px rgba(0,0,0,0.14);
        padding: 8px 16px calc(10px + env(safe-area-inset-bottom, 0px));
        max-height: 82vh;
        overflow: hidden;
    }
    /* Collapsed: hide the detailed summary card, keep handle + buttons */
    .calc-right-col .calc-summary { display: none; }
    .calc-right-col.is-expanded { overflow-y: auto; }
    .calc-right-col.is-expanded .calc-summary { display: block; }

    .calc-sheet-handle {
        display: flex; align-items: center; justify-content: space-between;
        gap: 12px; cursor: pointer; user-select: none;
        padding: 6px 4px 4px;
    }
    .calc-sheet-handle .sheet-figs { display: flex; flex-direction: column; line-height: 1.15; }
    .calc-sheet-handle .sheet-total { font-size: 19px; font-weight: 700; color: var(--red); }
    .calc-sheet-handle .sheet-days { font-size: 12px; color: var(--muted); }
    .calc-sheet-handle .sheet-chevron {
        flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
        background: var(--beige); color: var(--dark);
        display: flex; align-items: center; justify-content: center;
        font-size: 14px; transition: transform .18s ease;
    }
    .calc-right-col.is-expanded .sheet-chevron { transform: rotate(180deg); }

    /* Nav buttons in a compact single row on mobile (keeps sheet ≤ ~20vh).
       Назад / Далее flex to fill; "Посмотреть итог" collapses to a compact
       icon-only button that jumps straight to the summary.
       Scoped to .calc-right-col so it beats the later base column rule. */
    .calc-right-col .calc-nav-actions { flex-direction: row; flex-wrap: nowrap; gap: 8px; }
    .calc-right-col .calc-nav-actions .btn { flex: 1 1 0; min-width: 0; padding: 11px 10px; }
    .calc-right-col .calc-nav-actions .btn-summary {
        flex: 0 0 auto; width: 48px; padding: 11px 0;
        font-size: 19px; line-height: 1; font-weight: 700;
    }
    .calc-right-col .calc-nav-actions .btn-summary .btn-summary-text { display: none; }
    .calc-right-col .calc-nav-actions .btn-summary .btn-summary-icon { display: inline; }
}

/* Nav actions (back / next / summary link) */
.calc-nav-actions { display: flex; flex-direction: column; gap: 8px; }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--dark); text-align: center; }
.btn-outline:hover { background: var(--beige); }
/* Summary button: full text on desktop, icon hidden (only used as compact glyph on mobile) */
.btn-summary .btn-summary-icon { display: none; }

/* Base-info panel (step 1) */
.base-info-panel { background: var(--cream); border-radius: 10px; padding: 16px 18px; margin-top: 18px; }
.base-info-loading { color: var(--muted); font-size: 14px; }
.base-info-totals { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; }
.base-info-totals span { font-size: 14px; color: var(--muted); }
.base-info-totals strong { color: var(--dark); }
.base-info-services strong { font-size: 14px; display: block; margin-bottom: 6px; }
.base-info-services ul { margin: 0; padding-left: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 16px; }
.base-info-services li { font-size: 13px; color: var(--dark); padding: 2px 0; }

/* Design variant cards */
.design-fieldset { border: 0; padding: 0; margin: 14px 0 22px; }
.design-fieldset legend { font-weight: 600; margin-bottom: 8px; }
.design-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.design-card { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--beige); border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.design-card:hover { background: var(--cream); }
.design-card.is-selected { border-color: var(--red); background: var(--cream); }
.design-card input { accent-color: var(--red); }

/* Services list */
.services-list { display: flex; flex-direction: column; gap: 10px; }
.service { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.service.is-selected { border-color: var(--red); background: #fff8f5; }
.service.is-included { background: var(--green-bg); border-color: #b9dcc8; }
.service.is-recommended { border-color: var(--teal); background: #f0faf6; }
.service-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; cursor: pointer; }
.service-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--red); }
.service-name { font-weight: 500; }
.service-price { color: var(--muted); font-size: 13px; white-space: nowrap; }
.service-desc { color: var(--muted); font-size: 13px; margin: 8px 0 0; padding-left: 32px; }
.service-qty { padding-left: 32px; margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.qty-input { width: 80px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
/* "Добавить в рекомендации КП" toggle on service rows */
.service-rec-row { padding-left: 32px; margin-top: 6px; }
.rec-service-toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 12px;
    color: var(--muted); cursor: pointer; padding: 3px 8px; border-radius: 4px;
    border: 1px solid var(--line); background: #fff; }
.rec-service-toggle:hover { border-color: var(--teal); color: var(--dark); background: #f0faf6; }
.rec-service-toggle input { accent-color: var(--teal); width: 14px; height: 14px; }
/* ── Info-icon tooltip (hover/focus) — used on service rows & detail page ── */
.info-ic {
    display: inline-flex; align-items: center; justify-content: center;
    width: 17px; height: 17px; border-radius: 50%;
    background: var(--blue-d); color: var(--red-dark);
    font-size: 11px; font-weight: 700; font-style: normal; line-height: 1;
    cursor: help; position: relative; vertical-align: middle;
    margin-left: 6px; flex-shrink: 0; user-select: none;
}
.info-ic:hover, .info-ic:focus { background: var(--red); color: #fff; outline: none; }
.info-tip {
    /* No-JS fallback: absolute, centered. tooltip.js upgrades this to
       position:fixed with viewport clamping on show (see below). */
    position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%);
    width: max-content; max-width: min(280px, calc(100vw - 24px));
    background: var(--dark); color: #fff;
    font-weight: 400; font-style: normal; font-size: 12px; line-height: 1.45;
    text-align: left; padding: 9px 11px; border-radius: 7px;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    opacity: 0; visibility: hidden; transition: opacity .14s ease;
    pointer-events: none; white-space: normal; z-index: 300;
}
/* Arrow: --arrow is set by tooltip.js to point back at the icon; falls back
   to centered (50%) when JS hasn't positioned it yet. */
.info-tip::after {
    content: ''; position: absolute; top: 100%; left: var(--arrow, 50%); transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: var(--dark);
}
.info-tip.tip-below::after {
    top: auto; bottom: 100%;
    border-top-color: transparent; border-bottom-color: var(--dark);
}
.info-ic:hover .info-tip, .info-ic:focus .info-tip, .info-ic:focus-within .info-tip {
    opacity: 1; visibility: visible;
}

/* Summary recommended list */
.summary-rec-section { background: #f0faf6; border: 1px solid var(--teal); border-radius: 10px;
    padding: 16px 20px; margin: 24px 0; }
.summary-rec-section h3 { margin: 0 0 10px; font-size: 15px; color: #1a6b4a; }
.summary-rec-list { margin: 0; padding-left: 20px; }
.summary-rec-list li { font-size: 14px; padding: 3px 0; color: var(--dark); }

/* Form actions */
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* Summary side — stickiness is handled by parent .calc-right-col so both card + nav travel together */
.calc-summary { width: 100%; }
.calc-summary-card { background: var(--cream); border-radius: 10px; padding: 18px; }
.calc-summary-card h3 { margin: 0 0 8px; font-size: 16px; }
.calc-meta { font-size: 14px; margin: 0 0 14px; color: var(--dark); }
.calc-totals { margin: 0; }
.calc-totals > div { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.calc-totals dt { margin: 0; color: var(--muted); font-size: 13px; }
.calc-totals dd { margin: 0; font-weight: 600; }
.calc-totals .grand dt { color: var(--dark); }
.calc-totals .grand dd { color: var(--red); font-size: 18px; }

/* Summary page */
.summary-meta { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 22px; }
.chip { background: var(--beige); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.chip span { color: var(--muted); margin-right: 6px; }
/* Config chips inside the selections table — keep them tidy, wrap as a group */
.config-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-sm { padding: 3px 10px; font-size: 12px; white-space: nowrap; line-height: 1.5; }

/* Totals bar — each big-total is a card separated by a border */
.summary-totals-bar {
    display: flex;
    flex-wrap: wrap;
    background: var(--cream);
    border-radius: 10px;
    margin-bottom: 28px;
    overflow: hidden;
}
.big-total {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 22px;
    border-right: 1px solid var(--line);
    min-width: 140px;
    flex: 1 0 auto;
}
.big-total:last-child { border-right: none; }
.big-total span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    white-space: nowrap;
}
.big-total strong { font-size: 20px; color: var(--dark); line-height: 1.2; white-space: nowrap; }
.big-total--main strong { font-size: 24px; color: var(--red); }
.big-total--warn strong { color: var(--red-dark); font-size: 18px; }

/* Services by category on summary page */
.summary-cat-title { margin: 22px 0 8px; font-size: 16px; border-bottom: 2px solid var(--beige); padding-bottom: 6px; }
.summary-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 4px; }
.summary-table { width: 100%; border-collapse: collapse; min-width: 480px; }
.summary-table th { background: var(--beige); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.summary-table th, .summary-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.summary-table td.num, .summary-table th.num { text-align: right; }
.summary-table tr.is-included td { background: var(--green-bg); }
.summary-table tr:last-child td { border-bottom: none; }

.summary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 28px; }
.save-form { display: flex; flex-direction: column; gap: 12px; background: var(--beige); padding: 18px; border-radius: 10px; }
.export-actions { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 760px) { .summary-actions { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }

/* Generic horizontal-scroll wrapper for wide tables on narrow screens */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 760px) {
    .page-head { flex-wrap: wrap; }
    .page-head h1 { font-size: 22px; }
    .table-wrap .data-table { min-width: 560px; }
}

/* Data tables / list pages */
.page-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 18px; gap: 12px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table thead th { background: var(--cream); font-weight: 600; font-size: 13px; }
.data-table tr.cat-row th { background: var(--beige); font-size: 13px; padding-top: 12px; }
.data-table a { color: var(--red); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.btn-link { color: var(--red); background: transparent; border: 0; cursor: pointer; padding: 0 4px; font-size: 13px; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--error); }
form.inline { display: inline; }
.rec-toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.rec-toggle input { accent-color: var(--red); }

/* Admin layout */
.admin-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: flex-start; padding: 18px 0; }
.admin-sidenav { background: var(--cream); padding: 18px; border-radius: 8px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 18px; }
.admin-sidenav h3 { margin: 0 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.admin-sidenav a { color: var(--dark); text-decoration: none; padding: 6px 8px; border-radius: 6px; font-size: 14px; }
.admin-sidenav a:hover { background: var(--beige); }
.admin-sidenav hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
/* min-width:0 lets the 1fr content column shrink below its min-content so a
   wide table (min-width) scrolls inside its .table-wrap instead of stretching
   the whole admin grid past the viewport. */
.admin-main { min-width: 0; }
.admin-main h1 { margin-top: 0; }
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin: 14px 0 22px; }
.tile { background: var(--cream); padding: 16px; border-radius: 8px; display: flex; flex-direction: column; gap: 4px; }
.tile-num { font-size: 26px; font-weight: 700; color: var(--red); }
.tile-label { color: var(--muted); font-size: 13px; }

/* Forms (admin) */
.form-grid { display: flex; flex-direction: column; gap: 14px; max-width: 900px; }
.field-inline { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; }
.field-inline-row { display: flex; gap: 18px; flex-wrap: wrap; }
.num-input { width: 130px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.prices-table input { width: 110px; }
.filter-bar, .import-bar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar .field, .import-bar .field { flex: 0 0 auto; }
/* On phones stack filter/import controls full-width so wide native file
   inputs and selects can't push past the viewport edge. */
@media (max-width: 640px) {
    .filter-bar, .import-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .field, .import-bar .field { flex: 1 1 auto; width: 100%; min-width: 0; }
    .filter-bar .btn, .import-bar .btn { width: 100%; }
    .field input, .field select, .field textarea { max-width: 100%; box-sizing: border-box; }
    .field input[type="file"] { width: 100%; }
}
.base-matrix th { background: var(--cream); }
.base-matrix td { vertical-align: top; min-width: 160px; }
.small { font-size: 12px; }

@media (max-width: 980px) { .admin-wrap { grid-template-columns: 1fr; } .admin-sidenav { position: static; } }

/* ============================================================
   Micro-interactions & motion
   Subtle feedback on hover/press, smooth state changes and light
   entrance animations. Everything degrades to an instant, calm UI
   for users who prefer reduced motion (guard at the bottom).
   ============================================================ */

/* Smooth state transitions on interactive elements */
.btn { transition: background-color .18s ease, color .18s ease, transform .12s ease, box-shadow .18s ease; }
.btn-link, .topnav a, .admin-sidenav a, .step, .chip,
.design-card, .service, .tile, .info-ic, .rec-service-toggle, .nav-toggle,
.data-table a, .data-table tbody tr td, .summary-table tbody tr td,
.num-input, .qty-input, .sheet-chevron {
    transition: background-color .18s ease, color .18s ease, border-color .18s ease,
                box-shadow .18s ease, transform .12s ease;
}

/* Buttons: gentle lift on hover, settle back down on press */
.btn-primary:hover, .btn-secondary:hover, .btn-outline:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(42,42,42,.13);
}
.btn-primary:active, .btn-secondary:active, .btn-outline:active {
    transform: translateY(0);
    box-shadow: none;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(200,69,63,.30); }

/* Cards lift slightly and cast a soft shadow on hover */
.design-card:hover, .tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(42,42,42,.10); }
.service:hover { box-shadow: 0 3px 12px rgba(42,42,42,.07); }
/* Selected card gets a soft ring that eases in instead of a hard border snap */
.design-card.is-selected, .service.is-selected { box-shadow: 0 0 0 1px var(--red); }

/* Info icon pops a touch; step chips & sidenav links nudge on hover */
.info-ic:hover { transform: scale(1.12); }
.step:hover { transform: translateY(-1px); }
.admin-sidenav a:hover { transform: translateX(3px); }

/* Table rows highlight on hover */
.data-table tbody tr:hover td { background: var(--cream); }
.summary-table tbody tr:hover td { background: #f3f8ff; }
.summary-table tbody tr.is-included:hover td { background: #d8efe1; }

/* Soft focus ring for the standalone qty / number inputs */
.num-input:focus, .qty-input:focus {
    outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(200,69,63,.18);
}

/* Live total pulses when recalculated (class toggled by calculator.js) */
@keyframes pricePulse {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.10); color: var(--red-dark); }
    100% { transform: scale(1); }
}
.price-bump { display: inline-block; animation: pricePulse .42s ease; }

/* Light entrance animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.hero, .auth-card, .calc-summary-card, .summary-totals-bar, .base-info-panel {
    animation: fadeInUp .32s ease both;
}
.alert { animation: slideDown .3s ease both; }
.calc-right-col.is-expanded .calc-summary { animation: fadeInUp .25s ease both; }
.topnav.is-open { animation: slideDown .2s ease both; }

/* Dashboard tiles fade in with a gentle stagger */
.admin-tiles .tile { animation: fadeInUp .34s ease both; }
.admin-tiles .tile:nth-child(2) { animation-delay: .05s; }
.admin-tiles .tile:nth-child(3) { animation-delay: .10s; }
.admin-tiles .tile:nth-child(4) { animation-delay: .15s; }
.admin-tiles .tile:nth-child(5) { animation-delay: .20s; }
.admin-tiles .tile:nth-child(6) { animation-delay: .25s; }

/* Respect users who prefer reduced motion — collapse everything to instant */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── API keys page ──────────────────────────────────────────────────── */
.api-key-callout {
    background: #d8efe1;
    border: 1px solid #9bd3b4;
    border-radius: 10px;
    padding: 16px 18px;
    margin: 0 0 20px;
}
.api-key-value {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.api-key-value code {
    flex: 1 1 320px;
    background: #fff;
    border: 1px solid #b6d8c5;
    border-radius: 8px;
    padding: 10px 12px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 14px;
    word-break: break-all;
    color: var(--dark);
}
.api-key-create {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin: 0 0 22px;
    flex-wrap: wrap;
}
.api-key-create .field { margin: 0; flex: 1 1 280px; }
.btn-sm { padding: 7px 14px; font-size: 14px; }
code {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 13px;
    background: var(--cream);
    border-radius: 5px;
    padding: 1px 6px;
}
.code-block {
    background: #2a2a2a;
    color: #f4f4f4;
    border-radius: 10px;
    padding: 14px 16px;
    overflow-x: auto;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre;
}
.api-howto { margin-top: 32px; border-top: 1px solid #e3e8ef; padding-top: 20px; }
.api-howto h2 { font-size: 20px; margin: 0 0 10px; }
.api-howto .code-block code { background: none; padding: 0; color: inherit; }
