:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #111827;
  --muted: #475569;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #dbeafe;
  --danger: #b91c1c;
  --border: #e2e8f0;
  --ring: rgba(37, 99, 235, .22);
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.10);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.07);
  --content-width: 1920px;
}

* { box-sizing: border-box; }
html { min-width: 320px; overflow-x: hidden; }
img, svg, video, canvas { max-width: 100%; height: auto; }
body {
  margin: 0;
  font-family: Arial, Helvetica, ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(circle at 8% -10%, rgba(37, 99, 235, .22) 0, transparent 34rem),
    radial-gradient(circle at 92% 8%, rgba(14, 165, 233, .16) 0, transparent 26rem),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 1rem; top: 1rem; z-index: 100; transform: translateY(-150%); padding: .75rem 1rem; border-radius: 999px; background: #0f172a; color: white; font-weight: 900; box-shadow: var(--shadow); }
.skip-link:focus { transform: translateY(0); outline: 4px solid #facc15; outline-offset: 3px; }
:focus-visible { outline: 4px solid #1d4ed8; outline-offset: 3px; }
#main-content:focus { outline: 3px solid #1d4ed8; outline-offset: .45rem; }
a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, .button:focus-visible, summary:focus-visible, .table-wrap:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 3px; box-shadow: 0 0 0 4px rgba(37, 99, 235, .18); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media (forced-colors: active) {
  a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, .button:focus-visible, summary:focus-visible, .table-wrap:focus-visible { outline: 3px solid Highlight; outline-offset: 3px; box-shadow: none; }
  .status-pill, .flash, .empty-state, .recovery-box { border: 1px solid CanvasText; }
}
@media (prefers-contrast: more) {
  :root { --muted: #334155; --border: #94a3b8; }
  .button, button, input, textarea, select { border-color: #64748b; }
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .85rem clamp(1rem, 5vw, 4rem);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: inline-flex; gap: .85rem; align-items: center; min-width: 0; max-width: 100%; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: clamp(9rem, 18vw, 15rem); max-height: 3.2rem; object-fit: contain; object-position: left center; }
.brand-copy { min-width: 0; padding-left: .75rem; border-left: 1px solid var(--border); }
.brand strong, .brand small { display: block; line-height: 1.1; overflow-wrap: break-word; }
.brand small { margin-top: .18rem; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.main-nav { display: flex; gap: .35rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.main-nav a, .nav-button { display: inline-flex; align-items: center; min-height: 2.75rem; padding: .62rem .85rem; border-radius: 999px; color: #334155; font-weight: 800; font-size: .92rem; white-space: nowrap; }
.main-nav a:hover { background: var(--panel-soft); color: var(--accent); text-decoration: none; }
.main-nav a:focus-visible, .nav-button:focus-visible, .nav-dropdown summary:focus-visible { background: var(--accent-soft); color: #1e3a8a; }
.main-nav a[aria-current="page"] { background: var(--accent-soft); color: #1e3a8a; }
.nav-dropdown { position: relative; }
.nav-dropdown summary { display: inline-flex; align-items: center; min-height: 2.75rem; padding: .62rem .85rem; border-radius: 999px; color: #334155; font-weight: 800; font-size: .92rem; cursor: pointer; list-style: none; }
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::after { content: '▾'; margin-left: .4rem; font-size: .75rem; transition: transform .15s ease; }
.nav-dropdown[open] summary, .nav-dropdown summary:hover { background: var(--panel-soft); color: var(--accent); }
.nav-dropdown[open] summary::after { transform: rotate(180deg); }
.nav-dropdown-menu { position: absolute; right: 0; top: calc(100% + .45rem); z-index: 20; display: grid; min-width: 220px; max-width: min(320px, calc(100vw - 2rem)); padding: .45rem; border: 1px solid var(--border); border-radius: 18px; background: white; box-shadow: var(--shadow); }
.nav-dropdown-menu a { justify-content: flex-start; white-space: normal; }
.nav-button { background: #eef2f7; }
.site-search { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: .5rem; justify-self: end; width: min(520px, 100%); }
.site-search input { min-height: 2.6rem; border-radius: 999px; }
.site-search button { min-height: 2.6rem; padding-inline: 1.1rem; }
.container { width: min(var(--content-width), calc(100% - .75rem)); margin: 2rem auto 4rem; }

.hero, .page-title, .auth-card, .card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.card, .auth-card, .stat-card, .empty-state, .notice-card, .table-wrap { backdrop-filter: saturate(115%) blur(2px); }
.hero, .page-title { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; align-items: flex-start; padding: clamp(1.5rem, 4vw, 3rem); margin-bottom: 1.5rem; overflow-wrap: break-word; }
.hero > *, .page-title > *, .card > *, .stat-card > *, .feature-card > * { min-width: 0; }
.page-title > .eyebrow, .page-title > h1, .page-title > .muted { flex: 1 1 100%; }
.auth-card { max-width: 460px; margin: 4rem auto; padding: clamp(1.35rem, 4vw, 2rem); }
.login-hero { min-height: calc(100vh - 4.4rem); display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 460px); align-items: center; gap: clamp(1.5rem, 7vw, 5rem); margin: -2rem calc(50% - 50vw) -4rem; padding: clamp(2rem, 8vw, 5rem) max(1rem, calc((100vw - var(--content-width)) / 2)); background: linear-gradient(120deg, rgba(15, 23, 42, .88), rgba(30, 64, 175, .54)), url('/images/login-background.jpg') center / cover no-repeat; }
.login-copy { max-width: 620px; color: white; }
.login-copy .eyebrow { color: #dbeafe; }
.login-copy .login-heading { margin: 0 0 1rem; font-size: clamp(2.4rem, 7vw, 5.4rem); font-weight: 900; line-height: 1.03; letter-spacing: -.055em; }
.login-copy p:not(.eyebrow) { max-width: 40rem; color: rgba(255, 255, 255, .95); font-size: 1.12rem; }
.login-card { width: min(460px, 100%); margin: 0; background: rgba(255, 255, 255, .93); border-color: rgba(191, 219, 254, .72); box-shadow: 0 26px 80px rgba(15, 23, 42, .38); backdrop-filter: blur(18px); }
.card { padding: clamp(1.1rem, 2vw, 1.5rem); margin-bottom: 1rem; }
.card > :last-child, .auth-card > :last-child, .page-title > :last-child { margin-bottom: 0; }
.feature-card { background: linear-gradient(135deg, #ffffff, #eff6ff); }
.card-kicker { display: inline-flex; margin-bottom: 1rem; padding: .4rem .65rem; border-radius: 999px; background: var(--accent-soft); color: #1e3a8a; font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.hero-badge { flex: 0 0 auto; min-width: 150px; padding: 1rem; border-radius: 22px; background: var(--panel-soft); border: 1px solid var(--border); text-align: right; }
.hero-badge span { display: block; color: var(--muted); font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.hero-badge strong { display: block; margin: .2rem 0; font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1; }
.admin-badge { background: #fffbeb; border-color: #fde68a; }
.warning-badge { background: #fffbeb; border-color: #fde68a; }

.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.compact-status { flex: 0 1 470px; margin-bottom: 0; grid-template-columns: repeat(3, minmax(110px, 1fr)); }
.admin-status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { padding: 1rem; border: 1px solid var(--border); border-radius: 22px; background: rgba(255,255,255,.9); box-shadow: var(--shadow-soft); }
.stat-card span { display: block; color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; overflow-wrap: normal; word-break: normal; hyphens: manual; }
.stat-card strong { display: block; margin-top: .35rem; font-size: clamp(1.6rem, 4vw, 2.6rem); line-height: 1; letter-spacing: -.05em; }
.stat-card p { margin: .65rem 0 0; color: var(--muted); font-size: .94rem; }
.stat-card.large { min-height: 138px; }
.stat-card.ok { border-color: #bbf7d0; background: linear-gradient(135deg, #ffffff, #f0fdf4); }
.stat-card.attention { border-color: #fde68a; background: linear-gradient(135deg, #ffffff, #fffbeb); }
.section-heading { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.section-heading h2, .section-heading p { margin-bottom: 0; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; width: fit-content; max-width: 100%; min-height: 1.9rem; margin: .25rem .35rem .25rem 0; padding: .35rem .7rem; border-radius: 999px; background: #eef2f7; color: #334155; font-size: .78rem; font-weight: 900; white-space: nowrap; overflow-wrap: normal; text-align: center; }
.status-pill.success { background: #dcfce7; color: #14532d; }
.status-pill.warning { background: #fef3c7; color: #78350f; }
.status-pill.admin { background: #e0e7ff; color: #3730a3; }
.status-pill.neutral { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
.status-pill.uusi { background: #dbeafe; color: #1e3a8a; }
.status-pill.kasittelyssa { background: #fef3c7; color: #78350f; }
.status-pill.valmis { background: #dcfce7; color: #14532d; }
.status-pill.hylatty { background: #fee2e2; color: #7f1d1d; }
.notice-card { display: flex; gap: .75rem; align-items: center; margin: -0.5rem 0 1rem; padding: 1rem 1.15rem; border: 1px solid var(--border); border-radius: 20px; background: white; box-shadow: var(--shadow-soft); }
.notice-card strong { flex: 0 0 auto; }
.notice-card.warning { border-color: #fde68a; background: #fffbeb; color: #78350f; }
.empty-state { display: grid; justify-items: center; gap: .6rem; padding: clamp(1.5rem, 5vw, 2.5rem); border: 1px dashed #cbd5e1; border-radius: 22px; background: linear-gradient(135deg, #ffffff, var(--panel-soft)); text-align: center; }
.empty-state.compact { padding: 1.25rem; }
.empty-state h3, .empty-state p { margin: 0; }
.action-empty-state { justify-items: stretch; text-align: left; }
.action-empty-state .empty-icon, .action-empty-state h3, .action-empty-state > p, .action-empty-state > .button { justify-self: center; text-align: center; }
.data-load-empty { justify-items: start; text-align: left; }
.data-load-empty .empty-icon, .data-load-empty h3 { justify-self: center; text-align: center; }
.media-load-failed { border: 2px solid #fecaca; background: #fff7f7; }
.media-load-error { margin: .5rem 0 0; padding: .65rem .75rem; border: 1px solid #fecaca; border-radius: 12px; background: #fff7f7; color: #7f1d1d; font-weight: 800; }
.empty-action-list { display: grid; gap: .55rem; width: min(100%, 38rem); margin: .5rem auto 0; padding: 0; list-style: none; counter-reset: empty-steps; }
.empty-action-list li { counter-increment: empty-steps; position: relative; min-height: 2.5rem; padding: .65rem .8rem .65rem 3rem; border: 1px solid #bfdbfe; border-radius: 14px; background: #eff6ff; color: #1e3a8a; font-weight: 800; }
.empty-action-list li::before { content: counter(empty-steps); position: absolute; left: .75rem; top: .55rem; display: grid; place-items: center; width: 1.65rem; height: 1.65rem; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 900; }
.empty-icon { display: grid; place-items: center; width: 3.2rem; height: 3.2rem; border-radius: 20px; background: var(--accent-soft); color: #1e3a8a; font-size: 1.55rem; box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .12); }
.error-state { display: grid; justify-items: start; gap: .75rem; max-width: 720px; margin: clamp(2rem, 8vw, 5rem) auto; padding: clamp(1.5rem, 5vw, 3rem); }
.error-state h1, .error-state p { margin-bottom: 0; }
.error-state code { padding: .15rem .35rem; border-radius: 8px; background: #f1f5f9; color: #334155; }
.recovery-box { width: 100%; padding: 1rem; border: 1px solid #bfdbfe; border-radius: 18px; background: #eff6ff; color: #1e3a8a; }
.recovery-box ul { margin: .5rem 0 0; padding-left: 1.25rem; }
.recovery-box li + li { margin-top: .35rem; }
.error-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.error-icon { background: #fee2e2; color: #7f1d1d; font-weight: 900; }
.inline-empty { display: inline-flex; align-items: center; min-height: 2rem; padding: .45rem .7rem; border-radius: 12px; background: #f8fafc; color: #334155; border: 1px dashed #94a3b8; font-weight: 800; }
.search-results { display: grid; gap: 1rem; }
.search-result { display: grid; gap: .35rem; }
.search-result h2 { margin-bottom: 0; }
.result-type { width: fit-content; padding: .28rem .6rem; border-radius: 999px; background: var(--accent-soft); color: #1e3a8a; font-size: .76rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.filter-links { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-links .button { flex: 0 1 auto; }
.filter-links .button[aria-current="page"] { box-shadow: inset 0 0 0 2px rgba(255,255,255,.78); }
.filter-count { display: inline-grid; place-items: center; min-width: 1.6rem; min-height: 1.6rem; margin-left: .35rem; padding: .1rem .4rem; border-radius: 999px; background: rgba(255,255,255,.82); color: inherit; font-size: .78rem; font-weight: 900; }
.request-list, .own-requests { display: grid; gap: 1rem; }
.request-card, .request-mini-card { padding: 1rem; border: 1px solid var(--border); border-radius: 20px; background: linear-gradient(135deg, #ffffff, var(--panel-soft)); }
.request-card p, .request-mini-card p { overflow-wrap: break-word; }
.request-quote { margin: .75rem 0 1rem; padding: .85rem 1rem; border-left: 4px solid var(--accent); border-radius: 0 14px 14px 0; background: #f8fafc; color: var(--text); line-height: 1.55; overflow-wrap: break-word; }
.request-card form button, .change-request-card form button { width: fit-content; }
.compact-heading { margin-bottom: .5rem; }
.change-request-card { background: linear-gradient(135deg, #ffffff, #f8fafc); }
.site-footer { display: flex; justify-content: center; margin: 2rem 0 0; color: var(--muted); font-size: .92rem; }
.site-footer a { color: #475569; font-weight: 800; }
.privacy-card h2 { margin-top: 1.5rem; }
.privacy-card h2:first-child { margin-top: 0; }
.admin-group-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: end; padding: 1rem 0; border-top: 1px solid var(--border); }
.status-row { border-radius: 18px; padding-inline: .85rem; transition: background .15s ease, border-color .15s ease; }
.status-row.has-data { background: linear-gradient(90deg, rgba(240,253,244,.72), rgba(255,255,255,0)); border-top-color: #bbf7d0; }
.status-row.needs-attention { background: linear-gradient(90deg, rgba(255,251,235,.9), rgba(255,255,255,0)); border-top-color: #fde68a; }
.admin-workflow-card { border-color: #bfdbfe; background: linear-gradient(135deg, #ffffff, #eff6ff); }
.admin-flow-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; border-color: #bbf7d0; background: linear-gradient(135deg, #ffffff, #f0fdf4); }
.admin-flow-actions { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: flex-end; }
.admin-flow-actions .button { min-height: 2.75rem; }
.workflow-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin: 0; padding: 0; list-style: none; counter-reset: workflow; }
.workflow-list li { counter-increment: workflow; position: relative; min-width: 0; padding: 1rem 1rem 1rem 3.1rem; border: 1px solid var(--border); border-radius: 18px; background: rgba(255,255,255,.86); }
.workflow-list li::before { content: counter(workflow); position: absolute; left: .85rem; top: .9rem; display: grid; place-items: center; width: 1.65rem; height: 1.65rem; border-radius: 999px; background: var(--accent); color: white; font-weight: 900; }
.workflow-list strong, .workflow-list span { display: block; }
.workflow-list span { margin-top: .25rem; color: var(--muted); line-height: 1.45; }
.onboarding-progress-card { border-color: #bfdbfe; background: linear-gradient(135deg, #ffffff, #eff6ff); }
.onboarding-scan-nav { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); gap: 1rem; align-items: center; }
.scan-link-list { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.scan-link-list a { display: flex; align-items: center; min-height: 2.75rem; padding: .65rem .8rem; border: 1px solid #bfdbfe; border-radius: 14px; background: #eff6ff; color: #1e3a8a; font-weight: 900; text-decoration: none; }
.scan-link-list a:hover, .scan-link-list a:focus-visible { background: #dbeafe; text-decoration: none; }
.onboarding-checklist { display: grid; gap: .7rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.onboarding-checklist li { position: relative; min-height: 3rem; padding: .8rem .9rem .8rem 3.15rem; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.88); }
.onboarding-checklist li::before { content: '…'; position: absolute; left: .85rem; top: .85rem; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 999px; background: #fef3c7; color: #78350f; font-weight: 900; }
.onboarding-checklist li.is-complete::before { content: '✓'; background: #dcfce7; color: #14532d; }
.onboarding-checklist strong, .onboarding-checklist span { display: block; }
.onboarding-checklist span { margin-top: .2rem; color: var(--muted); line-height: 1.45; }
.onboarding-progress-card > .button { min-height: 3rem; }
.document-review-row { align-items: flex-start; }
.document-review-row .hint, .attention-text { margin: .25rem 0 0; }
.attention-text { color: #92400e; font-weight: 800; }
.app-chip-list { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.app-chip-list li { display: inline-flex; gap: .35rem; align-items: center; padding: .45rem .65rem; border-radius: 999px; background: #eff6ff; color: #1e3a8a; font-size: .9rem; }
.app-chip-list span { color: var(--muted); }
.admin-back-link a { display: inline-flex; align-items: center; min-height: 2.75rem; font-weight: 900; }
.admin-tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.admin-tool-grid .card { display: grid; align-content: start; gap: .65rem; margin-bottom: 0; }
.admin-tool-grid .button { align-self: end; width: 100%; }
.admin-users-card { grid-column: 1 / -1; }

h1, h2, h3 { margin-top: 0; line-height: 1.1; overflow-wrap: break-word; word-break: normal; hyphens: manual; }
p, a, span, strong, small, label, button, .button { overflow-wrap: break-word; word-break: normal; }
h1 { font-size: clamp(2rem, 5vw, 4rem); letter-spacing: -.045em; }
h2 { font-size: 1.35rem; }
p { line-height: 1.6; }
.eyebrow { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; overflow-wrap: normal; word-break: keep-all; hyphens: none; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .9rem; }
.required-label, .optional-label { display: inline-flex; align-items: center; width: fit-content; margin-left: .35rem; padding: .15rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.required-label { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }
.optional-label { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }

.grid { display: grid; gap: 1.25rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chooser-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
.choice-card { display: block; min-height: 220px; padding: 1.5rem; color: var(--text); background: rgba(255, 255, 255, 0.94); border: 1px solid var(--border); border-radius: 26px; box-shadow: var(--shadow-soft); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; overflow-wrap: break-word; }
.choice-card:hover, .choice-card:focus-visible { text-decoration: none; border-color: #1d4ed8; box-shadow: var(--shadow), 0 0 0 4px rgba(37, 99, 235, .18); }
.choice-card:hover { transform: translateY(-3px); }
.choice-card:focus-visible { transform: none; }
.card:focus-within, .feature-card:focus-within, .change-request-card:focus-within, .status-row:focus-within, .app-overview-row:focus-within, .page-admin-row:focus-within, .admin-row:focus-within, .admin-group-row:focus-within, .admin-option-row:focus-within, .list-row:focus-within, .search-result:focus-within, .page-list-section:focus-within, .table-wrap:focus-within, .action-empty-state:focus-within, .onboarding-progress-card:focus-within, .onboarding-scan-nav:focus-within, .request-mini-card:focus-within { border-color: #93c5fd; box-shadow: var(--shadow-soft), 0 0 0 3px rgba(37, 99, 235, .12); }
.choice-card p { color: var(--muted); }
.choice-icon { display: inline-grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 1rem; border-radius: 18px; background: var(--accent-soft); font-size: 1.5rem; }
.admin-choice .choice-icon { background: #fef3c7; }
@media (max-width: 760px) { .grid.two { grid-template-columns: 1fr; } }

.stack { display: grid; gap: 1rem; }
label { display: grid; gap: .35rem; min-width: 0; font-weight: 700; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .82rem .9rem;
  min-height: 2.75rem;
  min-width: 0;
  background: white;
  color: var(--text);
  font: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input[type="file"] { padding: .55rem; }
input[type="file"]::file-selector-button { min-height: 2.5rem; margin-right: .75rem; border: 0; border-radius: 999px; padding: .55rem .85rem; background: #e9edf2; color: var(--text); font: inherit; font-weight: 800; cursor: pointer; }
.password-toggle-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; align-items: stretch; width: 100%; }
.password-toggle-wrap input { min-width: 0; }
.password-toggle-button { min-height: 2.75rem; padding-inline: .85rem; border-radius: 14px; white-space: nowrap; }
input:user-invalid, textarea:user-invalid, select:user-invalid { border-color: var(--danger); background: #fff7f7; }
input:user-valid, textarea:user-valid, select:user-valid { border-color: #16a34a; }
input:user-invalid:focus-visible, textarea:user-invalid:focus-visible, select:user-invalid:focus-visible { box-shadow: 0 0 0 4px rgba(185, 28, 28, .18); }
.field-error { display: none; margin: -.35rem 0 .15rem; color: var(--danger); font-size: .88rem; font-weight: 800; }
input:user-invalid + .field-error, textarea:user-invalid + .field-error, select:user-invalid + .field-error,
label:has(input:user-invalid) .field-error, label:has(textarea:user-invalid) .field-error, label:has(select:user-invalid) .field-error,
.field-error.is-visible, input[aria-invalid="true"] + .field-error, textarea[aria-invalid="true"] + .field-error, select[aria-invalid="true"] + .field-error,
label:has(input[aria-invalid="true"]) .field-error, label:has(textarea[aria-invalid="true"]) .field-error, label:has(select[aria-invalid="true"]) .field-error { display: block; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); background: #fff7f7; }
input[aria-invalid="true"]:focus-visible, textarea[aria-invalid="true"]:focus-visible, select[aria-invalid="true"]:focus-visible { outline-color: var(--danger); box-shadow: 0 0 0 4px rgba(185, 28, 28, .2); }
.field-has-error { scroll-margin-top: 7rem; }
.form-success-note { margin: .75rem 0 0; padding: .75rem .9rem; border-radius: 14px; background: #dcfce7; color: #14532d; font-weight: 800; }
.form-submit-status { grid-column: 1 / -1; margin: .25rem 0 0; padding: .75rem .9rem; border: 1px solid #bfdbfe; border-radius: 14px; background: #eff6ff; color: #1e3a8a; font-weight: 900; }
.form-alert { grid-column: 1 / -1; margin: 0; padding: .75rem .9rem; border: 1px solid #fecaca; border-radius: 14px; background: #fff7f7; color: #7f1d1d; font-weight: 900; }
.form-note { margin: 0 0 1rem; padding: .8rem .95rem; border: 1px solid #bfdbfe; border-radius: 16px; background: #eff6ff; color: #1e3a8a; line-height: 1.5; }
.form-note.compact { margin: -.25rem 0 0; font-size: .92rem; }
.runtime-error-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 0 1rem; padding: .9rem 1rem; border: 1px solid #fecaca; border-left: 5px solid #dc2626; border-radius: 16px; background: #fff7f7; color: #7f1d1d; font-weight: 900; box-shadow: var(--shadow-soft); }
.runtime-error-banner:focus { outline: 3px solid #b91c1c; outline-offset: 3px; }
.runtime-error-banner p { margin: .15rem 0 0; font-weight: 700; }
.runtime-error-actions { display: inline-flex; flex-wrap: wrap; gap: .5rem; }
.runtime-error-actions a { display: inline-flex; align-items: center; min-height: 2.5rem; padding: .45rem .75rem; border-radius: 999px; background: white; color: #7f1d1d; font-weight: 900; text-decoration: none; }
.runtime-recovery-banner { margin: 0 0 1rem; padding: .8rem .95rem; border: 1px solid #bbf7d0; border-left: 5px solid #16a34a; border-radius: 16px; background: #f0fdf4; color: #14532d; font-weight: 900; box-shadow: var(--shadow-soft); }
.form-needs-attention { border-radius: 18px; padding-inline: .85rem; }
textarea { resize: vertical; }
button, .button {
  border: 0;
  border-radius: 999px;
  padding: .72rem 1rem;
  min-height: 2.75rem;
  background: #e9edf2;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
  transition: transform .15s ease, filter .15s ease, background .15s ease;
}
button:hover, .button:hover { filter: brightness(.97); text-decoration: none; transform: translateY(-1px); }
form.is-submitting { opacity: .82; }
form.is-submitting button { cursor: progress; }
button:disabled, .button[aria-disabled="true"] { cursor: not-allowed; opacity: .72; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.danger { background: #b91c1c; color: #fff; }
.danger:hover { background: #991b1b; }
.inline { display: inline; }
.inline button { padding: .45rem .8rem; }

.flash { display: flex; gap: .6rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 16px; margin-bottom: 1rem; font-weight: 800; box-shadow: var(--shadow-soft); }
.flash::before { flex: 0 0 auto; }
.flash.success::before { content: '✓'; }
.flash.error::before { content: '!'; }
.flash.success { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.flash.error { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }
.recovery-hint, .success-hint { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem; margin: -.35rem 0 1rem; padding: .75rem .9rem; border: 1px solid #bfdbfe; border-radius: 14px; background: #eff6ff; color: #1e3a8a; font-weight: 800; }
.success-hint { border-color: #86efac; background: #f0fdf4; color: #14532d; }
.recovery-actions { display: inline-flex; flex-wrap: wrap; gap: .5rem; }
.recovery-actions a { display: inline-flex; align-items: center; min-height: 2.5rem; padding: .45rem .75rem; border-radius: 999px; background: white; color: #1e3a8a; font-weight: 900; text-decoration: none; }
.success-actions { display: inline-flex; flex-wrap: wrap; gap: .5rem; }
.success-actions a { display: inline-flex; align-items: center; min-height: 2.5rem; padding: .45rem .75rem; border-radius: 999px; background: white; color: #14532d; font-weight: 900; text-decoration: none; }
.request-id-inline { display: inline-flex; align-items: center; gap: .25rem; margin-left: .35rem; padding: .15rem .45rem; border-radius: 999px; background: rgba(255,255,255,.75); color: #1e3a8a; font-weight: 900; white-space: nowrap; }

.prose { overflow-wrap: anywhere; }
.prose p { white-space: pre-wrap; }
.prose img, .prose table, .prose pre, .prose code { max-width: 100%; }
.prose pre { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.content-list, .file-list { display: grid; gap: 1rem; }
.image-link { display: block; cursor: zoom-in; border-radius: 18px; }
.image-link:focus-visible .uploaded-image { border-color: #1d4ed8; box-shadow: 0 0 0 4px rgba(37, 99, 235, .18); }
.uploaded-image { width: 100%; height: auto; max-height: min(70vh, 760px); object-fit: contain; border-radius: 18px; border: 1px solid var(--border); background: #fff; }
.pdf-icon { width: 92px; height: 116px; display: grid; place-items: center; border-radius: 14px; background: #fee2e2; color: #7f1d1d; font-weight: 900; margin-bottom: 1rem; border: 1px solid #fecaca; }
.admin-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto auto; gap: .75rem; align-items: start; padding: 1rem 0; border-top: 1px solid var(--border); }
.admin-option-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .5rem; align-items: start; padding: .8rem 0; border-top: 1px solid var(--border); }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--border); }
.user-admin-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 1.4fr) minmax(220px, .8fr); gap: 1rem; align-items: start; padding: 1rem 0; border-top: 1px solid var(--border); overflow: visible; }
.user-summary { min-width: 0; }
.user-summary strong, .user-summary .muted, .user-summary .hint { overflow-wrap: break-word; }
.user-summary .status-pill { display: flex; width: max-content; max-width: 100%; white-space: normal; overflow-wrap: break-word; }
.reset-password-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; gap: .5rem; align-items: start; min-width: 0; }
.reset-password-form label, .reset-password-form input, .user-actions form { min-width: 0; }
.reset-password-form button, .user-actions button { width: 100%; white-space: normal; }
.user-actions { display: flex; flex-wrap: wrap; gap: .5rem; min-width: 0; }
.user-actions form { flex: 1 1 180px; }
.qr-code { display: block; width: min(260px, 100%); margin: 1rem auto; border: 1px solid var(--border); border-radius: 18px; background: white; }
.manual-secret { display: block; padding: .75rem; margin-bottom: 1rem; border-radius: 12px; background: #eef2ff; color: #1e3a8a; overflow-wrap: anywhere; }
.two-factor-form { margin-top: 1rem; }
.credential-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: .9rem; align-items: end; }
.credential-form .hint { grid-column: span 1; margin: -.6rem 0 0; align-self: start; }
.credential-form button { align-self: end; }
.credential-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; align-items: end; padding: 1rem 0; border-top: 1px solid var(--border); }
.credential-row button { align-self: end; }
.app-overview-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto auto; gap: 1rem; align-items: start; padding: 1rem 0; border-top: 1px solid var(--border); }
.page-admin-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr) auto auto; gap: .75rem; align-items: end; padding: 1rem 0; border-top: 1px solid var(--border); }
.checkbox-label { display: flex; gap: .5rem; align-items: center; }
.checkbox-label input { width: 1.15rem; min-width: 1.15rem; height: 1.15rem; }
.edit-panel { border-color: #bfdbfe; background: #eff6ff; }
.page-content { font-size: 1.05rem; overflow-wrap: break-word; }
.compact-list { margin: 0; padding-left: 1.1rem; }
.compact-list li { margin-bottom: .25rem; }
.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #94a3b8 #f8fafc; border: 1px solid var(--border); border-radius: 18px; background: white; }
.table-wrap:focus-visible { outline: 4px solid #1d4ed8; outline-offset: 3px; box-shadow: 0 0 0 4px rgba(37, 99, 235, .18); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 520px; }
.data-table th, .data-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: break-word; word-break: normal; }
.data-table th { background: var(--panel-soft); color: #334155; font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.data-table thead th:first-child { border-top-left-radius: 17px; }
.data-table thead th:last-child { border-top-right-radius: 17px; }
.data-table tbody tr:nth-child(even) td { background: #fbfdff; }
.data-table tr:last-child td { border-bottom: 0; }
.narrow-card { max-width: 620px; }
.guide-preview { min-height: 18rem; }
@media (max-width: 1040px) {
  .topbar { grid-template-columns: 1fr; align-items: flex-start; }
  .main-nav { width: 100%; max-width: 100%; min-width: 0; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; padding-bottom: .35rem; scrollbar-width: thin; scroll-snap-type: x proximity; }
  .main-nav a, .main-nav details, .nav-button { flex: 0 0 auto; }
  .main-nav .inline { flex: 0 0 auto; }
  .main-nav .inline button { white-space: nowrap; }
  .main-nav a, .nav-button, .nav-dropdown summary { scroll-snap-align: start; }
  .site-search { justify-self: stretch; }
  .nav-dropdown { position: static; }
  .nav-dropdown-menu { left: 1rem; right: 1rem; }
}
@media (max-width: 900px) {
  .workflow-list, .admin-tool-grid { grid-template-columns: 1fr; }
  .admin-flow-nav { grid-template-columns: 1fr; }
  .admin-flow-actions { justify-content: stretch; gap: .65rem; }
  .admin-flow-actions .button { width: 100%; justify-content: center; text-align: center; line-height: 1.35; }
  .onboarding-scan-nav { grid-template-columns: 1fr; }
  .admin-row, .admin-option-row, .reset-password-form, .credential-form, .credential-row, .app-overview-row, .page-admin-row, .admin-group-row, .user-admin-row { grid-template-columns: minmax(0, 1fr); }
  .admin-row label, .admin-option-row label, .reset-password-form label, .credential-form label, .credential-row label, .app-overview-row > *, .page-admin-row label, .admin-group-row label, .user-admin-row > * { min-width: 0; }
  .list-row { align-items: flex-start; }
  .admin-row button, .admin-option-row button, .admin-group-row button, .reset-password-form button, .credential-row button, .credential-form button, .page-admin-row button { width: 100%; }
  .user-actions form { flex-basis: 100%; }
}
@media (min-width: 641px) and (max-width: 900px) {
  .admin-tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-tool-grid .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .admin-tool-grid .button { width: fit-content; min-width: 12rem; justify-self: start; }
}
@media (max-width: 820px) {
  .section-heading, .notice-card { flex-direction: column; align-items: stretch; }
  .section-heading { gap: .55rem; }
  .section-heading .status-pill { width: fit-content; max-width: 100%; white-space: normal; text-align: left; }
}
@media (max-width: 760px) {
  .container { width: min(100% - 1rem, var(--content-width)); margin-top: .75rem; margin-bottom: 2rem; }
  .hero, .page-title { align-items: stretch; flex-direction: column; gap: 1rem; padding: 1.15rem; border-radius: 22px; }
  .hero p, .page-title p { line-height: 1.55; }
  .hero-badge { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .35rem .75rem; width: 100%; min-width: 0; text-align: left; }
  .hero-badge strong { grid-column: 2; grid-row: 1 / span 2; justify-self: end; }
  .hero-badge span { min-width: 0; overflow-wrap: anywhere; }
  .compact-status, .admin-status-grid { grid-template-columns: 1fr; }
  .status-grid { gap: .75rem; margin-bottom: .9rem; }
  .stat-card.large { min-height: auto; }
  .card { border-radius: 22px; }
  .card + .card, .feature-card + .feature-card { margin-top: .85rem; }
  .section-heading, .notice-card { flex-direction: column; }
  .section-heading { gap: .5rem; }
  .section-heading > *, .notice-card > *, .list-row > * { min-width: 0; }
  .dashboard-hero .compact-status .stat-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .35rem .8rem; }
  .dashboard-hero .compact-status .stat-card span { align-self: end; }
  .dashboard-hero .compact-status .stat-card strong { justify-self: end; margin-top: 0; }
  .status-pill { white-space: normal; overflow-wrap: break-word; word-break: normal; }
  .status-row { padding-inline: .75rem; }
  .filter-links .button { flex: 1 1 10rem; }
  .request-card form button, .change-request-card form button { width: 100%; }
  .change-request-card { padding: 1rem; }
  .change-request-card textarea { min-height: 9rem; }
  .list-row { flex-direction: column; align-items: stretch; gap: .75rem; }
  .list-row form, .list-row button { width: 100%; }
  .runtime-error-banner { align-items: stretch; }
  .runtime-error-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .runtime-error-actions a { justify-content: center; min-height: 3rem; text-align: center; line-height: 1.35; }
  .app-chip-list { align-items: stretch; flex-direction: column; }
  .app-chip-list li { border-radius: 14px; justify-content: space-between; overflow-wrap: break-word; }
  .app-overview-row { gap: .75rem; padding: 1rem .75rem; border: 1px solid var(--border); border-radius: 18px; background: #fff; box-shadow: var(--shadow-soft); }
  .app-overview-row + .app-overview-row { margin-top: .85rem; }
  .app-overview-row h3 { margin-bottom: .15rem; }
  .app-overview-row .status-pill { width: 100%; justify-content: center; }
  .credential-form, .credential-row, .page-admin-row, .admin-row, .admin-option-row, .admin-group-row, .request-card form { gap: .9rem; }
  .credential-form .hint { grid-column: 1 / -1; margin-top: -.45rem; }
  .topbar { gap: .75rem; }
  .main-nav { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; max-width: calc(100vw - 1.5rem); padding-bottom: .35rem; -webkit-overflow-scrolling: touch; }
  .main-nav a, .nav-button, .nav-dropdown summary { flex: 0 0 auto; min-height: 3rem; }
  .site-search input, .search-page-form input { width: 100%; }
  .login-hero { grid-template-columns: 1fr; min-height: calc(100vh - 5.1rem); padding: 2rem 1rem; }
  .login-copy { display: none; }
  .auth-card { border-radius: 22px; }
  .auth-card, .login-card { width: 100%; max-width: none; }
  .choice-card { min-height: auto; }
}
@media (max-width: 640px) {
  .chooser-grid { grid-template-columns: 1fr; gap: .9rem; }
  .choice-card { min-height: 4.5rem; padding: 1rem; }
  .choice-icon { width: 2.7rem; height: 2.7rem; margin-bottom: .65rem; }
  .status-grid { grid-template-columns: 1fr; }
  .hero, .page-title { margin-bottom: 1rem; }
  .table-wrap { border-radius: 14px; margin-inline: -.15rem; width: calc(100% + .3rem); }
  .data-table { min-width: 440px; }
  .data-table th, .data-table td { padding: .7rem .75rem; }
  .work-hours-table { min-width: 0; border-spacing: 0 .75rem; }
  .work-hours-table thead { display: none; }
  .work-hours-table, .work-hours-table tbody, .work-hours-table tr, .work-hours-table th, .work-hours-table td { display: block; width: 100%; }
  .work-hours-table tr { padding: .85rem; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: var(--shadow-soft); }
  .work-hours-table th, .work-hours-table td { display: flex; justify-content: space-between; gap: 1rem; padding: .42rem 0; border-bottom: 1px solid #e2e8f0; font-size: .94rem; }
  .work-hours-table th { background: transparent; color: var(--text); letter-spacing: 0; text-transform: none; }
  .work-hours-table th::before { content: 'Kuljettaja'; color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
  .work-hours-table td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
  .work-hours-table tr:last-child td, .work-hours-table tr:last-child th, .work-hours-table td:last-child { border-bottom: 0; }
  .file-list .card { display: grid; gap: .75rem; }
  .file-list .card, .document-review-row, .list-row { min-width: 0; }
  .file-list a, .document-review-row a, .list-row strong, .list-row span { overflow-wrap: anywhere; }
  .file-list .card > a:not(.image-link) { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 3rem; padding: .65rem .85rem; border-radius: 14px; background: var(--panel-soft); }
  .uploaded-image { max-height: 55vh; }
  input, textarea, select { font-size: 16px; }
  textarea { min-height: 8rem; }
  button, .button { min-height: 3rem; }
  label { gap: .45rem; line-height: 1.35; }
  .field-error.is-visible, input[aria-invalid="true"] + .field-error, textarea[aria-invalid="true"] + .field-error, select[aria-invalid="true"] + .field-error { margin-top: .15rem; padding: .6rem .7rem; border: 1px solid #fecaca; border-radius: 12px; background: #fff7f7; line-height: 1.4; }
  .form-submit-status, .form-alert { padding: .85rem; border-radius: 14px; line-height: 1.45; }
  form.is-submitting { opacity: .92; }
  form.is-submitting button { min-height: 3.15rem; }
  .empty-action-list li { min-height: 3rem; padding: .75rem .85rem .75rem 3rem; }
  .stack, .reset-password-form, .user-actions { gap: .8rem; }
  .checkbox-label { align-items: flex-start; min-height: 3rem; padding-block: .35rem; }
  .checkbox-label input { width: 1.35rem; min-width: 1.35rem; height: 1.35rem; margin-top: .1rem; }
}
@media (max-width: 520px) {
  .topbar { padding: .75rem; }
  .brand { width: 100%; }
  .brand-copy { min-width: 0; }
  .brand-logo { width: min(13rem, 62vw); max-height: 2.8rem; }
  .brand small { display: none; }
  .main-nav { gap: .45rem; max-width: calc(100vw - 1.5rem); scroll-padding-inline: .75rem; margin-inline: -.25rem; padding-inline: .25rem; padding-bottom: .5rem; }
  .main-nav a, .nav-button { min-height: 3rem; max-width: min(16rem, calc(100vw - 1.5rem)); font-size: .88rem; padding-inline: .78rem; white-space: normal; text-align: center; }
  .main-nav .inline { flex: 0 0 auto; }
  .nav-dropdown summary { min-height: 3rem; max-width: min(16rem, calc(100vw - 1.5rem)); font-size: .88rem; padding-inline: .78rem; white-space: normal; text-align: center; }
  .nav-dropdown-menu { left: .5rem; right: .5rem; min-width: 0; max-width: calc(100vw - 1rem); max-height: min(70vh, 28rem); overflow-y: auto; }
  .nav-dropdown-menu a { min-height: 3rem; padding-block: .75rem; }
  .site-search { grid-template-columns: 1fr; width: 100%; }
  .site-search button { width: 100%; }
  .admin-tool-grid .card, .admin-workflow-card, .workflow-list li { min-width: 0; }
  .search-page-form { width: 100%; }
  .filter-links { display: grid; grid-template-columns: 1fr; }
  .filter-links .button { width: 100%; min-height: 3rem; justify-content: space-between; }
  .filter-count { margin-left: auto; }
  h1 { font-size: clamp(1.9rem, 12vw, 2.75rem); }
  h2 { font-size: 1.2rem; }
  .hero, .page-title { padding: 1rem; }
  .auth-card, .narrow-card { margin: 1rem auto; }
  .auth-card label, .narrow-card label { line-height: 1.35; }
  .hero-badge { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .hero-badge strong { grid-column: auto; grid-row: auto; justify-self: center; }
  .card, .choice-card { padding: 1rem; }
  .card > *, .choice-card > *, .auth-card > *, .page-title > *, form, fieldset { min-width: 0; max-width: 100%; }
  .grid.two > section { min-width: 0; }
  .grid.two > section > h2 { margin-bottom: .65rem; }
  .change-request-card .form-note { margin-bottom: .2rem; }
  .change-request-card button { margin-top: .1rem; }
  .image-link { min-height: 3rem; }
  .workflow-list li { padding: .9rem .9rem .9rem 2.8rem; }
  .workflow-list li::before { left: .75rem; top: .85rem; }
  .onboarding-checklist li { padding: .75rem .85rem .75rem 2.9rem; }
  .onboarding-checklist li::before { left: .75rem; top: .8rem; }
  .onboarding-checklist li, .scan-link-list a { overflow-wrap: anywhere; }
  .onboarding-progress-card .status-pill { width: 100%; justify-content: center; text-align: center; }
  .onboarding-progress-card > .button { width: 100%; }
  .onboarding-scan-nav { gap: .75rem; }
  .scan-link-list { gap: .65rem; }
  .scan-link-list a { min-height: 3rem; padding: .75rem .85rem; line-height: 1.35; }
  input[type="file"]::file-selector-button { display: block; width: 100%; margin: 0 0 .45rem; }
  .status-pill { width: fit-content; justify-content: flex-start; text-align: left; }
  .hero-badge strong { font-size: clamp(1.2rem, 8vw, 1.6rem); }
  .admin-row, .user-admin-row, .list-row, .credential-row, .app-overview-row, .page-admin-row, .admin-group-row, .request-card, .request-mini-card, .change-request-card { overflow-wrap: break-word; }
  .manual-secret, .recovery-box { overflow-wrap: anywhere; }
  .flash, .form-submit-status, .form-alert, .form-note, .recovery-hint, .success-hint, .runtime-recovery-banner { width: 100%; line-height: 1.45; overflow-wrap: break-word; }
  .flash { align-items: flex-start; padding: .8rem .85rem; }
  .stack > button, form.stack > .button { width: 100%; justify-content: center; text-align: center; }
  .stack > label + input, .stack > label + textarea, .stack > label + select { width: 100%; }
  .stack label > input, .stack label > textarea, .stack label > select { width: 100%; min-width: 0; margin-top: .35rem; }
  .request-id-inline { display: flex; width: fit-content; max-width: 100%; margin: .45rem 0 0; white-space: normal; overflow-wrap: anywhere; }
  .inline-empty { display: flex; width: 100%; justify-content: center; text-align: center; }
  .app-overview-row { padding: .9rem; }
  .app-chip-list li { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; gap: .15rem; padding: .7rem .8rem; }
  .app-chip-list span { overflow-wrap: anywhere; }
  .error-actions { width: 100%; }
  .recovery-hint { align-items: stretch; }
  .success-hint { align-items: stretch; }
  .recovery-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .recovery-actions a { justify-content: center; min-height: 3rem; text-align: center; line-height: 1.35; }
  .success-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .success-actions a { justify-content: center; min-height: 3rem; text-align: center; line-height: 1.35; }
  .runtime-recovery-banner { padding: .75rem .85rem; border-radius: 14px; }
  .admin-row button, .admin-option-row button, .admin-group-row button, .user-actions button, .reset-password-form button, .credential-row button, .credential-form button, .page-admin-row button, .app-overview-row .button, .request-card button, .error-actions .button, .button { width: 100%; }
  .admin-back-link a { justify-content: center; width: 100%; min-height: 3rem; padding: .65rem .85rem; border-radius: 14px; background: var(--panel-soft); text-align: center; }
  .inline button, .main-nav .inline button { width: auto; }
  .empty-state { padding: 1.1rem; }
  .empty-icon { width: 2.8rem; height: 2.8rem; border-radius: 16px; }
  .site-footer { align-items: center; text-align: center; padding-inline: .75rem; margin-top: 1.25rem; }
}
@media (max-width: 380px) {
  .container { width: min(100% - .5rem, var(--content-width)); }
  .topbar { padding: .6rem .5rem; }
  .login-hero { padding-inline: .5rem; }
  .main-nav a, .nav-button, .nav-dropdown summary { max-width: min(14rem, calc(100vw - 1rem)); padding-inline: .68rem; }
  .data-table { min-width: 360px; }
  .data-table th, .data-table td { padding: .58rem .5rem; font-size: .9rem; }
  .password-toggle-wrap { grid-template-columns: 1fr; }
  .password-toggle-button { width: 100%; }
  .recovery-box { padding: .85rem; border-radius: 16px; }
  .hero, .page-title, .card, .choice-card { border-radius: 18px; }
  .card, .choice-card, .request-card, .request-mini-card, .change-request-card { padding: .85rem; }
  input, textarea, select { padding-inline: .75rem; }
  .stack { gap: .7rem; }
}

@media print {
  @page { margin: 14mm; }
  * { box-shadow: none !important; text-shadow: none !important; }
  html, body { min-width: 0; overflow: visible; background: #fff !important; color: #111827; font-size: 11pt; }
  body { background: #fff !important; }
  .topbar, .site-search, .main-nav, .site-footer, form, button, .button, .skip-link, .flash, .recovery-hint, .success-hint, .runtime-error-banner { display: none !important; }
  .container { width: 100%; margin: 0; }
  .hero, .page-title, .card, .auth-card { border: 0; border-radius: 0; background: #fff !important; padding: 0; margin: 0 0 10mm; }
  .dashboard-hero { display: block; page-break-after: avoid; }
  .page-title h1, .hero h1 { font-size: 22pt; margin-bottom: 3mm; }
  h2 { font-size: 15pt; margin: 0 0 4mm; }
  h3 { font-size: 12pt; }
  p, .muted, .hint { color: #334155 !important; }
  .status-grid, .compact-status { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; margin: 5mm 0; }
  .stat-card { border: 1px solid #cbd5e1; border-radius: 0; padding: 4mm; break-inside: avoid; }
  .stat-card span { color: #334155; font-size: 8pt; }
  .stat-card strong { font-size: 18pt; }
  .grid, .grid.two { display: block; }
  .table-wrap { overflow: visible !important; border: 0; border-radius: 0; background: transparent; }
  .data-table, .work-hours-table { display: table; width: 100%; min-width: 0; border-collapse: collapse; border-spacing: 0; font-size: 9.5pt; }
  .data-table caption { text-align: left; margin-bottom: 3mm; font-weight: 800; }
  .data-table thead, .work-hours-table thead { display: table-header-group; }
  .data-table tbody, .work-hours-table tbody { display: table-row-group; }
  .data-table tr, .work-hours-table tr { display: table-row; break-inside: avoid; border: 0; padding: 0; background: transparent; }
  .data-table th, .data-table td, .work-hours-table th, .work-hours-table td { display: table-cell; width: auto; padding: 2.5mm 2mm; border: 1px solid #cbd5e1; background: #fff; color: #111827; text-align: left; vertical-align: top; font-size: 9.5pt; }
  .data-table th, .work-hours-table th { font-weight: 800; }
  .work-hours-table th::before, .work-hours-table td::before { content: none !important; }
  .section-heading { display: block; margin-bottom: 4mm; }
  .status-pill { border: 1px solid #cbd5e1; color: #111827 !important; background: #fff !important; }
  .list-row { display: block; border-top: 1px solid #cbd5e1; padding: 4mm 0; break-inside: avoid; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #475569; }
}

/* Excel-style work shift page */
.work-shift-hero { background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(219,234,254,.7)); }
.work-shift-controls { align-items: stretch; }
.work-range-card { border-color: #bfdbfe; background: linear-gradient(135deg, #ffffff, #eff6ff); }
.work-range-actions, .work-range-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.work-range-actions { margin-bottom: .9rem; }
.work-group-filters { margin: 0 0 .9rem; }
.work-range-form + .work-range-form { margin-top: .75rem; }
.work-range-form label { flex: 1 1 13rem; margin: 0; }
.work-range-form button, .work-range-actions .button { min-height: 3rem; }
.work-bulk-edit-card { border-color: #bbf7d0; background: linear-gradient(135deg, #ffffff, #f0fdf4); }
.work-bulk-toolbar { display: flex; flex-wrap: wrap; gap: .65rem; align-items: end; }
.work-bulk-toolbar button { min-height: 2.75rem; }
.work-bulk-toolbar label { flex: 1 1 12rem; margin: 0; }
.work-bulk-toolbar input, .work-bulk-toolbar select { width: 100%; }
.spreadsheet-card { overflow: hidden; }
.spreadsheet-wrap { border-radius: 16px; background: #f8fafc; border: 1px solid #cbd5e1; box-shadow: inset 0 1px 0 rgba(255,255,255,.7); }
.excel-like-table { min-width: 980px; border-collapse: collapse; font-size: .86rem; background: white; }
.excel-like-table th,
.excel-like-table td { border: 1px solid #b7c7db; padding: .45rem .55rem; white-space: nowrap; text-align: right; }
.excel-like-table th { background: #d9ead3; color: #173b16; font-weight: 900; text-align: center; }
.excel-like-table thead .group-row th { background: #b6d7a8; color: #102a10; }
.excel-like-table tbody th { position: sticky; left: 0; z-index: 1; min-width: 190px; background: #f3f6fb; color: #111827; text-align: left; }
.excel-like-table tbody tr:nth-child(even) td,
.excel-like-table tbody tr:nth-child(even) th { background-color: #fbfdff; }
.excel-like-table tbody tr:hover td,
.excel-like-table tbody tr:hover th { background-color: #fff7d6; }
.excel-like-table td:empty::after,
.excel-like-table .empty-cell::after { content: '·'; color: #cbd5e1; }
.excel-like-table .filled-cell { background: #ecfdf5; color: #064e3b; font-weight: 800; }
.work-hours-table .work-status-duunissa { background: #ffffff; color: #111827; font-weight: 900; }
.work-hours-table .work-status-koulutus { background: #ff0000; color: #ffffff; font-weight: 900; }
.work-hours-table .work-status-vuosiloma { background: #00b050; color: #ffffff; font-weight: 900; }
.work-hours-table .work-status-pekkanen { background: #ffff00; color: #111827; font-weight: 900; }
.work-hours-table .work-status-sairaus { background: #7030a0; color: #ffffff; font-weight: 900; }
.work-hours-table .work-status-muu-syy { background: #00b0f0; color: #ffffff; font-weight: 900; }
.work-hours-table tr:hover .work-status-duunissa,
.work-hours-table tr:hover .work-status-koulutus,
.work-hours-table tr:hover .work-status-vuosiloma,
.work-hours-table tr:hover .work-status-pekkanen,
.work-hours-table tr:hover .work-status-sairaus,
.work-hours-table tr:hover .work-status-muu-syy { filter: brightness(.96); }
.work-master-sheet-card { overflow: hidden; }
.work-master-wrap { max-height: none; }
.work-master-table { width: max-content; min-width: 100%; border-collapse: collapse; background: #fff; font-size: .78rem; }
.work-master-table th, .work-master-table td { min-width: 42px; height: 2rem; padding: .28rem .38rem; border: 1px solid #b7c7db; text-align: center; white-space: nowrap; }
.work-master-table .work-status-duunissa,
.work-master-table .work-status-koulutus,
.work-master-table .work-status-vuosiloma,
.work-master-table .work-status-pekkanen,
.work-master-table .work-status-sairaus,
.work-master-table .work-status-muu-syy,
.work-master-table .work-status-total { width: 44px; min-width: 44px; max-width: 44px; padding-inline: .22rem; }
.work-master-table .editable-summary-cell { cursor: cell; }
.work-master-table .editable-summary-cell:focus { background: #fff7d6 !important; outline: 3px solid rgba(37,99,235,.25); }
.work-master-table .shift-letter-cell { position: relative; width: 34px; min-width: 34px; max-width: 34px; padding: .18rem; font-weight: 900; cursor: cell; }
.work-master-table .shift-letter-cell:focus { background: #fff7d6; outline: 3px solid rgba(37,99,235,.25); }
.work-master-table .shift-letter-cell.is-selected { outline: 3px solid #2563eb; outline-offset: -3px; box-shadow: inset 0 0 0 2px #ffffff; }
.shift-letter-cell.shift-color-green { background: #c6efce !important; color: #006100 !important; }
.shift-letter-cell.shift-color-yellow { background: #ffeb9c !important; color: #9c5700 !important; }
.shift-letter-cell.shift-color-red { background: #ffc7ce !important; color: #9c0006 !important; }
.shift-letter-cell.shift-color-blue { background: #cfe2f3 !important; color: #17365d !important; }
.shift-letter-cell.has-note::after { content: ''; position: absolute; top: 0; right: 0; width: 0; height: 0; border-top: 9px solid #dc2626; border-left: 9px solid transparent; pointer-events: none; }
.work-master-table .master-driver-col { position: sticky; left: 0; z-index: 4; width: 170px; min-width: 170px; max-width: 170px; background: #f3f6fb; color: #111827; text-align: left; white-space: normal; overflow-wrap: anywhere; line-height: 1.15; }
.work-master-table .master-driver-col small { display: inline-flex; margin-top: .2rem; padding: .08rem .35rem; border-radius: 999px; background: #fef3c7; color: #78350f; font-size: .68rem; font-weight: 900; text-transform: uppercase; }
.work-master-table .master-driver-col.storage-worker { background: #fffbeb; }
.work-master-table .master-driver-col.office-worker { background: #eff6ff; }
.work-master-table .master-driver-col.office-worker small { background: #dbeafe; color: #1e3a8a; }
.work-master-table .master-driver-col:not(.storage-worker):not(.office-worker) small { background: #dcfce7; color: #14532d; }
.work-master-table thead th { position: sticky; top: 0; z-index: 3; background: #d9ead3; color: #173b16; font-weight: 900; }
.work-master-table thead tr:nth-child(2) th { top: 2rem; }
.work-master-table thead tr:nth-child(3) th { top: 4rem; }
.work-master-table thead .master-driver-col { z-index: 6; background: #b6d7a8; }
.work-master-table .master-group-row th { background: #b6d7a8; color: #102a10; }
.work-master-table .master-week-col { background: #cfe2f3; color: #17365d; font-size: .72rem; }
.work-master-table .master-day-row th, .work-master-table .master-weekday-row th { background: #eaf2f8; color: #17365d; }
.work-master-table tbody tr:nth-child(even) td, .work-master-table tbody tr:nth-child(even) th { background-color: #fbfdff; }
.work-master-table tbody tr:hover td, .work-master-table tbody tr:hover th { filter: brightness(.97); }
.work-master-table .filled-cell { background: #ecfdf5; color: #064e3b; font-weight: 900; }
.day-matrix-table th { background: #cfe2f3; color: #17365d; }
.day-matrix-table thead th:first-child { background: #9fc5e8; }
.raw-work-hours-table { min-width: 560px; }
@media (max-width: 760px) {
  .spreadsheet-card .section-heading { position: sticky; left: 0; }
  .excel-like-table { min-width: 860px; font-size: .8rem; }
  .excel-like-table th, .excel-like-table td { padding: .38rem .45rem; }
}
.work-month-calendars { display: grid; gap: 1.2rem; }
.work-month-calendar { overflow: hidden; border: 1px solid #bfdbfe; border-radius: 22px; background: #fff; box-shadow: var(--shadow-soft); }
.work-month-header { padding: .9rem 1rem; background: linear-gradient(135deg, #dbeafe, #eff6ff); border-bottom: 1px solid #bfdbfe; }
.work-month-header h3 { margin: 0; text-transform: capitalize; }
.work-month-weekdays, .work-month-grid { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
.work-month-weekdays span { padding: .55rem; background: #1d4ed8; color: white; font-size: .78rem; font-weight: 900; text-align: center; text-transform: uppercase; letter-spacing: .06em; }
.work-month-weekdays .week-number-head { background: #0f172a; }
.work-month-cell { min-height: 132px; padding: .5rem; border-right: 1px solid #dbeafe; border-bottom: 1px solid #dbeafe; background: #ffffff; }
.work-week-number { display: grid; place-items: start center; min-height: 132px; padding: .65rem .35rem; border-right: 1px solid #bfdbfe; border-bottom: 1px solid #dbeafe; background: #f1f5f9; color: #334155; font-weight: 900; }
.work-month-cell.outside-month { background: #f8fafc; color: #94a3b8; }
.work-month-cell.has-shifts { background: #eff6ff; }
.work-month-date { display: flex; justify-content: space-between; gap: .5rem; align-items: center; margin-bottom: .35rem; font-weight: 900; }
.work-month-date span { display: inline-grid; place-items: center; min-width: 1.8rem; min-height: 1.8rem; border-radius: 999px; background: #ffffff; color: #0f172a; border: 1px solid #bfdbfe; }
.work-month-date strong { color: #065f46; font-size: .82rem; white-space: nowrap; }
.work-month-cell ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .22rem; }
.work-month-cell li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem; align-items: center; padding: .24rem .35rem; border-radius: 8px; background: rgba(255,255,255,.76); font-size: .78rem; }
.work-month-cell li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-month-cell li strong { color: #065f46; white-space: nowrap; }
.calendar-more { margin: .3rem .15rem 0; color: var(--muted); font-weight: 800; font-size: .78rem; }
@media (max-width: 900px) { .work-month-cell, .work-week-number { min-height: 112px; } .work-month-cell { padding: .38rem; } .work-month-cell li { font-size: .72rem; } }
@media (max-width: 640px) { .work-month-calendars { overflow-x: auto; } .work-month-calendar { min-width: 760px; } }
/* Maintenance and inspections */
.maintenance-hero { background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(254,243,199,.72)); }
.maintenance-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.maintenance-card { position: relative; overflow: hidden; padding: 1rem; border: 1px solid var(--border); border-radius: 26px; background: white; box-shadow: var(--shadow-soft); }
.maintenance-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 7px; background: #22c55e; }
.maintenance-card.soon::before { background: #f59e0b; }
.maintenance-card.overdue::before { background: #ef4444; }
.maintenance-card header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-top: .35rem; }
.maintenance-card h2 { margin: .1rem 0 .25rem; font-size: clamp(1.45rem, 4vw, 2.1rem); letter-spacing: -.04em; }
.maintenance-status { display: inline-flex; align-items: center; justify-content: center; min-height: 1.85rem; padding: .3rem .65rem; border-radius: 999px; background: #dcfce7; color: #14532d; font-size: .76rem; font-weight: 900; white-space: nowrap; }
.maintenance-status.soon { background: #fef3c7; color: #78350f; }
.maintenance-status.overdue { background: #fee2e2; color: #7f1d1d; }
.autosave-status { display: inline-flex; align-items: center; justify-content: center; min-height: 1.85rem; padding: .3rem .65rem; border-radius: 999px; background: #eef2f7; color: #334155; font-size: .76rem; font-weight: 900; white-space: nowrap; }
.autosave-status.saved { background: #dcfce7; color: #14532d; }
.autosave-status.pending, .autosave-status.saving { background: #fef3c7; color: #78350f; }
.autosave-status.error { background: #fee2e2; color: #7f1d1d; }
.sheet-context-menu { position: fixed; z-index: 1000; min-width: 150px; padding: .35rem; border: 1px solid #94a3b8; border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.sheet-context-menu button { display: flex; width: 100%; min-height: 2.25rem; align-items: center; justify-content: flex-start; padding: .45rem .65rem; border: 0; border-radius: 10px; background: transparent; color: #0f172a; font-weight: 900; text-align: left; }
.sheet-context-menu button:hover, .sheet-context-menu button:focus-visible { background: #eff6ff; color: #1d4ed8; }
.sheet-context-menu button:disabled { opacity: .45; cursor: not-allowed; }
.maintenance-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin: 1rem 0; }
.maintenance-facts div { padding: .65rem; border-radius: 16px; background: #f8fafc; border: 1px solid #e2e8f0; }
.maintenance-facts dt { color: var(--muted); font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.maintenance-facts dd { margin: .15rem 0 0; font-weight: 900; overflow-wrap: anywhere; }
.maintenance-progress { height: .55rem; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.maintenance-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2563eb, #22c55e); }
.maintenance-card.overdue .maintenance-progress span { background: linear-gradient(90deg, #ef4444, #f97316); }
.maintenance-card.soon .maintenance-progress span { background: linear-gradient(90deg, #f59e0b, #facc15); }
.maintenance-checklist { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .45rem; }
.maintenance-checklist li { display: flex; gap: .5rem; align-items: center; color: #334155; font-weight: 750; }
.maintenance-checklist li span { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: .8rem; font-weight: 900; }
.maintenance-checklist li.done span { background: #dcfce7; color: #14532d; }
.maintenance-timeline { display: grid; gap: .7rem; }
.maintenance-timeline-row { display: grid; grid-template-columns: 100px minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .75rem; border: 1px solid #e2e8f0; border-left: 6px solid #22c55e; border-radius: 18px; background: #fff; }
.maintenance-timeline-row.soon { border-left-color: #f59e0b; }
.maintenance-timeline-row.overdue { border-left-color: #ef4444; }
.maintenance-timeline-row time { font-weight: 900; color: #0f172a; }
.maintenance-timeline-row span:not(.maintenance-status) { display: block; color: var(--muted); font-size: .9rem; }
.maintenance-form input:disabled, .maintenance-form select:disabled, .maintenance-form textarea:disabled, .maintenance-form button:disabled { opacity: .72; cursor: not-allowed; }
.maintenance-table th, .maintenance-table td { white-space: nowrap; }
@media (max-width: 760px) {
  .maintenance-card header, .maintenance-timeline-row { display: block; }
  .maintenance-status { margin-top: .5rem; }
  .maintenance-facts { grid-template-columns: 1fr; }
}
.maintenance-edit-panel { margin-top: 1rem; border-top: 1px solid #e2e8f0; padding-top: .8rem; }
.maintenance-edit-panel summary { cursor: pointer; width: fit-content; min-height: 2.4rem; padding: .55rem .8rem; border-radius: 999px; background: #eff6ff; color: #1e3a8a; font-weight: 900; }
.maintenance-edit-panel[open] summary { margin-bottom: .8rem; }
.maintenance-edit-panel form + form { margin-top: .65rem; }
/* Editable spreadsheet maintenance view */
.maintenance-sheet-card { overflow: hidden; }
.maintenance-sheet-wrap { overflow: auto; border: 1px solid #e2e8f0; border-radius: 18px; background: #fff; box-shadow: 0 14px 36px rgba(15,23,42,.06); }
.maintenance-sheet-table { width: 100%; min-width: 1180px; border-collapse: separate; border-spacing: 0; background: white; font-size: .86rem; }
.maintenance-sheet-table th,
.maintenance-sheet-table td { border: 0; border-bottom: 1px solid #e2e8f0; padding: .65rem .75rem; vertical-align: top; }
.maintenance-sheet-table th { position: sticky; top: 0; z-index: 2; background: #f8fafc; color: #334155; font-weight: 900; text-align: left; white-space: nowrap; }
.maintenance-sheet-table td:first-child,
.maintenance-sheet-table th:first-child { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 8px 0 14px rgba(15,23,42,.04); }
.maintenance-sheet-table th:first-child { z-index: 3; background: #f8fafc; }
.maintenance-sheet-table input,
.maintenance-sheet-table select,
.maintenance-sheet-table textarea { width: 100%; min-width: 120px; border: 0; border-radius: 10px; background: transparent; padding: .45rem; font: inherit; box-shadow: none; }
.maintenance-sheet-table textarea { min-width: 210px; resize: vertical; }
.maintenance-sheet-table input:focus,
.maintenance-sheet-table select:focus,
.maintenance-sheet-table textarea:focus { background: #fff7d6; outline: 3px solid rgba(37,99,235,.25); }
.maintenance-sheet-row.overdue td,
.maintenance-sheet-row.soon td,
.maintenance-sheet-row.ok td { background: #fff; }
.maintenance-sheet-table tbody tr:nth-child(even) td { background: #f8fafc; }
.maintenance-sheet-table tbody tr:hover td { background: #f1f5f9; }
.compact-button { min-height: 2.35rem; padding: .45rem .75rem; white-space: nowrap; }
.add-row-table th { background: #cfe2f3; color: #17365d; }
@media (max-width: 760px) { .maintenance-sheet-table { min-width: 1050px; font-size: .8rem; } }

.employee-directory-card { display: grid; gap: 1.25rem; }
.employee-tools-card { border-color: #bfdbfe; background: linear-gradient(135deg, #ffffff, #eff6ff); }
.employee-filter-form, .employee-import-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.employee-filter-form label, .employee-import-form label { flex: 1 1 13rem; margin: 0; }
.employee-filter-form button, .employee-filter-form .button, .employee-import-form button { min-height: 3rem; }
.employee-import-form { margin-top: .9rem; padding-top: .9rem; border-top: 1px solid #bfdbfe; }
.employee-detail-card, .fleet-detail-card { border-color: #bfdbfe; background: linear-gradient(135deg, #ffffff, #eff6ff); }
.employee-detail-form, .fleet-detail-form { max-width: 760px; }
.employee-group-section { display: grid; gap: .75rem; }
.employee-group-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.employee-group-heading h3 { margin: 0; }
.employee-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 18px; background: #fff; }
.employee-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.employee-table th, .employee-table td { padding: .72rem .85rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.employee-table tbody tr:last-child th, .employee-table tbody tr:last-child td { border-bottom: 0; }
.employee-table tbody tr:nth-child(even) { background: #f8fafc; }
.employee-group-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 5.8rem; padding: .18rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 900; }
.employee-group-pill.group-kuljettaja { background: #dcfce7; color: #14532d; }
.employee-group-pill.group-varasto { background: #fef3c7; color: #78350f; }
.employee-group-pill.group-toimisto { background: #dbeafe; color: #1e3a8a; }

.two-factor-card { max-width: 620px; }
.two-factor-card h1 { font-size: clamp(2rem, 4vw, 3rem); overflow-wrap: normal; word-break: keep-all; hyphens: none; letter-spacing: -.035em; }

/* Prevent Finnish UI labels from splitting in the middle of words. */
h1, h2, h3, button, .button, .nav-button, .main-nav a, .site-search button, label { overflow-wrap: normal; word-break: keep-all; hyphens: none; }
button, .button, .nav-button, .site-search button { white-space: normal; }

.fleet-directory-card { display: grid; gap: 1rem; }
.inline-add-panel { position: relative; display: inline-block; }
.inline-add-panel > summary { list-style: none; cursor: pointer; }
.inline-add-panel > summary::-webkit-details-marker { display: none; }
.inline-add-panel .inline-action-panel { display: none; }
.inline-add-panel[open] { z-index: 99998; }
.inline-add-panel[open]::before { content: none; }
.inline-modal-backdrop { display: none; position: fixed; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; margin: 0; transform: none; z-index: 99998; border: 0; border-radius: 0; appearance: none; background: rgba(15,23,42,.18); backdrop-filter: blur(1px); cursor: default; }
.inline-modal-open .inline-modal-backdrop { display: block; }
.inline-add-panel[open] .inline-action-panel,
.inline-action-panel.is-portal-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 99999;
  display: grid;
  gap: .75rem;
  width: min(1040px, calc(100vw - 3rem));
  max-height: min(86vh, 820px);
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 1.35rem;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15,23,42,.12);
}
.maintenance-sheet-table .inline-add-panel[open] .inline-action-panel,
.inline-action-panel.is-portal-modal { width: min(980px, calc(100vw - 3rem)); }
.inline-action-panel .admin-row { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 1rem; align-items: end; }
.inline-action-panel .admin-row label { display: grid; gap: .35rem; margin: 0; font-weight: 800; color: #334155; }
.inline-action-panel .admin-row input,
.inline-action-panel .admin-row select { min-height: 3rem; border: 1px solid #cbd5e1; border-radius: 14px; background: #f8fafc; padding: .65rem .8rem; }
.inline-action-panel .admin-row input:focus,
.inline-action-panel .admin-row select:focus { background: #fff; border-color: #2563eb; outline: 3px solid rgba(37,99,235,.16); }
.inline-action-panel .admin-row button.primary { grid-column: 1 / -1; justify-self: end; min-width: 10rem; }
.inline-action-panel .inline-delete-form { display: flex; justify-content: flex-end; padding-top: 1rem; border-top: 1px solid #e2e8f0; }
.inline-action-panel .modal-close-button { justify-self: end; min-height: 2.35rem; padding: .4rem .8rem; }
@media (max-width: 760px) { .inline-action-panel .admin-row { grid-template-columns: 1fr; } }
.fleet-table-wrap { overflow-x: auto; }
.fleet-table th:first-child { min-width: 9rem; }
.fleet-table td, .fleet-table th { white-space: nowrap; }
.fleet-table .maintenance-status { margin: 0; }

.employee-edit-row { grid-template-columns: minmax(220px, 1.4fr) minmax(140px, .6fr) auto auto auto auto; align-items: center; }
.fleet-edit-row { grid-template-columns: minmax(120px, .8fr) minmax(110px, .7fr) minmax(110px, .7fr) minmax(130px, .7fr) minmax(120px, .7fr) minmax(130px, .7fr) auto auto auto; align-items: center; }
.check-row { display: inline-flex; align-items: center; gap: .35rem; font-weight: 800; }
.check-row input { width: auto; }
@media (max-width: 900px) { .employee-edit-row, .fleet-edit-row { grid-template-columns: 1fr; } }

.fleet-document-upload-form { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #bfdbfe; }
.fleet-document-row { align-items: start; }
.fleet-document-preview { max-width: 220px; margin-top: .65rem; }
.fleet-document-preview .uploaded-image { max-height: 160px; }
.maintenance-warning-panel, .maintenance-warning-list { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .55rem; }
.maintenance-warning-panel { padding: .75rem .85rem; border: 1px solid #fde68a; border-radius: 16px; background: #fffbeb; }
.maintenance-warning { display: inline-flex; align-items: center; min-height: 1.8rem; padding: .25rem .55rem; border-radius: 999px; background: #dbeafe; color: #1e3a8a; font-size: .76rem; font-weight: 900; white-space: nowrap; }
.maintenance-warning.soon { background: #fef3c7; color: #78350f; }
.maintenance-warning.overdue { background: #fee2e2; color: #7f1d1d; }
.compact-warning-list { max-width: 20rem; }
.maintenance-status.completed { background: #e0f2fe; color: #075985; }
.maintenance-sheet-row.completed td { background: #f8fafc; color: #334155; }
.maintenance-timeline-row.completed { border-color: #93c5fd; background: #eff6ff; }
.sheet-check-label { display: inline-flex; align-items: center; gap: .35rem; min-width: 6rem; font-weight: 900; color: #0f172a; }
.sheet-check-label input { width: auto; min-width: auto; accent-color: #2563eb; }
.maintenance-history summary { cursor: pointer; min-height: 2rem; font-weight: 900; color: #1d4ed8; }
.maintenance-history ul { margin: .35rem 0 0; padding-left: 1rem; min-width: 12rem; color: #475569; }
.maintenance-history li + li { margin-top: .2rem; }
.maintenance-history li span { display: inline; color: #0f172a; font-weight: 800; }
.admin-search-card { border-color: #bfdbfe; background: linear-gradient(135deg, #ffffff, #eff6ff); }
.admin-search-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.admin-search-form label { flex: 1 1 18rem; margin: 0; }
.admin-search-form input[type="search"], .admin-search-form input[name="q"] { min-height: 3rem; }
.admin-search-form button, .admin-search-form .button { min-height: 3rem; }
.reliability-card { border-color: #bbf7d0; background: linear-gradient(135deg, #ffffff, #f0fdf4); }
.activity-log { margin-top: 1rem; border-top: 1px solid #bbf7d0; padding-top: .85rem; }
.activity-log h3 { margin-top: 0; }
.activity-log-row { display: grid; grid-template-columns: 9rem minmax(12rem, 1fr) minmax(8rem, .8fr); gap: .75rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid #dcfce7; }
.activity-log-row time { color: var(--muted); font-weight: 800; }
.activity-log-row span { color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 760px) { .activity-log-row { grid-template-columns: 1fr; gap: .2rem; } }

.mapon-map-card { display: grid; gap: 1rem; }
.mapon-map { min-height: 560px; width: 100%; border: 1px solid var(--border); border-radius: 22px; overflow: hidden; background: #e0f2fe; box-shadow: inset 0 0 0 1px rgba(15,23,42,.04); }
.mapon-map-meta { display: flex; flex-wrap: wrap; gap: .6rem; color: var(--muted); font-weight: 800; }
.mapon-map-meta span { display: inline-flex; gap: .35rem; align-items: center; padding: .35rem .65rem; border-radius: 999px; background: #eff6ff; color: #1e3a8a; }
.button-row { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; justify-content: flex-end; }
@media (max-width: 760px) { .mapon-map { min-height: 420px; border-radius: 16px; } .button-row { justify-content: flex-start; } }

.api-key-grid { align-items: start; }
.api-key-card { display: grid; gap: 1rem; border-color: #bfdbfe; background: linear-gradient(135deg, #ffffff, #eff6ff); }
.api-key-status { display: grid; gap: .55rem; margin: 0; }
.api-key-status div { display: grid; grid-template-columns: 7rem minmax(0,1fr); gap: .75rem; padding: .55rem .7rem; border: 1px solid #dbeafe; border-radius: 14px; background: #fff; }
.api-key-status dt { font-weight: 900; color: #1e3a8a; }
.api-key-status dd { margin: 0; overflow-wrap: anywhere; color: #334155; font-weight: 700; }
.api-key-form { padding-top: .85rem; border-top: 1px solid #bfdbfe; }
@media (max-width: 760px) { .api-key-status div { grid-template-columns: 1fr; gap: .15rem; } }

.mapon-map-legend { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; color: #334155; font-weight: 800; }
.mapon-map-legend span { display: inline-flex; gap: .4rem; align-items: center; padding: .35rem .65rem; border: 1px solid #e2e8f0; border-radius: 999px; background: #fff; }
.mapon-dot { width: .8rem; height: .8rem; border-radius: 999px; display: inline-block; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(15,23,42,.12); }
.mapon-dot.moving { background: #22c55e; }
.mapon-dot.idle { background: #facc15; }
.mapon-dot.long-idle { background: #ef4444; }
.mapon-vehicle-marker { position: relative; width: 120px; height: 54px; transform: translateY(-2px); pointer-events: auto; }
.mapon-vehicle-label { position: absolute; left: 50%; top: 0; transform: translateX(-50%); max-width: 116px; padding: .18rem .45rem; border-radius: 999px; background: #fff; color: #0f172a; border: 2px solid currentColor; box-shadow: 0 6px 18px rgba(15,23,42,.18); font: 900 12px/1.15 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mapon-vehicle-pin { position: absolute; left: 50%; bottom: 0; width: 24px; height: 24px; transform: translateX(-50%) rotate(45deg); border: 3px solid #fff; border-radius: 50% 50% 50% 0; box-shadow: 0 8px 22px rgba(15,23,42,.24); }
.mapon-vehicle-pin::after { content: ''; position: absolute; inset: 5px; border-radius: 999px; background: rgba(255,255,255,.92); }
.mapon-vehicle-marker.moving { color: #15803d; }
.mapon-vehicle-marker.moving .mapon-vehicle-pin { background: #22c55e; }
.mapon-vehicle-marker.idle { color: #a16207; }
.mapon-vehicle-marker.idle .mapon-vehicle-pin { background: #facc15; }
.mapon-vehicle-marker.long-idle { color: #b91c1c; }
.mapon-vehicle-marker.long-idle .mapon-vehicle-pin { background: #ef4444; }
.mapon-vehicle-arrow { position: absolute; left: 50%; bottom: 0; width: 30px; height: 34px; transform: translateX(-50%) rotate(var(--heading, 0deg)); transform-origin: 50% 50%; filter: drop-shadow(0 8px 14px rgba(15,23,42,.26)); }
.mapon-vehicle-arrow span { position: absolute; left: 50%; top: 0; width: 0; height: 0; transform: translateX(-50%); border-left: 13px solid transparent; border-right: 13px solid transparent; border-bottom: 31px solid currentColor; }
.mapon-vehicle-arrow span::after { content: ''; position: absolute; left: -6px; top: 11px; width: 12px; height: 12px; border-radius: 999px; background: rgba(255,255,255,.94); }
.mapon-vehicle-marker.moving .mapon-vehicle-arrow { color: #22c55e; }
.mapon-vehicle-marker.idle .mapon-vehicle-arrow { color: #facc15; }
.mapon-vehicle-marker.long-idle .mapon-vehicle-arrow { color: #ef4444; }

/* Polished Mapon fleet markers */
.mapon-vehicle-marker { height: 68px; }
.mapon-vehicle-label {
  top: 0;
  min-width: 58px;
  max-width: 118px;
  padding: .28rem .55rem .3rem;
  border: 0;
  background: rgba(255,255,255,.96);
  color: #0f172a;
  box-shadow: 0 10px 26px rgba(15,23,42,.22), 0 0 0 1px rgba(148,163,184,.35);
  backdrop-filter: blur(8px);
}
.mapon-vehicle-label::before {
  content: '';
  display: inline-block;
  width: .48rem;
  height: .48rem;
  margin-right: .35rem;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 2px rgba(255,255,255,.9);
  vertical-align: .04rem;
}
.mapon-vehicle-arrow {
  bottom: 2px;
  width: 38px;
  height: 42px;
  filter: drop-shadow(0 10px 14px rgba(15,23,42,.28));
}
.mapon-vehicle-arrow span {
  border-left-width: 16px;
  border-right-width: 16px;
  border-bottom-width: 38px;
  border-bottom-color: currentColor;
}
.mapon-vehicle-arrow span::before {
  content: '';
  position: absolute;
  left: -13px;
  top: 3px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.92);
}
.mapon-vehicle-arrow span::after {
  left: -4px;
  top: 12px;
  width: 8px;
  height: 8px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(15,23,42,.08);
}
.mapon-vehicle-marker.moving .mapon-vehicle-label { color: #15803d; }
.mapon-vehicle-marker.idle .mapon-vehicle-label { color: #a16207; }
.mapon-vehicle-marker.long-idle .mapon-vehicle-label { color: #b91c1c; }
.mapon-vehicle-marker:hover .mapon-vehicle-label { transform: translateX(-50%) translateY(-2px); box-shadow: 0 14px 34px rgba(15,23,42,.28), 0 0 0 1px rgba(148,163,184,.45); }
.mapon-vehicle-marker:hover .mapon-vehicle-arrow { filter: drop-shadow(0 14px 18px rgba(15,23,42,.34)); }

/* Top-down semi truck markers. Cabin/front is status-colored and rotates by Mapon heading. */
.mapon-truck {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 34px;
  height: 50px;
  transform: translateX(-50%) rotate(var(--heading, 0deg));
  transform-origin: 50% 54%;
  filter: drop-shadow(0 10px 14px rgba(15,23,42,.28));
}
.mapon-truck .truck-cabin,
.mapon-truck .truck-trailer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: block;
  box-sizing: border-box;
}
.mapon-truck .truck-cabin {
  top: 0;
  width: 25px;
  height: 18px;
  border-radius: 7px 7px 4px 4px;
  background: currentColor;
  border: 2px solid #fff;
  z-index: 2;
  box-shadow: inset 0 -5px 0 rgba(15,23,42,.13);
}
.mapon-truck .truck-cabin::before,
.mapon-truck .truck-cabin::after {
  content: '';
  position: absolute;
  top: 5px;
  width: 4px;
  height: 7px;
  border-radius: 2px;
  background: rgba(255,255,255,.9);
}
.mapon-truck .truck-cabin::before { left: 5px; }
.mapon-truck .truck-cabin::after { right: 5px; }
.mapon-truck .truck-cabin i {
  position: absolute;
  left: 50%;
  top: -7px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid currentColor;
}
.mapon-truck .truck-trailer {
  top: 18px;
  width: 31px;
  height: 31px;
  border-radius: 5px 5px 9px 9px;
  background: linear-gradient(180deg, #ffffff, #e5e7eb);
  border: 2px solid #fff;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.16);
}
.mapon-truck .truck-trailer::before,
.mapon-truck .truck-trailer::after {
  content: '';
  position: absolute;
  bottom: 5px;
  width: 4px;
  height: 10px;
  border-radius: 2px;
  background: #475569;
}
.mapon-truck .truck-trailer::before { left: -4px; }
.mapon-truck .truck-trailer::after { right: -4px; }
.mapon-truck .truck-trailer i {
  position: absolute;
  left: 50%;
  top: 5px;
  width: 18px;
  height: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(15,23,42,.16);
  box-shadow: 0 7px 0 rgba(15,23,42,.12), 0 14px 0 rgba(15,23,42,.09);
}
.mapon-vehicle-marker.moving .mapon-truck { color: #22c55e; }
.mapon-vehicle-marker.idle .mapon-truck { color: #facc15; }
.mapon-vehicle-marker.long-idle .mapon-truck { color: #ef4444; }
.mapon-vehicle-marker:hover .mapon-truck { filter: drop-shadow(0 14px 18px rgba(15,23,42,.34)); }

/* More realistic top-down semi-truck marker style */
.mapon-vehicle-marker { width: 140px; height: 82px; }
.mapon-vehicle-label {
  top: 0;
  font-size: 11px;
  padding: .24rem .5rem;
  box-shadow: 0 8px 20px rgba(15,23,42,.2), 0 0 0 1px rgba(15,23,42,.12);
}
.mapon-truck {
  bottom: 0;
  width: 44px;
  height: 62px;
  transform-origin: 50% 55%;
  filter: drop-shadow(0 9px 10px rgba(15,23,42,.32));
}
.mapon-truck .truck-cabin {
  top: 0;
  width: 32px;
  height: 23px;
  border-radius: 10px 10px 5px 5px;
  border: 2px solid #111827;
  box-shadow: inset 0 -6px 0 rgba(15,23,42,.16), inset 0 2px 0 rgba(255,255,255,.34);
}
.mapon-truck .truck-cabin::before,
.mapon-truck .truck-cabin::after {
  top: 6px;
  width: 6px;
  height: 9px;
  border-radius: 3px 3px 2px 2px;
  background: rgba(219,234,254,.95);
  box-shadow: inset 0 1px 0 #fff;
}
.mapon-truck .truck-cabin::before { left: 6px; }
.mapon-truck .truck-cabin::after { right: 6px; }
.mapon-truck .truck-cabin i {
  top: -9px;
  border-left-width: 8px;
  border-right-width: 8px;
  border-bottom-width: 10px;
  filter: drop-shadow(0 -1px 0 #111827);
}
.mapon-truck .truck-trailer {
  top: 22px;
  width: 39px;
  height: 39px;
  border-radius: 4px 4px 10px 10px;
  background: linear-gradient(180deg, #f8fafc 0%, #e5e7eb 100%);
  border: 2px solid #111827;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.75), inset 0 -8px 12px rgba(15,23,42,.08);
}
.mapon-truck .truck-trailer::before,
.mapon-truck .truck-trailer::after {
  bottom: 7px;
  width: 5px;
  height: 13px;
  border-radius: 3px;
  background: #111827;
  box-shadow: 0 -18px 0 #111827;
}
.mapon-truck .truck-trailer::before { left: -6px; }
.mapon-truck .truck-trailer::after { right: -6px; }
.mapon-truck .truck-trailer i {
  top: 7px;
  width: 24px;
  height: 2px;
  background: rgba(15,23,42,.18);
  box-shadow: 0 8px 0 rgba(15,23,42,.14), 0 16px 0 rgba(15,23,42,.1), 0 24px 0 rgba(255,255,255,.8);
}
.mapon-vehicle-marker:hover .mapon-truck { filter: drop-shadow(0 13px 16px rgba(15,23,42,.38)); }

/* Final Mapon marker: clean directional arrowhead with label */
.mapon-vehicle-marker { width: 132px; height: 72px; }
.mapon-arrowhead {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 42px;
  height: 48px;
  transform: translateX(-50%) rotate(var(--heading, 0deg));
  transform-origin: 50% 55%;
  filter: drop-shadow(0 12px 16px rgba(15,23,42,.3));
}
.mapon-arrowhead span {
  position: absolute;
  left: 50%;
  top: 0;
  width: 32px;
  height: 42px;
  transform: translateX(-50%);
  background: currentColor;
  clip-path: polygon(50% 0%, 95% 100%, 50% 78%, 5% 100%);
  box-shadow: inset 0 -8px 0 rgba(15,23,42,.16);
}
.mapon-arrowhead span::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 14px;
  width: 10px;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(15,23,42,.12);
}
.mapon-vehicle-marker.moving .mapon-arrowhead { color: #22c55e; }
.mapon-vehicle-marker.idle .mapon-arrowhead { color: #facc15; }
.mapon-vehicle-marker.long-idle .mapon-arrowhead { color: #ef4444; }
.mapon-vehicle-marker:hover .mapon-arrowhead { filter: drop-shadow(0 16px 20px rgba(15,23,42,.38)); }

/* Final Mapon marker: rotating map pointer; tip shows heading direction */
.mapon-pointer {
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 42px;
  height: 48px;
  transform: translateX(-50%) rotate(calc(var(--heading, 0deg) + 90deg));
  transform-origin: 50% 55%;
  filter: drop-shadow(0 12px 16px rgba(15,23,42,.32));
}
.mapon-pointer span {
  position: absolute;
  left: 50%;
  top: 1px;
  width: 34px;
  height: 34px;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 50% 50% 50% 6px;
  background: currentColor;
  border: 3px solid #fff;
  box-shadow: inset -5px -5px 0 rgba(15,23,42,.13), 0 0 0 1px rgba(15,23,42,.18);
}
.mapon-pointer span::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.14);
}
.mapon-vehicle-marker.moving .mapon-pointer { color: #22c55e; }
.mapon-vehicle-marker.idle .mapon-pointer { color: #facc15; }
.mapon-vehicle-marker.long-idle .mapon-pointer { color: #ef4444; }
.mapon-vehicle-marker:hover .mapon-pointer { filter: drop-shadow(0 16px 20px rgba(15,23,42,.4)); }

/* Document-like admin page editor */
.admin-docs-title { margin-bottom: 1rem; }
.docs-editor-shell { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.docs-editor-sidebar { position: sticky; top: 1rem; display: grid; gap: .9rem; }
.docs-sidebar-section { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-soft); padding: 1rem; }
.docs-sidebar-section h2, .docs-sidebar-section summary { margin: 0 0 .65rem; font-size: 1rem; font-weight: 800; }
.docs-sidebar-section summary { cursor: pointer; }
.docs-page-picker { width: 100%; margin-top: .35rem; }
.docs-page-link { width: 100%; display: grid; gap: .15rem; text-align: left; margin-top: .45rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-muted); color: var(--text); padding: .7rem .8rem; cursor: pointer; }
.docs-page-link small { color: var(--muted); font-weight: 600; }
.docs-page-link.is-active { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.docs-mini-form { gap: .5rem; margin-bottom: .75rem; }
.docs-nav-group-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .35rem; align-items: center; margin-top: .45rem; }
.docs-nav-group-row input { min-width: 0; }
.docs-nav-group-row button { padding: .55rem .7rem; }
.docs-editor-main { min-width: 0; border: 1px solid var(--border); border-radius: 22px; background: #f8fafc; box-shadow: var(--shadow-soft); overflow: hidden; }
.docs-toolbar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); padding: .65rem .8rem; }
.docs-toolbar button { border: 1px solid var(--border); border-radius: 999px; background: white; color: var(--text); padding: .45rem .75rem; font-weight: 800; cursor: pointer; }
.docs-toolbar button:hover { border-color: #93c5fd; background: #eff6ff; }
.docs-toolbar-spacer { flex: 1; }
.docs-toolbar-hint { color: var(--muted); font-size: .85rem; }
.docs-document-panel { display: none; padding: 1.25rem; }
.docs-document-panel.is-active { display: block; }
.docs-document-form { max-width: 980px; margin: 0 auto; }
.docs-document-title { margin: 0; font-size: 1.35rem; }
.docs-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; align-items: end; border: 1px solid var(--border); border-radius: 16px; background: white; padding: .9rem; }
.docs-visible-toggle { align-self: center; margin-top: 1.4rem; }
.docs-paper-label { font-weight: 900; color: var(--muted); }
.docs-paper { min-height: 720px; white-space: pre-wrap; outline: none; border: 1px solid #e2e8f0; border-radius: 4px; background: white; box-shadow: 0 24px 60px rgba(15, 23, 42, .12); padding: 72px 86px; color: #111827; font-family: Georgia, 'Times New Roman', serif; font-size: 1.04rem; line-height: 1.75; caret-color: #2563eb; }
.docs-paper:focus { border-color: #93c5fd; box-shadow: 0 24px 60px rgba(15, 23, 42, .12), 0 0 0 4px rgba(37,99,235,.14); }
.docs-paper:empty::before { content: attr(data-placeholder); color: #94a3b8; }
.docs-hidden-textarea { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }
.docs-actions { display: flex; justify-content: flex-end; gap: .6rem; align-items: center; border-top: 1px solid var(--border); padding-top: .9rem; }
@media (max-width: 900px) {
  .docs-editor-shell { grid-template-columns: 1fr; }
  .docs-editor-sidebar { position: static; }
  .docs-meta-grid { grid-template-columns: 1fr; }
  .docs-paper { min-height: 520px; padding: 36px 24px; }
  .docs-actions { flex-direction: column; align-items: stretch; }
}

.docs-drop-hint { margin: -.25rem 0 .5rem; color: var(--muted); font-size: .9rem; }
.docs-paper.is-drag-over { border-color: #2563eb; background: linear-gradient(rgba(239,246,255,.88), rgba(239,246,255,.88)), #fff; box-shadow: 0 24px 60px rgba(15,23,42,.12), 0 0 0 5px rgba(37,99,235,.18); }
.docs-paper.is-uploading { cursor: progress; opacity: .82; }
.page-attachment.image { margin: 1rem 0; }
.page-attachment.image img { display: block; max-width: min(100%, 720px); height: auto; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow-soft); }
.page-attachment.image figcaption { margin-top: .4rem; color: var(--muted); font-size: .9rem; }
.page-attachment.file a { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--border); border-radius: 12px; padding: .7rem .9rem; background: var(--surface-muted); font-weight: 800; }
.page-attachment.file a::before { content: '📎'; }
.docs-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.docs-toolbar-count { border: 1px solid var(--border); border-radius: 999px; background: var(--surface-muted); color: var(--muted); padding: .35rem .65rem; font-size: .82rem; font-weight: 800; white-space: nowrap; }
.docs-search-input { width: 11rem; min-height: 2.2rem; border: 1px solid var(--border); border-radius: 999px; padding: .35rem .75rem; }
.docs-asset-library { display: grid; gap: .4rem; }
.docs-asset-button, .docs-group-drop { width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: .55rem .65rem; color: var(--text); font-weight: 700; }
.docs-asset-button { display: grid; grid-template-columns: auto 1fr; gap: .5rem; align-items: center; }
.docs-group-drop { margin: .35rem 0; border-style: dashed; color: var(--muted); }
.docs-group-drop.is-drag-over { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
.docs-page-meta-line { color: var(--muted); font-size: .88rem; margin: -.25rem 0 .35rem; }
.docs-preview { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); padding: 1.25rem; box-shadow: var(--shadow-soft); }
.docs-a11y-report { color: var(--muted); font-size: .88rem; }
.docs-version-history { border: 1px solid var(--border); border-radius: 14px; padding: .75rem; background: var(--surface-muted); }
.docs-version-row { display: flex; justify-content: space-between; gap: .75rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--border); }
.docs-version-row:first-of-type { border-top: 0; }
.page-attachment.image.is-small img { max-width: 280px; }
.page-attachment.image.is-medium img { max-width: 520px; }
.page-attachment.image.is-full img { max-width: 100%; }
.page-attachment.image.align-center img { margin-inline: auto; }
.page-attachment.image.align-right img { margin-left: auto; }
.page-attachment.pdf object { width: 100%; min-height: 520px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-muted); }
.docs-toolbar [data-docs-command].is-active { background: #dbeafe; border-color: #2563eb; color: #1d4ed8; }
.docs-paper h2 { font-size: 1.9rem; line-height: 1.2; margin: 1.2rem 0 .55rem; color: var(--text); }
.docs-paper h3 { font-size: 1.35rem; line-height: 1.25; margin: 1rem 0 .45rem; color: var(--text); }
.docs-paper blockquote { margin: 1rem 0; padding: .9rem 1rem; border-left: 5px solid #2563eb; background: #eff6ff; border-radius: 12px; color: #1e3a8a; }
.docs-paper hr { border: 0; border-top: 2px solid var(--border); margin: 1.25rem 0; }
.docs-paper table { width: 100%; border-collapse: collapse; margin: 1rem 0; overflow: hidden; border-radius: 12px; }
.docs-paper td, .docs-paper th { border: 1px solid var(--border); padding: .65rem .75rem; }
.docs-paper ul, .docs-paper ol { padding-left: 1.5rem; }
.docs-editor-attachment.image { margin: 1rem 0; }
.docs-editor-attachment.image img { display: block; max-width: min(100%, 720px); height: auto; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow-soft); }
.docs-editor-attachment.image figcaption { margin-top: .4rem; color: var(--muted); font-size: .9rem; }
.docs-editor-attachment.file a { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--border); border-radius: 12px; padding: .7rem .9rem; background: var(--surface-muted); font-weight: 800; }
.docs-editor-attachment.image.is-small img { max-width: 280px; }
.docs-editor-attachment.image.is-full img { max-width: 100%; }
.docs-editor-attachment.image.align-center img { margin-inline: auto; }
.docs-editor-attachment.image.align-right img { margin-left: auto; }
