/* invest-hermes UI mockup – Material Design 3 layout on top of Material Web (@material/web).
   Colour tokens: vendor/m3-theme.css (--md-sys-color-*, --app-color-* extended colours).
   Type: vendor/md-typescale-styles.css (.md-typescale-*) + Roboto. Icons: Material Symbols Outlined.
   This file only adds layout, the app shell (navigation rail / bar, top app bar), cards, tables,
   snackbar and direction indicators – things Material Web has no component for. */

@font-face { font-family: "Roboto"; font-style: normal; font-weight: 400; font-display: swap; src: url(vendor/fonts/roboto-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 500; font-display: swap; src: url(vendor/fonts/roboto-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 700; font-display: swap; src: url(vendor/fonts/roboto-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Material Symbols Outlined"; font-style: normal; font-weight: 100 700; font-display: block; src: url(vendor/fonts/material-symbols-outlined.woff2) format("woff2"); }

:root {
  --md-ref-typeface-brand: "Roboto", system-ui, sans-serif;
  --md-ref-typeface-plain: "Roboto", system-ui, sans-serif;
  --md-icon-font: "Material Symbols Outlined";
  /* M3 shape scale */
  --shape-xs: 4px; --shape-sm: 8px; --shape-md: 12px; --shape-lg: 16px; --shape-xl: 28px;
  /* M3 motion: emphasized / standard easing */
  --ease-emph: cubic-bezier(.2, 0, 0, 1);
  --ease-std: cubic-bezier(.2, 0, 0, 1);
  /* Elevation level 1–3 shadows (M3 key + ambient) */
  --elev-1: 0 1px 2px rgb(0 0 0 / .3), 0 1px 3px 1px rgb(0 0 0 / .15);
  --elev-2: 0 1px 2px rgb(0 0 0 / .3), 0 2px 6px 2px rgb(0 0 0 / .15);
  --elev-3: 0 1px 3px rgb(0 0 0 / .3), 0 4px 8px 3px rgb(0 0 0 / .15);
  /* Compact fields for filter toolbars (M3 density -2 ≈ 48dp) */
  --compact-field: 12px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  font: 400 14px/20px var(--md-ref-typeface-plain);
  letter-spacing: .25px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--md-sys-color-primary); }
.tnum, .num { font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; }
.mono { font-family: ui-monospace, "Roboto Mono", Menlo, monospace; font-size: 12.5px; letter-spacing: 0; }
.variant { color: var(--md-sys-color-on-surface-variant); }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}
[hidden] { display: none !important; }
.icon {
  font-family: "Material Symbols Outlined"; font-weight: 400; font-style: normal; font-size: 24px; line-height: 1;
  display: inline-block; width: 1em; height: 1em; overflow: hidden; white-space: nowrap; letter-spacing: normal; text-transform: none;
  font-feature-settings: "liga"; -webkit-font-smoothing: antialiased; user-select: none; flex: none;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}
.icon.sm { font-size: 18px; } .icon.xs { font-size: 16px; }
md-icon { flex: none; }
/* M3 focus indicator: 3dp secondary outline, 2dp offset */
:focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; border-radius: 4px; }
/* Hide undefined custom elements until Material Web has upgraded them (app.js removes .loading). */
body.loading :is(main, .topbar) { visibility: hidden; }

.skip {
  position: fixed; left: 16px; top: -80px; z-index: 1000; padding: 10px 24px; border-radius: 20px;
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); font: 500 14px/20px var(--md-ref-typeface-plain); text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- App shell: navigation rail + top app bar + content pane ---------- */
body.app {
  display: grid; grid-template-columns: 88px minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr);
  grid-template-areas: "rail top" "rail main";
}
.rail {
  grid-area: rail; position: sticky; top: 0; height: 100vh; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 0 16px;
}
.rail-brand {
  width: 48px; height: 48px; border-radius: var(--shape-lg); display: grid; place-items: center; margin-bottom: 12px;
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); text-decoration: none; position: relative;
}
.brand-mark { width: 48px; height: 48px; border-radius: var(--shape-lg); display: grid; place-items: center; flex: none; background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.rail ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.dest {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 80px;
  color: var(--md-sys-color-on-surface-variant); text-decoration: none; outline: none;
  font: 500 12px/16px var(--md-ref-typeface-plain); letter-spacing: .5px;
}
.dest .ind {
  position: relative; width: 56px; height: 32px; border-radius: 16px; display: grid; place-items: center;
  --md-ripple-hover-color: var(--md-sys-color-on-surface); --md-ripple-pressed-color: var(--md-sys-color-on-surface);
  transition: background-color .2s var(--ease-std);
}
.dest .ind md-focus-ring { --md-focus-ring-shape: 16px; }
button.dest { background: none; border: 0; padding: 0; cursor: pointer; }
.dest[aria-current="page"], .dest.current { color: var(--md-sys-color-on-surface); font-weight: 700; }
.dest.current .ind { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.dest[aria-current="page"] .ind { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.dest[aria-current="page"] .icon { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
.dest .badge {
  position: absolute; top: -2px; left: calc(50% + 4px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); font: 500 11px/16px var(--md-ref-typeface-plain); text-align: center;
}
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.topbar {
  grid-area: top; position: sticky; top: 0; z-index: 4;
  display: flex; align-items: center; gap: 8px; padding: 8px 16px 8px 8px;
  background: var(--md-sys-color-surface-container);
}
.topbar .appname { display: none; font: 400 22px/28px var(--md-ref-typeface-brand); color: var(--md-sys-color-on-surface); margin-right: auto; white-space: nowrap; }
.topbar .appname b { font-weight: 500; }
.search {
  position: relative; display: flex; align-items: center; gap: 12px; height: 48px; flex: 0 1 560px; min-width: 0;
  padding: 0 16px; border-radius: 24px; background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant);
}
.search input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--md-sys-color-on-surface);
  font: 400 16px/24px var(--md-ref-typeface-plain); letter-spacing: .5px;
}
.search input::placeholder { color: var(--md-sys-color-on-surface-variant); }
.search:focus-within { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; }
.search kbd { font: 500 12px/16px var(--md-ref-typeface-plain); color: var(--md-sys-color-on-surface-variant); border: 1px solid var(--md-sys-color-outline); border-radius: 4px; padding: 1px 6px; }
.topbar .spacer { flex: 1; }
@media (max-width: 1023px) { .topbar .mock-flag { display: none; } }
.menu-anchor { position: relative; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); font: 500 14px/20px var(--md-ref-typeface-plain);
}
.avatar.juhis { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.avatar.hermes { background: var(--app-color-warn-container); color: var(--app-color-on-warn-container); }
.avatar.sm { width: 24px; height: 24px; font-size: 12px; }
.mock-flag {
  font: 500 12px/16px var(--md-ref-typeface-plain); letter-spacing: .5px; padding: 6px 12px; border-radius: 8px; white-space: nowrap;
  background: var(--app-color-warn-container); color: var(--app-color-on-warn-container);
}

main.pane {
  grid-area: main; min-width: 0; background: var(--md-sys-color-surface);
  border-radius: var(--shape-xl) 0 0 0; padding: 24px 32px 48px;
}
main.pane:focus { outline: none; }
.content { max-width: 1280px; margin: 0 auto; }

/* Compact window (< 600dp): navigation bar at the bottom, compact top app bar */
@media (max-width: 599px) {
  body.app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr) 80px; grid-template-areas: "top" "main" "rail"; }
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: 80px; flex-direction: row; justify-content: center; padding: 0;
    background: var(--md-sys-color-surface-container); gap: 0; z-index: 6;
  }
  .rail-brand, .rail-foot, .rail .rail-only { display: none; }
  .rail ul { flex-direction: row; gap: 0; width: 100%; }
  .rail li { flex: 1 1 0; min-width: 0; }
  .dest { width: 100%; padding: 12px 0 16px; }
  .dest > span:not(.ind):not(.badge) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dest .ind { width: 56px; }
  button.dest { padding: 12px 0 16px; }
  .topbar { padding: 8px 4px 8px 16px; }
  .topbar .appname { display: block; }
  .topbar .search, .topbar .mock-flag { display: none; }
  main.pane { border-radius: 0; padding: 16px 16px 112px; }
}
@media (min-width: 600px) { .bar-only { display: none; } }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .supporting { color: var(--md-sys-color-on-surface-variant); margin-top: 4px; max-width: 70ch; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0 0 8px; padding: 0; color: var(--md-sys-color-on-surface-variant); }
.breadcrumb li + li::before { content: "chevron_right"; font-family: "Material Symbols Outlined"; font-size: 16px; vertical-align: -3px; margin-right: 4px; }
.breadcrumb a { color: var(--md-sys-color-on-surface-variant); text-decoration: none; display: inline-flex; min-height: 24px; align-items: center; }
.breadcrumb a:hover { text-decoration: underline; }
.stack > * + * { margin-top: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin: 32px 0 12px; }

