/* Lean layer (owner, 2026-11-10: the portal "feels bloated and not lean"). Loaded after style.css and changes only
   spacing, size and decoration: flat background, tighter title cards and cards, smaller corners, no soft shadows,
   form labels on one line with a quiet "pakollinen", compact inputs and buttons, borderless status rows. */
body { background: var(--bg); }
.container { margin-top: .9rem; }

.hero, .page-title, .auth-card, .card { border-radius: 12px; box-shadow: none; }
.hero, .page-title { gap: .5rem; padding: .8rem 1.1rem; margin-bottom: .75rem; }
.dashboard-hero { box-shadow: none; }
h1 { font-size: clamp(1.35rem, 1.8vw, 1.7rem); letter-spacing: -.02em; }
.page-title h1, .hero h1 { margin-bottom: .15rem; }
.page-title p, .hero p { margin-block: 0; }
.eyebrow { margin-bottom: .2rem; font-size: .7rem; letter-spacing: .08em; }
.card { padding: .9rem 1rem; margin-bottom: .65rem; }
.stat-card { border-radius: 10px; box-shadow: none; }
.stack { gap: .75rem; }

/* Labels: the field name and "pakollinen" share a line; the control and its messages take the next line. */
label { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .45rem; font-weight: 700; }
label > input:not([type="checkbox"]):not([type="radio"]), label > select, label > textarea, label > div,
label > .field-error, label > .hint, label > small { flex: 1 1 100%; }
.required-label, .optional-label { margin-left: 0; padding: 0; border: 0; background: none; font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: none; }
.required-label { color: var(--danger-text); }
.admin-form-card .stack label { padding: 0; border: 0; background: none; }

input, textarea, select { min-height: 2.5rem; padding: .55rem .7rem; border-radius: 8px; }
button, .button { min-height: 2.4rem; padding: .45rem .85rem; border-radius: 8px; }
input[type="file"]::file-selector-button { min-height: 2.1rem; border-radius: 8px; }
@media (min-width: 761px) {
  .stack > button, form.stack > .button { justify-self: start; min-width: 10rem; }
  .admin-form-card .stack > button { box-shadow: none; }
}

.api-key-status div { padding: .25rem 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: none; }
.api-key-status dt { color: var(--text); font-weight: 700; }
.site-footer a { font-weight: 600; }

/* Menu cards: icon beside the title, one compact row each. */
.choice-card { padding: .8rem 1rem; border-radius: 12px; box-shadow: none; min-height: 0; }
.choice-card:has(> .choice-icon) { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .8rem; align-items: center; }
.choice-card:has(> .choice-icon) > .choice-icon { grid-row: span 2; }
.choice-card h2, .choice-card.choose-primary-card h2 { margin: 0; font-size: 1.05rem; }
.choice-card p { margin: .15rem 0 0; }
.choice-icon { width: 2.25rem; height: 2.25rem; margin: 0; border-radius: 10px; font-size: 1.15rem; }
.chooser-grid, .choose-grid { gap: .6rem; }

/* Empty states, hints and list rows. */
.empty-state { padding: .9rem 1rem; border-radius: 10px; }
.empty-state .empty-icon { width: 2rem; height: 2rem; margin: 0 auto .35rem; font-size: 1rem; }
.empty-state h3 { margin: 0 0 .2rem; font-size: 1rem; }
.empty-state p { margin: 0; }
.stack > .hint, .stack > .form-note, .stack > p { margin-block: 0; }
.user-admin-row { padding: .75rem 0; }
.status-pill { padding: .15rem .55rem; }

