/* ============================================================
   Profit.StoreFront — publik prisjämförelse-sida
   Editorial-tonad design: serif-display + sans-body, varma toner,
   subtila lager och ett distinkt besparings-uttryck.
   ============================================================ */

:root {
    /* Bakgrunder */
    --bg: #f6f3ec;
    --bg-soft: #ede9dd;
    --bg-warm: #fbf6ec;
    --surface: #ffffff;

    /* Bordar */
    --border: #e6dfd0;
    --border-strong: #d3cab5;

    /* Text */
    --text: #1c211c;
    --text-soft: #4a504a;
    --text-muted: #7a8078;
    --text-faint: #a8aea4;

    /* Brand & accent */
    --brand: #234c41;            /* djup mossgrön */
    --brand-deep: #122a23;
    --brand-soft: #e2ebe6;
    --brand-glow: rgba(35, 76, 65, 0.12);

    --accent: #c2410c;           /* terrakotta — varm sidoaccent */
    --accent-soft: #fce5d4;

    --savings: #15803d;
    --savings-bg: #d6f0db;
    --savings-strong: #14532d;

    /* Skugga och radius */
    --shadow-xs: 0 1px 2px rgba(20, 30, 25, 0.04);
    --shadow-sm: 0 2px 6px rgba(20, 30, 25, 0.06);
    --shadow-md: 0 6px 20px rgba(20, 30, 25, 0.08);
    --shadow-lg: 0 20px 50px rgba(20, 30, 25, 0.12);

    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 24px;
    --r-pill: 999px;

    /* Typografi */
    --font-display: 'Fraunces', 'Georgia', serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    padding: 0;
}

/* ===== Layout ============================================== */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

main.page-main { flex: 1; padding-bottom: 5rem; }

/* ===== Hero =============================================== */

.hero {
    position: relative;
    overflow: hidden;
    padding: 4rem 0 3.5rem;
    background:
        radial-gradient(800px 360px at 50% 0%, rgba(194, 65, 12, 0.06), transparent 70%),
        radial-gradient(1000px 500px at 50% 100%, rgba(35, 76, 65, 0.08), transparent 60%),
        linear-gradient(180deg, #fbf6ec 0%, #f6f3ec 100%);
}

.hero::before {
    /* Subtilt prick-mönster för djup. Pos:as svagt så det inte konkurrerar
       med innehållet. */
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(35, 76, 65, 0.07) 1px, transparent 1.5px);
    background-size: 28px 28px;
    background-position: 0 0;
    opacity: 0.5;
    pointer-events: none;
}

.hero-inner {
    position: relative;
    text-align: center;
}

.hero-live {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    padding: 0.4rem 0.9rem 0.4rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-soft);
    letter-spacing: 0.02em;
    box-shadow: var(--shadow-xs);
    margin-bottom: 1.75rem;
}

.hero-live .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--savings);
    box-shadow: 0 0 0 0 rgba(21, 128, 61, 0.5);
    animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(21, 128, 61, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(21, 128, 61, 0); }
    100% { box-shadow: 0 0 0 0 rgba(21, 128, 61, 0); }
}

/* Wrapper sätter bara höjden (och centrerar via parent text-align: center).
   Bredden anpassas efter loggans naturliga proportioner — inget vitt kort,
   ingen ram, så irreguljära logo-former läses direkt mot hero-bakgrunden. */
.hero-logo {
    display: inline-block;
    height: 104px;
    margin: 0 auto 1.5rem;
    line-height: 0;     /* hindrar baseline-gap under img */
}

.hero-logo img {
    height: 100%;
    width: auto;
    display: block;
    max-width: 360px;   /* säkerhetstak för extremt breda loggor */
    object-fit: contain;
}

/* Fallback (när butiken saknar logga) — fortsatt fast kvadrat med
   Profit-gradient och initial. Står på egen bg, så vi måste lägga
   tillbaka skuggan och radien här. */
.hero-logo-fallback {
    width: 104px;
    height: 104px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
    color: #fff;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.hero h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2rem, 3.6vw + 0.5rem, 3.2rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0 0 0.85rem;
    color: var(--brand-deep);
    font-variation-settings: "opsz" 144;
}

.hero-tagline {
    font-size: 1.1rem;
    color: var(--text-soft);
    max-width: 38rem;
    margin: 0 auto;
    line-height: 1.6;
}