/* ---------- Cards (M3: filled / outlined / elevated) ---------- */
.card { position: relative; border-radius: var(--shape-md); background: var(--md-sys-color-surface-container-low); color: var(--md-sys-color-on-surface); }
.card.outlined { background: var(--md-sys-color-surface); border: 1px solid var(--md-sys-color-outline-variant); }
.card.filled { background: var(--md-sys-color-surface-container-highest); }
.card.elevated { background: var(--md-sys-color-surface-container-low); box-shadow: var(--elev-1); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 16px 16px 8px; }
.card-head .sub { color: var(--md-sys-color-on-surface-variant); }
.card-body { padding: 8px 16px 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.grid-wide { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.grid-side { display: grid; gap: 16px; grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .grid-2, .grid-wide { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 840px) { .grid-side { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 1101px) { .sticky { position: sticky; top: 80px; } }

/* KPI cards */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) { .kpis { grid-template-columns: minmax(0, 1fr); } }
.kpi { padding: 16px; display: grid; gap: 8px; align-content: start; }
.kpi .k-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--md-sys-color-on-surface-variant); }
.kpi .k-value { font: 400 32px/40px var(--md-ref-typeface-brand); font-variant-numeric: tabular-nums; }
.kpi .k-value small { font: 400 14px/20px var(--md-ref-typeface-plain); color: var(--md-sys-color-on-surface-variant); letter-spacing: .25px; }
.kpi .k-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .k-foot { display: flex; gap: 4px 12px; flex-wrap: wrap; color: var(--md-sys-color-on-surface-variant); }

/* Distribution bar: up / flat / down, 4dp, with 2dp gaps (M3 linear-indicator style) */
.dist { display: flex; gap: 4px; height: 4px; }
.dist > span { border-radius: 2px; }
.dist .u { background: var(--app-color-up); } .dist .f { background: var(--md-sys-color-outline); } .dist .d { background: var(--app-color-down); }

.spark { display: block; width: 104px; height: 32px; overflow: visible; }
.spark.lg { width: 168px; height: 48px; }
.spark path.line { fill: none; stroke: var(--md-sys-color-primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark path.area { fill: var(--md-sys-color-primary); opacity: .12; }
.spark circle { fill: var(--md-sys-color-primary); stroke: var(--md-sys-color-surface-container-low); stroke-width: 2; }

/* ---------- Direction & status: small coloured icon + word ---------- */
.dir { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; font: 500 12px/16px var(--md-ref-typeface-plain); letter-spacing: .5px; color: var(--md-sys-color-on-surface-variant); }
.dir .icon { font-size: 18px; }
.dir.up, .dir.up .icon { color: var(--app-color-up); }
.dir.down, .dir.down .icon { color: var(--app-color-down); }
.dir.flat .icon { color: var(--md-sys-color-on-surface-variant); }
.status { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font: 500 12px/16px var(--md-ref-typeface-plain); letter-spacing: .5px; color: var(--md-sys-color-on-surface-variant); }
.status .icon { font-size: 18px; }
.status.ok .icon { color: var(--app-color-up); }
.status.err, .status.err .icon { color: var(--md-sys-color-error); }
.status.info .icon { color: var(--md-sys-color-primary); }
.status.warn .icon { color: var(--app-color-warn); }
/* Small label (non-interactive, chip-like) */
.label {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--shape-sm);
  font: 500 12px/16px var(--md-ref-typeface-plain); letter-spacing: .5px; white-space: nowrap;
  border: 1px solid var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-surface-variant);
}
.label.tonal { border-color: transparent; background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.label.hermes { border-color: transparent; background: var(--app-color-warn-container); color: var(--app-color-on-warn-container); }
.err-text { color: var(--md-sys-color-error); font: 400 12px/16px var(--md-ref-typeface-plain); letter-spacing: .4px; margin-top: 2px; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--shape-md); }
.banner.warn { background: var(--app-color-warn-container); color: var(--app-color-on-warn-container); }
.banner.info { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }

/* ---------- Tabs ---------- */
md-tabs { background: transparent; margin-bottom: 16px; --md-primary-tab-container-color: transparent; }

/* ---------- Teemat: layer board ---------- */
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1360px) { .board { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 960px)  { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px)  { .board { grid-template-columns: minmax(0, 1fr); } }
.lane { padding: 8px; border-radius: var(--shape-lg); background: var(--md-sys-color-surface-container-low); }
.lane-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 12px; }
.lane-head .n { color: var(--md-sys-color-on-surface-variant); }
.lane-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.co {
  position: relative; display: block; padding: 12px 16px; border-radius: var(--shape-md); text-decoration: none; outline: none;
  background: var(--md-sys-color-surface-container-lowest); color: var(--md-sys-color-on-surface);
  --md-focus-ring-shape: 12px;
}
.co-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ticker { font: 500 16px/24px var(--md-ref-typeface-plain); letter-spacing: .15px; }
.co .q { color: var(--md-sys-color-on-surface-variant); font-variant-numeric: tabular-nums; }
.co .name { display: block; color: var(--md-sys-color-on-surface-variant); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co .drivers { display: grid; gap: 2px; }
.co .drv { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--md-sys-color-on-surface-variant); }
.co .dir:not(.down) { color: var(--md-sys-color-on-surface-variant); }
.legend { display: flex; gap: 4px 16px; flex-wrap: wrap; align-items: center; list-style: none; margin: 0; padding: 0; }

