/* ============================================================
   Ajopäiväkirja v1.0 — quiet premium production UI
   Softer dark slate refresh
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #101725;
  --bg-deep: #0c1220;
  --panel: rgba(31, 42, 59, 0.72);
  --panel-strong: rgba(36, 49, 69, 0.86);
  --field: rgba(18, 26, 41, 0.58);
  --line: rgba(196, 210, 232, 0.14);
  --line-strong: rgba(210, 222, 242, 0.24);
  --text: rgba(255,255,255,0.95);
  --muted: rgba(218,228,244,0.66);
  --faint: rgba(218,228,244,0.38);
  --green: #43c979;
  --green-strong: #38b86b;
  --green-soft: #2f8f6f;
  --green-soft-2: #277a68;
  --green-bg: rgba(67,201,121,0.13);
  --green-line: rgba(86,220,143,0.30);
  --amber: #e6b450;
  --amber-bg: rgba(230,180,80,0.14);
  --amber-line: rgba(230,180,80,0.26);
  --red: #e36b72;
  --red-bg: rgba(227,107,114,0.10);
  --red-line: rgba(227,107,114,0.36);
  --radius: 24px;
  --radius-sm: 16px;
  --accent: #6ea8fe;
  --max-w: 390px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
  min-height: 100%;
  background: var(--bg-deep);
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: inherit;
  background:
    radial-gradient(circle at 50% -12%, rgba(68, 96, 132, 0.34), transparent 38%),
    linear-gradient(180deg, #142033 0%, #101725 42%, #0c1220 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
.is-disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.screen {
  display: none;
  min-height: 100vh;
  width: 100%;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.screen-body {
  width: 100%;
  max-width: var(--max-w);
  padding: 28px 21px 46px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.top-bar {
  width: 100%;
  max-width: var(--max-w);
  min-height: 72px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(196, 210, 232, 0.10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(10, 16, 27, 0.14);
}

.brand-title {
  color: var(--muted);
  font-size: 15px;
  font-weight: 640;
  letter-spacing: -0.015em;
}

.landing-title {
  font-size: 30px;
  font-weight: 760;
  letter-spacing: -0.04em;
}

.brand-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.page-intro {
  padding: 16px 2px 2px;
}

.page-intro h1 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 36px;
  line-height: 1.05;
  font-weight: 780;
  letter-spacing: -0.055em;
}

.page-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.42;
  letter-spacing: -0.02em;
}

.landing-wrap {
  width: 100%;
  max-width: var(--max-w);
  min-height: 100vh;
  padding: 44px 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  text-align: center;
}

.landing-msg {
  min-height: 1.4em;
  color: var(--amber);
  font-size: 14px;
  line-height: 1.45;
}

/* Loading- ja error-näkymät (auth-flow) */
.loading-note {
  color: #8a97ab;
  font-size: 14px;
  margin-top: 4px;
}

.error-msg {
  min-height: 1.4em;
  color: var(--amber);
  font-size: 14px;
  line-height: 1.45;
}

/* Ohjesivut (/ohjeet/) */
.ohje-linkki {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}
body > h1, body > h2, body > p, body > ol, body > ul {
  max-width: var(--max-w, 640px);
  margin-left: auto;
  margin-right: auto;
  padding-left: 21px;
  padding-right: 21px;
}

/* Versio top-barissa, kayttajatunnuksen ja Ulos-painikkeen valissa.
   Oli aiemmin position:fixed ruudun alalaidassa ja vain aloitusnakymassa. */
.app-version {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-left: auto;
  margin-right: 10px;
  opacity: 0.7;
}

/* Top-barin oikea reuna: brand vasemmalle, toiminnot oikealle. Kaare
   sailyttaa .top-barin space-between-asettelun kolmella lapsella. */
