/* Spara24.se – gemensam stilmall för huvudsajten och bloggens sidhuvud/sidfot */

:root {
    --green: #0b6b3a;
    --green-dark: #07482a;
    --green-deep: #052e1b;
    --mint: #9be3b4;
    --mint-soft: #e8f7ee;
    --bg: #f5f7f5;
    --surface: #fff;
    --text: #17221c;
    --muted: #5a6a61;
    --border: #e1e8e3;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(10, 40, 25, .06), 0 4px 16px rgba(10, 40, 25, .06);
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 var(--font);
}

a { color: var(--green); text-underline-offset: 2px; }
a:hover { color: var(--green-dark); }

img { max-width: 100%; height: auto; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; color: var(--text); }
h1 { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.6rem); margin: 0 0 .5em; font-weight: 750; }
h2 { font-size: 1.35rem; margin: 1.6em 0 .5em; font-weight: 700; }
h3 { font-size: 1.1rem; margin: 1.4em 0 .4em; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* --- Sidhuvud --- */

.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}

.header-inner { display: flex; align-items: center; gap: 24px; min-height: 64px; }

.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-mark { width: 36px; height: 36px; flex: none; }
.logo-text { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
.logo-text b { color: var(--green); font-weight: 800; }
.logo-light, .logo-light:hover { color: #fff; }
.logo-light .logo-text b { color: var(--mint); }

.site-nav { display: flex; gap: 4px; margin-left: auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
    padding: 8px 14px; border-radius: 999px;
    color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; white-space: nowrap;
}
.site-nav a:hover { background: var(--mint-soft); color: var(--green-dark); }
.site-nav a[aria-current="page"] { background: var(--mint-soft); color: var(--green); }

/* --- Knappar --- */

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 9px 16px; border-radius: 10px; border: 0;
    background: var(--green); color: #fff !important;
    font-weight: 700; font-size: .95rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
    transition: background .15s, transform .15s;
}
.btn:hover { background: var(--green-dark); transform: translateY(-1px); }
.btn-small { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn-big { padding: 14px 22px; font-size: 1.05rem; }
.btn-ghost { background: var(--mint-soft); color: var(--green) !important; }
.btn-ghost:hover { background: #d3f0de; }
.btn-light { background: #fff; color: var(--green-dark) !important; }
.btn-light:hover { background: var(--mint-soft); }

/* --- Kort --- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}
.card h2 { margin-top: 0; font-size: 1.1rem; }
.card h2 a { color: inherit; text-decoration: none; }

/* --- Startsidans topp --- */

.hero {
    background:
        radial-gradient(900px 400px at 85% -10%, rgba(155, 227, 180, .35), transparent 60%),
        linear-gradient(135deg, var(--green-deep), var(--green) 70%);
    color: #e9f6ee;
    padding: 56px 0 64px;
}
.hero h1, .hero strong { color: #fff; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero-grid > *, .layout > *, .calc-fields > * { min-width: 0; }
.hero-text p { margin: 0 0 1em; max-width: 60ch; }
.hero .lead { font-size: 1.15rem; }
.eyebrow {
    margin: 0 0 .5em; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--green);
}
.hero .eyebrow { color: var(--mint); }

.calc { color: var(--text); }
.calc h2 { font-size: 1.15rem; }
.calc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.calc-fields label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.calc-wide { grid-column: 1 / -1; }
.input-unit {
    display: flex; align-items: center;
    border: 1px solid var(--border); border-radius: 10px; background: #fbfcfb;
    transition: border-color .15s, box-shadow .15s;
}
.input-unit:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(11, 107, 58, .15); }
.input-unit input {
    flex: 1; width: 100%; min-width: 0; border: 0; background: transparent; outline: 0;
    padding: 10px 12px; font: 600 1.1rem var(--font); color: var(--text);
}
.input-unit span { padding-right: 12px; color: var(--muted); font-weight: 600; }
.calc-result {
    margin: 18px 0 0; padding: 14px 16px; border-radius: 10px;
    background: var(--mint-soft); color: var(--green-deep);
}
.calc-result strong { color: var(--green); font-size: 1.35rem; white-space: nowrap; }

/* --- Innehåll + sidopanel --- */

.layout {
    display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px;
    padding-top: 32px; padding-bottom: 56px;
}
.sidebar { display: flex; flex-direction: column; gap: 20px; }

.section-head h2 { margin-top: 0; font-size: 1.6rem; }
.section-head p { margin-top: 0; max-width: 75ch; font-size: .92rem; }

.prose { max-width: 75ch; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: .3em 0; }

.page-narrow { max-width: 820px; padding-top: 40px; padding-bottom: 64px; }
.article {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: clamp(20px, 4vw, 48px); max-width: none;
}
.article-image { display: block; border-radius: 10px; margin-bottom: 24px; }

.breadcrumbs { padding-top: 20px; font-size: .9rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }

/* --- Räntetabellen --- */

.rate-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden; font-size: .93rem;
}
.rate-table th {
    background: #f0f5f2; color: var(--muted);
    font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
    text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.rate-table th:not(.sorttable_nosort) { cursor: pointer; user-select: none; }
.rate-table th:not(.sorttable_nosort):hover { color: var(--green); }
.rate-table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rate-table tbody tr:last-child td { border-bottom: 0; }
.rate-table tbody tr:hover { background: #fafcfb; }
.cell-bank a { font-weight: 700; color: var(--text); text-decoration: none; }
.cell-bank a:hover { color: var(--green); text-decoration: underline; }
.cell-rate { font-weight: 700; color: var(--green); font-size: 1.05rem; white-space: nowrap; }
.rate-table td[data-label="Rörlig ränta"] { white-space: nowrap; }
.cell-income { font-weight: 700; white-space: nowrap; }
.cell-cta { text-align: right; }
#sorttable_sortfwdind, #sorttable_sortrevind { color: var(--green); }

/* --- Filter för bindningstid --- */

.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 14px; }
.filter-label { font-size: .85rem; font-weight: 700; color: var(--muted); margin-right: 4px; }
.filter button {
    font: 600 .88rem var(--font); color: var(--text); cursor: pointer;
    padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
}
.filter button:hover { border-color: var(--green); color: var(--green); }
.filter button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }

.vald-ranta { display: block; }
.vald-bindning { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); }
.tag {
    display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 999px;
    background: #eef3ff; color: #2c4a8a; font-size: .72rem; font-weight: 700;
}

/* --- Alternativ till sparkonto --- */

#alternativ { margin-bottom: 44px; }
.alt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.alt-card { display: flex; flex-direction: column; }
.alt-card h3 { margin: 0 0 6px; font-size: 1.15rem; }
.alt-card h3 a { color: var(--text); text-decoration: none; }
.alt-card p { margin: 0 0 10px; font-size: .93rem; }
.alt-rate strong { display: block; font-size: 1.5rem; color: var(--green); }
.alt-rate span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.alt-actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Banksidan: räntor per bindningstid, förslag, stängd bank --- */

.rates-small { border-collapse: collapse; width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.rates-small th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #f0f5f2; padding: 10px 14px; }
.rates-small td { padding: 10px 14px; border-top: 1px solid var(--border); }
.rates-small tr.best td { background: var(--mint-soft); font-weight: 700; color: var(--green-dark); }

.notice.notice-closed { background: #fdeeee; border-color: #f2c4c4; color: #6b1f1f; }
.suggest-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
.suggest { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.suggest:hover { border-color: var(--green); transform: translateY(-1px); color: var(--text); }
.suggest-name { font-weight: 700; }
.suggest-rate { font-size: 1.35rem; font-weight: 750; color: var(--green); }

/* --- Sidopanel --- */

.side-list, .link-list { list-style: none; margin: 0; padding: 0; }
.side-list li {
    display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.side-list li:last-child { border-bottom: 0; }
.side-bank { font-weight: 700; color: var(--text); text-decoration: none; }
.side-rate { font-weight: 700; color: var(--green); }
.link-list li { padding: 8px 0; border-bottom: 1px solid var(--border); line-height: 1.35; }
.link-list li:last-child { border-bottom: 0; }
.link-list a { text-decoration: none; color: var(--text); }
.link-list a:hover { color: var(--green); text-decoration: underline; }
.more { display: inline-block; margin-top: 10px; font-weight: 700; text-decoration: none; }

/* --- Banksidan --- */

.bank-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.bank-head h1 { margin: 0; }
.bank-head p { margin: .3em 0 0; }

.facts {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
    margin: 20px 0 6px;
}
.facts div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.facts dt { hyphens: manual; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.facts dd { margin: 4px 0 0; font-weight: 700; font-size: 1.05rem; }
.facts .fact-main { color: var(--green); font-size: 1.6rem; }

.notice {
    margin: 20px 0; padding: 14px 18px; border-radius: 12px;
    background: #fff8e6; border: 1px solid #f3dfa6; color: #5c4510;
}

.rating { margin: 28px 0; }
.rating .ratingblock { border: 0; padding: 0; margin: 0; }
.rating p { margin: 8px 0 0; }
.banner { overflow-x: auto; }
.comments { margin-top: 32px; }

/* --- Admin --- */

.admin { padding-top: 24px; padding-bottom: 56px; }
.admin-top { font-weight: 600; }
.admin-login { max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.admin-login input, .admin-form input, .admin-form select, .admin-form textarea {
    font: 1rem var(--font); padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; width: 100%; background: #fff;
}
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.admin-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.admin-wide { grid-column: 1 / -1; }
.admin-rates { max-width: 760px; }
.admin-rates td { padding: 6px 8px; }
.admin-list { max-width: none; }
.notice.notice-ok { background: var(--mint-soft); border-color: #bfe8cf; color: var(--green-deep); }

/* --- Sidfot --- */

.site-footer { background: var(--green-deep); color: #b9cfc2; font-size: .93rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding-top: 48px; padding-bottom: 32px; }
.footer-grid p { max-width: 42ch; }
.site-footer h2 { color: #fff; font-size: 1rem; margin: 0 0 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 6px 0; }
.site-footer a { color: #dcebe2; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-bottom {
    display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding-top: 18px; padding-bottom: 24px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .85rem;
}

/* --- Mobil --- */

@media (max-width: 960px) {
    .hero-grid, .layout, .footer-grid { grid-template-columns: 1fr; }
    .hero-grid { gap: 28px; }
    .hero { padding: 36px 0 40px; }
}

@media (max-width: 760px) {
    .wrap { padding-left: 16px; padding-right: 16px; }
    .layout { padding-top: 24px; gap: 28px; }
    .page-narrow { padding-top: 24px; }
    .section-head h2 { font-size: 1.4rem; }
    #alternativ { margin-bottom: 32px; }
    .header-inner { gap: 12px; min-height: 56px; }
    .logo-text { font-size: 1.2rem; }
    .logo-mark { width: 30px; height: 30px; }
    .site-nav a { padding: 6px 10px; font-size: .9rem; }

    /* Tabellen blir kort */
    .rate-table, .rate-table tbody, .rate-table tr, .rate-table td { display: block; }
    .rate-table { background: transparent; border: 0; box-shadow: none; overflow: visible; }
    .rate-table thead { display: none; }
    .rate-table tr {
        display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px;
        background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
    }
    .rate-table td { padding: 0; border: 0; }
    .rate-table td[data-label]::before {
        content: attr(data-label); display: block;
        font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700;
    }
    .rate-table td:empty, .rate-table td[data-label]:empty { display: none; }
    .cell-bank { grid-column: 1 / -1; font-size: 1.1rem; }
    .cell-cta { grid-column: 1 / -1; text-align: left; margin-top: 6px; }
    .cell-cta .btn { width: 100%; padding: 12px; }
    .bank-head .btn { width: 100%; }
}

@media (max-width: 440px) {
    .site-nav a[href="/#kalkyl"] { display: none; }
    .suggest-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .suggest { padding: 12px; }
    .suggest-rate { font-size: 1.1rem; }
}
