/* Polar Lapland Insights - dashboard styles (dark, monochrome chrome; colour only on data marks). */
:root {
  color-scheme: dark;
  --bg: #0e0f11; --surface: #16181c; --surface-2: #1d2025; --hair: rgba(255,255,255,.08); --hair-2: rgba(255,255,255,.14);
  --text: #f2f2f2; --text-2: #a9abb0; --text-3: #6f7278;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --gray: #6b6f76; --gray-2: #3a3d43;
  --good: #0ca30c; --warn: #fab219; --bad: #d03b3b;
  --radius: 10px; --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 600; margin: 0; }
h2 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Top bar */
.top { display: flex; align-items: center; gap: 24px; padding: 10px 16px; border-bottom: 1px solid var(--hair); position: sticky; top: 0; background: rgba(14,15,17,.92); backdrop-filter: blur(8px); z-index: 20; flex-wrap: wrap; }
.top__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; }
.top__mark { width: 22px; height: 22px; border-radius: 6px; background: #fff; display: inline-block; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M7 22 L13 12 L18 19 L22 9 L26 22' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M7 22 L13 12 L18 19 L22 9 L26 22' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat; }
.top__sub { color: var(--text-2); font-weight: 400; }
.top__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 8px 12px; border-radius: 8px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--text); background: var(--surface); }
.tabs button.is-active { color: var(--text); background: var(--surface-2); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gray-2); display: inline-block; }
.live-dot.is-on { background: var(--good); box-shadow: 0 0 0 4px rgba(12,163,12,.2); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 12px 16px; border-bottom: 1px solid var(--hair); }
.filters__group { display: flex; gap: 6px; align-items: center; }
.filters__group > button { background: var(--surface); border: 1px solid var(--hair); color: var(--text-2); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.filters__group > button:hover { color: var(--text); border-color: var(--hair-2); }
.filters__group > button.is-active { background: #fff; color: #111; border-color: #fff; }
.filters input[type=date], .filters select { background: var(--surface); border: 1px solid var(--hair); border-radius: 8px; padding: 6px 8px; color: var(--text); }
.filters select { max-width: 180px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--text-2); cursor: pointer; }
.filters__note { color: var(--text-3); margin-left: auto; }

/* Layout */
.view { padding: 16px; display: grid; gap: 16px; max-width: 1400px; margin: 0 auto; }
.view.is-loading { opacity: .55; transition: opacity .2s; }
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card__head .hint { color: var(--text-3); font-size: 12px; }
.kpi { padding: 12px 14px; }
.kpi__label { color: var(--text-2); font-size: 12px; }
.kpi__value { font-size: 26px; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; }
.kpi__delta { font-size: 12px; margin-top: 4px; color: var(--text-3); }
.kpi__delta.up { color: #4fc44f; } .kpi__delta.down { color: #ef6b6b; }
.kpi__sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.hero { font-size: 48px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.empty { color: var(--text-3); padding: 24px 0; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { background: var(--surface-2); border: 1px solid var(--hair); border-radius: 999px; padding: 4px 10px; color: var(--text-2); cursor: pointer; font-size: 12px; }
.chips button.is-active { background: #fff; color: #111; border-color: #fff; }
.btn { background: var(--surface-2); border: 1px solid var(--hair-2); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.btn--primary { background: #fff; color: #111; border-color: #fff; font-weight: 600; }
.btn--ghost { background: transparent; }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
textarea { width: 100%; min-height: 120px; background: var(--bg); border: 1px solid var(--hair); border-radius: 8px; color: var(--text); padding: 8px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
pre { background: var(--bg); border: 1px solid var(--hair); border-radius: 8px; padding: 10px; overflow: auto; font-size: 12px; }
ol.steps { padding-left: 20px; margin: 0; color: var(--text-2); }
ol.steps li { margin: 6px 0; }
ol.steps strong { color: var(--text); }

/* Bar lists */
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-size: 13px; position: relative; padding: 5px 8px; border-radius: 6px; cursor: default; }
.bar:hover { background: var(--surface-2); }
.bar__fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--s1); opacity: .16; }
.bar__label { position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__value { position: relative; font-variant-numeric: tabular-nums; }
.bar__extra { position: relative; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12px; min-width: 52px; text-align: right; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--hair); text-align: left; vertical-align: top; }
th { color: var(--text-2); font-weight: 500; white-space: nowrap; cursor: pointer; user-select: none; font-size: 12px; }
th.num, td.num { text-align: right; }
th.is-sorted::after { content: " ↓"; color: var(--text-3); }
th.is-sorted.asc::after { content: " ↑"; }
tr:hover td { background: var(--surface-2); }
td.path { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.link { cursor: pointer; text-decoration: underline; text-decoration-color: var(--hair-2); }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); font-size: 11px; color: var(--text-2); margin-right: 4px; white-space: nowrap; }
.pill--on { background: rgba(57,135,229,.18); color: #9cc4f5; }
.pill--good { background: rgba(12,163,12,.18); color: #7bd67b; }
.pill--warn { background: rgba(250,178,25,.18); color: #f5cf7a; }

/* Journeys */
.journey { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--hair); font-size: 12px; }
.journey__n { min-width: 40px; font-weight: 600; font-variant-numeric: tabular-nums; }
.journey__step { background: var(--surface-2); border-radius: 6px; padding: 2px 7px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journey__arrow { color: var(--text-3); }
.journey__step.is-conv { outline: 1px solid rgba(57,135,229,.6); }

/* Funnel */
.funnel { display: grid; gap: 8px; }
.funnel__row { display: grid; grid-template-columns: 200px 1fr 90px 90px; gap: 12px; align-items: center; font-size: 13px; }
.funnel__track { height: 22px; border-radius: 4px; background: var(--surface-2); position: relative; overflow: hidden; }
.funnel__fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.funnel__drop { color: var(--text-3); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }

/* SVG charts */
.chart { width: 100%; height: 240px; display: block; }
.chart--sm { height: 140px; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .grid line { stroke: var(--hair); stroke-width: 1; }
.chart .axis line { stroke: var(--hair-2); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: .1; }
.chart .crosshair { stroke: var(--hair-2); stroke-width: 1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .col { rx: 3; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 2px; background: var(--c); vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.legend span.rect::before { height: 10px; border-radius: 2px; }
.tooltip { position: fixed; z-index: 50; background: #24272d; border: 1px solid var(--hair-2); border-radius: 8px; padding: 8px 10px; font-size: 12px; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.4); min-width: 140px; }
.tooltip__title { color: var(--text-2); margin-bottom: 4px; }
.tooltip__row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip__row b { font-variant-numeric: tabular-nums; }
.tooltip__row i { display: inline-block; width: 10px; height: 2px; background: var(--c); vertical-align: middle; margin-right: 6px; border-radius: 2px; }

/* Drawer (session detail) */
.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; display: flex; justify-content: flex-end; }
.drawer__panel { width: min(560px, 100%); background: var(--surface); border-left: 1px solid var(--hair-2); height: 100%; overflow: auto; padding: 20px; position: relative; }
.drawer__close { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 22px; color: var(--text-2); cursor: pointer; }
.timeline { list-style: none; margin: 12px 0 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 62px 110px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--hair); font-size: 12px; }
.timeline .ev { font-weight: 600; }
.timeline .ev.pageview { color: var(--text-2); font-weight: 400; }
.timeline .ev.purchase, .timeline .ev.lead, .timeline .ev.checkout, .timeline .ev.booking_click, .timeline .ev.contact_click { color: #9cc4f5; }

/* Live */
.stream { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.stream li { display: grid; grid-template-columns: 56px 100px 1fr 60px; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--hair); }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.login__brand { color: var(--text-2); letter-spacing: .12em; text-transform: uppercase; font-size: 12px; }
.login h1 { font-size: 22px; }
.field { display: grid; gap: 6px; }
.field span { color: var(--text-2); font-size: 12px; }
.field input { background: var(--bg); border: 1px solid var(--hair-2); border-radius: 8px; padding: 10px 12px; }
.error { color: #ef6b6b; margin: 0; }

@media (max-width: 720px) {
  .top { gap: 10px; }
  .funnel__row { grid-template-columns: 120px 1fr 70px 60px; }
  .view { padding: 12px; }
  .kpi__value { font-size: 22px; }
  .filters__note { margin-left: 0; }
}