.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* .btn-pill on suunniteltu button-elementille; ankkuri tarvitsee nama. */
.ohje-pill {
  display: inline-block;
  text-decoration: none;
  line-height: 1.2;
}
.btn-pill {
  color: rgba(238,244,255,0.82);
  border: 1px solid rgba(210,222,242,0.18);
  border-radius: 999px;
  background: rgba(31,42,59,0.58);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 620;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.blocked-msg {
  width: 100%;
  max-width: var(--max-w);
  min-height: 0;
  padding: 6px 21px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.state-strip {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.035);
  color: var(--muted);
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 620;
}

.state-strip-amber {
  color: var(--amber);
  background: var(--amber-bg);
  border-color: var(--amber-line);
}

.state-strip-green {
  color: var(--green);
  background: var(--green-bg);
  border-color: var(--green-line);
}

.state-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: currentColor;
  flex: 0 0 auto;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(42, 56, 78, 0.78), rgba(27, 38, 55, 0.76));
  padding: 22px;
  box-shadow:
    0 22px 54px rgba(0,0,0,0.23),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

.card-title {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.field {
  margin-bottom: 17px;
  display: flex;
  flex-direction: column;
}

.field:last-child {
  margin-bottom: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.field-row .field {
  margin-bottom: 0;
}

/* ── Kenttaohjeet ───────────────────────────────────────────────────────────
   Ohje avautuu kentan alle, ei erilliselle sivulle: toimii myos offline.
   Teksti tulee OHJEET-taulukosta avaimella (app-v1-core.js). */
.field-label-rivi {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
}
.field-label-rivi .field-label {
  margin: 0;
}
.ohje-nappi {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  cursor: pointer;
}
.ohje-nappi[aria-expanded="true"] {
  color: var(--text);
  border-color: var(--green-line);
  background: var(--green-bg);
}
.ohje-teksti {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.ohje-teksti[hidden] {
  display: none;
}

.field-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  text-transform: none;
  letter-spacing: -0.01em;
}

select,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea.comment-field {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--text);
  padding: 0 14px;
  outline: none;
  font-size: 16px;
  font-weight: 540;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}

textarea.comment-field {
  min-height: 76px;
  padding: 14px;
  resize: none;
  line-height: 1.45;
}

select {
  appearance: none;
}

select option {
  background: #1b2637;
  color: var(--text);
}

input[type="date"],
input[type="time"] {
  color-scheme: dark;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--line-strong);
  background: rgba(18, 26, 41, 0.78);
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  display: none;
}

.uppercase {
  text-transform: uppercase;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  min-height: 54px;
  width: 100%;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 16px;
  font-weight: 740;
  letter-spacing: -0.018em;
}

.btn-primary {
  background: linear-gradient(180deg, var(--green) 0%, var(--green-strong) 100%);
  color: #06120b;
  box-shadow:
    0 12px 26px rgba(35, 167, 92, 0.23),
    inset 0 1px 0 rgba(255,255,255,0.18);
}

.btn-secondary {
  border: 1px solid rgba(86,220,143,0.24);
  background: linear-gradient(180deg, rgba(47,143,111,0.92), rgba(39,122,104,0.92));
  color: rgba(255,255,255,0.92);
  box-shadow:
    0 10px 24px rgba(18, 84, 70, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.10);
}

.btn-danger {
  border: 1px solid var(--red-line);
  background: var(--red-bg);
  color: var(--red);
}

.btn-flush,
.btn-calc {
  width: 100%;
}

.action-stack {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 3px;
}

.notice,
.alert-warn {
  border: 1px solid var(--amber-line);
  border-radius: var(--radius-sm);
  background: var(--amber-bg);
  color: var(--amber);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 15px;
}

.queue-panel {
  margin-bottom: 18px;
}

.queue-title {
  margin-bottom: 12px;
  color: var(--amber);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.driver-badge {
  min-height: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.34; }
}

.recording-card {
  border: 1px solid var(--green-line);
  border-radius: 28px;
  background: var(--green-bg);
  padding: 30px 22px;
  text-align: center;
}

.recording-status {
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 720;
  margin-bottom: 28px;
}

