/* SafeWay Logistik – interface styles
   Brand colours are taken from the logo: blue (text) and the red-to-orange gradient (icon). */

:root {
  --blue: #122ad2;
  --blue-dark: #0c1e9e;
  --blue-tint: #eef0fd;
  --orange-1: #ee4337;
  --orange-2: #f3703a;
  --orange-3: #faac41;

  --ink: #0f0b10;
  --ink-2: #4a4750;
  --muted: #6b6873;
  --bg: #f6f6fa;
  --surface: #ffffff;
  --line: #e4e4ee;
  --line-strong: #c9c9d8;

  --good: #1b6b3f;
  --good-bg: #e8f5ee;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --bad-ink: #8c1d18;

  --radius: 14px;
  --radius-sm: 8px;
  --gutter: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: 1.0625rem; line-height: 1.3; font-weight: 650; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- header */

.strip {
  height: 4px;
  background: linear-gradient(90deg, var(--orange-1), var(--orange-2), var(--orange-3));
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 68px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.brand { display: inline-flex; flex: none; }
.brand img { display: block; height: 44px; width: auto; }

.main-nav { display: flex; gap: 4px; }
.main-nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 550;
}
.main-nav a:hover { background: var(--blue-tint); color: var(--blue); text-decoration: none; }
.main-nav a.is-active { background: var(--blue-tint); color: var(--blue); font-weight: 650; }

/* Hamburger button that opens the nav as a dropdown on narrow screens.
   Hidden on wider screens, where the nav already shows inline above. */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.nav-toggle:hover { background: var(--blue-tint); border-color: #b9c0f3; }
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; transition: transform 0.15s ease, top 0.15s ease; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { top: 0; transform: rotate(-45deg); }

.header-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.lang button {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 5px 10px;
  border: 0;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.lang button + button { border-left: 1px solid var(--line-strong); }
.lang button:hover { background: var(--blue-tint); }
.lang button.is-on { background: var(--blue); color: #fff; }

.user { display: flex; align-items: center; gap: 10px; }
.user form { margin: 0; }
.user-name { font-weight: 600; font-size: 0.9375rem; }
.link-quiet { color: var(--ink-2); font-size: 0.875rem; }

.is-login .brand,
.is-login .main-nav { display: none; }

/* ------------------------------------------------------------------ page */

.page { flex: 1; padding-top: 28px; padding-bottom: 48px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head .muted { margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.section-gap { margin-top: 20px; }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card > h2 + .small { margin-top: 2px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.card > h2 { margin-bottom: 4px; }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 20px;
  align-items: start;
}
.grid-2.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.link { font-weight: 600; font-size: 0.9375rem; }
.link-plain { color: var(--ink); font-weight: 550; }

.empty { color: var(--muted); padding: 16px 0 4px; }
.empty-state {
  text-align: center;
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.note {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

/* ----------------------------------------------------------- stat tiles */

.tiles {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  color: var(--ink);
}
a.tile:hover { text-decoration: none; border-color: var(--line-strong); }
.tile-hero { background: var(--blue-tint); border-color: #d9ddfa; }
a.tile-hero:hover { border-color: #b9c0f3; }

.tile-label { color: var(--ink-2); font-size: 0.9375rem; font-weight: 550; }
.tile-value {
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.tile-value-hero { font-size: 3.5rem; letter-spacing: -0.03em; }

/* ------------------------------------------------ department bar chart */

.bars { margin-top: 12px; }

.bar-row {
  display: grid;
  grid-template-columns: minmax(96px, 30%) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: var(--radius-sm);
  color: var(--ink);
}
.bar-row:hover,
.bar-row:focus-visible { background: var(--bg); text-decoration: none; }

.bar-label {
  font-size: 0.9375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plot {
  position: relative;
  height: 28px;
  margin-right: 88px;              /* room for the value at the bar tip */
  border-left: 1px solid var(--line-strong);
}
.bar {
  position: absolute;
  left: 0;
  top: 4px;
  height: 20px;                    /* thin bars, never fill the row */
  width: calc(var(--w) * 1%);
  background: var(--blue);
  border-radius: 0 4px 4px 0;      /* rounded data end, square at the baseline */
}
.bar-value {
  position: absolute;
  left: calc(var(--w) * 1%);
  top: 50%;
  transform: translateY(-50%);
  padding-left: 8px;
  display: flex;
  gap: 6px;
  align-items: baseline;
  white-space: nowrap;
  font-size: 0.9375rem;
}
.bar-value .muted { font-size: 0.8125rem; }

.twin { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.twin summary {
  cursor: pointer;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 2px 0;
}
.twin[open] summary { margin-bottom: 8px; }

/* --------------------------------------------------------- people lists */

.avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue-tint);
  color: var(--blue-dark);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.25rem; }

.people { list-style: none; margin: 8px 0 0; padding: 0; }
.people li + li { border-top: 1px solid var(--line); }
.people a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  color: var(--ink);
}
.people a:hover { text-decoration: none; }
.people a:hover strong { color: var(--blue); }
.person { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.person strong { font-weight: 600; }
.person .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.person-head { display: flex; align-items: center; gap: 16px; }

/* --------------------------------------------------------------- tables */

.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th {
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th.num { text-align: right; }
.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--ink); text-decoration: underline; }
.sort-link.is-active { color: var(--blue); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-list tbody tr:hover td { background: #fafaff; }
.table-compact th, .table-compact td { padding-left: 0; padding-right: 0; }
.table-compact td { padding-top: 9px; padding-bottom: 9px; }
.table-compact th:last-child, .table-compact td:last-child { padding-left: 16px; }

.table-card { padding: 4px 6px; overflow-x: auto; }

.person-link { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.person-link:hover { text-decoration: none; }
.person-link:hover strong { color: var(--blue); }
.only-narrow { display: none; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eeeef3;
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-good { background: var(--good-bg); color: var(--good); }

/* -------------------------------------------------------------- filters */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 14px;
  margin-bottom: 16px;
  padding: 16px 20px;
}
.filters .field { margin: 0; min-width: 160px; }
.filters .field.grow { flex: 1 1 240px; }
.filter-actions { display: flex; gap: 8px; }

.col-picker { position: relative; }
.col-picker summary { list-style: none; cursor: pointer; }
.col-picker summary::-webkit-details-marker { display: none; }
.col-picker-menu {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-width: 180px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.col-picker-menu .check span { font-weight: 400; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

/* ---------------------------------------------------------------- forms */

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}
.req { color: var(--bad); }

input[type="text"], input[type="email"], input[type="url"], input[type="tel"],
input[type="number"], input[type="date"], input[type="search"], input[type="password"],
select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  height: 42px;
  line-height: 1.25;
}
textarea { height: auto; min-height: 84px; }
input:hover, select:hover, textarea:hover { border-color: #a9a9c0; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 0;
  border-color: var(--blue);
}
input[aria-invalid="true"], .field.has-error input { border-color: var(--bad); }

.form { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--blue); }
.check span { font-weight: 600; color: var(--ink); font-size: 0.9375rem; }

.errorlist {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  color: var(--bad-ink);
  font-size: 0.875rem;
  font-weight: 550;
}
.errorlist li::before { content: "! "; font-weight: 800; }

.alert {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-weight: 550;
}
.alert-bad { background: var(--bad-bg); color: var(--bad-ink); border: 1px solid #f3c3bf; }
.alert .errorlist { margin: 0; }

/* -------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  padding: 10px 18px;
  min-height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: 0.875rem; }
.btn .icon { flex: none; }
.btn-sm .icon { width: 14px; height: 14px; }
.card-head .actions { justify-content: flex-end; }
.btn-block { width: 100%; }

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }

.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg); }

.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: var(--bad-ink); }
.btn-danger-ghost { background: var(--surface); color: var(--bad); border-color: #e7b3af; }
.btn-danger-ghost:hover { background: var(--bad-bg); }

.is-disabled { opacity: 0.5; pointer-events: none; }

/* ------------------------------------------------------------- key/value */

.facts { margin: 8px 0 0; }
.facts > div {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.facts > div:first-child { border-top: 0; }
.facts dt { color: var(--muted); font-size: 0.9375rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.confirm { max-width: 620px; display: grid; gap: 12px; }
.confirm .note { margin-top: 0; }
.confirm-name { font-size: 1.25rem; font-weight: 700; }

/* ------------------------------------------------------------- messages */

.messages { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; }
.message {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--good-bg);
  color: var(--good);
  border: 1px solid #c5e5d2;
  font-weight: 600;
}
.message.error { background: var(--bad-bg); color: var(--bad-ink); border-color: #f3c3bf; }
.message-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 50%;
  flex: none;
  font-size: 0.6875rem;
  font-weight: 800;
  line-height: 1;
}

/* --------------------------------------------------------------- login */

.login { display: flex; justify-content: center; padding-top: 24px; }
.login-card { width: 100%; max-width: 420px; padding: 28px; }
.login-logo { display: block; width: 220px; max-width: 100%; height: auto; margin: 0 0 20px; }
.login-card h1 { font-size: 1.5rem; }
.login-card .muted { margin: 4px 0 20px; }

.login-extra { margin: 14px 0 0; text-align: center; font-size: 0.9375rem; }
.passkey-box { margin-top: 18px; }
.passkey-box .or { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: 0.875rem; }
.passkey-box .or::before, .passkey-box .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.passkey-hint { margin: 14px 0 0; text-align: center; }
.passkey-hint[hidden] { display: none; }
.passkey-status { margin: 10px 0 0; min-height: 1.4em; }
.passkey-box[hidden], form[data-passkey-add][hidden] { display: none; }

/* --------------------------------------------------------------- footer */

.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  padding-bottom: 14px;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* ----------------------------------------------------------- responsive */

@media (max-width: 960px) {
  .col-email { display: none; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile-hero { grid-column: 1 / -1; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  h1 { font-size: 1.5rem; }

  .header-bar { flex-wrap: nowrap; gap: 8px 12px; padding-bottom: 6px; position: relative; }
  .brand img { height: 34px; }
  .header-tools { gap: 10px; }
  .user-name, .link-quiet, .user .avatar { display: none; }

  .nav-toggle { display: inline-flex; }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    flex-direction: column;
    gap: 2px;
    margin-top: 1px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 16px 32px rgba(15, 11, 16, 0.16);
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { border-radius: var(--radius-sm); padding: 12px 14px; border-bottom: 0; }
  .main-nav a.is-active { background: var(--blue-tint); color: var(--blue); border-bottom: 0; }
  .main-nav a:hover { background: var(--blue-tint); }

  .page { padding-top: 20px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn, .actions .btn { flex: 1; }

  .col-job, .col-dept, .col-date { display: none; }
  .only-narrow { display: block; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .facts > div { grid-template-columns: 1fr; gap: 2px; }
  .grid-2.equal { grid-template-columns: minmax(0, 1fr); }
  .filters .field { flex: 1 1 100%; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1; }
  .login-card { padding: 22px; }
}

@media (max-width: 480px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px; gap: 8px; }
  .tile-label { font-size: 0.8125rem; line-height: 1.3; }
  .tile-hero { padding: 16px; }
  .tile-hero .tile-label { font-size: 0.9375rem; }
  .tile-value-hero { font-size: 3rem; }
  .main-nav a { padding: 12px 10px; font-size: 0.9375rem; }
  .bar-row { grid-template-columns: minmax(0, 1fr); gap: 2px; padding-top: 8px; padding-bottom: 8px; }
  .plot { margin-right: 76px; }
  .table-compact th { white-space: normal; }
  .table-compact { font-size: 0.8125rem; }
  .table-compact th { hyphens: auto; }
  .card-head { flex-wrap: wrap; }
  .card-head .actions { justify-content: flex-start; }
  .card-head .actions .btn { flex: none; }
  .table-compact th:last-child, .table-compact td:last-child { padding-left: 8px; }
  .table-compact td.num, .table-compact th.num { padding-left: 8px; }
}

@media print {
  .site-header, .site-footer, .strip, .actions, .filters, .pager { display: none; }
  body { background: #fff; }
}

/* ------------------------------------------- documents, payroll, warnings */

[hidden] { display: none !important; }
.block { display: block; }

.card-alert { margin-bottom: 20px; border-color: #f0d9a8; background: #fffdf7; }

.badge-warn { background: #fff1d1; color: #7a4a00; }
.badge-bad { background: var(--bad-bg); color: var(--bad-ink); }

.link-danger { color: var(--bad); margin-left: 12px; }
.file-link { white-space: nowrap; }
.table-compact td:not(:last-child) { padding-right: 14px; }
.table-compact th:not(:last-child) { padding-right: 14px; }
.expiry { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.table-scroll { overflow-x: auto; }

.chip {
  display: inline-block;
  margin: 2px 6px 2px 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--blue-tint);
  color: var(--ink);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.field-hint { margin-top: 6px; color: var(--muted); font-size: 0.8125rem; }
.form-section { margin: 12px 0 2px; }

input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: #fafaff;
}
input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  margin-right: 12px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
textarea { resize: vertical; }

.hours { margin: 12px 0 10px; max-width: 520px; }
.hours-head,
.hours-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 88px;
  gap: 10px;
  align-items: start;
}
.hours-head {
  padding-bottom: 6px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
}
.hours-row .field { margin-bottom: 10px; }
.hours-remove { align-self: center; margin-bottom: 10px; }
.hours-remove span { font-weight: 500; font-size: 0.875rem; color: var(--bad-ink); }
.hours-errors { grid-column: 1 / -1; margin-top: -6px; margin-bottom: 8px; }
.hours-errors:empty { display: none; }
[data-add-row] { margin-bottom: 8px; }

.invoice-items-table th:nth-child(1) { width: 44%; }
.invoice-items-table input[type="text"],
.invoice-items-table input[type="number"] { width: 100%; }
.invoice-items-table td .errorlist { margin-top: 4px; }
.invoice-item-remove {
  display: inline-flex; align-items: center; white-space: nowrap;
  background: none; border: 0; padding: 4px 2px; cursor: pointer;
  font-weight: 500; font-size: 0.8125rem; color: var(--bad-ink);
}
.invoice-item-remove:hover { text-decoration: underline; }
.new-client-fields {
  margin: 4px 0 18px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.new-client-fields .form-grid { margin-top: 8px; }
.invoice-totals { max-width: 320px; margin-left: auto; }
.invoice-totals .facts > div { grid-template-columns: 1fr auto; }
.invoice-totals .grand-total dt,
.invoice-totals .grand-total dd { font-weight: 700; font-size: 1.0625rem; }

@media (max-width: 720px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { padding: 3px 0 !important; border: 0; text-align: left !important; }
  .table-stack td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
  }
  .table-stack td:last-child { padding-top: 8px !important; }
  .hours-head, .hours-row { grid-template-columns: minmax(0, 1fr) 104px; }
  .hours-remove, .hours-row .hours-remove { grid-column: 1 / -1; margin-top: -4px; }
  .col-note { display: none; }
  .link-danger { margin-left: 8px; }
  .hours { max-width: none; }
  .invoice-totals { max-width: none; }
}

/* small screens: rules that must come after the base rules above */
@media (max-width: 720px) {
  .table-stack td.col-date, .table-stack td.col-note { display: none; }
}
@media (max-width: 480px) {
  .people a { flex-wrap: wrap; }
  .expiry {
    flex-basis: 100%;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding-left: 48px;
    text-align: left;
  }
}

.form > .errorlist { margin: 0 0 14px; }

/* ------------------------------------------------------- license plates */
/* A small styled German plate: blue EU band (stars + "D") plus the plate
   number, in place of plain text - scoped class names (plate-eu/plate-num,
   not eu/num) so this never collides with the existing .num utility class
   used for right-aligned table columns. */

.plate {
  display: inline-flex;
  align-items: stretch;
  height: 26px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
  vertical-align: middle;
  line-height: 1;
}
.plate-eu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 17px;
  padding: 2px 0;
  background: #1f4ba5;
  color: #fff;
  font-weight: 700;
  font-size: 0.5rem;
  line-height: 1.2;
}
.plate-eu i {
  font-style: normal;
  color: #f5cb2e;
  font-size: 0.5rem;
  letter-spacing: -1px;
  transform: scale(0.85, 1);
}
.plate-num {
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
}
.plate-big { height: 42px; border-width: 3px; border-radius: 6px; }
.plate-big .plate-eu { width: 27px; font-size: 0.6875rem; }
.plate-big .plate-eu i { font-size: 0.6875rem; }
.plate-big .plate-num { padding: 0 14px; font-size: 1.375rem; }

/* ------------------------------------------- driver app, daily check, fines */

.btn-big { min-height: 56px; font-size: 1.0625rem; }
.center-text { text-align: center; margin-top: 8px; }
.section-gap-sm { margin-top: 10px; }
.plain-list { list-style: none; margin: 8px 0 0; padding: 0; }
.plain-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.plain-list li:first-child { border-top: 0; }

.driver-car-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.driver-car-head .muted { margin-bottom: 4px; }
.check-done {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 10px;
  border-radius: var(--radius-sm);
  background: var(--good-bg); color: var(--good); border: 1px solid #c5e5d2;
}

.check-vehicle { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.check-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.check-items { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.check-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-top: 1px solid var(--line);
}
.check-item:first-child { border-top: 0; }
.check-item.is-ok { background: var(--good-bg); }
.check-item.is-bad { background: var(--bad-bg); }
.check-label { font-weight: 550; }
.seg { display: inline-flex; flex: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg label { position: relative; margin: 0; cursor: pointer; }
.seg label + label { border-left: 1px solid var(--line-strong); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-flex; align-items: center; justify-content: center; min-width: 76px; min-height: 42px; padding: 0 12px; font-weight: 650; font-size: 0.9375rem; color: var(--ink-2); }
.seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: -2px; }
.seg-ok input:checked + span { background: var(--good); color: #fff; }
.seg-bad input:checked + span { background: var(--bad); color: #fff; }

.tabs-inline { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs-inline a { padding: 8px 14px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-inline a:hover { text-decoration: none; color: var(--blue); }
.tabs-inline a.is-active { color: var(--blue); border-bottom-color: var(--blue); }

.who { font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin: 8px 0 4px; }
.result-card.is-none { border-color: #f3c3bf; background: #fffafa; }
.reply-text {
  width: 100%; min-height: 240px; margin-top: 12px; padding: 12px 14px;
  font: inherit; font-size: 0.9375rem; line-height: 1.5; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); resize: vertical;
}

@media (max-width: 480px) {
  .check-item { flex-direction: column; align-items: stretch; gap: 8px; }
  .seg { width: 100%; }
  .seg label { flex: 1; }
  .seg span { width: 100%; }
}

/* narrow phones: keep logo, menu button, language switch and sign-out on one line */
@media (max-width: 480px) {
  .header-bar { gap: 8px; }
  .brand img { height: 28px; }
  .header-tools { gap: 8px; }
  .lang button { padding: 5px 8px; }
  .user .btn-sm { padding: 6px 10px; }
}

.footer-links { display: inline-flex; gap: 16px; }
.footer-links a { color: var(--ink-2); }

/* Wide screens: slightly tighter nav links so all sections fit on one line. */
@media (min-width: 1101px) {
  .main-nav a { padding: 8px 10px; }
}

/* Tablets and small laptops: the full nav doesn't fit next to the logo and the
   user tools, so it becomes the same dropdown as on phones. */
@media (max-width: 1100px) {
  .header-bar { flex-wrap: nowrap; position: relative; }
  .nav-toggle { display: inline-flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    flex-direction: column;
    gap: 2px;
    margin-top: 1px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 16px 32px rgba(15, 11, 16, 0.16);
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { border-radius: var(--radius-sm); padding: 12px 14px; }
}

/* scanning a fine letter */
.scan-box { margin-bottom: 16px; border-color: #d9ddfa; background: var(--blue-tint); }
.scan-box h2 { margin-bottom: 4px; }
.scan-status { margin: 10px 0 0; font-weight: 600; }
.scan-status:empty { display: none; }
.scan-status.is-busy { color: var(--ink-2); }
.scan-status.is-ok { color: var(--good); }
.scan-status.is-warn { color: #7a4a00; }
.scan-status.is-bad { color: var(--bad-ink); }
input.is-filled, select.is-filled, textarea.is-filled { background: #fff8d6; border-color: #e0c24a; }
.scan-box .form-actions { position: relative; }
.scan-box input[type="file"] { position: absolute; left: 0; top: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; overflow: hidden; }