.link-card { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 16px; }
.link-path { display: flex; align-items: center; gap: 8px; }

.empty { text-align: center; padding: 48px 24px; display: grid; justify-items: center; gap: 12px; }
.empty .ill { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.empty .ill .icon { font-size: 36px; }
.empty p { color: var(--md-sys-color-on-surface-variant); max-width: 48ch; }

/* ---------- Company ---------- */
.hero { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 32px; align-items: center; }
@media (max-width: 760px) { .hero { grid-template-columns: minmax(0, 1fr); padding: 16px; } }
.hero-id { display: flex; gap: 16px; align-items: center; min-width: 0; }
.logo-tile { width: 56px; height: 56px; border-radius: var(--shape-lg); display: grid; place-items: center; flex: none; background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); font: 500 14px/20px var(--md-ref-typeface-plain); letter-spacing: .1px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 8px 0 0; padding: 0; }
.hero-stat { display: flex; align-items: center; gap: 16px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--md-sys-color-outline-variant); }
.facts > div { padding: 12px 24px 16px; }
.facts > div + div { border-left: 1px solid var(--md-sys-color-outline-variant); }
.facts dt { color: var(--md-sys-color-on-surface-variant); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .facts > div { padding: 12px 16px; } .facts > div:nth-child(3) { border-left: 0; } .facts > div:nth-child(n+3) { border-top: 1px solid var(--md-sys-color-outline-variant); } }