.hero-tagline em {
    font-style: italic;
    font-family: var(--font-display);
    color: var(--accent);
    font-weight: 500;
}

/* ===== Trust-strip (editorial KPI-rad) ==================== */

.trust-strip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    margin: -2rem auto 3.5rem;
    box-shadow: var(--shadow-lg);
    max-width: 760px;
    padding: 1.5rem 2rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 2;
}

.trust-divider {
    width: 1px;
    height: 44px;
    background: var(--border);
    justify-self: center;
}

.trust-cell { text-align: center; }

.trust-value {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 2rem;
    color: var(--brand-deep);
    letter-spacing: -0.02em;
    line-height: 1;
    font-variation-settings: "opsz" 144;
}

.trust-value .unit {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 0.3rem;
    letter-spacing: 0;
}

.trust-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.5rem;
    font-weight: 600;
}

@media (max-width: 640px) {
    .trust-strip {
        grid-template-columns: 1fr;
        padding: 1.25rem;
    }
    .trust-divider { width: 60%; height: 1px; justify-self: center; }
}

/* ===== Section heading =================================== */

.section { margin-top: 3.5rem; }

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
}

.section-head .eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.section-head h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.85rem;
    color: var(--brand-deep);
    margin: 0;
    letter-spacing: -0.02em;
    font-variation-settings: "opsz" 96;
}

.section-head .section-aside {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--font-display);
}

/* ===== Search ============================================ */

.search-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    padding: 0.6rem 0.6rem 0.6rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.search-box:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 5px var(--brand-glow), var(--shadow-lg);
    transform: translateY(-1px);
}

.search-box i.fa-magnifying-glass {
    color: var(--brand);
    font-size: 1.1rem;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1.1rem;
    color: var(--text);
    padding: 0.7rem 0;
    min-width: 0;
    font-family: inherit;
}

.search-input::placeholder { color: var(--text-faint); }

.search-submit {
    background: var(--brand);
    color: #fff;
    border-radius: var(--r-pill);
    padding: 0.75rem 1.4rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.15s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(35, 76, 65, 0.25);
}

.search-submit:hover { background: var(--brand-deep); transform: translateY(-1px); }
.search-submit:active { transform: translateY(0); }

.search-suggestions {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.search-suggestions .label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--font-display);
    margin-right: 0.25rem;
}

.chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    padding: 0.4rem 0.95rem;
    font-size: 0.85rem;
    color: var(--text-soft);
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: var(--brand-deep);
}

/* ===== Sökresultat ======================================= */

/* .sf-search är relative-positionerad så rullgardinen kan absolut-positioneras
   direkt under sökrutan. */
.sf-search { position: relative; margin-bottom: 1.25rem; }

/* Hur många varor jämförelsen omfattar — en diskret rad direkt under sökrutan */
.sf-assortment-note {
    margin: -0.85rem 0 1.1rem 0.25rem;
    font-size: 0.8rem;
    color: var(--text-faint);
}

.sf-assortment-note i { margin-right: 0.3rem; }

.search-spinner {
    color: var(--text-faint);
    font-size: 1rem;
    margin-right: 0.6rem;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.75rem;
    z-index: 50;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-height: 460px;
    overflow-y: auto;
}

.search-result {
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 0.9rem 1.25rem;
    text-align: left;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s;
}

.result-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-soft), #c8d8d0);
    overflow: hidden;
    flex-shrink: 0;
}

.result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    display: block;
}

.search-result:last-child { border-bottom: none; }
.search-result:hover:not(:disabled) { background: var(--bg-warm); }
.search-result:disabled { opacity: 0.6; cursor: default; }

.search-result.in-cart .result-action { color: var(--savings); }

