@font-face { font-family: Archivo; src: url(/assets/archivo-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Archivo; src: url(/assets/archivo-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: Archivo; src: url(/assets/archivo-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --ink: #0e1621; --ink-2: #364152; --muted: #5d6878; --line: #e2e6eb; --paper: #fff; --mist: #f2f4f6; --mist-2: #e8ecf0;
  --accent: #1d4ed8; --accent-strong: #1a3fae; --accent-tint: #e8eefc; --ok: #15803d; --ok-tint: #e5f4ea;
  --bad: #b91c1c; --bad-tint: #fdecec; --warn: #a16207; --warn-tint: #fdf4dc;
  --radius: 12px; --side: 220px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 Archivo, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--mist); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.icon { width: 18px; height: 18px; flex: none; }

/* shell */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; background: var(--ink); color: #c9d1dc; }
.brand { display: block; padding: 4px 10px 18px; color: #fff; font-weight: 700; font-size: 17px; }
.brand:hover { text-decoration: none; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #c9d1dc; font-weight: 500; }
.nav:hover { background: #172231; text-decoration: none; color: #fff; }
.nav.on { background: #263345; color: #fff; }
.who { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; font-size: 13px; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .iconbtn { color: #c9d1dc; }
.main { padding: 28px clamp(16px, 3vw, 40px) 60px; max-width: 1400px; width: 100%; min-width: 0; }
.solo { min-height: 100vh; display: grid; place-items: center; padding: 20px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: auto 0 0 0; top: auto; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
  .brand, .who { display: none; }
  .side nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; }
  .main { padding: 18px 14px 96px; }
}

/* page header */
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { margin-right: auto; }
.top .iconbtn + h1 { margin-right: 0; }
.top .pill { margin-right: auto; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: #c8cfd8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 0; background: none; color: var(--ink); cursor: pointer; }
.iconbtn:hover { background: var(--mist-2); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.toolbar { margin-bottom: 16px; }

/* cards, rows */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
details.card summary { cursor: pointer; font-weight: 600; }
details.card[open] summary { margin-bottom: 14px; }
.block { margin-bottom: 24px; }
.block > h2 { margin-bottom: 10px; }
.sub { font-size: 15px; font-weight: 600; margin: 4px 0 12px; }
.rows { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rows.plain { border: 0; border-radius: 0; margin-bottom: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.row:last-child { border-bottom: 0; }
a.row:hover { background: #f8f9fb; text-decoration: none; }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; flex: none; }
.empty { color: var(--muted); padding: 8px 2px; }
.lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 20px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--mist-2); color: var(--ink-2); }
.pill.s-booket { background: var(--accent-tint); color: var(--accent-strong); }
.pill.s-udleveret { background: var(--accent); color: #fff; }
.pill.s-afleveret, .pill.s-annulleret { background: var(--mist-2); color: var(--muted); }
.pill.s-late { background: var(--bad-tint); color: var(--bad); }
.pill.s-free { background: var(--ok-tint); color: var(--ok); }

/* facts */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 24px; margin: 0; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; }
.feats { margin: 14px 0 0; padding-left: 18px; color: var(--ink-2); }
.notes { white-space: pre-wrap; margin: 0; }
.log { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.log li { display: flex; flex-direction: column; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.log li:last-child { border-bottom: 0; }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid #cfd6df; border-radius: 9px; padding: 9px 11px; min-height: 42px; width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.grid2, .grid3 { display: grid; gap: 14px; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid3 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; min-height: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0; }
legend { font-weight: 600; padding: 0 6px; }
.error { margin: 0; padding: 10px 14px; border-radius: 9px; background: var(--bad-tint); color: var(--bad); font-weight: 500; }
.hint { margin: -6px 0 0; font-size: 13px; color: var(--muted); }
.suggest { margin: -4px 0 0; min-height: 1.4em; color: var(--ink-2); }
.suggest .bad { color: var(--bad); font-weight: 600; }
.suggest button { margin-left: 8px; }
.searchbar { margin-bottom: 12px; }
.searchbar input { max-width: 520px; }
.inline { display: flex; gap: 10px; }
.inline input { max-width: 320px; }
.invite { margin-bottom: 12px; }
.invite p { margin: 0 0 6px; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; overflow-x: auto; }
.tab { padding: 6px 12px; border-radius: 99px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.tab:hover { background: var(--mist-2); text-decoration: none; }
.tab.on { background: var(--ink); color: #fff; }

.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 22px; }

/* contract preview and signing */
.contract h3 { font-size: 18px; }
.contract h4 { font-size: 14px; margin: 16px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.contract p { margin: 4px 0; }
.contract ol { margin: 0; padding-left: 20px; }
.contract li { margin-bottom: 4px; }
.pairs { display: grid; gap: 4px; margin: 0; }
.pairs div { display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.pairs dt { color: var(--muted); }
.pairs dd { margin: 0; }
.contract-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; max-height: 50vh; overflow: auto; }
.contract-preview summary { cursor: pointer; font-weight: 600; }
.sign { display: flex; flex-direction: column; gap: 6px; }
.sign > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.sign canvas { width: 100%; max-width: 600px; aspect-ratio: 3 / 1; border: 1px dashed #9aa5b3; border-radius: 10px; background: #fbfcfd; touch-action: none; }
.sign .btn { align-self: flex-start; }

.licence, .carphoto { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin-bottom: 12px; }
.upload { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.btn.file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.upload .preview { flex-basis: 100%; max-width: 100%; max-height: 240px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); order: -1; }

/* calendar */
.monthbar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.monthbar h2 { min-width: 150px; text-align: center; text-transform: capitalize; }
.timeline-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.timeline { display: grid; grid-template-columns: 170px repeat(var(--days), minmax(34px, 1fr)); grid-template-rows: 44px repeat(var(--rows), 46px); min-width: calc(170px + var(--days) * 34px); position: relative; }
.corner { grid-row: 1; grid-column: 1; position: sticky; left: 0; background: var(--paper); z-index: 3; border-bottom: 1px solid var(--line); }
.day { grid-row: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); }
.day span { font-size: 10px; font-weight: 500; color: var(--muted); text-transform: uppercase; }
.day.today { color: var(--accent); }
.carname { grid-column: 1; position: sticky; left: 0; z-index: 2; display: flex; flex-direction: column; justify-content: center; padding: 0 12px; background: var(--paper); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); color: var(--ink); min-width: 0; }
.carname strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carname span { font-size: 11px; color: var(--muted); }
.carname:hover { text-decoration: none; background: #f8f9fb; }
.cell { border-bottom: 1px solid var(--line); border-left: 1px solid #f0f2f5; }
.cell.weekend, .day.weekend { background: #fafbfc; }
.cell.today, .day.today { background: var(--accent-tint); }
.cell:hover { background: #eef2fb; }
.bar { z-index: 1; align-self: center; height: 30px; margin: 0 2px; padding: 0 8px; border-radius: 7px; display: flex; align-items: center; font-size: 12px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar:hover { text-decoration: none; filter: brightness(.96); }
.bar.s-booket { background: var(--accent-tint); color: var(--accent-strong); border: 1px solid #b9c9f5; }
.bar.s-udleveret { background: var(--accent); color: #fff; }
.bar.s-afleveret { background: var(--mist-2); color: var(--muted); }
.bar.s-late { background: var(--bad); color: #fff; }
@media (max-width: 820px) {
  .timeline { grid-template-columns: 110px repeat(var(--days), 34px); min-width: calc(110px + var(--days) * 34px); }
  .carname { padding: 0 8px; }
  .pairs div { grid-template-columns: 110px 1fr; }
}

.sitebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -10px 0 16px; padding: 9px 14px; border-radius: 10px; background: var(--accent-tint); color: var(--accent-strong); font-size: 14px; font-weight: 500; }
.sitebar.bad { background: var(--bad-tint); color: var(--bad); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 500; box-shadow: 0 8px 24px rgba(14,22,33,.18); animation: toast 4s forwards; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); animation-duration: 8s; }
@keyframes toast { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
@media (max-width: 820px) { .toast { bottom: 84px; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

dialog.confirm { max-width: 400px; width: calc(100vw - 32px); margin: auto; }
dialog.confirm p { margin: 0 0 16px; font-weight: 500; }
dialog::backdrop { background: rgba(14, 22, 33, .4); }

/* phones */
@media (max-width: 600px) {
  input, select, textarea { font-size: 16px; }
  h1 { font-size: 21px; }
  .card { padding: 16px 14px; }
  .row { flex-wrap: wrap; row-gap: 4px; padding: 12px 14px; }
  .row-main { flex: 1 1 0; }
  .row-side { display: contents; }
  .row-side > .small { flex-basis: 100%; text-align: left; }
  .grid3.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .timeline { grid-template-columns: 96px repeat(var(--days), 34px); min-width: calc(96px + var(--days) * 34px); }
  .carname strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 12px; line-height: 1.2; }
  .pairs div { grid-template-columns: 1fr; gap: 0; }
  .pairs div + div { margin-top: 6px; }
  .top .btn { min-height: 38px; padding: 7px 13px; }
  .actions .btn { flex: 1 1 auto; }
  .monthbar h2 { min-width: 0; padding: 0 6px; }
  .sign canvas { aspect-ratio: 2 / 1; }
}