/* Online users sit in the top bar beside the bell instead of floating over the page edge (owner, 2026-11-10). */
@media (min-width: 1041px) {
  .topbar[data-portal-header] { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .topbar > .online-users-drawer { position: relative; top: auto; right: auto; z-index: 30; grid-row: 1; grid-column: 4; }
  .topbar > [data-vehicle-area-notifications] { grid-row: 1; grid-column: 3; }
  .topbar > .online-users-drawer > summary { width: 2.4rem; height: 2.4rem; border-right: 1px solid #bbf7d0; border-radius: 8px; box-shadow: none; }
  .topbar > .online-users-drawer .online-users-menu { right: 0; border-right-width: 1px; border-radius: 12px; }
}

/* Refined look (owner, 2026-11-10: "the ui is a bit ugly"): a system UI font at normal weights, one accent colour,
   neutral cards and rows instead of green/yellow tints, quiet nav items without pill borders, quiet delete buttons. */
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--text); }
h1, h2, h3 { font-weight: 650; letter-spacing: -.01em; }
h1 { letter-spacing: -.02em; }
label { font-weight: 600; }
button, .button { font-weight: 600; }
.eyebrow { color: var(--muted); font-weight: 600; }
.muted, .hint { color: var(--muted); }

/* Neutral surfaces: status is shown by the small pill, not by tinting whole cards and rows. */
.stat-card, .stat-card.ok, .dashboard-hero .stat-card { border-color: var(--border); background: var(--panel); }
.stat-card span { color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.status-row.has-data, .status-row.needs-attention { background: none; border-top-color: var(--border); }
.status-row { border-radius: 0; padding-inline: 0; }
.app-overview-row, .app-overview-row.needs-attention { border: 0; border-top: 1px solid var(--border); border-radius: 0; background: none; padding: .7rem 0; }
.app-overview-row + .app-overview-row { margin-top: 0; }
.choose-admin-section, .choose-admin-section .choose-section-heading { border-color: var(--border); }
.dashboard-hero { border-color: var(--border); }

/* Buttons: one solid primary, plain secondary, delete as red text until hovered. */
button, .button { border-color: var(--border); background: var(--panel); }
button:hover, .button:hover { background: var(--panel-soft); }
.primary, button.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.primary:hover, button.primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.danger-quiet { border-color: transparent; background: none; color: var(--danger); }
.danger-quiet:hover { border-color: #fecaca; background: #fef2f2; color: var(--danger); }

/* Desktop nav: plain items; the current section is accent text on a soft background. */
@media (min-width: 1041px) {
  .main-nav a, .main-nav a.nav-link-opter, .nav-dropdown summary, .nav-search button { border-color: transparent; background: none; box-shadow: none; font-weight: 600; border-radius: 8px; }
  .main-nav a:hover, .nav-dropdown summary:hover { background: var(--panel-soft); }
  .main-nav a[aria-current="page"], .nav-dropdown[data-nav-current="true"] > summary, .nav-dropdown[open] > summary { background: var(--accent-soft); color: var(--accent-dark); box-shadow: none; }
  .main-nav a.nav-link-opter { border-color: transparent !important; background: none; box-shadow: none; }
  .main-nav a.nav-link-opter[aria-current="page"] { background: var(--accent-soft); }
  .nav-search input { border-radius: 8px; }
  .settings-dropdown summary { border-color: transparent; background: none; color: inherit; box-shadow: none; }
  .nav-dropdown-menu { border-radius: 10px; }
  .nav-dropdown-menu a { border: 0; border-radius: 6px; background: none; font-weight: 500; }
  .nav-dropdown-menu a:hover { background: var(--panel-soft); }
}
.api-priority-secret-card, .api-priority-scania-card { border-color: var(--border); background: var(--panel); box-shadow: none; }
.check-row.destructive-check { padding: .2rem 0; border: 0; background: none; color: var(--danger); font-weight: 500; }

/* Käyttäjät rows (owner, 2026-11-10: "why a line per pill"): name and username on one line, role, 2FA and the
   password date on the next, the actions grouped on the right; the password form opens under the actions. */
.user-admin-row { grid-template-columns: minmax(0, 1fr) minmax(0, auto); gap: .4rem 1rem; align-items: center; }
.user-name-line, .user-meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; margin: 0; }
.user-name-line strong { font-size: 1rem; font-weight: 650; }
.user-meta-line { margin-top: .25rem; }
.user-meta-line .status-pill { min-height: 0; margin: 0; padding: .1rem .5rem; font-size: .75rem; }
.user-meta-line .hint { font-size: .8rem; }
.user-summary .attention-text { margin: .3rem 0 0; }
.user-admin-row .user-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .4rem; }
.user-admin-row .user-actions form { flex: 0 0 auto; margin: 0; }
.user-admin-row .user-actions button { width: auto; }
.user-admin-row .user-actions .user-password-change[open] { flex-basis: 100%; order: 3; }
.user-admin-row .user-actions .user-password-change[open] > summary { margin-bottom: .5rem; }
.user-admin-row .reset-password-form button { width: auto; }
@media (max-width: 760px) { .user-admin-row { grid-template-columns: minmax(0, 1fr); } .user-admin-row .user-actions { justify-content: flex-start; } }
.app-access-summary .inline-empty { padding: 0; border: 0; background: none; font-weight: 400; }