.result-info { min-width: 0; }
.result-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.98rem;
    line-height: 1.3;
}
.result-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.result-prices { text-align: right; }
.result-our {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.result-saving {
    font-size: 0.8rem;
    color: var(--savings-strong);
    background: var(--savings-bg);
    border-radius: var(--r-pill);
    padding: 0.1rem 0.55rem;
    margin-top: 0.3rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.result-saving i { font-size: 0.65rem; }
.result-loss {
    font-size: 0.8rem;
    background: #fde2d4;
    color: #9a3412;
    border-radius: var(--r-pill);
    padding: 0.1rem 0.55rem;
    margin-top: 0.3rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.result-loss i { font-size: 0.65rem; }

.result-action {
    width: 36px;
    height: 36px;
    border-radius: var(--r-pill);
    background: var(--brand-soft);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.shopping-loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

/* ===== Kontroll-rad (toolbar) ============================ */

.sf-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.sf-dropdown { position: relative; }

.sf-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-soft);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sf-dropdown-trigger:hover { background: var(--bg-warm); border-color: var(--border-strong); }
.sf-dropdown-trigger i { font-size: 0.7rem; transition: transform 0.2s; }
.sf-dropdown.open .sf-dropdown-trigger {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: var(--brand-deep);
}
.sf-dropdown.open .sf-dropdown-trigger i { transform: rotate(180deg); }

.sf-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 60;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    max-height: 360px;
    overflow-y: auto;
}

.sf-dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--r-sm);
    font-size: 0.92rem;
    color: var(--text);
    text-align: left;
    transition: background 0.15s;
}

.sf-dropdown-item:hover:not(:disabled) { background: var(--bg-warm); }
.sf-dropdown-item:disabled { opacity: 0.6; cursor: default; }

.sf-item-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    background: var(--bg-soft);
    border-radius: var(--r-pill);
    padding: 0.05rem 0.5rem;
}

.sf-dropdown-bulk {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.35rem;
}
.sf-dropdown-bulk button {
    color: var(--brand);
    font-weight: 600;
    font-size: 0.8rem;
    border-bottom: 1px dashed transparent;
}
.sf-dropdown-bulk button:hover { border-bottom-color: var(--brand); }

.sf-dropdown-check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--r-sm);
    font-size: 0.92rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}
.sf-dropdown-check:hover { background: var(--bg-warm); }
.sf-dropdown-check input { accent-color: var(--brand); width: 16px; height: 16px; }

/* Butiksväljaren: max fyra butiker — hjälptext överst och spärrade rader när urvalet är fullt */
.sf-dropdown-hint {
    padding: 0.2rem 0.75rem 0.5rem;
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--text-muted);
}
.sf-dropdown-check--locked { color: var(--text-faint); cursor: not-allowed; }
.sf-dropdown-check--locked:hover { background: none; }
.sf-dropdown-check--locked input { cursor: not-allowed; }

.sf-toolbar-clear {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}
.sf-toolbar-clear:hover:not(:disabled) { background: #fde2e2; color: #b91c1c; }
.sf-toolbar-clear:disabled { opacity: 0.45; cursor: default; }

.text-faint { color: var(--text-faint); }

/* ===== Mappad-vara-markör (*) ============================ */

/* Inline-* för sökresultat — bara visuellt, ingen popup där (dropdownen
   har egen overflow så popup blir trasig). */
.mapped-marker-inline {
    color: var(--accent);
    font-weight: 700;
    margin-left: 0.2rem;
}

/* Mapped-cell wrapper runt priset + asterisken i kassetabellen.
   Hover triggas på hela ytan (inte bara *) så användaren slipper sikta. */
.mapped-cell {
    position: relative;
    display: inline-block;
    cursor: help;
}

.mapped-asterisk {
    color: var(--accent);
    font-weight: 700;
    margin-left: 0.15rem;
}

.mapped-popup {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding: 0.85rem;
    z-index: 100;
    text-align: left;
    font-weight: normal;
    color: var(--text);
    font-variant-numeric: normal;
    /* Priscellen bryter inte rader — utan detta ärver popupen det och långa namn
       ("CA 170G KLASS 1, ECUADOR") rinner ut ur rutan */
    white-space: normal;
    overflow-wrap: anywhere;
    /* Liten "tail" mot priset så det syns var den hör hemma */
    pointer-events: auto;
}

.mapped-cell:hover .mapped-popup,
.mapped-cell:focus-within .mapped-popup {
    display: block;
}

.mapped-popup img {
    width: 100%;
    height: 110px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 0.55rem;
    display: block;
}

.mapped-popup-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.3;
}

.mapped-popup-brand {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.mapped-popup-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

/* Skrapningsdatum under priset i matris-cellen — synligt alltid, inte bara vid hover. */
.cell-date {
    display: block;
    font-size: 0.72rem;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
    margin-top: 0.1rem;
}

/* Fotnot under cart-summary när någon rad är mappad. */
.cart-footnote {
    padding: 0.85rem 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    font-style: italic;
}

.cart-footnote .footnote-marker {
    color: var(--accent);
    font-weight: 700;
    font-style: normal;
    margin: 0 0.1rem;
}

/* Töm-listan-knapp i section-aside */
.cart-clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-body);
    font-style: normal;
    margin-left: 0.75rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.cart-clear-btn:hover {
    background: #fde2e2;
    color: #b91c1c;
}

