:root {
    color-scheme: light;
    --background: #f5f7fa;
    --surface: #ffffff;
    --surface-muted: #eef2f6;
    --text: #17202a;
    --muted: #667382;
    --line: #dce3e9;
    --accent: #1769aa;
    --accent-dark: #105386;
    --success: #e8f7ed;
    --success-text: #176b36;
    --error: #fff0f0;
    --error-text: #9a2424;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    line-height: 1.55;
}

a {
    color: var(--accent);
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.header-inner {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 800;
    text-decoration: none;
}

nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

nav a,
.link-button {
    color: var(--muted);
    font: inherit;
    text-decoration: none;
}

.inline-form {
    display: inline;
}

.link-button {
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
}

main.shell {
    padding-top: 48px;
    padding-bottom: 72px;
}

.hero {
    padding: 40px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 820px;
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

h2 {
    font-size: 1.15rem;
}

.eyebrow {
    margin-bottom: 10px;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lead {
    max-width: 760px;
    color: var(--muted);
    font-size: 1.08rem;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(190px, 1fr) auto;
    align-items: end;
    gap: 14px;
    margin-top: 32px;
}

.field {
    display: grid;
    gap: 7px;
}

label {
    font-size: 0.88rem;
    font-weight: 700;
}

input,
button {
    min-height: 48px;
    border-radius: 10px;
    font: inherit;
}

input {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface);
    padding: 0 14px;
}

input:focus {
    border-color: var(--accent);
    outline: 3px solid rgb(23 105 170 / 14%);
}

button[type="submit"] {
    border: 0;
    background: var(--accent);
    color: white;
    padding: 0 22px;
    font-weight: 750;
    cursor: pointer;
}

button[type="submit"]:hover {
    background: var(--accent-dark);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 18px;
}

.card,
.empty-state,
.login-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
}

.card p,
.empty-state p {
    color: var(--muted);
}

.recent-search {
    margin-top: 18px;
}

.login-panel {
    width: min(440px, 100%);
    margin: 60px auto;
}

.stack {
    display: grid;
    gap: 12px;
}

.notice {
    margin-bottom: 18px;
    border-radius: 10px;
    padding: 12px 15px;
}

.notice-success {
    background: var(--success);
    color: var(--success-text);
}

.notice-error {
    background: var(--error);
    color: var(--error-text);
}

.page-heading {
    margin-bottom: 28px;
}

.page-heading h1 {
    font-size: clamp(2rem, 4vw, 3rem);
}

.table-wrap {
    overflow-x: auto;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

th {
    background: var(--surface-muted);
    font-size: 0.82rem;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.muted {
    color: var(--muted);
}

@media (max-width: 760px) {
    .header-inner {
        align-items: flex-start;
        flex-direction: column;
        padding-top: 16px;
        padding-bottom: 16px;
    }

    main.shell {
        padding-top: 24px;
    }

    .hero {
        padding: 24px;
    }

    .search-form,
    .info-grid {
        grid-template-columns: 1fr;
    }

    .search-form button {
        width: 100%;
    }
}

/* Hintatutka branding and search progress */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.brand-logo {
    display: block;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
}

.search-progress {
    width: min(100%, 720px);
    margin: 24px auto 0;
    text-align: center;
}

.search-progress progress {
    display: block;
    width: 100%;
    margin: 12px auto;
}

.search-progress p {
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 640px) {
    .brand-logo {
        width: 26px;
        height: 26px;
    }

    .search-progress {
        margin-top: 18px;
    }
}


/* Hintatutka result comparison */
.results-summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 14px;
}

.merchant-cell {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.badge,
.confidence {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.badge-best {
    background: var(--surface-muted);
}

.best-offer td {
    background: color-mix(
        in srgb,
        var(--surface-muted) 55%,
        var(--surface)
    );
}

.confidence-high {
    background: var(--surface-muted);
}

.confidence-medium {
    background: var(--surface);
}

.confidence-low {
    color: var(--muted);
}

.offer-identifiers {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.78rem;
    white-space: normal;
}
