/* Laatulehti – toimituksen työpöytä. Tumma toimitusteema, kultainen korostus. */
:root {
    --bg: hsl(225 30% 7%);
    --bg-2: hsl(225 26% 10%);
    --panel: hsl(225 22% 12.5%);
    --panel-2: hsl(225 20% 15.5%);
    --line: hsl(225 18% 20%);
    --line-soft: hsl(225 18% 16%);
    --text: hsl(40 20% 92%);
    --muted: hsl(225 12% 62%);
    --faint: hsl(225 10% 45%);
    --gold: hsl(39 74% 63%);
    --gold-deep: hsl(33 70% 48%);
    --gold-glow: hsl(39 80% 60% / .18);
    --teal: hsl(172 50% 52%);
    --red: hsl(4 70% 62%);
    --amber: hsl(32 85% 60%);
    --radius: 14px;
    --serif: 'Fraunces', Georgia, serif;
    --sans: 'Inter', system-ui, sans-serif;
    --shadow: 0 1px 0 hsl(0 0% 100% / .03) inset, 0 12px 32px -18px hsl(225 60% 2% / .9);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
    margin: 0;
    font: 15px/1.5 var(--sans);
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 85% -10%, hsl(39 60% 40% / .10), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, hsl(215 60% 40% / .10), transparent 60%),
        var(--bg);
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ── Yläpalkki ─────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 28px;
    padding: 14px 28px;
    background: hsl(225 30% 7% / .78);
    backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
    font: 650 20px var(--serif); color: var(--bg);
    background: linear-gradient(140deg, var(--gold), var(--gold-deep));
    box-shadow: 0 6px 20px -6px var(--gold-glow), 0 0 0 1px hsl(39 80% 70% / .3) inset;
}
.brand-text { font: 650 19px var(--serif); letter-spacing: .2px; }
.brand-text em { font-style: normal; color: var(--muted); font-weight: 500; margin-left: 4px; }

.mainnav { display: flex; gap: 4px; max-width: 100%; overflow-x: auto; }
.mainnav a {
    white-space: nowrap;
    padding: 7px 14px; border-radius: 999px; color: var(--muted); font-weight: 500;
    transition: color .2s, background .2s;
}
.mainnav a:hover { color: var(--text); background: var(--panel); }
.mainnav a.active { color: var(--text); background: var(--panel-2); box-shadow: 0 0 0 1px var(--line) inset; }

.toolbar { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.segmented {
    display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
    background: var(--panel); box-shadow: 0 0 0 1px var(--line) inset;
}
.segmented button {
    border: 0; background: transparent; padding: 5px 12px; border-radius: 999px;
    font-size: 13px; font-weight: 500; color: var(--muted); transition: all .2s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--panel-2); color: var(--gold); box-shadow: 0 0 0 1px var(--line) inset; }

.btn-primary {
    display: inline-flex; align-items: center; gap: 9px;
    border: 0; padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 14px;
    color: hsl(225 40% 8%);
    background: linear-gradient(140deg, var(--gold), var(--gold-deep));
    box-shadow: 0 8px 24px -10px var(--gold-glow);
    transition: transform .15s, filter .2s, box-shadow .2s;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 12px 28px -10px hsl(39 80% 55% / .45); }
.btn-primary:disabled { filter: grayscale(.4) brightness(.8); cursor: progress; transform: none; }
.btn-primary .dot { width: 7px; height: 7px; border-radius: 50%; background: hsl(225 40% 10%); }
.btn-primary.busy .dot { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.4); opacity: .4; } }

/* ── Tilapalkki ────────────────────────────────────────── */
.statusbar {
    display: flex; flex-wrap: wrap; gap: 26px; align-items: center;
    padding: 12px 28px; color: var(--muted); font-size: 13px;
    border-bottom: 1px solid var(--line-soft);
}
.statusbar b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.statusbar .live { display: inline-flex; align-items: center; gap: 8px; }
.statusbar .live::before {
    content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--teal);
    box-shadow: 0 0 0 0 hsl(172 50% 52% / .6); animation: ring 2.2s infinite;
}
@keyframes ring { 70% { box-shadow: 0 0 0 8px hsl(172 50% 52% / 0); } 100% { box-shadow: 0 0 0 0 hsl(172 50% 52% / 0); } }

