/* Layout: one column, tabs on top; a week view built around a yard of EUR pallets seen from above. */
:root {
  --bg: #f2f4f7; --panel: #ffffff; --fg: #15202d; --muted: #5d6a7c; --line: #dbe1e9;
  --grid: #e7ebf1; --axis: #aab4c2; --accent: #1f5fd1; --accent-ink: #ffffff; --wood: #c99d63;
  --ok: #1d8049; --warn: #a86d10; --bad: #c4372b; --chip: #e9eef6;
  --f-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 10px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0e131a; --panel: #17202a; --fg: #e7ecf3; --muted: #93a0b2; --line: #29333f;
  --grid: #222c38; --axis: #4b5767; --accent: #6f9cff; --accent-ink: #0e131a; --wood: #9c7b4f;
  --ok: #4cc27f; --warn: #e2aa4c; --bad: #ff6d60; --chip: #1f2a37; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0e131a; --panel: #17202a; --fg: #e7ecf3; --muted: #93a0b2; --line: #29333f;
  --grid: #222c38; --axis: #4b5767; --accent: #6f9cff; --accent-ink: #0e131a; --wood: #9c7b4f;
  --ok: #4cc27f; --warn: #e2aa4c; --bad: #ff6d60; --chip: #1f2a37; color-scheme: dark; }
/* The Artifact host's reset did these two. Without the first, .page { display: grid } shows every tab at once. */
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 15px; }
.app { max-width: 1120px; margin: 0 auto; padding-block: 20px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 20px; font-variant-numeric: tabular-nums; }
.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.brand { font-family: var(--f-display); font-weight: 700; font-size: 1.9rem; letter-spacing: .01em; margin: 0; line-height: 1; }
.konto { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--muted); font-size: .85rem; }
.konto .btn { white-space: nowrap; padding-inline: 8px; }
@media (max-width: 640px) { .konto { flex: 1 1 100%; } .tema { margin-left: auto; } }
.login { max-width: 22rem; }
.tema { display: inline-flex; gap: 2px; margin-left: 6px; padding: 3px; background: var(--chip); border-radius: 999px; min-height: 1.7rem; min-width: 6.2rem; box-sizing: border-box; }
.tema button { appearance: none; border: 0; background: none; color: var(--muted); width: 1.9rem; height: 1.7rem; padding: 0; display: grid; place-items: center; border-radius: 999px; cursor: pointer; }
.tema button:hover { color: var(--fg); }
.tema button[aria-pressed="true"] { background: var(--panel); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tema svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
a.btn { text-decoration: none; text-align: center; }
.brukerrad { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 8px 10px; border-radius: 8px; background: var(--bg); }
.brukerrad .n { flex: 1 1 10rem; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.brukerrad .v { min-width: 6.5rem; }
.brukerrad .s { min-width: 5rem; color: var(--muted); font-size: .85rem; }
.brukerrad .handling { display: flex; flex-wrap: wrap; gap: 2px; min-height: 2rem; min-width: 17rem; }
.brukerrad select { font: inherit; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--fg); }
.passord-nytt { font-family: ui-monospace, Consolas, monospace; font-size: 1.15rem; font-weight: 600; user-select: all; }
.brand small { font-weight: 500; color: var(--muted); font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; display: block; margin-top: 4px; font-family: var(--f-body); }
.tabs { display: flex; gap: 4px; background: var(--chip); padding: 4px; border-radius: 999px; overflow-x: auto; }
.tab { appearance: none; border: 0; background: none; color: var(--muted); font: 500 .92rem var(--f-body); padding: 8px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--fg); }
/* Wraps on a phone. In a scrolling row the last years would run past the edge of the card. */
.aarvalg { justify-self: start; flex-wrap: wrap; max-width: 100%; box-sizing: border-box; overflow: visible; border-radius: 20px; }
.periode { display: flex; gap: 10px; }
.periode .field select { font-size: .95rem; padding: 6px 10px; width: auto; }
.tab[aria-selected="true"], .tab[aria-pressed="true"] { background: var(--panel); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tab:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Each tab's id is also its #hash, and the browser scrolls to it on load, which would push the tabs out of view. */
.page { display: grid; gap: 16px; scroll-margin-top: 100vh; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 14px; min-width: 0; }
.card h2 { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: 1.3rem; letter-spacing: .01em; }
.note { margin: 0; color: var(--muted); font-size: .85rem; max-width: 70ch; }
.head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; }
.head h1 { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: 2.4rem; line-height: 1; }
.sub { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.weeknav { display: inline-flex; align-items: center; gap: 4px; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font: 500 .9rem var(--f-body); padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.btn:hover { border-color: var(--axis); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); padding: 6px 10px; }
.btn.ghost:hover { color: var(--fg); background: var(--chip); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.take { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0; font-size: 1rem; }
.pill { display: inline-flex; align-items: center; gap: .45em; padding: 3px 11px; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid currentColor; letter-spacing: .02em; }
.pill::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.none { color: var(--muted); }
.hero { display: grid; grid-template-columns: minmax(170px, 230px) 1fr; gap: 28px; align-items: center; }
@media (max-width: 640px) { .hero { grid-template-columns: 1fr; justify-items: center; } }
.ring { position: relative; width: 100%; max-width: 230px; aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px; }
.ring-pct { font-family: var(--f-display); font-weight: 700; font-size: 3.2rem; line-height: 1; }
.ring-pct span { font-size: .45em; color: var(--muted); }
.ring-of { color: var(--muted); font-size: .82rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: 12px; width: 100%; }
.stat { display: grid; gap: 2px; align-content: start; padding: 6px 12px; border-left: 3px solid var(--line); }
.stat.key { border-left-color: var(--accent); }
.stat.bad { border-left-color: var(--bad); }
.stat-l { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 500; }
.stat-v { font-family: var(--f-display); font-weight: 600; font-size: 2.1rem; line-height: 1.05; }
.stat-v small { font-family: var(--f-body); font-size: .85rem; font-weight: 400; color: var(--muted); margin-left: .3em; }
.stat-s { color: var(--muted); font-size: .8rem; }
.neg { color: var(--bad); } .pos { color: var(--ok); }
.yard { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.pallet { display: grid; gap: 4px; justify-items: center; }
.pallet svg { width: 100%; height: auto; display: block; }
.pallet-l { font-size: .75rem; color: var(--muted); }
.pallet.done .pallet-l { color: var(--fg); font-weight: 600; }
.pallet.next .pallet-l { color: var(--accent); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .45em; }
.legend i { width: .75rem; height: .75rem; border-radius: 50%; display: inline-block; }
.lg-on { background: var(--accent); } .lg-off { border: 1.3px solid var(--axis); } .lg-next { border: 1.6px solid var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 16px; }
.chart { position: relative; min-height: 240px; }
.chart svg { display: block; width: 100%; }
.chart text { font-family: var(--f-body); }
.tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.14); padding: 6px 10px; font-size: .8rem; white-space: nowrap; z-index: 3; }
.tip b { display: block; color: var(--muted); font-weight: 400; }
.empty { display: grid; place-items: center; min-height: 160px; color: var(--muted); font-size: .9rem; text-align: center; padding: 16px; border: 1px dashed var(--line); border-radius: var(--r); }
.tblwrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--muted); font-weight: 500; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.tbl tr.now td { background: color-mix(in srgb, var(--accent) 9%, transparent); font-weight: 600; }
.tbl input { width: 6.5em; text-align: right; font: inherit; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
.tbl input.saved { border-color: var(--ok); }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: 12px; align-items: end; }
.field { display: grid; gap: 5px; }
.field label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 500; }
.field input, .field select { font: 500 1.05rem var(--f-body); padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); min-width: 0; width: 100%; box-sizing: border-box; }
.total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; padding: 12px 14px; background: var(--chip); border-radius: 8px; }
.total b { font-family: var(--f-display); font-size: 2rem; font-weight: 700; line-height: 1; }
.msg { min-height: 1.3em; font-size: .88rem; margin: 0; }
.msg.ok { color: var(--ok); } .msg.err { color: var(--bad); }
.daylist { display: grid; gap: 6px; }
.dayrow { display: grid; grid-template-columns: 4.5rem 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--bg); }
.dayrow .d { font-weight: 600; }
.dayrow .v { font-family: var(--f-display); font-size: 1.25rem; font-weight: 600; }
.dayrow .v small { font-family: var(--f-body); font-size: .78rem; color: var(--muted); font-weight: 400; margin-left: 6px; }
.dayrow.blank .v { color: var(--muted); font-family: var(--f-body); font-size: .85rem; font-weight: 400; }
.banner { padding: 10px 14px; border-radius: 8px; background: var(--chip); color: var(--muted); font-size: .88rem; }
@media (prefers-reduced-motion: no-preference) {
  .anim .dot.on { animation: pop .5s cubic-bezier(.2,.8,.2,1) both; }
  .pallet.next .slot-next { animation: pulse 1.6s ease-in-out infinite; }
  .arc { transition: stroke-dashoffset 1.1s cubic-bezier(.2,.8,.2,1); }
}
@keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
