:root {
    --bg: #f6f3ee;
    --card: #fffdf8;
    --ink: #1d2430;
    --muted: #6d7280;
    --accent: #e76f51;
    --accent-dark: #c85538;
    --line: #e5ded3;
    --header-bg: #fffdf8;
    --hero-start: #ffe8dc;
    --hero-end: #f1e7da;
    --placeholder-start: #f5c7b5;
    --placeholder-end: #e9ddd0;
    --theme-shadow: rgba(29,36,48,.09);
    --shadow: 0 14px 35px var(--theme-shadow);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; background: var(--bg); color: var(--ink); }
a { color: inherit; }
.site-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px clamp(18px, 5vw, 70px); background: color-mix(in srgb, var(--header-bg) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.25rem; text-decoration: none; }
.logo-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--accent); color: white; }
nav { display: flex; gap: 16px; flex-wrap: wrap; font-size: .94rem; }
nav a { text-decoration: none; color: var(--muted); font-weight: 700; }
nav a:hover { color: var(--accent-dark); }
.container { max-width: 1180px; margin: 0 auto; padding: 42px 18px 70px; }
.hero { padding: clamp(36px, 7vw, 80px); border-radius: 36px; background: radial-gradient(circle at top left, var(--hero-start), transparent 35%), linear-gradient(135deg, var(--card), var(--hero-end)); box-shadow: var(--shadow); }
.hero h1 { font-size: clamp(2.3rem, 6vw, 5rem); line-height: .95; margin: 0 0 18px; letter-spacing: -.055em; }
.hero p { max-width: 680px; color: var(--muted); font-size: 1.15rem; line-height: 1.6; }
.page-title { margin-bottom: 26px; }
.page-title h1 { font-size: clamp(2rem, 5vw, 4rem); margin: 0; letter-spacing: -.045em; }
.page-title p { color: var(--muted); font-size: 1.08rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.tile { display: flex; flex-direction: column; min-height: 280px; overflow: hidden; border-radius: 26px; background: var(--card); box-shadow: var(--shadow); text-decoration: none; border: 1px solid color-mix(in srgb, var(--line) 65%, transparent); }
.tile img, .placeholder { width: 100%; height: 180px; object-fit: cover; background: linear-gradient(135deg, var(--placeholder-start), var(--placeholder-end)); display: grid; place-items: center; font-size: 3rem; color: white; }
.tile-body { padding: 18px; }
.tile h2, .tile h3 { margin: 0 0 8px; font-size: 1.13rem; }
.tile p { margin: 0; color: var(--muted); line-height: 1.45; }
.badge { display: inline-block; margin-bottom: 10px; padding: 5px 9px; border-radius: 999px; font-size: .75rem; font-weight: 800; color: var(--accent-dark); background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.btn, button { display: inline-block; border: 0; border-radius: 12px; padding: 11px 15px; background: var(--accent); color: white; font-weight: 800; text-decoration: none; cursor: pointer; }
.btn:hover, button:hover { background: var(--accent-dark); }
.form-card { max-width: 820px; padding: 24px; border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }
label { display: block; margin: 14px 0 6px; font-weight: 800; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font: inherit; background: var(--card); }
textarea { min-height: 110px; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.admin-table th, .admin-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; }
.offer-frame { width: 100%; min-height: 780px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: var(--shadow); }
.site-footer { text-align: center; color: var(--muted); padding: 24px; border-top: 1px solid var(--line); }
@media (max-width: 800px) { .site-header { align-items: flex-start; flex-direction: column; } }
.logo-image { max-width: 44px; max-height: 44px; object-fit: contain; border-radius: 10px; }
.btn-secondary { background: #6d7280; }
.btn-secondary:hover { background: #4f5563; }
.compact-form { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 10px 16px; max-width: 980px; align-items: center; }
.compact-form label { margin: 0; }
.compact-form button, .compact-form p { grid-column: 2; }
.compact-form textarea { min-height: 80px; }
@media (max-width: 760px) { .compact-form { display: block; } .compact-form label { margin: 14px 0 6px; } }

.swatch { display:inline-block; width:26px; height:26px; border-radius:8px; border:1px solid var(--line); margin-right:6px; vertical-align:middle; }

/* v4 refinements */
.logo-image { max-width: 92px; max-height: 64px; object-fit: contain; border-radius: 12px; }
.logo:has(.logo-image) { gap: 14px; }

/* Keep native dialogs, admin overlays and browser-painted controls readable in dark themes. */
dialog, .dialog, .modal, .popup {
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.55); }
input, textarea, select {
    color: var(--ink);
    background: color-mix(in srgb, var(--card) 94%, white 6%);
    border-color: var(--line);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
option { color: #111827; background: #ffffff; }
.form-section-title {
    grid-column: 1 / -1;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-weight: 900;
    font-size: 1.05rem;
}
.check-row {
    grid-column: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-weight: 700;
}
.check-row input { width: auto; }
@media (max-width: 760px) { .check-row { display: flex; margin: 12px 0; } }
.validation-message {
    color: #b00020;
    font-weight: 700;
}
.notice-message {
    border: 1px solid rgba(180, 120, 0, .35);
    background: rgba(255, 200, 80, .16);
    color: var(--text);
    border-radius: 12px;
    padding: .75rem 1rem;
}
.login-card {
    max-width: 460px;
    margin-inline: auto;
}

/* v7 editable site pages */
.content-card {
    max-width: 920px;
    padding: 26px;
    border-radius: 24px;
    background: var(--card);
    box-shadow: var(--shadow);
}
.rich-content { line-height: 1.7; }
.rich-content h2, .rich-content h3 { margin-top: 1.4em; }
.rich-content a, .site-footer a { color: var(--accent); font-weight: 800; }
.rich-content img { max-width: 100%; height: auto; border-radius: 16px; }
.footer-links { margin-top: 6px; }
.wide-form { max-width: 1100px; }
.large-editor { min-height: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .94rem; line-height: 1.5; }
.help-text { color: var(--muted); font-size: .95rem; }
.hint { margin-top: -0.4rem; color: var(--muted); font-size: 0.92rem; }
.validation-summary { background: color-mix(in srgb, var(--accent) 12%, var(--card)); border: 1px solid var(--accent); color: var(--ink); border-radius: 14px; padding: 1rem; margin: 1rem 0; }
.validation-summary ul { margin: .5rem 0 0 1.2rem; }

/* v10 homepage/rich intro refinements */
.hero-intro { max-width: 780px; color: var(--muted); font-size: 1.15rem; }
.hero-intro p { margin: 0 0 1rem; }
.hero-intro p:last-child { margin-bottom: 0; }
.home-featured { margin-top: 34px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.6rem); letter-spacing: -.035em; }
.section-heading p { margin: 0; color: var(--muted); }
.featured-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stats-cards { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap:16px; margin:24px 0; }
.stat-card { background: var(--card); border:1px solid var(--line); border-radius:18px; padding:20px; box-shadow:0 12px 30px var(--shadow); }
.stat-card strong { display:block; font-size:2.4rem; line-height:1; color:var(--accent); }
.stat-card span { display:block; margin-top:8px; color:var(--muted); }

/* v11.1 admin edit form layout fix
   Edit pages use .compact-form as a two-column grid. Headings, checkbox rows
   and action buttons need explicit grid placement otherwise the browser places
   them into the label/value grid and the card appears squashed/misaligned. */
.compact-form > h2,
.compact-form > h3,
.compact-form > .validation-summary,
.compact-form > .help-text,
.compact-form > .hint {
    grid-column: 1 / -1;
}

.compact-form > label:has(input[type="checkbox"]) {
    grid-column: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0;
    font-weight: 800;
}

.compact-form > label:has(input[type="checkbox"]) input {
    flex: 0 0 auto;
    width: auto;
}

.compact-form > button[type="submit"],
.compact-form > a.btn {
    grid-column: 2;
    justify-self: start;
}

.compact-form > a.btn {
    margin-top: -4px;
}

@media (max-width: 760px) {
    .compact-form > label:has(input[type="checkbox"]),
    .compact-form > button[type="submit"],
    .compact-form > a.btn {
        display: inline-flex;
        margin-top: 12px;
    }
}

/* v13 category browsing layouts */
.category-carousel-section { margin-top: 34px; }
.carousel-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 260px);
    gap: 18px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 4px 4px 18px;
    scroll-snap-type: inline mandatory;
}
.carousel-tile { min-height: 260px; scroll-snap-align: start; }
.carousel-tile img, .carousel-tile .placeholder { height: 160px; }
.show-all-tile { border: 2px dashed color-mix(in srgb, var(--accent) 55%, var(--line)); }
.show-all-tile .placeholder { background: color-mix(in srgb, var(--accent) 24%, var(--card)); color: var(--accent-dark); }

/* v15 Mailmentum Create admin refresh */
body.admin-shell {
    --bg: #f5f7fb;
    --card: #ffffff;
    --ink: #172033;
    --muted: #697386;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --line: #dde5f2;
    --theme-shadow: rgba(18, 32, 58, .08);
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    background: var(--bg);
}
.admin-sidebar { position: sticky; top:0; height:100vh; overflow:auto; background:#111827; color:#d8e1f0; padding:18px 14px; border-right:1px solid rgba(255,255,255,.08); }
.admin-brand { display:flex; align-items:center; gap:12px; padding:10px 12px 20px; text-decoration:none; color:#fff; }
.admin-brand-mark { width:40px; height:40px; border-radius:12px; display:grid; place-items:center; background:#2563eb; color:#fff; font-weight:900; }
.admin-brand small { display:block; color:#93a4bd; font-weight:800; margin-top:2px; }
.admin-tree details { border-top:1px solid rgba(255,255,255,.08); padding:10px 0; }
.admin-tree summary { cursor:pointer; list-style:none; font-weight:900; color:#f8fafc; padding:8px 12px; }
.admin-tree summary::-webkit-details-marker { display:none; }
.admin-tree a, .admin-tree span { display:block; padding:8px 12px 8px 26px; color:#b9c5d8; text-decoration:none; border-radius:10px; font-weight:700; }
.admin-tree a:hover { background:rgba(255,255,255,.08); color:#fff; }
.admin-main { min-width:0; }
.admin-topbar { height:64px; display:flex; align-items:center; justify-content:space-between; gap:18px; padding:0 28px; background:#fff; border-bottom:1px solid var(--line); position:sticky; top:0; z-index:20; }
.admin-content { max-width:1400px; padding:28px; margin:0 auto; }
.system-menu { position:relative; }
.system-menu summary { cursor:pointer; padding:9px 14px; border:1px solid var(--line); border-radius:12px; background:#fff; font-weight:800; list-style:none; }
.system-menu summary::-webkit-details-marker { display:none; }
.system-menu div { position:absolute; right:0; top:calc(100% + 8px); min-width:160px; background:#fff; border:1px solid var(--line); border-radius:14px; box-shadow:0 18px 40px rgba(18,32,58,.14); padding:8px; }
.system-menu a { display:block; padding:9px 10px; border-radius:10px; text-decoration:none; color:var(--ink); font-weight:800; }
.system-menu a:hover { background:#eef4ff; }
.admin-shell .site-header, .admin-shell .site-footer { display:none; }
.check-list { display:grid; gap:8px; }
.check-list label { display:flex; gap:8px; align-items:center; margin:0; font-weight:700; }
.check-list input { width:auto; }
.tile-image-wrap { position:relative; width:100%; height:180px; overflow:hidden; background:linear-gradient(135deg, var(--placeholder-start), var(--placeholder-end)); }
.tile-image-wrap > img, .tile-image-wrap > .placeholder { height:100%; }
.rec-card-badge { position:absolute; top:10px; right:10px; border-radius:999px; padding:6px 10px; font-size:.73rem; font-weight:900; box-shadow:0 8px 22px rgba(0,0,0,.16); }
.image-category-badge { position:absolute; bottom:10px; left:10px; border-radius:999px; padding:6px 10px; background:rgba(17,24,39,.78); color:#fff; font-size:.73rem; font-weight:900; backdrop-filter: blur(8px); }
.card-comment { margin:0 0 12px; color:var(--muted); line-height:1.45; }
@media (max-width: 920px) { body.admin-shell { grid-template-columns:1fr; } .admin-sidebar { position:relative; height:auto; } .admin-content { padding:18px; } }


.tile-image-link { display: block; text-decoration: none; color: inherit; }
.card-primary-link { display: inline-block; margin-top: .65rem; font-weight: 800; color: var(--accent); text-decoration: none; }
.card-primary-link:hover, .card-guide-link:hover { text-decoration: underline; }
.card-guide-link { display: block; margin: .45rem 0 .15rem; font-size: .92rem; font-weight: 700; color: var(--accent); text-decoration: none; }
.card-guide-link::before { content: "📘 "; }

/* v15.2.8 consistent admin table actions */
.admin-table .table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.admin-table .table-actions form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.admin-table .table-actions .btn,
.admin-table .table-actions button {
    margin: 0;
    width: auto;
    line-height: 1.1;
}

.admin-table th:last-child,
.admin-table td.table-actions {
    text-align: right;
}

@media (max-width: 760px) {
    .admin-table .table-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

/* v15.2.11 badge rendering/admin preview fix */
.admin-badge-preview {
    display: inline-block;
    position: static;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: .73rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: none;
    white-space: nowrap;
}

/* v15.2.12 recommendation HTML comments */
.card-comment.html-content {
    margin: 0 0 12px;
    font-size: .94rem;
    line-height: 1.45;
}

.card-comment.html-content p {
    margin: 0 0 8px;
}

.card-comment.html-content p:last-child {
    margin-bottom: 0;
}

.card-comment.html-content ul,
.card-comment.html-content ol {
    margin: 6px 0 8px 18px;
    padding: 0;
}

.card-comment.html-content a {
    font-weight: 700;
}

/* v15.2.18 homepage featured cap
   The server limits this section to eight randomly selected items, intended as a
   two-row maximum on the standard desktop grid while remaining responsive. */
.home-featured-grid { align-items: stretch; }

/* v15.2.23 offer/recommendation card consistency */
.carousel-tile-wrap { scroll-snap-align: start; }
.carousel-tile-wrap > .tile { min-height: 260px; width: minmax(220px, 260px); }
.offer-tile .tile-body { display: flex; flex-direction: column; align-items: flex-start; }