/* Buttons and fields use the page font too (the nav "Hae" was still bold Arial, off the line). */
button, input, select, textarea { font-family: inherit; }
@media (min-width: 1041px) {
  .main-nav .nav-search button { line-height: normal; font-weight: 600; }
  .main-nav a.nav-link-opter { padding-block: .34rem; }
}

/* Valikko: destinations as tiles, three or four to a row on a 1440 px screen; section headings span the row. */
.choose-greeting { margin: .1rem 0 0; text-transform: none; }
.choose-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: .6rem; align-items: stretch; }
.choose-tiles > .choose-destination-section, .choose-tiles .chooser-grid, .choose-tiles .choose-grid { display: contents; }
.choose-tiles .choice-card { height: 100%; margin: 0; }
.choose-tiles .choose-section-heading, .choose-tiles > p, .choose-tiles > .empty-state, .choose-tiles h2.sr-only { grid-column: 1 / -1; }
.choose-tiles .choose-section-heading { margin: .6rem 0 0; }
.choose-tiles > .choose-admin-section { display: contents; }
.choose-tiles .choice-card:has(> .choice-icon) { align-items: start; }
.choose-tiles .choice-card:has(> .choice-icon) > .choice-icon { align-self: start; margin-top: .1rem; }

/* Readable sizes (owner, 2026-11-10: "some text/fonts are a bit small"): nothing in the chrome below 13 px. */
.main-nav a, .nav-dropdown summary, .nav-search input, .nav-search button { font-size: .9375rem; }
.nav-dropdown-menu a, .settings-menu a, .settings-menu label { font-size: .9375rem; }
.nav-dropdown-label, .settings-menu-title { font-size: .75rem; }
.eyebrow { font-size: .75rem; }
.hint, .form-note, .settings-menu-note, .settings-menu-intro, .muted small { font-size: .875rem; }
.status-pill, .user-meta-line .status-pill { font-size: .8125rem; }
.user-meta-line .hint { font-size: .875rem; }
.required-label, .optional-label { font-size: .8125rem; }
.stat-card span { font-size: .8125rem; }
.choice-card p { font-size: .9375rem; }
.site-footer { font-size: .9375rem; }
@media (max-width: 1400px) { .main-nav a, .nav-dropdown summary, .nav-search input, .nav-search button { font-size: .84rem; } }