.timeline { min-width: 820px; }
.timeline thead th.current { color: var(--md-sys-color-primary); }
.timeline tbody th { width: 200px; }
.timeline td.current, .timeline th.current { background: color-mix(in srgb, var(--md-sys-color-primary) 6%, transparent); }
.timeline .note-t { display: block; margin-top: 2px; }

.doc-list { list-style: none; margin: 0; padding: 0 0 8px; }
.doc-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 8px 16px; min-height: 72px; }
.doc-list li + li { border-top: 1px solid var(--md-sys-color-outline-variant); }
.doc-list .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-list .acts { grid-column: 2 / -1; display: flex; gap: 4px; flex-wrap: wrap; margin-left: -12px; }

.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.notes > section { padding: 8px 16px 16px; min-width: 0; }
.notes > section + section { border-left: 1px solid var(--md-sys-color-outline-variant); }
@media (max-width: 760px) { .notes { grid-template-columns: minmax(0, 1fr); } .notes > section + section { border-left: 0; border-top: 1px solid var(--md-sys-color-outline-variant); } }
.notes-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 12px; }
.note { padding: 12px 16px; border-radius: var(--shape-md); background: var(--md-sys-color-surface-container); }
.note + .note { margin-top: 8px; }
.note.hermes { background: transparent; border: 1px dashed var(--md-sys-color-outline-variant); }
.note .who { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--md-sys-color-on-surface-variant); margin-bottom: 4px; }
.composer { display: grid; gap: 12px; padding: 16px; border-top: 1px solid var(--md-sys-color-outline-variant); }