.cart-clear-btn i { margin-right: 0.3rem; }

/* ===== Jämförelse-matris ================================= */

.matrix-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    /* INGEN overflow: hidden — *-hover-popupen måste kunna sticka ut. Hörn
       rundas manuellt på thead-cellerna. */
}

/* Två separata kort (Resultat + varulista) med äkta bakgrund emellan.
   table-layout: fixed + identisk colgroup håller kolumnerna i linje mellan korten. */
.matrix-card-list { margin-top: 14px; }

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.matrix-col-label { width: 34%; }

.matrix-table thead th {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-soft);
    padding: 1rem 1.25rem;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.matrix-table thead th.matrix-corner {
    text-align: left;
    border-top-left-radius: var(--r-md);
}
.matrix-table thead th:last-child { border-top-right-radius: var(--r-md); }
.matrix-table thead th.matrix-store.is-home { color: var(--brand-deep); }

.matrix-rowhead {
    text-align: left;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--brand-deep);
    font-size: 1rem;
    padding: 1rem 1.25rem;
}

.matrix-total {
    background: var(--bg-warm);
}
.matrix-total .matrix-cell { font-weight: 700; font-size: 1.05rem; }

/* Runda Resultat-kortets nederkant (totalradens ytterceller) så färgad bg
   inte fyrkantar hörnen. */
.matrix-card-result .matrix-total .matrix-rowhead { border-bottom-left-radius: var(--r-md); }
.matrix-card-result .matrix-total td:last-child { border-bottom-right-radius: var(--r-md); }

.matrix-cell {
    text-align: right;
    padding: 0.9rem 1.25rem;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    white-space: nowrap;
}

.matrix-cell.is-cheapest {
    color: var(--savings-strong);
    background: var(--savings-bg);
    font-weight: 700;
}

.matrix-table tbody tr { border-bottom: 1px solid var(--border); }
.matrix-table tbody tr:last-child { border-bottom: none; }
/* Hover på hela raden — bg på <tr> lyser igenom de transparenta cellerna. */
.matrix-card-list .matrix-table tbody tr:hover { background: var(--bg-warm); }

.matrix-product {
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.matrix-product .product-cell { flex: 1; min-width: 0; }

.product-cell { display: flex; align-items: center; gap: 0.95rem; }

.product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand-soft), #c8d8d0);
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
    overflow: hidden;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    display: block;
}

.product-name {
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    font-size: 0.98rem;
}

.product-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.row-remove {
    width: 34px;
    height: 34px;
    border-radius: var(--r-pill);
    color: var(--text-faint);
    transition: background 0.15s, color 0.15s;
    display: grid;
    place-items: center;
    font-size: 1rem;
}