/* Työntekijät (2026-11-10 review): each person is one readable row; "Muokkaa" opens the edit form across the row. */
.employee-list-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: .4rem 1rem; padding: .55rem .75rem; border-radius: 10px; }
.employee-list-row + .employee-list-row { margin-top: .35rem; }
.employee-list-row > .employee-row-fields { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.employee-list-row > .employee-row-fields strong { font-weight: 600; }
.employee-list-row > .employee-row-fields span { color: var(--muted); font-size: .875rem; }
.employee-list-row > .employee-row-status { display: flex; align-items: center; gap: .5rem; font-size: .875rem; }
.employee-list-row > .employee-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .4rem; }
.employee-inline-edit > summary { list-style: none; }
.employee-inline-edit > summary::-webkit-details-marker { display: none; }
.employee-list-row:has(.employee-inline-edit[open]) > .employee-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
.employee-inline-edit[open] { flex-basis: 100%; }
.employee-edit-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem 1rem; align-items: end; margin-top: .5rem; padding: .75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-soft); }
.employee-edit-form .employee-row-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .6rem; }
.employee-edit-form .employee-row-fields label { font-size: .875rem; }
.employee-edit-form .employee-row-status { display: flex; align-items: center; gap: .6rem; }
.employee-edit-form .employee-row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem; }
.employee-edit-form .employee-row-actions-save, .employee-edit-form .employee-row-actions-main { gap: .4rem; }
.employee-fold > summary { list-style: none; display: inline-flex; }
.employee-fold > summary::-webkit-details-marker { display: none; }
.employee-fold[open] > summary { margin-bottom: .6rem; }
.employee-tools-card .employee-fold { margin-top: .6rem; }
@media (min-width: 900px) {
  .employee-filter-form { display: grid; grid-template-columns: minmax(0, 1fr) 11rem 11rem auto auto; align-items: end; gap: .6rem; }
  .employee-filter-form > button, .employee-filter-form > .button { width: auto; }
}
@media (min-width: 900px) {
  .employee-tools-card form.employee-filter-form.admin-search-form { display: grid; grid-template-columns: minmax(0, 1fr) 11rem 11rem auto auto; align-items: end; gap: .6rem; }
  .employee-tools-card form.employee-filter-form.admin-search-form > * { grid-column: auto; }
}
.employee-tools-card > .section-heading { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: .5rem; }
.employee-tools-card > .section-heading > div:first-child { margin-right: auto; }

/* Search tabs across the search pages (2026-11-10 review). */
.search-tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 .75rem; padding: .25rem; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.search-tabs a { display: inline-flex; align-items: center; min-height: 2.4rem; padding: 0 .9rem; border-radius: 8px; color: var(--text); font-weight: 600; text-decoration: none; }
.search-tabs a:hover { background: var(--panel-soft); }
.search-tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); }

/* Työvuorot ja tunnit (2026-11-11 review): one button size on the page, tool groups without boxes inside the box. */
.work-selection-inline .work-bulk-toolbar > .work-tool-section { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.work-selection-inline .work-bulk-toolbar button, .work-selection-inline .work-save-button { min-height: 2.5rem; font-size: .875rem; }
.work-selection-inline .status-pill { font-size: .8125rem; }
.work-upload-card button.primary { min-height: 2.5rem; font-size: .9375rem; }
.work-master-table .master-driver-col small { font-size: .75rem; }

/* Page-header counters (2026-11-11 review): four fit on one row on a wide screen, so the fourth no longer sits alone below. */
@media (min-width: 1100px) {
  .dashboard-hero .compact-status:has(> .stat-card:nth-child(4):last-child) { flex-basis: 620px; grid-template-columns: repeat(4, minmax(110px, 1fr)); }
  .dashboard-hero .employee-detail-status:has(> .stat-card:nth-child(4):last-child) { max-width: 38rem; }
  .dashboard-hero > div:first-child:has(+ .compact-status > .stat-card:nth-child(4):last-child) { flex: 1 1 20rem; }
}

/* Finnish file picker (js/file-picker.js): the real input lies transparent over the button and the file name. */
.file-pick { position: relative; display: flex; flex: 1 1 100%; align-items: center; gap: .75rem; min-width: 0; min-height: 2.5rem;
  padding: .25rem .7rem .25rem .25rem; border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--text); }
.file-pick > .file-pick-input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0;
  border: 0; opacity: 0; cursor: pointer; }
