/* Tidsregistrering – mobil først. Farver fra planen: markgrøn + maskingul. */
:root {
  --bg: #F3F5EE; --surface: #FFFFFF; --fg: #1D2318; --muted: #5E6656; --line: #D9DDD0;
  --green: #2E6A3B; --green-soft: #E3EEDF; --yellow: #E6AE0B; --yellow-soft: #FBF0CC;
  --red: #B4412E; --red-soft: #F6E1DC; --blue: #2D5E8A; --blue-soft: #E0EAF3; --on-color: #FFFFFF;
  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141812; --surface: #1C2119; --fg: #E7EBE1; --muted: #A1A996; --line: #33392E;
    --green: #6FB57A; --green-soft: #22331F; --yellow: #F0C232; --yellow-soft: #3A3115;
    --red: #E8846F; --red-soft: #3A221D; --blue: #86B4DE; --blue-soft: #1C2A37; --on-color: #141812;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; line-height: 1.1; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.label { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

/* Ramme */
#app { min-height: 100%; display: flex; flex-direction: column; }
header.top { position: sticky; top: 0; z-index: 1000; background: var(--fg); color: var(--bg);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
header.top .brand { font-family: var(--display); font-weight: 700; font-size: 1.2rem; letter-spacing: .02em; }
header.top .who { font-size: .85rem; opacity: .8; display: flex; gap: 10px; align-items: center; }
header.top button { background: none; border: 1px solid currentColor; border-radius: 8px; padding: 4px 10px; cursor: pointer; color: inherit; }
main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 96px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; }
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom, 0px); }
nav.tabs a { flex: 1; max-width: 160px; text-align: center; padding: 10px 4px 12px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .85rem; display: flex; flex-direction: column; align-items: center; gap: 2px; }
nav.tabs a svg { width: 22px; height: 22px; }
nav.tabs a.on { color: var(--green); }

/* Kort / flader */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }

/* Knapper */
.btn { border: 0; border-radius: var(--radius); padding: 14px 16px; font-family: var(--display); font-size: 1.2rem; font-weight: 700; letter-spacing: .03em; cursor: pointer; text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn.green { background: var(--green); color: var(--on-color); }
.btn.yellow { background: var(--yellow); color: #1D2318; }
.btn.red { background: var(--red); color: var(--on-color); }
.btn.outline { background: transparent; border: 2px solid var(--blue); color: var(--blue); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--fg); font-family: var(--body); font-size: .95rem; font-weight: 600; min-height: 40px; padding: 8px 12px; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .95rem; }
.btn.block { width: 100%; }

/* Formularer */
label.f { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 600; }
input[type=text], input[type=password], input[type=search], input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 11px 12px; min-height: 46px; }
textarea { min-height: 70px; resize: vertical; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 12px 4px; font-weight: 700; cursor: pointer; min-height: 48px; }
.seg button.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* Mark-vælger */
.picker { position: relative; }
.picker .list { position: absolute; z-index: 900; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; max-height: 280px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.picker .list button { display: flex; justify-content: space-between; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 12px; cursor: pointer; gap: 8px; }
.picker .list button:hover, .picker .list button:focus { background: var(--green-soft); }
.chosen { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--green-soft); }

/* Status */
.clock { border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); }
.clock.running { background: var(--green-soft); border-color: transparent; }
.clock.paused { background: var(--yellow-soft); border-color: transparent; }
.clock .big { font-family: var(--mono); font-size: 2.6rem; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pill { font-family: var(--mono); font-size: .72rem; padding: 3px 9px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.st-aaben { background: var(--line); color: var(--fg); }
.st-indsendt { background: var(--blue-soft); color: var(--blue); }
.st-retur { background: var(--red-soft); color: var(--red); }
.st-godkendt { background: var(--green-soft); color: var(--green); }
.st-koerer { background: var(--yellow-soft); color: var(--fg); }

/* Lister */
.entry { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.entry:first-of-type { border-top: 0; }
.entry .t { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.entry .actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.notice { border-left: 4px solid var(--red); background: var(--red-soft); padding: 8px 12px; border-radius: 6px; font-size: .92rem; }
.notice.info { border-color: var(--blue); background: var(--blue-soft); }
.notice.warn { border-color: var(--yellow); background: var(--yellow-soft); }
.daysum { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
table.t { border-collapse: collapse; width: 100%; font-size: .92rem; }
table.t th, table.t td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; }
.chk { width: 22px; height: 22px; accent-color: var(--green); }

/* Kortside */
.map-wrap { position: relative; height: calc(100dvh - 190px); min-height: 360px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
#map { position: absolute; inset: 0; }
.map-tools { position: absolute; z-index: 800; top: 10px; left: 10px; right: 10px; display: flex; gap: 8px; }
.map-tools .picker { flex: 1; }
.legend { position: absolute; z-index: 800; bottom: 10px; left: 10px; background: var(--surface); border-radius: 8px; padding: 6px 10px; font-size: .78rem; display: flex; gap: 10px; flex-wrap: wrap; border: 1px solid var(--line); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.leaflet-popup-content { font-family: var(--body); margin: 12px 14px; }
.leaflet-popup-content .btn { min-height: 40px; font-size: 1rem; padding: 8px 12px; }

/* Dialog */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--fg); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog .dlg { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 2000; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; max-width: calc(100vw - 32px); }
.toast.err { background: var(--red); color: #fff; }

/* Login */
.login { max-width: 380px; margin: 8vh auto 0; width: 100%; }
.login h1 { font-size: 2.4rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.cap::first-letter { text-transform: uppercase; }
.map-tools .btn.ghost, .map-tools input { background: var(--surface); }
.stepper { display: flex; gap: 6px; align-items: center; }
.stepper input[type=time] { flex: 1; min-width: 92px; text-align: center; font-family: var(--mono); font-size: 1.1rem; }
.stepper input[type=date] { width: auto; flex: 0 0 auto; }
.stepper .btn.small { min-width: 44px; min-height: 46px; padding: 6px 4px; font-family: var(--mono); }
@media (max-width: 420px) { .stepper { flex-wrap: wrap; } .stepper input[type=date] { flex-basis: 100%; } }
.sumline { background: var(--green-soft); border-radius: 10px; padding: 10px 12px; }
/* Sprogvalg */
.langsel { width: auto; min-height: 32px; padding: 3px 6px; border-radius: 8px; background: transparent; color: inherit; border: 1px solid currentColor; font-size: .85rem; }
.langsel option { color: #1D2318; background: #fff; }
.langrow { display: flex; flex-wrap: wrap; gap: 6px; }
.langrow button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600; min-height: 36px; }
.langrow button.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
@media (max-width: 420px) { header.top .uname { display: none; } }
/* Madbestilling */
.mealcard { border-left: 4px solid var(--yellow); }
.stat { flex: 1; min-width: 80px; background: var(--bg); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.stat b { font-size: 1.6rem; }
.eligible { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
/* Flag ved sprogvalg */
.flag { display: inline-block; width: 22px; height: 15px; border-radius: 2px; overflow: hidden; flex: 0 0 auto; box-shadow: 0 0 0 1px rgba(255,255,255,.5); }
.flag svg { width: 100%; height: 100%; display: block; }
.langwrap { display: inline-flex; align-items: center; gap: 6px; border: 1px solid currentColor; border-radius: 8px; padding: 0 0 0 8px; cursor: pointer; }
.langwrap .langsel { border: 0; padding-left: 2px; }
.langrow button { display: inline-flex; align-items: center; gap: 8px; }
.langrow .flag { box-shadow: 0 0 0 1px var(--line); }