/* ---------- Tables (Material Web has no table: M3 tokens + typescale) ---------- */
.table-wrap { overflow-x: auto; position: relative; } /* position contains .sr-only absolutes */
table { width: 100%; border-collapse: collapse; }
caption { text-align: left; }
thead th {
  text-align: left; white-space: nowrap; padding: 12px 16px; height: 48px;
  font: 500 14px/20px var(--md-ref-typeface-plain); letter-spacing: .1px; color: var(--md-sys-color-on-surface-variant);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
tbody th, tbody td { text-align: left; padding: 8px 16px; height: 52px; border-bottom: 1px solid var(--md-sys-color-outline-variant); font-weight: 400; vertical-align: middle; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:not(.static):hover > * { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
tbody tr.selected > * { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
th.num, td.num { text-align: right; }
.cell-title { font: 500 14px/20px var(--md-ref-typeface-plain); letter-spacing: .1px; }
.cell-sub { display: block; color: var(--md-sys-color-on-surface-variant); font: 400 12px/16px var(--md-ref-typeface-plain); letter-spacing: .4px; }
tr.selected .cell-sub { color: inherit; }
.url { display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--md-sys-color-on-surface-variant); font: 400 12px/16px var(--md-ref-typeface-plain); }
table.wide { min-width: 860px; }
.row-btn {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; min-height: 24px; border-radius: 4px;
  font: 500 14px/20px var(--md-ref-typeface-plain); letter-spacing: .1px; color: var(--md-sys-color-primary);
}
.row-btn:hover { text-decoration: underline; }
.row-btn:focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; }
.row-btn[aria-current="true"] { color: inherit; }
.table-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 12px 16px; color: var(--md-sys-color-on-surface-variant); border-top: 1px solid var(--md-sys-color-outline-variant); }

/* Filter toolbars: compact outlined selects/text fields */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.toolbar md-outlined-select, .toolbar md-outlined-text-field, .compact {
  --md-outlined-field-top-space: var(--compact-field); --md-outlined-field-bottom-space: var(--compact-field);
  --md-outlined-text-field-top-space: var(--compact-field); --md-outlined-text-field-bottom-space: var(--compact-field);
  min-width: 160px;
}
md-outlined-select, md-outlined-text-field { --md-outlined-select-text-field-container-shape: 8px; }
.grow { flex: 1 1 240px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 599px) { .form-grid .span-2 { grid-column: auto; } }

/* ---------- Pick list (reports) ---------- */
.pick { list-style: none; margin: 0; padding: 4px 8px 8px; display: grid; gap: 2px; }
.pick button {
  all: unset; box-sizing: border-box; position: relative; display: grid; gap: 2px; width: 100%; cursor: pointer;
  padding: 12px 16px; border-radius: var(--shape-xl); color: var(--md-sys-color-on-surface-variant);
  --md-focus-ring-shape: 28px;
}
.pick .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; color: var(--md-sys-color-on-surface); }
.pick button[aria-current="true"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.pick button[aria-current="true"] .top { color: var(--md-sys-color-on-secondary-container); }

/* ---------- Markdown ---------- */
.md h3 { margin: 24px 0 8px; }
.md :is(ul, ol) { padding-left: 24px; margin: 8px 0; }
.md li + li { margin-top: 4px; }
.md ul.plain { list-style: none; padding-left: 0; }
.md blockquote { margin: 16px 0; padding: 4px 16px; border-left: 4px solid var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-surface-variant); }
.md .ref { color: var(--md-sys-color-on-surface-variant); font: 500 11px/16px var(--md-ref-typeface-plain); letter-spacing: .5px; margin-left: 2px; }
.md table { margin: 8px 0; }

