/* ==========================================================================
   FlowLeads v4 — "remonttien kirjanpito"
   --------------------------------------------------------------------------
   Loaded after every other stylesheet. No new colour values: everything
   below uses the tokens of design-system.css. What it sets is the type
   (IBM Plex Sans + Plex Mono for figures), the shape of controls, flat
   surfaces, the text-only navigation, and the PTS strip shared by Kohteet,
   the dashboard and a lead. Checked with `impeccable detect`.
   ========================================================================== */

:root {
  --font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  /* Readable secondary text uses the darker grey of the palette: the lighter
     one (#8A94A6) is 3.1:1 on white, below WCAG AA. It stays for rules. */
  --color-text-muted: var(--color-text-secondary);
  --sidebar-text-muted: var(--color-text-secondary);
  --sidebar-text-label: var(--color-text-secondary);
  --v4-rule: var(--color-border);
  --v4-rule-soft: var(--color-border-light);
  --v4-ctl: 34px;
  --v4-ctl-sm: 30px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow-md: 0 6px 20px rgba(21, 36, 59, 0.10);
  --shadow-accent: none;
}

body {
  font-family: var(--font-family);
  font-size: 14px;
  letter-spacing: 0;
}

.mono,
.num {
  font-family: var(--font-mono);
  font-size: 0.93em;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* --- Headings: one scale, sentence case everywhere ---------------------- */

h1, .page-header h1, .leads-header__title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.6px;
  line-height: 1.15;
}

h2 { letter-spacing: -0.2px; }

.page-subtitle,
.leads-header__sub {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

[class*="label"],
[class*="eyebrow"],
[class*="__kicker"],
.app-main th,
.sidebar-section,
.nav-group-label {
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.app-main th {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* --- App frame ------------------------------------------------------------ */

.app-main {
  padding: 30px 36px 72px;
}

/* --- Sidebar: wordmark, organisation, text links, figures ---------------- */

@media (min-width: 901px) {
  .sidebar {
    background-image: none;
    padding: 0 6px;
  }
  .sidebar-logo {
    border-bottom: 0;
    min-height: 0;
    padding: 22px 12px 14px;
  }
  .sidebar-logo__img { height: 30px; }
  .sidebar-org {
    margin: 0 12px 10px;
    padding: 0 0 14px;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--v4-rule-soft);
    border-radius: 0;
  }
  .sidebar-org__label { display: none; }
  .sidebar-org__name { font-weight: 600; font-size: 13.5px; }
  .sidebar-org__switch { font-size: 12px; color: var(--color-text-secondary); }
  .sidebar .sidebar-icon { display: none; }
  .sidebar-section,
  .nav-group-label {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-secondary);
    padding: 14px 12px 4px;
    margin: 0;
  }
  .sidebar-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    min-height: 0;
    padding: 5px 10px 5px 12px;
    margin: 0;
    border-radius: 0;
    background: none;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 400;
    transition: color 120ms ease;
  }
  .sidebar-item:hover { background: none; color: var(--color-text-primary); }
  .sidebar-item.active {
    background: none;
    color: var(--color-text-primary);
    font-weight: 600;
  }
  .sidebar-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--color-accent);
  }
  .sidebar-badge {
    background: none;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 400;
    padding: 0;
    min-width: 0;
    height: auto;
    border-radius: 0;
  }
  .sidebar-item.active .sidebar-badge { color: var(--color-accent); }
  .sidebar-footer { border-top: 1px solid var(--v4-rule-soft); margin: 0 6px; }
  .sidebar-notifications__toggle { font-size: 13.5px; }
  .sidebar-user-avatar { display: none; }
  .sidebar-user-email { display: none; }
}

/* --- Page headers -------------------------------------------------------- */

.page-header,
.leads-header {
  align-items: flex-end;
  margin-bottom: 18px;
}

/* --- Buttons: square-ish, one weight; step on hover, press on click ------ */