.row-remove:hover { background: #fde2e2; color: #b91c1c; }

/* Mobil: matrisen kan bli bred med många butiker → tillåt horisontell scroll.
   (overflow-x på kortet clippar *-popupen, men på touch finns ingen hover
   ändå — en mer kortbaserad mobil-layout kommer i Matify-skinet.) */

@media (max-width: 720px) {
    /* Dölj desktop-tabellen, visa mobil-korten */
    .matrix-card { display: none; }
}

/* Mobil-layout syns bara på < 720px, dölj på desktop */
.matrix-mobile { display: none; }

@media (max-width: 720px) {
    .matrix-mobile {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    /* ===== Resultat-section ===== */
    .mm-result {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--r-md);
        box-shadow: var(--shadow-sm);
        padding: 1rem 1.1rem;
    }

    .mm-result-label {
        font-family: var(--font-display);
        font-weight: 600;
        color: var(--brand-deep);
        font-size: 1.05rem;
        margin-bottom: 0.65rem;
    }

    .mm-result-note {
        margin-top: 0.65rem;
        font-size: 0.8rem;
        font-style: italic;
        color: var(--text-muted);
    }

    .mm-result-pills {
        display: flex;
        gap: 0.4rem;
        flex-wrap: wrap;
    }

    .mm-pill {
        flex: 1;
        min-width: calc(50% - 0.2rem);  /* 4+ butiker: två per rad */
        text-align: center;
        padding: 0.3rem 0.25rem;
    }

    .mm-result-pills--single-row .mm-pill { min-width: 0; }  /* ≤3 butiker: alla på en rad */

    .mm-pill-store {
        font-size: 0.7rem;
        font-weight: 600;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 0.3rem;
    }

    .mm-pill-total span {
        display: inline-block;
        background: var(--accent);
        color: #fff;
        border-radius: var(--r-pill);
        padding: 0.25rem 0.65rem;
        font-size: 0.92rem;
        font-weight: 700;
        font-variant-numeric: tabular-nums;
    }

    .mm-pill.is-cheapest .mm-pill-total span { background: var(--savings); }

    .mm-pill.is-empty .mm-pill-total span {
        background: var(--bg-soft);
        color: var(--text-faint);
    }

    /* ===== Produkt-kort ===== */
    .mm-product {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--r-md);
        box-shadow: var(--shadow-sm);
        overflow: hidden;
    }

    .mm-product-header {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--border);
    }

    .mm-product-info {
        flex: 1;
        min-width: 0;
    }

    /* ===== Pris-rad: butikerna sida vid sida ===== */
    .mm-prices {
        display: flex;
    }

    .mm-store-cell {
        flex: 1;
        text-align: center;
        padding: 0.55rem 0.25rem;
        color: var(--accent);
    }

    .mm-store-cell.is-cheapest {
        color: var(--savings-strong);
        font-weight: 700;
    }

    .mm-store-cell.is-empty { color: var(--text-faint); }

    .mm-store-name {
        font-size: 0.65rem;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 0.1rem;
    }

    .mm-store-cell.is-cheapest .mm-store-name { color: var(--savings); }

    .mm-price {
        font-size: 0.88rem;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

    .mm-date {
        font-size: 0.6rem;
        color: var(--text-faint);
        font-variant-numeric: tabular-nums;
        margin-top: 0.1rem;
    }
}

/* ===== Footer ============================================ */

.page-footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 5rem;
}

.page-footer .brand {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--brand);
    font-weight: 500;
}

.page-footer p { margin: 0 0 0.5rem; }
.page-footer .tiny { font-size: 0.75rem; color: var(--text-faint); }

/* Matifys sidfot: "Rapportera fel" överst, större än i standardsidfoten */
.page-footer .mt-report { margin-bottom: 1.1rem; }
.page-footer .mt-report .sf-report-link { font-size: 1.05rem; font-weight: 600; color: var(--text-soft); }
.page-footer .mt-report .sf-report-link:hover { color: var(--brand); }

/* Reklammarkeringen ska synas tydligt, texten är större än övrig sidfot (ingen ram, nov 2026) */
.page-footer .mt-ad-label {
    margin-bottom: 0.85rem;
    color: var(--brand);
    font-size: 1.05rem;
    font-weight: 700;
}

.page-footer .mt-disclaimer {
    max-width: 760px;
    margin: 0 auto 0.75rem;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-soft);
}

/* ===== Landningssida ===================================== */

.landing {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 4rem 1.5rem;
    text-align: center;
}

.landing h1 {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--brand-deep);
    margin: 0 0 1rem;
    letter-spacing: -0.02em;
}

.landing p {
    color: var(--text-soft);
    max-width: 32rem;
    margin: 0 auto;
    font-size: 1.05rem;
}

/* ===== 404 =============================================== */

.notfound {
    display: grid;
    place-items: center;
    padding: 6rem 1.5rem;
    text-align: center;
}

.notfound .icon {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    line-height: 1;
}

.notfound h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--brand-deep);
    margin: 0 0 0.75rem;
}

.notfound p { color: var(--text-soft); max-width: 28rem; font-size: 1.05rem; }

/* ============================================================
   MATIFY-SKIN (.skin-matify)
   White-label-skin: DM Sans, navy + terrakotta, ljusgrå bakgrund
   med kundvagn-watermark. Re-skin sker mestadels via CSS-variabel-
   override; bara den brandade chrome:n (topbar/hero/Om oss) har egna
   klasser. Default-skinet är helt orört.
   ============================================================ */