.recording-dot {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  background: currentColor;
  animation: pulse 1.8s ease-in-out infinite;
}

.recording-plate {
  min-height: 39px;
  font-size: 39px;
  line-height: 1;
  font-weight: 760;
  letter-spacing: -0.055em;
  margin-bottom: 8px;
}

.recording-job {
  min-height: 22px;
  color: rgba(255,255,255,0.72);
  font-size: 17px;
  margin-bottom: 28px;
}

.recording-time {
  display: flex;
  justify-content: center;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
}

.time-label {
  color: var(--muted);
  font-size: 14px;
}

.time-value {
  display: block;
  color: var(--text);
  font-size: 17px;
  font-weight: 670;
  margin-top: 4px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.summary-row {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-row span:first-child {
  color: var(--muted);
}

.summary-row span:last-child {
  font-weight: 640;
  text-align: right;
}

.manual-top-title,
.step-indicator {
  color: var(--muted);
  font-size: 14px;
}

.manual-title {
  width: 100%;
  max-width: var(--max-w);
  padding: 21px 21px 0;
  font-size: 22px;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(3,4,10,0.72);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-card {
  width: 100%;
  max-width: 340px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(31,42,59,0.97);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 28px 80px rgba(0,0,0,0.50);
}

.modal-title {
  color: var(--amber);
  text-align: center;
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.modal-info {
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  width: calc(100% - 40px);
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #16202f;
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 300;
  text-align: center;
  pointer-events: none;
  line-height: 1.4;
}

/* Virheilmoitus ei haviä itsestaan: kayttaja sulkee napauttamalla. */
.toast                { cursor: pointer; }
.toast.toast-pysyva::after { content: ' ✕'; opacity: 0.55; margin-left: 8px; }

.toast.toast-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.toast-ok {
  border-color: var(--green-line);
  background: var(--green-bg);
  color: var(--green);
}

.toast.toast-warn {
  border-color: var(--amber-line);
  background: var(--amber-bg);
  color: var(--amber);
}

input.field-offline { border-color: var(--amber); }
input.field-valid { border-color: var(--green); }
input.field-invalid { border-color: var(--red); }

.waypoint-row {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
}

.waypoint-row input[type="text"] {
  flex: 1;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
  margin: 0 !important;
}

.waypoint-remove {
  flex: 0 0 46px;
  height: 52px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--red-bg);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-add-waypoint {
  width: 100%;
  background: transparent;
  color: var(--green);
  font-size: 13px;
  padding: 4px 0;
  text-align: left;
  text-decoration: underline;
}

@media (max-width: 420px) {
  :root { --max-w: 100%; }

  .screen-body,
  .top-bar,
  .manual-title,
  .landing-wrap {
    max-width: none;
  }
}

/* ── Päivän ajot (screen-day) ─────────────────────────────────────────── */
.btn-sub {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0.75;
  margin-top: 2px;
}
.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 16px;
}
.day-label {
  flex: 1;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
}
.day-section { margin-bottom: 22px; }
.day-section-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin: 0 0 8px;
}
.day-row {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.day-row-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.day-row-time { font-variant-numeric: tabular-nums; min-width: 6.2em; }
.day-row-plate { flex: 1; font-weight: 600; }
.day-row-km { font-variant-numeric: tabular-nums; text-align: right; }
.day-row-sub, .day-row-meta {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 4px;
}
.day-row-free { border-left: 3px solid rgba(90, 200, 140, 0.6); }
.day-row-other { opacity: 0.45; border-left: 3px solid rgba(255, 255, 255, 0.18); }
.day-row-other .day-row-km { font-size: 0.8rem; }

/* ── Poiminta ja luokittelu ───────────────────────────────────────────── */
.day-check { width: 20px; height: 20px; flex: none; margin-right: 2px; }
.day-row-free { cursor: pointer; }
.day-row-selected { background: rgba(90, 200, 140, 0.16); }
.day-row-click { cursor: pointer; }
.claim-bar {
  position: sticky; bottom: 0;
  background: rgba(20, 26, 34, 0.97);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 16px 16px;
}
.claim-info { font-weight: 600; margin-bottom: 10px; }
.claim-actions { display: flex; gap: 10px; }
.claim-actions button { flex: 1; }
.cls-group { display: flex; gap: 8px; }
.cls-btn {
  flex: 1; padding: 10px 6px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent; color: inherit; font-size: 0.85rem; cursor: pointer;
}
.cls-btn.cls-active {
  background: rgba(90, 200, 140, 0.22);
  border-color: rgba(90, 200, 140, 0.7);
}
.lk-tag { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.09); }
.lk-work { background: rgba(90, 200, 140, 0.22); }
.lk-unclassified { background: rgba(230, 180, 60, 0.22); }
.btn-void { color: rgba(255, 140, 140, 0.95); }

/* Painike, jossa on aputeksti omalla rivillaan.
   .btn-secondary on display:flex ilman suuntaa, joten span asettuisi
   paatekstin viereen. Sarakesuunta erottaa rivit. */
.btn-day {
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    line-height: 1.25;
}
.btn-day .btn-sub {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    opacity: 0.78;
}

/* ── Ohjesivut (/ohjeet/) ──────────────────────────────────────────────
   Pandocin tuottama paljas HTML. style.css on suunniteltu PWA:n
   .screen/.card-rakenteelle, joten ohjesivut tarvitsevat omat tyylit. */
.ohje-sivu {
  font-size: 16px;
  line-height: 1.6;
  padding: 0 0 48px;
}
.ohje-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 20px 0;
}
.ohje-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line);
}
.ohje-sivu .ohje-takaisin {
  display: inline-block;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel-strong);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.ohje-nav {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.ohje-nav-link {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.ohje-nav-link:hover {
  color: var(--text);
  border-color: var(--line-strong);
}
.ohje-sivu h1,
.ohje-sivu h2 { scroll-margin-top: 72px; }
.ohje-sivu h1 {
  font-size: 26px;
  font-weight: 760;
  letter-spacing: -0.02em;
  margin: 20px 0 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.ohje-sivu h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 34px 0 12px;
  color: var(--green);
}
.ohje-sivu h3 {
  font-size: 16px;
  font-weight: 680;
  margin: 24px 0 8px;
}
.ohje-sivu p {
  margin: 0 0 14px;
  color: var(--muted);
}
.ohje-sivu ol,
.ohje-sivu ul {
  margin: 0 0 16px;
  padding-left: 24px;
  color: var(--muted);
}
.ohje-sivu li { margin-bottom: 7px; }
.ohje-sivu li > p { margin-bottom: 6px; }
.ohje-sivu strong { color: var(--text); font-weight: 680; }
.ohje-sivu code {
  background: var(--field);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.9em;
}
.ohje-sivu table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 20px;
  font-size: 14px;
}
.ohje-sivu th,
.ohje-sivu td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.ohje-sivu th {
  color: var(--faint);
  font-weight: 620;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ohje-sivu td { color: var(--muted); }
.ohje-sivu td:first-child { color: var(--text); white-space: nowrap; }

@media (max-width: 480px) {
  .ohje-wrap { padding: 16px 16px 0; }
  .ohje-sivu h1 { font-size: 23px; }
  .ohje-sivu h2 { font-size: 17px; }
  .ohje-sivu table { font-size: 13px; }
  .ohje-sivu th, .ohje-sivu td { padding: 8px 8px; }
  .ohje-sivu td:first-child { white-space: normal; }
}

/* Mitatointi on eri luokan toiminto kuin Tallenna/Peruuta — erotetaan viivalla */
.edit-void-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}


/* ── Admin > Ajoneuvot ─────────────────────────────────────────────────────── */
.admin-kortti        { margin-top: 12px; }
.admin-otsikko       { display: flex; justify-content: space-between;
                       align-items: center; margin-bottom: 8px; }
.admin-kv            { display: flex; justify-content: space-between;
                       gap: 12px; padding: 3px 0; font-size: 0.92rem; }
.admin-kv span       { opacity: 0.7; }
.admin-kv b          { text-align: right; word-break: break-all; }
.admin-tila          { font-size: 0.8rem; padding: 2px 10px; border-radius: 999px; }
.admin-tila-ok       { background: #1f6f3f; color: #fff; }
.admin-tila-odottaa  { background: #7a5c00; color: #fff; }
.admin-tila-virhe    { background: #8a1f1f; color: #fff; }
.admin-varoitukset   { margin: 8px 0 0 0; padding-left: 18px; font-size: 0.88rem; }
.admin-varoitukset li{ margin: 2px 0; }
.admin-napit         { margin-top: 10px; }
.admin-virhe         { border-left: 3px solid #8a1f1f; }


/* ── Admin: navigaatio, lomakkeet ja ajoraportti ───────────────────────────── */
/* R413: valilehdet RIVITTYVAT, eivat vierity.
   Sisaltosarake on --max-w = 390 px KAIKILLA naytoilla. Nelja valilehtea
   vaatii noin 510 px, joten neljas jai aina naytön ulkopuolelle. Vaakavieritys
   olisi kelvannut, mutta piilotettu vierityspalkki teki siita nakymattoman:
   tyopoydalla ei voi pyyhkaista, joten Jarjestelmatila-valilehtea ei ollut
   millaan tavalla loydettavissa. Rivittyminen nayttaa kaikki aina. */
.admin-nav            { display: flex; flex-wrap: wrap; gap: 4px;
                        margin-bottom: 16px;
                        border-bottom: 1px solid var(--line); }
.admin-tab            { background: none; border: none; color: var(--muted);
                        font-size: 15px; font-weight: 600; padding: 10px 14px;
                        cursor: pointer; border-bottom: 2px solid transparent;
                        margin-bottom: -1px; white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 400px) {
  .admin-tab          { font-size: 14px; padding: 10px 9px; }
}
.admin-tab-aktiivinen { color: var(--text); border-bottom-color: #2a6fb0; }

/* R414: Jarjestelmatila. Pienempi teksti, ei teknisia merkintoja. */
.system-kortti        { padding: 12px 14px; }
.system-tila          { font-size: 0.72rem; letter-spacing: 0.04em;
                        text-transform: uppercase; color: var(--muted);
                        margin-bottom: 4px; }
.system-tila-vakava   { color: #e06c60; }
.system-otsikko       { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.system-teksti        { font-size: 0.85rem; line-height: 1.45;
                        color: var(--muted); margin: 0; }
.admin-lomake         { margin-top: 14px; padding-top: 14px;
                        border-top: 1px solid var(--line); }
.admin-lomake input:disabled,
.admin-lomake select:disabled { opacity: 0.5; }
.admin-ohje           { margin: 6px 0 0; font-size: 0.88rem; opacity: 0.75; }
.admin-checkbox       { display: flex; align-items: center; gap: 10px;
                        margin: 12px 0; font-size: 0.95rem; }
.admin-checkbox input { width: auto; min-height: 0; }
.admin-passiivinen    { opacity: 0.62; }
.admin-vapaa          { border-left: 3px solid #7a5c00; }
.admin-mitatoity      { border-left: 3px solid #8a1f1f; opacity: 0.75; }


/* ── Admin: etusivu ja taulukot ────────────────────────────────────────────── */
.action-stack > button { margin-bottom: 10px; }
.action-stack > button:last-child { margin-bottom: 0; }

.home-kuukausi        { font-size: 1.05rem; font-weight: 700; margin-bottom: 12px; }
.home-otsikko         { font-size: 1rem; margin: 18px 0 10px; }

/* Rengaskuvaaja. Otsikko on "Kuukauden kilometrit", ei "Luokittelu":
   vapaa ajo ei ole luokitteluvaihtoehto vaan kirjaamatta oleva ajo. */
.rengas-kehys         { display: flex; align-items: center; gap: 20px;
                        flex-wrap: wrap; }
.rengas-wrap          { position: relative; flex: none; }
.rengas               { transform: rotate(-90deg); display: block; }
.rengas-tausta        { fill: none; stroke: var(--field); stroke-width: 12; }
.rengas-osa           { fill: none; stroke-width: 12; }
.rengas-keskus        { position: absolute; inset: 0; display: flex;
                        flex-direction: column; align-items: center;
                        justify-content: center; pointer-events: none; }
.rengas-keskus b      { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.rengas-keskus span   { font-size: 0.8rem; opacity: 0.7; }
.rengas-pieni .rengas-keskus { display: none; }

.osa-work             { stroke: #2f7d4f; background: #2f7d4f; }
.osa-other            { stroke: #4a6fa5; background: #4a6fa5; }
.osa-free             { stroke: #b3352f; background: #b3352f; }

.home-selite          { font-size: 0.92rem; min-width: 210px; }
.home-selite-rivi     { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.home-selite-arvo     { margin-left: auto; opacity: 0.85; }
.home-merkki          { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* Ajoneuvokortit. Vapaita ajoja sisaltavat ensin ja korostettuina. */
.ajoneuvo-ruudukko    { display: grid; gap: 12px;
                        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ajoneuvo-kortti      { margin: 0; }
.ajoneuvo-huomio      { border-left: 3px solid #b3352f; }
.ajoneuvo-otsikko     { font-weight: 700; margin-bottom: 10px; }
.ajoneuvo-sisalto     { display: flex; align-items: center; gap: 14px; }
.ajoneuvo-luvut       { flex: 1; min-width: 0; font-size: 0.88rem; }
.ajoneuvo-rivi        { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.ajoneuvo-nimi        { opacity: 0.85; }
.ajoneuvo-arvo        { margin-left: auto; white-space: nowrap; }
.ajoneuvo-mitatoidyt  { margin-top: 10px; font-size: 0.84rem; opacity: 0.7; }

/* Kuukausiraportti: tiivis rivi + avaus. 26 saraketta ei mahdu naytolle. */
.raportti-lista       { margin-top: 12px; border: 1px solid var(--line);
                        border-radius: var(--radius-sm); overflow: hidden; }
/* Yksi tekstirivi, ei sarakkeita: viisi saraketta ei mahdu kapealle naytolle
   luettavasti. Rivi rivittyy luonnollisesti. */
.raportti-rivi        { display: flex; gap: 10px; padding: 11px 12px;
                        align-items: flex-start; cursor: pointer;
                        font-size: 0.92rem; }
.raportti-rivi + .raportti-rivi,
.raportti-avattu + .raportti-rivi { border-top: 1px solid var(--line); }
.raportti-rivi:hover  { background: rgba(255,255,255,0.04); }
.raportti-teksti      { flex: 1; min-width: 0; line-height: 1.5; }
.raportti-km          { font-weight: 700; white-space: nowrap; }
.raportti-erotin      { font-style: normal; opacity: 0.4; margin: 0 6px; }
.raportti-nuoli       { opacity: 0.6; flex: none; width: 14px; }
.raportti-avattu      { padding: 0 12px; }
.raportti-avattu.auki { padding: 10px 12px 14px; border-top: 1px solid var(--line);
                        background: rgba(255,255,255,0.03); }
.home-huomio          { margin-top: 14px; padding: 10px 12px;
                        border-left: 3px solid #7a5c00;
                        background: rgba(122, 92, 0, 0.16);
                        border-radius: var(--radius-sm); font-size: 0.92rem; }
.home-huomio b        { color: #d9a300; margin-right: 6px; }
.home-huomio-rivi td  { background: rgba(122, 92, 0, 0.18); }

.admin-taulukko-kehys { overflow-x: auto; -webkit-overflow-scrolling: touch;
                        border: 1px solid var(--line); border-radius: var(--radius-sm); }
.admin-taulukko       { border-collapse: collapse; width: 100%; font-size: 0.86rem;
                        white-space: nowrap; }
.admin-taulukko th,
.admin-taulukko td    { padding: 7px 10px; border-bottom: 1px solid var(--line);
                        text-align: left; }
/* Kiinnitetty sarake tarvitsee LAPINAKYMATTOMAN taustan ja z-indexin.
   var(--field) on puolilapinakyva, joten sen lapi nakyi vierivat solut. */
.admin-taulukko th    { font-weight: 650; opacity: 0.9; position: sticky; top: 0;
                        background: #16202f; z-index: 2; }
.admin-taulukko .kiinni { position: sticky; left: 0; background: #16202f;
                          font-weight: 650; z-index: 1; }
.admin-taulukko th.kiinni { z-index: 3; }
.admin-taulukko tbody tr:hover .kiinni { background: #1b2739; }
.admin-taulukko .km-laskutus { font-weight: 700; }


/* ── Paivamaaravalinta (screen-day) ────────────────────────────────────────── */
.day-date             { width: auto; min-height: 44px; flex: 1;
                        text-align: center; font-weight: 650; }
.day-label-rivi       { display: flex; align-items: center; justify-content: center;
                        gap: 10px; margin: 6px 0 12px; }
.day-tanaan           { padding: 4px 12px; font-size: 13px; }


/* ── Kuukausiraporttien lista (haitari) ────────────────────────────────────── */
.kuukausi-rivi        { display: flex; gap: 10px; padding: 13px 12px;
                        align-items: flex-start; cursor: pointer; }
.kuukausi-rivi + .kuukausi-rivi,
.kuukausi-avattu + .kuukausi-rivi { border-top: 1px solid var(--line); }
.kuukausi-rivi:hover  { background: rgba(255,255,255,0.04); }
.kuukausi-teksti      { flex: 1; min-width: 0; display: flex;
                        flex-direction: column; gap: 3px; }
.kuukausi-meta        { font-size: 0.8rem; opacity: 0.65; word-break: break-all; }
.kuukausi-avattu      { padding: 0 12px; }
.kuukausi-avattu.auki { padding: 10px 12px 14px; border-top: 1px solid var(--line);
                        background: rgba(255,255,255,0.03); }


/* Nimipoikkeama: erottuva lohko rivilla, ei luettelomerkki muiden joukossa. */
.admin-poikkeama      { margin: 10px 0; padding: 10px 12px;
                        border-left: 3px solid #b3352f;
                        background: rgba(179, 53, 47, 0.12);
                        border-radius: var(--radius-sm); font-size: 0.9rem; }
.admin-poikkeama > b  { display: block; margin-bottom: 6px; }

/* ── Ajoneuvosuodatin (B4) ────────────────────────────────────────────── */
.day-plate-wrap {
  margin: 0 0 12px;
}
/* Ei omaa saantoa .day-plate-filter-luokalle.
 *
 * Aiempi ylikirjoitus viittasi muuttujiin --raja ja --tausta-kentta, joita ei
 * ole koskaan maaritelty. var() palautti silloin fallbackin: taustaksi tuli
 * #fff ja color: inherit peri teeman vaalean tekstivarin. Kentassa luki
 * valittu rekisteri valkoisena valkoisella, eli se nakyi tyhjana. Ks. R309.
 *
 * Yleinen select-saanto antaa jo width, min-height, font-size 16px
 * (iOS-zoomin esto), border, border-radius, background ja color oikein.
 */
.day-select-all {
  margin: 0 0 8px;
}
.day-row-select-all {
  font-weight: 600;
}

/* Tekstinappi tilaviestin sisalla: tyhjasta tuloksesta takaisin kaikkiin.
   Kokonainen painike olisi liian painava rivin sisalla, mutta pelkka linkki
   ei kerro olevansa toiminto. */
.linkki-nappi {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  min-height: 0;
}
.linkki-nappi:hover,
.linkki-nappi:focus-visible {
  text-decoration: none;
}