.file-pick-button { flex: none; min-height: 2.1rem; pointer-events: none; }
.file-pick:hover .file-pick-button { background: var(--button-hover-bg, #e2e8f0); }
.file-pick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.file-pick.has-file .file-pick-name { color: var(--text); font-weight: 700; }
.file-pick:has(> .file-pick-input:focus-visible) { outline: 3px solid #1d4ed8; outline-offset: 3px; box-shadow: 0 0 0 4px rgba(37, 99, 235, .18); }
.file-pick:has(> .file-pick-input[aria-invalid="true"]), .file-pick:has(> .file-pick-input:user-invalid) { border-color: var(--danger); background: #fff7f7; }
:root[data-portal-theme="dark"] .file-pick { background: #07111f; }

/* Finnish date picker (js/date-picker.js): text field "13.11.2026", one click opens the month calendar below it. */
.date-pick { position: relative; display: inline-flex; align-items: center; flex: 1 1 100%; width: 100%; min-width: 0; max-width: 100%; }
.date-pick > .date-pick-text { width: 100%; padding-right: 2.4rem; cursor: pointer; }
.date-pick > .date-pick-text:focus { cursor: text; }
.date-pick > .date-pick-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; min-height: 0; margin: 0; padding: 0;
  border: 0; opacity: 0; pointer-events: none; }
.date-pick-icon { position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 2rem;
  height: 2rem; min-height: 0; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); box-shadow: none; cursor: pointer; }
.date-pick-icon:hover { color: var(--text); background: var(--panel-soft); }
.date-pick.is-disabled .date-pick-icon { display: none; }
.date-pick:has(> .date-pick-native[aria-invalid="true"]) > .date-pick-text,
.date-pick:has(> .date-pick-native:user-invalid) > .date-pick-text { border-color: var(--danger); background: #fff7f7; }
.date-pick-calendar { position: absolute; top: calc(100% + .3rem); left: 0; z-index: 1200; display: grid; gap: .45rem;
  width: min(18.5rem, calc(100vw - 2rem)); padding: .6rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel, #fff); color: var(--text); box-shadow: 0 14px 34px rgba(15, 23, 42, .18); }
.date-pick-calendar.is-above { top: auto; bottom: calc(100% + .3rem); }
.date-pick-head { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.date-pick-head strong { font-size: .95rem; text-transform: capitalize; }
.date-pick-nav { min-height: 2.1rem; width: 2.1rem; padding: 0; font-size: 1.25rem; line-height: 1; }
.date-pick-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.date-pick-grid th { padding: .15rem 0; color: var(--muted); font-size: .75rem; font-weight: 800; text-align: center; text-transform: uppercase; }
.date-pick-grid td { padding: 1px; text-align: center; }
.date-pick-grid .date-pick-week { width: 2rem; font-size: .68rem; text-transform: lowercase; opacity: .8; }
.date-pick-grid tbody .date-pick-week { font-size: .72rem; font-weight: 700; }
.date-pick-day { width: 100%; min-height: 2.2rem; padding: 0; border: 1px solid transparent; border-radius: 7px; background: transparent;
  color: var(--text); font-weight: 700; box-shadow: none; }
.date-pick-day:hover:not(:disabled) { background: var(--panel-soft); border-color: var(--border); }
.date-pick-day.is-outside { color: var(--muted); opacity: .55; }
.date-pick-day.is-today { border-color: #93c5fd; }
.date-pick-day.is-selected { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.date-pick-day:disabled { opacity: .3; cursor: not-allowed; }
.date-pick-foot { display: flex; flex-wrap: wrap; gap: .35rem; }
.date-pick-quick { min-height: 2.1rem; padding: .3rem .7rem; font-size: .88rem; }
.date-pick-quick.is-clear { margin-left: auto; }
.date-pick-typed { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; width: 100%; min-height: 2.6rem;
  padding: .45rem .75rem; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); box-shadow: none; text-align: left; }
.date-pick-typed strong { font-size: 1.05rem; }
.date-pick-typed span { color: var(--muted); font-size: .8rem; font-weight: 700; }
.date-pick-typed:hover { background: var(--panel-soft); }
.date-pick-typing { display: flex; gap: .35rem; }
.date-pick-typing .date-pick-type { flex: 1 1 auto; min-width: 0; font-size: 1.05rem; }
.date-pick-typing .date-pick-type[aria-invalid="true"] { border-color: var(--danger); }
.date-pick-ok { min-height: 2.5rem; padding: 0 .9rem; }
.time24 .date-pick { flex: 0 1 10em; width: 10em; }
:root[data-portal-theme="dark"] .date-pick-calendar { background: #0f1b2d; border-color: #29405f; }
:root[data-portal-theme="dark"] .date-pick-day.is-selected { background: #2563eb; border-color: #2563eb; }