.skin-matify {
    /* Bakgrunder */
    --bg: #eef1f3;
    --bg-soft: #e3e8ec;
    --bg-warm: #f5f7f8;
    --surface: #ffffff;

    /* Bordar */
    --border: #d8dee2;
    --border-strong: #c2cace;

    /* Text */
    --text: #2c3e50;
    --text-soft: #34495e;
    --text-muted: #6b7884;
    --text-faint: #9aa6b0;

    /* Brand & accent */
    --brand: #2c3e50;            /* navy */
    --brand-deep: #1f2d3a;
    --brand-soft: #e2e7ec;
    --brand-glow: rgba(44, 62, 80, 0.12);

    --accent: #e74c3c;           /* terrakotta-röd */
    --accent-soft: #fbdcd6;

    --savings: #2e9e5b;
    --savings-bg: #d8f0e0;
    --savings-strong: #1e7a44;

    /* Radius — något stramare än default */
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;

    /* Typografi — allt i DM Sans */
    --font-display: 'DM Sans', system-ui, sans-serif;
    --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;

    font-family: var(--font-body);
    background-color: var(--bg);
}

/* DM Sans har opsz-axel men inte Fraunces "opsz" 144-känslan — nollställ
   font-variation-settings som default-skinet sätter på rubriker. */
.skin-matify h1,
.skin-matify h2,
.skin-matify .summary-value,
.skin-matify .trust-value { font-variation-settings: normal; }

/* ===== Matify: topp-bar ===== */

.mt-topbar {
    background: transparent;
}

/* Full bredd med kant-padding — loggan längst till vänster, Om oss längst till höger. */
.mt-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 2rem;
}

.mt-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.mt-brand-icon { width: 52px; height: auto; display: block; }

.mt-nav a {
    color: var(--brand);
    font-weight: 600;
    font-size: 1.2rem;
    text-decoration: none;
    padding: 0.4rem 0.7rem;
    border-radius: var(--r-sm);
    transition: background 0.15s;
}
.mt-nav a:hover { background: var(--brand-soft); }

@media (max-width: 640px) {
    .mt-topbar-inner { padding: 0.7rem 1.1rem; }
    .mt-brand-icon { width: 44px; }
    .mt-nav a { font-size: 1.05rem; }
}

/* ===== Matify: hero ===== */

.mt-hero {
    text-align: center;
    padding: 3rem 0 2.5rem;
}

.mt-hero-logo {
    width: 260px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* ── Reconnect-overlay ────────────────────────────────────────────────────── */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.97);
}
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected { display: flex; }
#components-reconnect-modal.components-reconnect-hide { display: none; }

.reconnect-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
    padding: 2.5rem 2rem;
}
.reconnect-logo { width: 200px; height: auto; }