.btn {
  min-height: var(--v4-ctl);
  padding: 0 14px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease,
    transform 140ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.btn:hover { transform: translateY(-1px); box-shadow: none; }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-sm { min-height: var(--v4-ctl-sm); padding: 0 11px; font-size: 13px; }
.btn-lg { min-height: 40px; padding: 0 18px; font-size: 14px; }
.btn-link, .btn-link:hover { min-height: 0; transform: none; }
.btn-secondary, .btn.secondary { border-color: var(--v4-rule); }
.btn-secondary:hover, .btn.secondary:hover { border-color: var(--color-text-secondary); background: var(--color-card); }

/* --- Inputs ---------------------------------------------------------------- */

.form-input,
.form-select {
  min-height: var(--v4-ctl);
  border-radius: 6px;
  box-shadow: none;
}
.form-input:focus,
.form-select:focus {
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
  outline: none;
}

/* --- Surfaces: flat, hairline, modest radius ----------------------------- */

.card,
.dash-panel,
.dash-stats,
.leads-work,
.task-card,
.report-card,
.settings-panel {
  border-radius: 8px;
  box-shadow: none;
}
.card:hover { box-shadow: none; }

.badge {
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: 0;
}

/* Side-tab accent borders (impeccable: "side-tab") become plain hairlines;
   the state is still in the text ("Myöhässä", priority label, stage). */
.playbook-card,
.ai-insights-card,
.task-queue-item.priority-urgent,
.task-queue-item.priority-high,
.task-queue-item.priority-normal,
.task-section--overdue,
.task-card--overdue,
.lead-card--risk,
.lead-card--won {
  border-left: 1px solid var(--v4-rule) !important;
}
.focus-card::before { display: none; }

/* Emoji contact icons on the lead page: hidden, the value says what it is */
.contact-info-icon { display: none; }

/* --- PTS strip (app/listings/pts.py) -------------------------------------- */

.pts {
  display: inline-grid;
  grid-template-columns: repeat(5, 34px);
  border-left: 1px solid var(--v4-rule-soft);
  vertical-align: middle;
}
.pts__y {
  height: 26px;
  border-right: 1px solid var(--v4-rule-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.pts__m {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 18px;
  padding: 0 3px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: default;
}
.pts__m--info    { background: var(--color-info-soft);    color: var(--color-info-emphasis); }
.pts__m--warning { background: var(--color-warning-soft); color: var(--color-warning-emphasis); }
.pts__m--accent  { background: var(--color-accent-soft);  color: var(--color-accent-emphasis); }
.pts__m--success { background: var(--color-success-soft); color: var(--color-success-emphasis); }
.pts__m--danger  { background: var(--color-danger-soft);  color: var(--color-danger-emphasis); }
.pts__m--neutral { background: var(--color-neutral-soft); color: var(--color-neutral-emphasis); }
.pts-open { font-size: 12px; color: var(--color-text-secondary); margin-left: 8px; }
.pts-years {
  display: inline-grid;
  grid-template-columns: repeat(5, 34px);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-secondary);
}
.pts-years span { text-align: center; }

.pts--big { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; border-left-color: var(--v4-rule); }
.pts--big .pts__y { height: 42px; justify-content: flex-start; padding-left: 10px; border-right-color: var(--v4-rule); gap: 6px; }
.pts--big .pts__m { height: 26px; padding: 0 10px; font-family: var(--font-family); font-size: 13px; }
.pts-years--big { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; margin-top: 6px; }
.pts-years--big span { text-align: left; padding-left: 10px; }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:hover, .btn:active { transform: none; }
}

@media (max-width: 900px) {
  .app-main { padding: 16px 16px 48px; }
  h1, .page-header h1, .leads-header__title { font-size: 22px; }
}

/* ==========================================================================
   Kohteet (targets/index.html)
   ========================================================================== */

.targets-page .leads-work { background: var(--color-card); border: 1px solid var(--v4-rule); border-radius: 8px; overflow: visible; }
.targets-page .leads-toolbar { padding: 0 18px; border-bottom: 1px solid var(--v4-rule); min-height: 48px; }
.targets-page .leads-opp-tab { font-weight: 500; }
.targets-tab-count { background: none !important; padding: 0; margin-left: 4px; font-family: var(--font-mono); font-weight: 400; color: var(--color-text-secondary) !important; }

/* filter bar reads as a sentence of choices, not a row of boxes */
.targets-filters { gap: 6px 22px; padding: 12px 18px; border-bottom: 1px solid var(--v4-rule); background: var(--color-card); align-items: center; }
.targets-filter { flex-direction: row; align-items: baseline; gap: 6px; margin: 0; }
.targets-filter__label { font-size: 13px; font-weight: 400; color: var(--color-text-secondary); margin: 0; }
.targets-filter__select.form-input {
  min-height: 0; height: auto; width: auto; padding: 2px 16px 2px 0; border: 0; border-bottom: 1px dotted var(--color-text-secondary);
  border-radius: 0; background-color: transparent; font-weight: 500; font-size: 13.5px; color: var(--color-text-primary); box-shadow: none;
  background-position: right 0 center; background-size: 12px;
}
.targets-filter__select.form-input:focus { box-shadow: none; border-bottom-color: var(--color-accent); }
.targets-filter--check { font-size: 13px; color: var(--color-text-secondary); }
.targets-filter--sort { margin-left: auto; }

/* selection bar is the sheet's header */
.targets-bulk { padding: 8px 18px; background: var(--color-card-hover); border-bottom: 1px solid var(--v4-rule); min-height: 46px; }
.targets-bulk__count { font-family: var(--font-mono); }

/* the ledger */
.targets-list { list-style: none; margin: 0; padding: 0; }
.targets-head,
.target-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 172px minmax(170px, 0.55fr) 56px 168px;
  column-gap: 18px;
  align-items: center;
  padding: 0 18px;
}
.targets-head { min-height: 34px; font-size: 12px; color: var(--color-text-secondary); border-bottom: 1px solid var(--v4-rule); }
.targets-head__fit { text-align: right; }
.targets-group { display: flex; align-items: baseline; gap: 12px; padding: 16px 18px 6px; border-bottom: 1px solid var(--v4-rule-soft); }
.targets-group__year { font-size: 15px; font-weight: 500; color: var(--color-text-primary); }
.target-row { min-height: 54px; padding-top: 0; padding-bottom: 0; border-bottom: 1px solid var(--v4-rule-soft); gap: 0 18px; position: relative; }
.target-row:hover { background: var(--color-card-hover); }
.target-row:has(.target-row__check:checked) { background: var(--color-accent-soft); }
.target-row:has(.target-row__check:checked)::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--color-accent); }
.target-row__check { margin: 0; width: 15px; height: 15px; accent-color: var(--color-accent); }
.target-row__main { min-width: 0; padding: 8px 0; display: grid; }
.target-row__name { font-size: 14px; font-weight: 500; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.target-row__name a:hover { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.target-row__new { font-size: 12px; font-weight: 500; color: var(--color-accent); margin-left: 4px; }
.target-row__meta { font-size: 12.5px; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.target-row__pts { display: flex; align-items: center; min-width: 0; }
.target-row__pts .pts-open { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.target-row__who { min-width: 0; display: grid; font-size: 13.5px; }
.target-row__company { font-size: 12.5px; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.target-row__company:hover { color: var(--color-accent); text-decoration: underline; }
.target-row__wait { font-size: 12.5px; font-style: italic; color: var(--color-text-secondary); }
.target-row__fit { text-align: right; font-weight: 500; }
.target-row__actions { display: flex; justify-content: flex-end; gap: 4px; margin: 0; }
.target-row__act {
  border: 0; background: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; padding: 6px 8px; border-radius: 5px;
  color: var(--color-text-secondary); transition: color 120ms ease, background 120ms ease;
}
.target-row__act:hover { color: var(--color-text-primary); background: var(--color-bg-secondary); }
.target-row__act--go { color: var(--color-accent); }
.target-row__act--go:hover { color: var(--color-accent-hover); background: var(--color-accent-soft); }
.target-row__more { grid-column: 2 / -1; margin: -6px 0 8px; font-size: 13px; }
.target-row__more summary { font-size: 12.5px; color: var(--color-text-secondary); cursor: pointer; width: fit-content; }
.target-row__more summary:hover { color: var(--color-text-primary); }
.target-row__facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 8px 0 4px; padding: 10px 0 0; border-top: 1px solid var(--v4-rule-soft); }
.target-row__facts dt { color: var(--color-text-secondary); }
.target-row__facts dd { margin: 0; display: flex; gap: 12px; flex-wrap: wrap; }
.target-row__facts a:hover { color: var(--color-accent); }

@media (max-width: 1100px) {
  .targets-head { display: none; }
  .target-row { grid-template-columns: 22px minmax(0, 1fr) auto; row-gap: 4px; padding-top: 10px; padding-bottom: 6px; }
  .target-row__pts, .target-row__who { grid-column: 2 / -1; }
  .target-row__fit { grid-row: 1; grid-column: 3; }
  .target-row__actions { grid-column: 2 / -1; justify-content: flex-start; margin-left: -8px; }
}

/* "Tiedot" sits at the row's right edge; when open, the facts span the row */
.target-row__more { margin: 0; }
.target-row__more summary {
  position: absolute; right: 12px; top: 15px; list-style: none; font-size: 0; width: 24px; height: 24px; border-radius: 5px;
  display: grid; place-items: center;
}
.target-row__more summary::-webkit-details-marker { display: none; }
.target-row__more summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform 160ms ease; }
.target-row__more[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.target-row__more summary:hover { background: var(--color-bg-secondary); }
.target-row__more[open] { padding-bottom: 10px; }
.target-row__actions { padding-right: 26px; }
.targets-filter__select.form-input { max-width: 190px; min-width: 0; }
.targets-filters { flex-wrap: wrap; }
.target-row__act { white-space: nowrap; }
.targets-head, .target-row { grid-template-columns: 22px minmax(0, 1fr) 172px minmax(170px, 0.55fr) 48px 200px; }
.targets-filter--check, .targets-calllist, .targets-bulk__all { align-items: center; display: inline-flex; gap: 6px; }
.targets-calllist input, .targets-bulk__all input, .targets-filter--check input { margin: 0; accent-color: var(--color-accent); }

/* ==========================================================================
   Kojelauta (dashboard/index.html)
   ========================================================================== */

.dash-header { align-items: flex-end; margin-bottom: 20px; }
.dash-header__context { font-size: 12.5px; color: var(--color-text-secondary); font-family: var(--font-mono); }
.dash-header__org { font-family: var(--font-family); }
.dash-header__title { font-size: 26px; font-weight: 600; letter-spacing: -0.6px; }
.dash-header__summary { margin: 4px 0 0; color: var(--color-text-secondary); font-size: 14px; }
.dash-search { border-radius: 6px; box-shadow: none; }

.dash-focus { border-radius: 8px !important; box-shadow: none !important; margin-bottom: 28px; }

.dash-today { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; margin-bottom: 36px; }
.dash-ledger__head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 8px; border-bottom: 1px solid var(--color-text-primary); }
.dash-ledger__head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.dash-ledger__link { font-size: 13px; color: var(--color-text-secondary); }
.dash-ledger__link:hover { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.dash-ledger__link.dash-targets { display: inline; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.dash-ledger__link .dash-targets__count { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--color-text-primary); }
.dash-ledger__empty { padding: 14px 0; color: var(--color-text-secondary); font-size: 13.5px; margin: 0; border-bottom: 1px solid var(--v4-rule); }
.dash-call, .dash-target {
  display: grid; align-items: center; gap: 14px; min-height: 52px; border-bottom: 1px solid var(--v4-rule);
  color: inherit; transition: background 100ms ease;
}
.dash-call { grid-template-columns: 20px minmax(0, 1fr) auto auto; }
.dash-target { grid-template-columns: minmax(0, 1fr) auto 32px; }
.dash-call:hover, .dash-target:hover { background: var(--color-card-hover); }
.dash-call__n { color: var(--color-text-secondary); }
.dash-call:first-of-type .dash-call__n { color: var(--color-accent); font-weight: 500; }
.dash-call.is-late .dash-call__meta { color: var(--color-warning-emphasis); }
.dash-call__main { min-width: 0; display: grid; padding: 7px 0; }
.dash-call__name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-call:hover .dash-call__name, .dash-target:hover .dash-call__name { color: var(--color-accent); }
.dash-call__meta { font-size: 12.5px; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-call__tel { color: var(--color-text-secondary); }
.dash-target__fit { text-align: right; font-weight: 500; }

/* the older panels below read as the same ledger */
.dash-columns { gap: 40px; }
.dash-panel { background: none; border: 0; border-radius: 0; }
.dash-panel__head { padding: 0 0 8px; border-bottom: 1px solid var(--color-text-primary); background: none; }
.dash-panel__title { font-size: 15px; font-weight: 600; }
.dash-panel__meta { font-size: 12.5px; color: var(--color-text-secondary); }
.work-row { padding: 10px 0; border-radius: 0; border-bottom: 1px solid var(--v4-rule); background: none; }
.work-row:hover { background: var(--color-card-hover); transform: none; }
.lead-next { background: none; padding: 0; color: var(--color-accent); font-weight: 500; }

.dash-stats { background: none; border: 0; border-top: 1px solid var(--v4-rule); border-radius: 0; margin-top: 36px; }
.dash-stat { border: 0 !important; padding: 12px 0 0; background: none; }
.dash-stat__label { font-size: 12.5px; font-weight: 400; color: var(--color-text-secondary); }
.dash-stat__value { font-family: var(--font-mono); font-size: 24px; font-weight: 500; letter-spacing: -0.5px; }

@media (max-width: 1100px) {
  .dash-today { grid-template-columns: 1fr; gap: 28px; }
  .dash-call .pts, .dash-target .pts { display: none; }
}
.dash-header__context { font-family: var(--font-family); }
.dash-ledger__link.dash-targets { margin: 0; gap: 0; border: 0; background: none; padding: 0; display: inline; }
.dash-ledger__head { min-height: 30px; }
/* the focus band: one compact line of work, no side panel of counts */
.dash-focus__side { display: none !important; }
.dash-focus__main { padding: 20px 24px !important; }
.dash-focus__name { font-size: 21px !important; letter-spacing: -0.4px !important; margin: 4px 0 6px !important; }
.dash-focus__action { margin-top: 14px !important; padding-top: 14px !important; }
.dash-focus__next-text { font-size: 15px !important; }
.dash-focus__open.btn-lg { min-height: 36px; font-size: 13.5px; }

/* ==========================================================================
   Liidin sivu (leads/detail.html)
   ========================================================================== */

.lead-focus {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "main next" "pts next";
  column-gap: 40px;
  background: none !important;
  color: var(--color-text-primary) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin-bottom: 28px;
}
.lead-focus__main { grid-area: main; padding: 0 0 16px !important; }
.lead-focus__name { color: var(--color-text-primary) !important; font-size: 26px !important; font-weight: 600 !important; letter-spacing: -0.6px !important; }
.lead-focus__person { color: var(--color-text-secondary) !important; font-size: 14px !important; }
.lead-focus__facts, .lead-focus__facts .lead-stage { color: var(--color-text-secondary) !important; font-size: 13.5px !important; }
.lead-focus__badges:empty { display: none; }
.lead-focus__pts { grid-area: pts; }
.lead-focus__next {
  grid-area: next;
  align-self: start;
  background: var(--color-card) !important;
  border: 1px solid var(--v4-rule) !important;
  border-radius: 8px !important;
  padding: 16px 18px !important;
  color: var(--color-text-primary) !important;
}
.lead-focus__next-label { color: var(--color-text-secondary) !important; font-size: 12.5px !important; font-weight: 400 !important; }
.lead-focus__next-text { color: var(--color-text-primary) !important; font-size: 15px !important; font-weight: 600 !important; }
.lead-focus__next-meta { color: var(--color-text-secondary) !important; font-family: var(--font-mono); font-size: 12.5px !important; }
.lead-focus__cta { margin-top: 12px; background: var(--color-accent) !important; border-color: var(--color-accent) !important; color: var(--color-text-inverse) !important; }

.lead-why { margin: 0 0 28px; }
.lead-why__title { font-size: 15px; font-weight: 600; padding-bottom: 8px; border-bottom: 1px solid var(--color-text-primary); margin: 0 0 12px; }
.lead-why__quote { font-size: 18px; line-height: 1.45; letter-spacing: -0.2px; margin: 0; max-width: 40em; text-indent: -0.4em; }
.lead-why__src { font-size: 13px; color: var(--color-text-secondary); margin: 6px 0 0; }

.lead-profile-grid .card { border-radius: 8px; }
.lead-profile-grid .card-header { border-bottom-color: var(--v4-rule-soft); }
.lead-profile-grid .card-title { font-size: 15px; font-weight: 600; }

@media (max-width: 1000px) {
  .lead-focus { grid-template-columns: 1fr; grid-template-areas: "main" "pts" "next"; row-gap: 16px; }
}
.lead-focus .lead-source { color: var(--color-text-secondary) !important; }
.lead-focus__next-meta { font-family: var(--font-family) !important; }
/* running text stays readable (impeccable: line-length) */
.lead-notes, .lead-why__quote, .leads-header__sub, .page-subtitle, .dash-header__summary { max-width: 58ch; }

/* ==========================================================================
   Myyntiputki (leads/pipeline.html): columns are lanes on the page, not a
   card holding cards (impeccable: nested-cards, edge-flush-cards)
   ========================================================================== */

.pipeline-wrapper { border: 0; border-radius: 0; background: none; gap: 14px; padding: 0 2px; }
.pipeline-col { border-left: 0; background: none; }
.pipeline-col__header { background: none; padding: 0 2px 8px; border-bottom: 1px solid var(--color-text-primary); }
.pipeline-col__count, .pipeline-col__value { font-family: var(--font-mono); }
.lead-card { border-color: var(--v4-rule); border-radius: 8px; transition: border-color 120ms ease, transform 160ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.lead-card:hover { border-color: var(--color-text-secondary); transform: translateY(-2px); box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .lead-card, .lead-card:hover { transition: none; transform: none; } }
.pipeline-wrapper { gap: 28px; }
.pipeline-col__header { padding: 0 0 8px; }

@media (max-width: 1100px) {
  .targets-head, .target-row { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .target-row__actions { padding-right: 0; }
  .target-row__more summary { top: 10px; }
  .targets-filters { gap: 4px 18px; }
}
.pipeline-board { gap: 20px; }
.pipeline-col__header { padding: 0 10px 8px; min-height: 0; }
.pipeline-board {
  grid-template-columns: repeat(var(--pipeline-cols, 6), minmax(160px, 1fr));
  min-width: calc(var(--pipeline-cols, 6) * 160px + (var(--pipeline-cols, 6) - 1) * 20px);
}
.target-row__new.badge-new { background: none; padding: 0; border-radius: 0; }

/* ==========================================================================
   System-wide fixes from `impeccable detect` on the remaining pages
   ========================================================================== */

/* no text below 12px: the xs step was 11px (tiny-text, undersized-ui-text) */
:root { --font-size-xs: 12px; }
.settings-nav__label, .settings-nav__group-label { font-size: 12px !important; color: var(--color-text-secondary); }
small, .form-hint, .help-text, .text-xs { font-size: 12px; }

/* empty states: a sentence and an action, no icon tile above the heading */
.empty-state { padding: 28px 4px; max-width: 52ch; color: var(--color-text-secondary); }
.empty-state__title { font-size: 15px; font-weight: 600; color: var(--color-text-primary); margin: 0 0 4px; letter-spacing: -0.1px; }
.empty-state p { margin: 0 0 14px; font-size: 14px; }

/* a card never sits inside another card (nested-cards): inner ones go flat */
.card .card,
.settings-panel .card,
.card .report-card,
.report-card .card,
.card .report-metric,
.settings-panel .settings-panel,
.card .task-card,
.task-section .task-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* running text in settings stays readable (line-length) */
.settings-panel p, .card-body > p, .settings-section p { max-width: 70ch; }

/* Raportit: metrics are figures on a rule, not boxes inside the card */
.report-metric { background: none; border: 0; border-top: 1px solid var(--v4-rule); border-radius: 0; padding: 10px 0 0; }
.report-metric__value, .report-metric strong { font-family: var(--font-mono); font-weight: 500; }

/* Urakat ja kohdehaku: the profile list is a plain column; regions wrap freely */
.search-profiles-list { background: none; border: 0; border-right: 1px solid var(--v4-rule); border-radius: 0; padding: 0 16px 0 0; }
.search-profiles-regions__grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.search-profiles-regions__grid .form-check { min-width: 0; overflow-wrap: anywhere; }
.search-profiles-sidepanel { position: static; }
@media (max-width: 1280px) { .search-profiles-layout { grid-template-columns: 200px minmax(0, 1fr); } .search-profiles-sidepanel { grid-column: 1 / -1; } }

/* Webhookit: event groups separated by a rule, not boxed */
.event-fieldset { border: 0; border-top: 1px solid var(--v4-rule); border-radius: 0; padding: 12px 0 0; }

/* Tehtävät: rows on rules inside their section */
.task-row { border: 0; border-bottom: 1px solid var(--v4-rule); border-radius: 0; padding: 10px 2px; }
.task-row:hover { background: var(--color-card-hover); }

.form-helper { max-width: 68ch; }
.search-profiles-list__off { display: block; font-size: 12px; color: var(--color-text-secondary); }
.search-profiles-sidepanel { background: none; border: 0; border-left: 1px solid var(--v4-rule); border-radius: 0; padding: 0 0 0 16px; }
.form-helper { max-width: 56ch; }

/* ==========================================================================
   Liidit (leads/index.html, list.html) and Isännöitsijät (insights)
   ========================================================================== */

.leads-page .leads-work { border-radius: 8px; box-shadow: none; }
.leads-toolbar { min-height: 48px; }
.leads-opp-tab { font-weight: 500; }
.leads-quick-filters { gap: 6px 22px; align-items: baseline; }
.leads-quick-filter { flex-direction: row; align-items: baseline; gap: 6px; }
.leads-quick-filter__label { font-size: 13px; font-weight: 400; color: var(--color-text-secondary); margin: 0; }
.leads-quick-filter__select.form-input {
  min-height: 0; height: auto; width: auto; max-width: 190px; padding: 2px 16px 2px 0; border: 0; border-bottom: 1px dotted var(--color-text-secondary);
  border-radius: 0; background-color: transparent; font-weight: 500; font-size: 13.5px; color: var(--color-text-primary); box-shadow: none;
}
.lead-row { border-radius: 0; }
.lead-row .badge-new, .lead-row .badge { background: none; padding: 0; color: var(--color-accent); font-size: 12px; }
.lead-row__value, .leads-footer__count { font-family: var(--font-mono); }

.insights-table th { font-family: var(--font-family) !important; }
.insights-count { background: none !important; padding: 0 !important; font-family: var(--font-mono); font-weight: 500; color: var(--color-text-primary); }
.insights-table td.num, .insights-table .num { font-family: var(--font-mono); }

/* ==========================================================================
   Soittolista (tasks/calls.html): a call sheet
   ========================================================================== */

.calls-list { background: var(--color-card); border: 1px solid var(--v4-rule); border-radius: 8px; padding: 0 18px; gap: 0 !important; counter-reset: none; }
.call-card {
  display: grid !important;
  grid-template-columns: 24px minmax(0, 1fr) minmax(320px, 0.9fr);
  column-gap: 18px;
  align-items: start;
  background: none !important;
  border: 0 !important;
  border-bottom: 1px solid var(--v4-rule) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 16px 0 !important;
  margin: 0 !important;
}
.call-card:last-child { border-bottom: 0 !important; }
.call-card__n { color: var(--color-text-secondary); padding-top: 2px; }
.call-card:first-child .call-card__n { color: var(--color-accent); font-weight: 500; }
.call-card__title { font-size: 15px; font-weight: 600; }
.call-card__late { background: none; color: var(--color-warning-emphasis); padding: 0; font-size: 12.5px; font-weight: 500; }
.call-card__tag { display: none; }
.call-card__pts { margin: 8px 0 6px; }
.call-card__phone { font-family: var(--font-mono); font-size: 17px; font-weight: 500; color: var(--color-text-primary); letter-spacing: -0.2px; }
.call-card__phone:hover { color: var(--color-accent); }
.call-card__form { gap: 8px; }
@media (max-width: 900px) {
  .call-card { grid-template-columns: 24px minmax(0, 1fr); row-gap: 10px; }
  .call-card__form { grid-column: 2; }
}

/* Tehtävät: sections are headed groups on the page */
.task-section { background: none; border: 0; box-shadow: none; padding: 0; margin-bottom: 28px; }
.task-section__header, .task-section > header { padding: 0 0 8px; border-bottom: 1px solid var(--color-text-primary); }
.call-card__outcomes { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.call-card__outcomes .btn { width: 100%; }
.call-card__outcomes .btn-primary { order: -1; }
/* mono is for figures only: values that can be words stay in the text face */
.lead-row__value, .dash-stat__value, .leads-footer__count { font-family: var(--font-family) !important; font-variant-numeric: tabular-nums; }
.insights-count { font-family: var(--font-family) !important; }

/* ==========================================================================
   Kirjautuminen ja esittely (auth/login.html, login.css)
   ========================================================================== */

.lp-hero__title { font-weight: 600; letter-spacing: -1.4px; }
.lp-hero__lead { max-width: 58ch; }
.lp-section__lead, .lp-card__lead { max-width: 62ch; }
.lp-hero__points { list-style: none; padding: 0; margin-top: 20px; border-top: 1px solid var(--v4-rule); max-width: 58ch; }
.lp-hero__points li { padding: 8px 0 8px 0 !important; border-bottom: 1px solid var(--v4-rule); }
.lp-hero__points li::before, .lp-hero__points svg { display: none !important; }
.lp-card { box-shadow: none !important; border: 1px solid var(--v4-rule) !important; border-radius: 10px !important; }
.lp-btn { border-radius: 6px !important; box-shadow: none !important; }
.lp-btn:hover { transform: translateY(-1px); }
.lp-btn:active { transform: scale(0.98); }

/* demo: one sheet with ruled rows, reasons as text, the score as a figure */
.lp-target { border: 0 !important; border-bottom: 1px solid var(--v4-rule) !important; border-radius: 0 !important; background: none !important; box-shadow: none !important; }
.lp-target:last-child { border-bottom: 0 !important; }
.lp-reason { background: none !important; border: 0 !important; padding: 0 !important; color: var(--color-text-secondary); font-size: 12.5px; }
.lp-reason + .lp-reason::before { content: "· "; }
.lp-score { background: none !important; border: 0 !important; }
.lp-score__value { font-family: var(--font-mono); font-weight: 500; }
.lp-learn { background: none !important; border: 0 !important; border-left: 2px solid var(--v4-rule) !important; border-radius: 0 !important; padding-left: 12px !important; }

/* trade and benefit columns sit on a rule, not in boxes */
.lp-segment, .lp-benefit { background: none !important; border: 0 !important; border-top: 1px solid var(--color-text-primary) !important; border-radius: 0 !important; box-shadow: none !important; padding: 14px 4px 0 0 !important; }
.lp-cta { box-shadow: none !important; border-radius: 10px !important; }
/* the score's label is said once, on the first row */
.lp-target:not(:first-child) .lp-score__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* explanatory paragraphs stay a readable measure everywhere (line-length) */
.app-main p.text-muted, .app-main p.text-sm, .app-main .card-body > p { max-width: 62ch; }
p.form-helper { max-width: 460px !important; }
/* counts in tables are figures; the available count is the accent figure */
.insights-table td.num .badge { background: none; padding: 0; color: var(--color-accent); font-weight: 600; font-family: var(--font-mono); font-size: 13px; }
/* sopivuus: a figure in the level's text colour; the breakdown opens beside it */
.target-row__fit .target-score { margin: 0; }
.target-row__fit .target-score > summary { background: none !important; padding: 2px 0; border-radius: 0; font-weight: 500; font-size: 13.5px; }
.target-row__fit .target-score__parts { box-shadow: var(--shadow-md); border-color: var(--v4-rule); border-radius: 8px; text-align: left; }
.target-row__signals { color: var(--color-text-secondary); text-decoration: underline; text-underline-offset: 2px; }
/* Integraatiot: providers are sections on a rule, not cards in the panel */
.integration-card { background: none !important; border: 0 !important; border-top: 1px solid var(--v4-rule) !important; border-radius: 0 !important; box-shadow: none !important; padding: 16px 0 !important; }
.settings-panel__subtitle { max-width: 62ch; }
p.settings-panel__subtitle, .settings-panel__subtitle { max-width: 460px !important; }
/* "Kerro mitä etsit": same inset as the other rows of the sheet */
.targets-ask { padding: 12px 18px; margin: 0; border-bottom: 1px solid var(--v4-rule); gap: 10px; align-items: center; }
.targets-ask__label { font-size: 13px; font-weight: 500; white-space: nowrap; }

/* ==========================================================================
   Second detector pass (antislopdev UI-01/05/16/25/37, impeccable advisories)
   ========================================================================== */

/* headings and running text wrap without a lone last word */
h1, h2, h3, .lp-hero__title, .lp-section__title { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }

/* close and remove controls: a drawn x, never an emoji */
.icon-close { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--color-text-secondary); cursor: pointer; }
.icon-close:hover { background: var(--color-bg-secondary); color: var(--color-text-primary); }
.leads-opp-chip__x, .targets-saved__icon { display: inline-grid; place-items: center; }
.i-x { display: block; }
.btn-link-plain { border: 0; background: none; padding: 0; font: inherit; color: var(--color-accent); cursor: pointer; }
.btn-link-plain:hover { text-decoration: underline; text-underline-offset: 3px; }

/* activity timeline and system checks: a small dot carries the kind */
.activity-icon { width: 9px !important; height: 9px !important; min-width: 9px; border-radius: 50%; background: var(--color-card) !important; border: 1.5px solid var(--color-text-secondary); font-size: 0 !important; padding: 0 !important; margin-top: 6px; }
.activity-icon.email { border-color: var(--color-info); }
.activity-icon.stage { border-color: var(--color-accent); }
.activity-icon.task { border-color: var(--color-success); }
.system-check__mark { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-secondary); margin-right: 8px; vertical-align: middle; }
.system-check--ok .system-check__mark { background: var(--color-success); }
.system-check--warn .system-check__mark { background: var(--color-warning); }
.system-check--fail .system-check__mark { background: var(--color-danger); }

/* stat labels in the search-profile panel: sentence case, no tracking (UI-01) */
.search-profiles-stats dt { text-transform: none !important; letter-spacing: 0 !important; font-size: 12.5px; color: var(--color-text-secondary); }

/* phone width: nothing wider than the screen (UI-37) */
@media (max-width: 600px) {
  .page-header, .leads-header { flex-wrap: wrap; gap: 10px; }
  .page-header__actions, .leads-header__actions { flex-wrap: wrap; }
  .search-profiles-layout { grid-template-columns: minmax(0, 1fr) !important; }
  .search-profiles-list { border-right: 0; border-bottom: 1px solid var(--v4-rule); padding: 0 0 12px; }
  .search-profiles-regions, .search-profiles-regions__grid { min-width: 0; max-width: 100%; }
  .search-profiles-regions__grid { grid-template-columns: minmax(0, 1fr); }
  fieldset { min-width: 0; }
}
.tasks-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px; }
.tasks-header .page-header__actions { flex-wrap: wrap; }
@media (max-width: 600px) { .tasks-header .page-header__actions select { max-width: 100%; } }

/* ==========================================================================
   Third pass: nongeneric / Gesso / avoid-ai-design rules on a phone
   ========================================================================== */

/* the shell fills the dynamic viewport on phones (legacy-viewport-height) */
.app-layout { min-height: 100dvh; }

/* search fields that drop the input outline show the ring on their wrapper */
.dash-search:focus-within, .leads-opp-search:focus-within { border-color: var(--color-accent); box-shadow: var(--focus-ring); }

/* touch: inputs at 16px so iOS does not zoom on focus (ios-input-zoom),
   controls at least 44px tall (tiny-tap-target, WCAG 2.5.5) */
@media (max-width: 900px), (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]), select, textarea, .form-input, .form-select { font-size: 16px !important; }
  .btn, .btn-sm, .btn-lg, .target-row__act, .leads-opp-tab, .tab, .icon-close, .btn-link-plain,
  .seg button, .app-main__topbar button, .sidebar-toggle, .lead-next, .lead-card__next,
  .call-card__outcomes .btn, .dash-ledger__link, .head-link { min-height: 44px; }
  .sidebar-item { min-height: 44px; align-items: center; }
  .app-main__topbar-logo { min-height: 44px; display: inline-flex; align-items: center; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  .target-row__check { width: 22px; height: 22px; }
  .targets-filter__select.form-input, .leads-quick-filter__select.form-input { min-height: 40px; }
  .lead-next, .lead-card__next { display: inline-flex; align-items: center; }
}
@media (max-width: 900px), (pointer: coarse) {
  .btn, .btn-sm { min-height: 44px !important; }
  .lead-list-head__col, .task-row__edit, .calls-scope__item, .dash-panel__link, .task-row__meta a,
  .breadcrumbs a, .work-row__name, .dash-call, .dash-target { min-height: 44px; display: inline-flex; align-items: center; }
  .task-row__check, .task-row button[aria-label] { min-width: 44px; min-height: 44px; }
}
/* the complete-task control: a drawn ring, named for screen readers */
.task-check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--color-text-secondary); background: var(--color-card); cursor: pointer; padding: 0; font-size: 0; position: relative; }
.task-check:hover { border-color: var(--color-success); }
.task-check::after { content: ""; position: absolute; inset: -11px; }
input[type=checkbox] { width: 24px; height: 24px; }
@media (max-width: 900px), (pointer: coarse) {
  .pipeline-page-actions .btn { height: auto !important; min-height: 44px !important; }
  .task-row__edit { min-width: 44px; justify-content: center; }
  .task-toggle-btn { min-height: 44px; }
  .contact-info-value { min-height: 44px; display: inline-flex; align-items: center; }
}
@media (max-width: 900px), (pointer: coarse) {
  .pipeline-add-lead, .lead-row__name { min-height: 44px; display: inline-flex; align-items: center; }
}

/* ==========================================================================
   Kirjautumissivu, rakenne 2: tuote heti näkyvissä, yksi faktaosio
   ========================================================================== */

.lp-ledger { margin: 22px 0 22px; max-width: 560px; background: var(--color-card); border: 1px solid var(--v4-rule); border-radius: 8px; padding: 0 16px; }
.lp-ledger__head, .lp-ledger__row { display: grid; grid-template-columns: minmax(0, 1fr) auto 56px; column-gap: 16px; align-items: center; }
.lp-ledger__head { min-height: 32px; font-size: 12px; color: var(--color-text-secondary); border-bottom: 1px solid var(--v4-rule); }
.lp-ledger__head span:last-child, .lp-ledger__fit { text-align: right; }
.lp-ledger__row { min-height: 52px; border-bottom: 1px solid var(--v4-rule-soft); }
.lp-ledger__row:last-of-type { border-bottom: 0; }
.lp-ledger__name { display: grid; min-width: 0; }
.lp-ledger__name b { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-ledger__name span { font-size: 12.5px; color: var(--color-text-secondary); }
.lp-ledger__fit { font-family: var(--font-mono); font-weight: 500; font-size: 14px; }
.lp-ledger figcaption { font-size: 12.5px; color: var(--color-text-secondary); padding: 10px 0 12px; border-top: 1px solid var(--v4-rule); }
.lp-textlink { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; color: var(--color-accent); margin-left: 6px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.lp-textlink:hover { color: var(--color-accent-hover); }

.lp-fit__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.lp-facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 0 16px; margin: 22px 0 0; border-top: 1px solid var(--color-text-primary); }
.lp-facts dt, .lp-facts dd { padding: 11px 0; border-bottom: 1px solid var(--v4-rule); margin: 0; }
.lp-facts dt { font-weight: 600; font-size: 14px; }
.lp-facts dd { color: var(--color-text-secondary); font-size: 14.5px; }
.lp-fit__label { font-size: 13px; font-weight: 500; color: var(--color-text-secondary); margin: 6px 0 8px; }
.lp-trades { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-text-primary); }
.lp-trades li { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--v4-rule); }
.lp-trades b { font-weight: 600; font-size: 14px; }
.lp-trades span { color: var(--color-text-secondary); font-size: 14px; }

.lp-cta--plain { background: none !important; border: 0 !important; border-top: 1px solid var(--color-text-primary) !important; border-radius: 0 !important; padding: 22px 0 0 !important; box-shadow: none !important; }

@media (max-width: 900px) {
  .lp-fit__grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .lp-trades li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .lp-ledger__head .pts-years { display: none; }
}
@media (max-width: 480px) {
  .lp-ledger__head, .lp-ledger__row { grid-template-columns: minmax(0, 1fr) 40px; }
  .lp-ledger .pts { display: none; }
  .lp-facts { grid-template-columns: minmax(0, 1fr); }
  .lp-facts dt { border-bottom: 0; padding-bottom: 0; }
}