/* ---------- Ajastus ---------- */
.cost-grid { display: grid; gap: 24px 32px; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; }
@media (max-width: 1100px) { .cost-grid { grid-template-columns: minmax(0, 1fr); } }
.cost-stats { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.cost-stats dt { color: var(--md-sys-color-on-surface-variant); }
.cost-stats dd { margin: 0; font: 400 22px/28px var(--md-ref-typeface-brand); font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .cost-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.meter { position: relative; margin: 12px 0 4px; }
.meter md-linear-progress { width: 100%; --md-linear-progress-track-height: 8px; --md-linear-progress-active-indicator-height: 8px; --md-linear-progress-track-shape: 4px; }
.meter .mark { position: absolute; top: -6px; height: 20px; width: 3px; border-radius: 2px; background: var(--app-color-warn); }
.meter-scale { position: relative; height: 16px; color: var(--md-sys-color-on-surface-variant); font-variant-numeric: tabular-nums; }
.meter-scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.meter-scale span:first-child { transform: none; } .meter-scale span:last-child { transform: translateX(-100%); }
.meter-scale .w { color: var(--app-color-warn); }
.chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.chart .y { display: flex; flex-direction: column; justify-content: space-between; text-align: right; color: var(--md-sys-color-on-surface-variant); padding-bottom: 20px; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 128px; border-bottom: 1px solid var(--md-sys-color-outline);
  background-image: linear-gradient(var(--md-sys-color-outline-variant) 1px, transparent 1px); background-size: 100% 50%; }
.bars > span { flex: 1; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--md-sys-color-primary); }
.bars > span.future { background: transparent; border: 1px dashed var(--md-sys-color-outline); border-bottom: 0; }
.x-axis { display: flex; justify-content: space-between; color: var(--md-sys-color-on-surface-variant); margin-top: 4px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--md-sys-color-on-surface-variant); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--md-sys-color-primary); margin-right: 6px; vertical-align: -2px; }
.sw.future { background: transparent; border: 1px dashed var(--md-sys-color-outline); }
details.disclose > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 12px 0 4px; border-radius: 20px; color: var(--md-sys-color-primary); font: 500 14px/20px var(--md-ref-typeface-plain); letter-spacing: .1px; list-style: none; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); }
details.disclose[open] > summary .icon { transform: rotate(90deg); }
.mini-table { max-width: 320px; }
.mini-table tbody :is(th, td) { height: 36px; padding: 4px 16px; }

/* ---------- Snackbar (M3 spec: inverse surface, 4dp corners, body-medium) ---------- */
.snackbar-host { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 300; display: grid; gap: 8px; width: min(560px, calc(100vw - 32px)); }
@media (max-width: 599px) { .snackbar-host { bottom: 96px; } }
.snackbar {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px 4px 4px 16px; border-radius: var(--shape-xs);
  background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface); box-shadow: var(--elev-3);
  font: 400 14px/20px var(--md-ref-typeface-plain); letter-spacing: .25px;
  animation: snack-in .25s var(--ease-emph);
}
.snackbar .msg { flex: 1; padding: 10px 0; }
.snackbar md-text-button { --md-text-button-label-text-color: var(--md-sys-color-inverse-primary); --md-text-button-hover-label-text-color: var(--md-sys-color-inverse-primary); --md-text-button-focus-label-text-color: var(--md-sys-color-inverse-primary); --md-text-button-pressed-label-text-color: var(--md-sys-color-inverse-primary); }
.snackbar md-icon-button { --md-icon-button-icon-color: var(--md-sys-color-inverse-on-surface); --md-icon-button-hover-icon-color: var(--md-sys-color-inverse-on-surface); --md-icon-button-focus-icon-color: var(--md-sys-color-inverse-on-surface); --md-icon-button-pressed-icon-color: var(--md-sys-color-inverse-on-surface); }
@keyframes snack-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Dialog form ---------- */
md-dialog { max-width: min(640px, calc(100vw - 32px)); }
md-dialog form { display: grid; gap: 16px; padding-top: 8px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--md-sys-color-surface-container); }
.login-card { width: 100%; max-width: 400px; padding: 32px 24px 24px; border-radius: var(--shape-xl); background: var(--md-sys-color-surface-container-low); }
.login-card form { display: grid; gap: 16px; margin-top: 24px; }
.login-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.check-row { display: flex; align-items: center; gap: 4px; min-height: 48px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Monospace wins over typescale/font shorthands on the same element */
.mono.mono { font-family: ui-monospace, "Roboto Mono", Menlo, monospace; font-size: 12.5px; letter-spacing: 0; }

/* ---------- Käsiteltävät (needs-attention queue) ---------- */
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.q-card { position: relative; padding: 16px; border-radius: var(--shape-md); background: var(--md-sys-color-surface-container-low); border: 1px solid transparent; }
.q-card.selected { border-color: var(--md-sys-color-primary); background: color-mix(in srgb, var(--md-sys-color-primary) 6%, var(--md-sys-color-surface-container-low)); }
.q-card.done { opacity: 1; }
.q-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.q-head .row-btn { font: 500 16px/24px var(--md-ref-typeface-plain); letter-spacing: .15px; }
.q-reasons { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.q-reasons li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: start; }
.q-reasons .detail { color: var(--md-sys-color-on-surface-variant); padding-top: 2px; overflow-wrap: anywhere; }
@media (max-width: 599px) { .q-reasons li { grid-template-columns: minmax(0, 1fr); } }
.q-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin-top: 12px; color: var(--md-sys-color-on-surface-variant); }
.q-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; margin-left: -12px; }
.reason { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--shape-sm); white-space: nowrap;
  font: 500 12px/16px var(--md-ref-typeface-plain); letter-spacing: .5px;
  background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant); }