/* Spinner */
.reconnect-connecting { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.reconnect-spinner {
    width: 36px; height: 36px;
    border: 3px solid #e8e8e8;
    border-top-color: #E74C3C;
    border-radius: 50%;
    animation: reconnect-spin 0.8s linear infinite;
}
@keyframes reconnect-spin { to { transform: rotate(360deg); } }
.reconnect-connecting p { color: #666; font-size: 0.95rem; margin: 0; }

/* Failed-tillstånd */
.reconnect-failed { display: none; flex-direction: column; align-items: center; gap: 1rem; }
.reconnect-failed p { color: #555; font-size: 0.95rem; margin: 0; }
.reconnect-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    background: #E74C3C; color: #fff;
    border-radius: 8px; font-weight: 600; font-size: 1rem;
    text-decoration: none;
    transition: background 0.15s;
}
.reconnect-btn:hover { background: #c0392b; color: #fff; }

/* Visa rätt sektion per state */
#components-reconnect-modal.components-reconnect-show .reconnect-failed { display: none; }
#components-reconnect-modal.components-reconnect-show .reconnect-connecting { display: flex; }
#components-reconnect-modal.components-reconnect-failed .reconnect-connecting,
#components-reconnect-modal.components-reconnect-rejected .reconnect-connecting { display: none; }
#components-reconnect-modal.components-reconnect-failed .reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected .reconnect-failed { display: flex; }

/* I Matify sitter sök-sektionen tätt under hero (ingen extra topp-marginal). */
.skin-matify .page-main .section:first-child { margin-top: 1rem; }

/* ===== Matify: Resultat-kort ===== */

/* Rubrik- och Resultat-raden har samma (vita) bakgrund som varulistan. */
.skin-matify .matrix-table thead th { background: transparent; }
.skin-matify .matrix-total { background: transparent; }
.skin-matify .matrix-total .matrix-cell { background: transparent; }

/* Större Resultat. */
.skin-matify .matrix-table thead th { font-size: 0.95rem; }
.skin-matify .matrix-rowhead { font-size: 1.4rem; }
.skin-matify .matrix-total .matrix-cell { font-size: 1.15rem; }

.matrix-total-pill {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: var(--r-pill);
    font-variant-numeric: tabular-nums;
}

.skin-matify .matrix-total-pill { padding: 0.32rem 0.95rem; font-size: 1.1rem; }

.skin-matify .matrix-total .matrix-cell .matrix-total-pill {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}

.skin-matify .matrix-total .matrix-cell.is-cheapest { background: transparent; }
.skin-matify .matrix-total .matrix-cell.is-cheapest .matrix-total-pill {
    background: var(--savings);
    color: #fff;
}

/* Centrera butiksrubrikerna och prisvärdena i sina kolumner. */
.skin-matify .matrix-table thead th.matrix-store { text-align: center; }
.skin-matify .matrix-cell { text-align: center; }

/* Varulistans priser: grön TEXT för billigast, röd TEXT för övriga (ingen bakgrund). */
.skin-matify .matrix-card-list .matrix-cell { color: #c0392b; }
.skin-matify .matrix-card-list .matrix-cell.is-cheapest {
    background: transparent;
    color: var(--savings-strong);
    font-weight: 700;
}

/* ===== Matify: Om oss / FaQ-accordion ===== */

.mt-omoss { max-width: 760px; padding-top: 2.5rem; padding-bottom: 1rem; }

.mt-omoss h1 {
    font-weight: 700;
    font-size: 2rem;
    color: var(--brand);
    letter-spacing: -0.02em;
    margin: 0 0 1.5rem;
}

/* Faktarutan ovanför frågor och svar */
.mt-factbox {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
    padding: 1.25rem 1.4rem;
    margin-bottom: 1.75rem;
}

.mt-factbox h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand);
    margin: 0 0 0.5rem;
}

.mt-factbox p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.65;
}

.mt-faq {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
    margin-bottom: 0.85rem;
    overflow: hidden;
}

.mt-faq > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.4rem;
    font-weight: 600;
    color: var(--brand);
    font-size: 1.02rem;
}

.mt-faq > summary::-webkit-details-marker { display: none; }

.mt-faq > summary i {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.mt-faq[open] > summary i { transform: rotate(180deg); }

.mt-faq-body {
    padding: 0 1.4rem 1.25rem;
    color: var(--text-soft);
    line-height: 1.65;
}

/* ── Rapportera fel (ReportProblemModal) ─────────────────────────────────── */
.sf-report-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 1px dashed transparent;
}
.sf-report-link:hover { color: var(--brand); border-bottom-color: var(--brand); }

.sf-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(20, 30, 25, 0.45);
}
.sf-modal {
    position: fixed;
    z-index: 201;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(520px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
}
.sf-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.5rem;
}
.sf-modal-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.35rem;
    color: var(--brand-deep);
}
.sf-modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: var(--r-sm);
}
.sf-modal-close:hover { background: var(--bg-warm); color: var(--text); }
.sf-modal-body { padding: 0.25rem 1.25rem 1rem; }
.sf-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
}

.sf-field { display: block; margin-bottom: 0.9rem; }
.sf-field > span {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 0.3rem;
}
.sf-field textarea,
.sf-field input {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    padding: 0.55rem 0.7rem;
}
.sf-field textarea:focus,
.sf-field input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
}
.sf-field small { display: block; margin-top: 0.3rem; font-size: 0.78rem; color: var(--text-muted); }

/* Honungsfältet: utanför synfältet men i DOM så robotar hittar det */
.sf-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.sf-report-muted { font-size: 0.9rem; color: var(--text-muted); margin: 0 0 1rem; }
.sf-report-done { font-size: 1rem; color: var(--savings-strong); margin: 0.5rem 0; }
.sf-report-done i { color: var(--savings); margin-right: 0.3rem; }
.sf-report-error { font-size: 0.88rem; color: #b91c1c; margin: 0.25rem 0 0; }
.sf-report-error i { margin-right: 0.3rem; }

.sf-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--r-pill);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sf-btn:hover:not(:disabled) { background: var(--bg-warm); }
.sf-btn:disabled { opacity: 0.6; cursor: default; }
.sf-btn-primary { background: var(--brand); border-color: var(--brand); color: #ffffff; }
.sf-btn-primary:hover:not(:disabled) { background: var(--brand-deep); border-color: var(--brand-deep); }