/* ── Näkymät ───────────────────────────────────────────── */
.view { padding: 28px; max-width: 1800px; margin: 0 auto; animation: fadein .35s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

.view-head { display: flex; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.view-head h1 { margin: 0; font: 650 clamp(26px, 3vw, 36px)/1.1 var(--serif); letter-spacing: -.3px; }
.view-head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.view-head .spacer { flex: 1; }

/* ── Yleiskuvan maakortit ──────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.card {
    position: relative; display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--panel), var(--bg-2));
    border: 1px solid var(--line-soft); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
    transition: border-color .25s, transform .25s;
    animation: rise .45s ease both;
}
.card:hover { border-color: var(--line); transform: translateY(-2px); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.card-head {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px;
}
.cc {
    display: inline-grid; place-items: center; min-width: 36px; height: 26px; padding: 0 6px; border-radius: 7px;
    font: 600 12px var(--sans); letter-spacing: .8px; color: var(--gold);
    background: hsl(39 70% 50% / .1); box-shadow: 0 0 0 1px hsl(39 70% 60% / .22) inset;
}
.cc-lg { min-width: 48px; height: 34px; font-size: 15px; margin-right: 14px; vertical-align: 6px; }
.card-head h2 { margin: 0; font: 600 18px var(--serif); }
.card-head h2 a:hover { color: var(--gold); }
.card-head .meta { margin-left: auto; font-size: 12px; color: var(--faint); white-space: nowrap; }
.card-head .meta b { color: var(--muted); font-weight: 600; }

.headlines { list-style: none; margin: 0; padding: 0 8px 8px; }
.headline {
    display: block; padding: 9px 10px; border-radius: 9px;
    transition: background .18s;
}
.headline:hover { background: hsl(225 20% 18% / .7); }
.headline .t { font: 500 15px/1.35 var(--serif); color: var(--text); }
.headline:hover .t { color: hsl(40 40% 96%); }
.headline .orig { display: block; margin-top: 3px; font-size: 12.5px; color: var(--faint); line-height: 1.35; }
.lead { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; margin-top: 3px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.lead.lead-3 { -webkit-line-clamp: 3; line-clamp: 3; margin-top: 4px; }
.headline .row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 5px; font-size: 12px; color: var(--faint); }
.headline .row > span { white-space: nowrap; }
.src { color: var(--muted); font-weight: 500; }
.badge {
    display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px;
    font-size: 10.5px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
}
.badge.new { color: var(--teal); background: hsl(172 50% 50% / .12); }
.badge.language { color: var(--muted); background: var(--panel-2); text-transform: none; letter-spacing: 0; font-weight: 400; white-space: normal; }
.badge.top { color: var(--gold); background: hsl(39 70% 55% / .12); }
.badge.untr { color: var(--faint); background: hsl(225 10% 50% / .12); }
.badge.skip { color: var(--faint); background: transparent; border: 1px dashed hsl(225 10% 50% / .35); }
.badge.fail { color: hsl(4 80% 68%); background: hsl(4 75% 55% / .14); cursor: help; }
.badge.act {
    color: var(--gold); background: hsl(39 70% 55% / .08); border: 1px solid hsl(39 70% 55% / .35);
    cursor: pointer; transition: background .15s, transform .15s;
}
.badge.act:hover, .badge.act:focus-visible { background: hsl(39 70% 55% / .2); transform: translateY(-1px); outline: none; }
.badge.act.busy { cursor: progress; opacity: .7; animation: badge-blink 1.2s ease-in-out infinite; }

/* ── Aiheluokittelu ja avainsanat ──────────────────────── */
.badge.topic { font-weight: 600; font-size: 10px; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.badge.topic-politiikka    { color: #93c5fd; background: hsl(217 91% 60% / 0.15); border: 1px solid hsl(217 91% 60% / 0.28); }
.badge.topic-talous        { color: #6ee7b7; background: hsl(158 64% 52% / 0.15); border: 1px solid hsl(158 64% 52% / 0.28); }
.badge.topic-turvallisuus  { color: #fca5a5; background: hsl(0 91% 71% / 0.15); border: 1px solid hsl(0 91% 71% / 0.28); }
.badge.topic-oikeus        { color: #d8b4fe; background: hsl(271 91% 65% / 0.15); border: 1px solid hsl(271 91% 65% / 0.28); }
.badge.topic-yhteiskunta   { color: #7dd3fc; background: hsl(199 89% 48% / 0.15); border: 1px solid hsl(199 89% 48% / 0.28); }
.badge.topic-terveys       { color: #5eead4; background: hsl(173 80% 40% / 0.15); border: 1px solid hsl(173 80% 40% / 0.28); }
.badge.topic-ymparisto     { color: #86efac; background: hsl(142 69% 58% / 0.15); border: 1px solid hsl(142 69% 58% / 0.28); }
.badge.topic-teknologia    { color: #a5b4fc; background: hsl(239 84% 67% / 0.15); border: 1px solid hsl(239 84% 67% / 0.28); }
.badge.topic-kulttuuri     { color: #f9a8d4; background: hsl(330 81% 60% / 0.15); border: 1px solid hsl(330 81% 60% / 0.28); }
.badge.topic-urheilu       { color: #fdba74; background: hsl(27 96% 61% / 0.15); border: 1px solid hsl(27 96% 61% / 0.28); }
.badge.topic-onnettomuudet { color: #fde047; background: hsl(48 96% 53% / 0.15); border: 1px solid hsl(48 96% 53% / 0.28); }
.badge.topic-lifestyle     { color: #c4b5fd; background: hsl(258 90% 66% / 0.15); border: 1px solid hsl(258 90% 66% / 0.28); }
.badge.cc-tag { font-weight: 700; font-size: 10px; padding: 2px 6px; border-radius: 4px; letter-spacing: 0.4px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); }
.badge.genre { font-weight: 600; font-size: 10px; padding: 2px 6px; border-radius: 4px; color: var(--gold); background: hsl(40 70% 55% / 0.12); border: 1px solid hsl(40 70% 55% / 0.3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.chip { padding: 5px 11px; border-radius: 999px; font-size: 13px; color: var(--muted); border: 1px solid var(--line); text-decoration: none; transition: background .15s, color .15s; }
.chip b { color: var(--faint); font-weight: 600; margin-left: 3px; }
.chip:hover { background: var(--panel-2); color: var(--text, inherit); }
.chip.active { background: var(--panel-2); color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }

.badge.geo { font-weight: 500; font-size: 10px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

.result-keywords { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.kw-tag { font-size: 11px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 999px; padding: 1px 7px; text-decoration: none; transition: all .15s; }
.kw-tag:hover { color: var(--gold); border-color: var(--gold-deep); background: var(--panel); text-decoration: none; }
@keyframes badge-blink { 50% { opacity: .35; } }
#statusbar a.warn { color: hsl(4 80% 68%); text-decoration: none; }
#statusbar a.warn:hover { text-decoration: underline; }
.empty { padding: 18px 18px 22px; color: var(--faint); font-size: 13.5px; }
.card-foot { margin-top: auto; padding: 0 18px 14px; }
.card-foot a { font-size: 13px; color: var(--muted); }
.card-foot a:hover { color: var(--gold); }

/* ── Maanäkymä: lehdet sarakkeina ──────────────────────── */
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.column { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.column-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.column-head h2 { margin: 0; font: 600 17px var(--serif); }
.column-head a.home { margin-left: auto; font-size: 12px; color: var(--faint); }
.column-head a.home:hover { color: var(--gold); }
.column .headlines { padding: 6px; }
.pos { font-variant-numeric: tabular-nums; color: var(--faint); min-width: 22px; }

/* ── Haku ──────────────────────────────────────────────── */
.searchbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.input, .select {
    padding: 11px 14px; border-radius: 11px; border: 1px solid var(--line);
    background: var(--panel); color: var(--text); font: inherit; outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.input { flex: 1; min-width: 260px; font-size: 16px; }
.input:focus, .select:focus { border-color: var(--gold-deep); box-shadow: 0 0 0 4px var(--gold-glow); }
.results { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.result { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: start; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); transition: background .18s; }
.result:last-child { border-bottom: 0; }
.result:hover { background: var(--panel-2); }
.result .when { font-size: 12px; color: var(--faint); white-space: nowrap; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 16px; color: var(--muted); font-size: 14px; }
.btn-ghost { border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 999px; transition: border-color .2s, color .2s; }
.btn-ghost:hover:not(:disabled) { border-color: var(--gold-deep); color: var(--gold); }
.btn-ghost:disabled { opacity: .4; cursor: default; }

/* ── Lähteet ───────────────────────────────────────────── */
table.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 11px 14px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl tr:hover td { background: var(--panel-2); }
.tbl .err { color: var(--faint); font-size: 12px; max-width: 420px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status.ok::before { background: var(--teal); }
.status.empty::before { background: var(--amber); }
.status.error::before { background: var(--red); }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* Error history */
.topbar { flex-wrap: wrap; }
.error-filters { align-items: end; }
.error-filters label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; min-width: 0; }
.error-filters input, .error-filters select { max-width: 100%; }
.error-summary { color: var(--muted); font-size: 14px; }
.error-summary span { display: block; font-size: 12px; margin-top: 4px; }
.error-list { display: grid; gap: 10px; }
.error-entry { min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.error-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; }
.error-heading time { color: var(--muted); font-variant-numeric: tabular-nums; }
.error-level { border-radius: 99px; padding: 2px 9px; background: var(--panel-2); }
.error-level.error { color: var(--red); }
.error-level.warning { color: var(--amber); }
.error-origin { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.error-message { margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.6 var(--sans); }
.error-pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 20px; color: var(--muted); font-size: 13px; }

/* ── Muut ──────────────────────────────────────────────── */
.skeleton { height: 260px; border-radius: var(--radius); background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; padding: 12px 18px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); box-shadow: var(--shadow); animation: rise .3s ease; }
.foot { padding: 28px; text-align: center; color: var(--faint); font-size: 12.5px; }

/* ── Tapahtumat ja Aiheryhmät ───────────────────────────── */
.clusters-grid { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.cluster-card {
    background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius);
    padding: 20px 24px; box-shadow: var(--shadow); transition: border-color .2s;
}
.cluster-card:hover { border-color: var(--line); }
.cluster-card-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 12px; border-bottom: 1px solid var(--line-soft); padding-bottom: 14px; margin-bottom: 16px; }
.cluster-title-wrap { display: flex; align-items: center; gap: 12px; }
.cluster-badge {
    background: var(--gold-glow); color: var(--gold); border: 1px solid hsl(39 80% 60% / .3);
    font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; letter-spacing: .2px;
}
.cluster-title { font: 600 20px/1.3 var(--serif); margin: 0; color: var(--text); }
.cluster-time { font-size: 12.5px; color: var(--faint); display: flex; gap: 8px; }

.cluster-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.cluster-item-row {
    display: grid; grid-template-columns: 220px 1fr auto; gap: 16px; align-items: start;
    padding: 10px 12px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line-soft);
    transition: background .18s;
}
.cluster-item-row:hover { background: var(--panel-2); }
.item-meta-badges { display: flex; flex-direction: column; gap: 4px; }
.tag-type {
    display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
    padding: 2px 7px; border-radius: 5px; width: fit-content;
}
.tag-lead { background: hsl(39 80% 60% / .2); color: var(--gold); }
.tag-same_event { background: hsl(172 50% 52% / .18); color: var(--teal); }
.tag-follow_up { background: hsl(200 60% 50% / .2); color: hsl(200 80% 70%); }
.tag-source { font-size: 12px; color: var(--muted); font-weight: 500; }
.tag-manual { font-size: 10.5px; color: var(--amber); }

.item-text { display: flex; flex-direction: column; gap: 3px; }
.item-link { font-size: 14.5px; font-weight: 500; color: var(--text); line-height: 1.4; transition: color .18s; }
.item-link:hover { color: var(--gold); }
.orig-sub { font-size: 12px; color: var(--muted); }
.item-actions { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--faint); }
.btn-detach {
    background: transparent; border: 1px solid var(--line); color: var(--muted);
    padding: 3px 8px; border-radius: 6px; font-size: 11.5px; transition: border-color .2s, color .2s;
}
.btn-detach:hover { border-color: var(--red); color: var(--red); }

/* Tarkistusjono */
.review-box {
    background: hsl(32 85% 60% / .08); border: 1px solid hsl(32 85% 60% / .3);
    border-radius: var(--radius); padding: 18px 22px; margin-bottom: 24px;
}
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.review-head h3 { margin: 0; font-size: 16px; color: var(--amber); }
.review-head .tag { font-size: 11.5px; background: hsl(32 85% 60% / .2); color: var(--amber); padding: 2px 8px; border-radius: 999px; }
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-card {
    background: var(--panel); border: 1px solid var(--line-soft); border-radius: 10px;
    padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.review-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: start; }
.pair-item { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.pair-meta { display: flex; align-items: center; gap: 6px; }
.pair-item .source-tag { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.pair-item .lang-tag { font-size: 10px; background: var(--line); color: var(--muted); padding: 1px 5px; border-radius: 4px; font-weight: 600; letter-spacing: 0.5px; }
.pair-title { color: var(--text); font-size: 14px; line-height: 1.35; }
.pair-summary { font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.pair-vs { color: var(--faint); font-weight: 600; font-size: 12px; text-transform: uppercase; align-self: center; }
.review-reason { font-size: 12.5px; color: var(--muted); background: var(--card-bg, rgba(255,255,255,0.02)); padding: 6px 10px; border-radius: 6px; }
.review-actions { display: flex; gap: 10px; }
.btn-small { padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; border: 1px solid transparent; }
.btn-approve { background: var(--teal); color: var(--bg); }
.btn-approve:hover { filter: brightness(1.1); }
.btn-dismiss { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-dismiss:hover { border-color: var(--red); color: var(--red); }

@media (max-width: 860px) {
    .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
    .toolbar { margin-left: 0; width: 100%; justify-content: space-between; flex-wrap: wrap; }
    .view { padding: 18px 14px; }
    .grid { grid-template-columns: 1fr; }
    .result { grid-template-columns: 1fr; gap: 4px; }
    .cluster-item-row { grid-template-columns: 1fr; gap: 8px; }
    .review-pair { grid-template-columns: 1fr; gap: 8px; }
}

/* ── Tapahtumakartta (#/kartta) ─────────────────────────────────────────── */
.em-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 10px; }
.em-controls .chips { margin: 0; }
.em-controls input[type=search], .em-controls select { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; max-width: 220px; }
.em-controls input[type=search] { min-width: 190px; }
.em-notes { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; min-height: 1.2em; }
.em-notes b { color: var(--amber); }
.em-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.em-layout:has(.em-detail:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); }
.em-main { min-width: 0; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.em-svg { display: block; max-width: 100%; height: auto; background: radial-gradient(circle at 50% 40%, hsl(225 24% 11%), var(--bg)); border-radius: 10px; }
.em-svg { overflow: hidden; touch-action: none; user-select: none; }
.em-svg.em-zoomed { cursor: grab; }
.em-svg.em-dragging, .em-svg.em-dragging .em-bub { cursor: grabbing; }
.em-svg:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.em-zoom-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 2px 4px 8px; }
.em-zoom-controls button { min-width: 36px; min-height: 36px; }
.em-zoom-controls button:disabled { opacity: .4; cursor: default; }
.em-zoom-controls output { min-width: 64px; text-align: center; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.em-bub { cursor: pointer; outline: none; }
.em-hit { fill: transparent; }
.em-disc { stroke: hsl(225 30% 7% / .55); stroke-width: 1.5; fill-opacity: .88; transition: fill-opacity .15s, stroke .15s; }
.em-bub:hover .em-disc, .em-bub:focus-visible .em-disc { fill-opacity: 1; stroke: var(--gold); stroke-width: 2.5; }
.em-bub.sel .em-disc { stroke: #fff; stroke-width: 3; fill-opacity: 1; }
.em-n, .em-t { fill: hsl(225 30% 7%); text-anchor: middle; dominant-baseline: central; pointer-events: none; font-family: var(--sans); }
.em-t { font-weight: 650; }
.em-n { font-weight: 500; }
.em-country { font-weight: 650; }
.em-research { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 4px; }
.em-research h4 { font-size: 12px; margin: 12px 0 5px; color: var(--muted); }
.em-research ul { padding-left: 18px; }
.em-research li { margin-bottom: 7px; }
.em-research a { color: var(--gold); }
.em-research-status { color: var(--amber); font-weight: 600; }
.em-research-status.ready { color: var(--teal); }
.em-follow { stroke: var(--gold); stroke-width: 2; stroke-dasharray: 6 5; opacity: .85; pointer-events: none; }
.em-foot { color: var(--faint); font-size: 12px; margin: 10px 6px 4px; }
.em-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 6px 8px; font-size: 12px; color: var(--muted); }
.em-leg i, .em-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.em-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.em-table th, .em-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.em-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.em-table tr.sel { background: var(--panel-2); }
.em-table a { color: var(--text); text-decoration: none; }
.em-table a:hover, .em-table a:focus-visible { color: var(--gold); text-decoration: underline; }
.em-th { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.em-th:hover, .em-th:focus-visible { color: var(--gold); }
.em-detail { position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); font-size: 13.5px; }
.em-d-head { display: flex; gap: 10px; align-items: start; justify-content: space-between; }
.em-d-head h2 { font-family: var(--serif); font-size: 19px; margin: 0 0 8px; line-height: 1.25; outline: none; }
.em-detail h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 16px 0 6px; }
.em-badges { margin: 0 0 6px; }
.em-desc { margin: 10px 0 4px; }
.em-note { color: var(--faint); font-size: 12px; margin: 0 0 6px; }
.em-pubs, .em-pubs ul, .em-rel { list-style: none; margin: 0; padding: 0; }
.em-pubs > li { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.em-pubs ul { margin: 3px 0 0 10px; }
.em-pubs a, .em-rel a { color: var(--text); }
.em-pubs a:hover, .em-rel a:hover { color: var(--gold); }
.em-detail .muted { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) { .em-layout:has(.em-detail:not([hidden])) { grid-template-columns: minmax(0, 1fr); } .em-detail { position: static; max-height: none; } }

/* Alkuperäiskielisen ingressin valinta (ylävalikko) */
.radios { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; margin: 0; font-size: 12.5px; color: var(--muted); }
.radios legend { float: left; padding: 0; margin-right: 2px; font-size: 12.5px; color: var(--faint); }
.radios label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.radios input { accent-color: var(--gold); margin: 0; }
.radios label:has(input:checked) { color: var(--gold); }
.lead.lead-orig { color: var(--faint); font-style: italic; }

.ingress-tooltip {
    position: fixed; z-index: 10000; pointer-events: none;
    width: max-content; max-width: min(440px, calc(100vw - 24px));
    max-height: calc(100vh - 24px); overflow: hidden; box-sizing: border-box;
    padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--panel); color: var(--text); box-shadow: var(--shadow);
    font-size: 13px; line-height: 1.5; overflow-wrap: anywhere;
}
.ingress-tooltip[hidden] { display: none; }


/* Uutisen lukukortti keskellä näyttöä. Dialogin top layer pitää sen muun käyttöliittymän päällä. */
.em-article-dialog { box-sizing: border-box; width: min(760px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 40px); margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--bg); box-shadow: 0 24px 90px #0008; overflow: auto; overscroll-behavior: contain; }
.em-article-dialog::backdrop { background: #0009; }
.em-article-toolbar { display: flex; justify-content: flex-end; position: sticky; top: 0; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 1; }
.em-news { padding: 12px 40px 36px; line-height: 1.75; font-size: 17px; overflow-wrap: anywhere; }
.em-news h1 { font-size: clamp(25px, 4vw, 36px); line-height: 1.22; margin: 12px 0 24px; letter-spacing: -.02em; }
.em-news p { margin: 0 0 1.2em; }
.em-news-lead { font-weight: 600; font-size: 1.08em; }
.em-news-sources { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; }
.em-news-sources h2 { font-size: 16px; margin: 0 0 8px; }
.em-news-sources ul { padding-left: 20px; margin: 0; }
.em-news-sources a { overflow-wrap: anywhere; }
@media (max-width: 600px) {
    .em-article-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 20px); }
    .em-news { padding: 8px 20px 24px; font-size: 16px; }
}