.reason .icon { font-size: 16px; }

.panes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .panes { grid-template-columns: minmax(0, 1fr); } }
.pane-box { border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--shape-sm); overflow: hidden; min-width: 0; }
.pane-box h4 { margin: 0; padding: 8px 12px; font: 500 12px/16px var(--md-ref-typeface-plain); letter-spacing: .5px; color: var(--md-sys-color-on-surface-variant); background: var(--md-sys-color-surface-container); border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.pane-box .scroll { overflow-x: auto; padding: 8px 12px 12px; }
.raw-table { border-collapse: collapse; font: 400 12px/16px var(--md-ref-typeface-plain); min-width: 0; width: auto; }
.raw-table :is(th, td) { height: auto; padding: 4px 8px; border: 1px solid var(--md-sys-color-outline-variant); text-align: right; white-space: nowrap; }
.raw-table :is(th, td):first-child { text-align: left; }
.raw-table thead th { font-weight: 500; color: var(--md-sys-color-on-surface); text-align: center; }
pre.code { margin: 0; font: 12px/18px ui-monospace, "Roboto Mono", Menlo, monospace; white-space: pre; color: var(--md-sys-color-on-surface); }
pre.code mark { display: block; margin: 0 -12px; padding: 0 12px; background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); border-left: 3px solid var(--md-sys-color-error); }

.history { list-style: none; margin: 0; padding: 0; }
.history li { position: relative; padding: 0 0 16px 28px; }
.history li::before { content: ""; position: absolute; left: 7px; top: 20px; bottom: 0; width: 2px; background: var(--md-sys-color-outline-variant); }
.history li:last-child::before { display: none; }
.history .dot { position: absolute; left: 0; top: 2px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.history .dot .icon { font-size: 12px; }
.history li.todo .dot { background: transparent; border: 2px dashed var(--md-sys-color-outline); }
.history .when { color: var(--md-sys-color-on-surface-variant); }

.cmd { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: var(--shape-sm); background: var(--md-sys-color-surface-container-highest); }
.cmd + .cmd { margin-top: 8px; }
.cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font: 13px/20px ui-monospace, "Roboto Mono", Menlo, monospace; color: var(--md-sys-color-on-surface); }
.cmd .hint { color: var(--md-sys-color-on-surface-variant); font: 400 12px/16px var(--md-ref-typeface-plain); white-space: nowrap; }
@media (max-width: 599px) { .cmd .hint { display: none; } }

.dropzone { position: relative; display: grid; justify-items: center; gap: 4px; padding: 16px; text-align: center; border-radius: var(--shape-md);
  border: 2px dashed var(--md-sys-color-outline); background: var(--md-sys-color-surface-container-low); color: var(--md-sys-color-on-surface-variant); }
.dropzone.over { border-color: var(--md-sys-color-primary); background: color-mix(in srgb, var(--md-sys-color-primary) 8%, var(--md-sys-color-surface-container-low)); }
.dropzone .icon { font-size: 36px; color: var(--md-sys-color-primary); }
.file-chip { display: inline-flex; align-items: center; gap: 8px; }
.validation { border-radius: var(--shape-sm); padding: 12px 16px; }
.validation.ok { background: var(--app-color-up-container); color: var(--app-color-on-up-container); }
.validation.err { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.validation ul { margin: 6px 0 0; padding-left: 20px; }
.steps { display: flex; gap: 8px; align-items: center; color: var(--md-sys-color-on-surface-variant); }
.steps .on { color: var(--md-sys-color-on-surface); font-weight: 500; }
.queue-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
@media (max-width: 1100px) { .queue-grid { grid-template-columns: minmax(0, 1fr); } }
.pane-box .scroll { position: relative; } /* contains .sr-only absolutes */
