/* Timer app. Breakpoint: 760px (phone layout below, desktop above). Only this file uses it.
   Fonts are self-hosted latin subsets, never hotlinked.
   Archivo: Google Fonts, OFL 1.1, variable width 75-100 and weight 600-900. Headings and numerals.
   Schibsted Grotesk: Google Fonts, OFL 1.1, variable 400-900. Body, labels, buttons. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 600 900;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url("/fonts/archivo-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/schibsted-grotesk-var-latin.woff2") format("woff2");
}

:root {
  --bg: #f2f2ee;
  --bg-2: #ffffff;
  --bg-banner: #15181b;
  --ink: #15181b;
  --ink-2: #41474e;
  --ink-3: #5d646c;
  --ink-placeholder: #6b727a;
  --accent: #ffcc00;            /* the yellow from Mull-elektro's own site; also warning-tape yellow */
  --accent-btn: #ffcc00;
  --accent-btn-hover: #f0bd00;
  --on-accent: #15181b;
  --tint-ink: #f2f2ee;
  --tint-ink-2: #c3c8cd;
  --rule: #d3d2cb;
  --rule-dark: #2c3136;
  --danger: #a3200e;            /* app-only tokens, recorded as a deviation in CLAUDE.md */
  --on-danger: #ffffff;
  --danger-bg: #fbeae7;
  --ok: #17603a;
  --ok-bg: #e6f3ea;
  --font-display: "Archivo", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Schibsted Grotesk", "Helvetica Neue", Helvetica, sans-serif;
  --font-data: var(--font-display);
  --gutter: 16px;
  --maxw: 760px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}
body.has-tabs { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
a { color: inherit; text-underline-offset: 0.18em; }
p { margin: 0 0 0.75rem; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.top :focus-visible { outline-color: var(--accent); }

.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--on-accent); padding: 12px 16px; font-weight: 600; z-index: 10; }
.skip:focus { left: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- header with the warning-tape stripe (the one signature element) ---- */
.top { background: var(--bg-banner); color: var(--tint-ink); }
.top-in { max-width: var(--maxw); margin: 0 auto; padding: 12px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-family: var(--font-display); font-weight: 800; font-stretch: 78%; font-size: 1.35rem; text-transform: uppercase; letter-spacing: 0.02em; text-decoration: none; line-height: 1.1; min-height: 44px; display: inline-flex; align-items: center; }
.top-user { display: flex; align-items: center; gap: 12px; margin: 0; }
.who { font-size: 0.9rem; color: var(--tint-ink-2); }
.top-btn { font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--tint-ink); background: none; border: 1px solid var(--tint-ink-2); border-radius: 2px; min-height: 44px; padding: 0 12px; cursor: pointer; }
.top-btn:hover { border-color: var(--accent); }
.tape { height: 6px; background: repeating-linear-gradient(-45deg, var(--accent) 0 10px, var(--bg-banner) 10px 20px); }

.demo-bar { background: var(--accent); color: var(--on-accent); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 8px max(var(--gutter), calc((100% - var(--maxw)) / 2 + var(--gutter))); }
.demo-bar p { margin: 0; font-size: 0.9rem; }
.demo-bar form { margin: 0; }
.demo-bar .btn { background: var(--bg-banner); color: var(--tint-ink); border-color: var(--bg-banner); }

/* ---- tabs: fixed to the thumb on a phone, a plain row on desktop ---- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-2); border-top: 1px solid var(--ink); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { min-height: 64px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 4px; font-weight: 600; font-size: 0.95rem; text-decoration: none; border-top: 4px solid transparent; }
.tabs a[aria-current="page"] { border-top-color: var(--accent); background: var(--bg); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 20px var(--gutter) 32px; }
.foot { max-width: var(--maxw); margin: 0 auto; padding: 8px var(--gutter) 24px; font-size: 0.85rem; color: var(--ink-3); }

/* ---- type ---- */
h1 { font-family: var(--font-display); font-weight: 800; font-stretch: 78%; text-transform: uppercase; font-size: clamp(2.25rem, 10vw, 3.5rem); line-height: 1; letter-spacing: -0.005em; margin: 0 0 8px; }
h2 { font-family: var(--font-display); font-weight: 700; font-stretch: 88%; font-size: 1.3rem; line-height: 1.2; margin: 36px 0 4px; padding-top: 10px; border-top: 2px solid var(--ink); }
.panel h2 { margin-top: 0; padding-top: 0; border-top: 0; }
.head { margin-bottom: 20px; }
.head-sub { color: var(--ink-2); margin: 0 0 2px; }
.head-num { margin: 10px 0 0; color: var(--ink-2); }
.head-num .num { font-size: 2rem; color: var(--ink); line-height: 1; }
.lead { font-size: 1.125rem; color: var(--ink-2); max-width: 60ch; margin-top: 12px; }
.hint { font-size: 0.9rem; color: var(--ink-2); margin-top: 12px; }
.empty { color: var(--ink-2); padding: 14px 0; margin: 0; }
.num { font-family: var(--font-data); font-weight: 700; font-stretch: 88%; font-variant-numeric: tabular-nums; }
.crumb { margin: 0 0 12px; font-size: 0.9rem; }
.crumb a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.crumb a::before { content: "\2190"; margin-right: 6px; }

/* ---- ruled rows: the work-order look everything is built from ---- */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.rows > li { border-bottom: 1px solid var(--rule); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 60px; }
.row-wrap { flex-wrap: wrap; }
.row-wrap .row-main { flex: 1 1 140px; }  /* the name keeps its room; the tools drop to the next line on a phone */
.row-link { text-decoration: none; }
.row-link:hover .row-title { text-decoration: underline; }
.row-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; }
.row-sub { font-size: 0.875rem; color: var(--ink-2); }
.row-num { flex: none; text-align: right; white-space: nowrap; }
.row-num .num { font-size: 1.25rem; }
.row-num-stack { display: flex; flex-direction: column; align-items: flex-end; }
.row-go { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 0.9rem; border-radius: 2px; }
.row-none { color: var(--ink-3); }
.row-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-tools form { margin: 0; }
.row-day.is-today .row-title::after { content: " (i dag)"; font-weight: 400; color: var(--ink-2); }
.row-day .row-title::first-letter { text-transform: uppercase; }

/* ---- forms ---- */
.panel { background: var(--bg-2); border: 1px solid var(--rule); padding: 16px; margin-top: 28px; }
.form { margin: 0; }
.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-narrow { max-width: 200px; }
label { font-weight: 600; font-size: 0.9rem; }
input, select, textarea { font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg-2); border: 1px solid var(--ink-3); border-radius: 2px; padding: 10px 12px; min-height: 48px; width: 100%; min-width: 0; }
textarea { min-height: 96px; resize: vertical; }
::placeholder { color: var(--ink-placeholder); opacity: 1; }
.stepper { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; }
.stepper button { font: inherit; font-size: 1.5rem; font-weight: 600; line-height: 1; background: var(--ink); color: var(--tint-ink); border: 0; min-height: 48px; cursor: pointer; }
.stepper button:first-child { border-radius: 2px 0 0 2px; }
.stepper button:last-child { border-radius: 0 2px 2px 0; }
.stepper input { text-align: center; border-radius: 0; border-left: 0; border-right: 0; font-family: var(--font-data); font-weight: 700; font-stretch: 88%; font-size: 1.35rem; padding: 4px; }
.form-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.form-inline .field { margin-bottom: 0; flex: 1 1 160px; }
.form-inline .field-narrow { flex: 0 1 180px; }
.input-pin { width: 110px; min-height: 44px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px; font: inherit; font-weight: 600; color: var(--ink); background: transparent; border: 2px solid var(--ink); border-radius: 2px; text-decoration: none; cursor: pointer; transition: background-color 120ms ease; }
.btn:hover { background: var(--bg-2); }
.btn-main { background: var(--accent-btn); color: var(--on-accent); }
.btn-main:hover { background: var(--accent-btn-hover); }
.btn-small { min-height: 44px; padding: 0 12px; font-size: 0.9rem; }
.btn-wide { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
.actions form { margin: 0; }
.actions-stack { flex-direction: column; }
.del-form { margin: 0; flex: none; }
.del { font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--danger); background: none; border: 0; border-radius: 2px; min-height: 44px; min-width: 44px; padding: 0 8px; text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }
.del.is-armed { background: var(--danger); color: var(--on-danger); text-decoration: none; }

.flash { padding: 12px 14px; margin: 0 0 20px; font-weight: 600; border: 2px solid; border-radius: 2px; }
.flash-ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.flash-feil { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }

.switch { display: inline-flex; border: 2px solid var(--ink); border-radius: 2px; margin-bottom: 16px; }
.switch a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; font-weight: 600; text-decoration: none; }
.switch a[aria-current="true"] { background: var(--ink); color: var(--tint-ink); }

.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.weeknav a, .weeknav-off { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-weight: 600; border: 1px solid var(--ink-3); border-radius: 2px; text-decoration: none; }
.weeknav-off { color: var(--ink-3); border-color: var(--rule); }
.weeknav-now { font-weight: 600; }

/* ---- sums and tables ---- */
.sums { margin: 0; border-top: 1px solid var(--rule); }
.sums > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.sums dt { color: var(--ink-2); }
.sums dd { margin: 0; text-align: right; white-space: nowrap; }
.sums .num { font-size: 1.15rem; }
.sums-total { border-top: 2px solid var(--ink); }
.sums-total dt { color: var(--ink); font-weight: 600; }
.sums-total .num { font-size: 1.5rem; }
.sums-meta dd { white-space: normal; font-weight: 600; }

/* position: relative keeps the visually hidden column label inside the scroller; without it the label
   escapes to the page and makes a phone scroll sideways. */
.table-scroll { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { padding: 10px 12px 10px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.table thead th { font-size: 0.85rem; color: var(--ink-2); border-bottom: 2px solid var(--ink); white-space: nowrap; }
.table tbody th, .table tfoot th { font-weight: 600; }
.table tfoot th, .table tfoot td { border-top: 2px solid var(--ink); border-bottom: 0; }
.table .r { text-align: right; padding-right: 0; padding-left: 12px; }
.table td:has(.del) { padding-top: 0; padding-bottom: 0; vertical-align: middle; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 800; }
.table-week { min-width: 520px; }
.th-date { font-weight: 400; }

.steps { margin: 32px 0 0; padding: 0; list-style: none; counter-reset: step; border-top: 1px solid var(--rule); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.5rem 1fr; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.steps li::before { content: counter(step); font-family: var(--font-data); font-weight: 800; font-stretch: 78%; font-size: 1.6rem; line-height: 1.1; }

@media (max-width: 380px) {
  .field-pair { grid-template-columns: 1fr; }
}

@media (min-width: 760px) {
  body.has-tabs { padding-bottom: 0; }
  .tabs { position: static; display: flex; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); background: none; border-top: 0; border-bottom: 1px solid var(--rule); }
  .tabs a { min-height: 52px; padding: 0 18px; border-top: 0; border-bottom: 4px solid transparent; }
  .tabs a:first-child { padding-left: 0; }
  .tabs a[aria-current="page"] { background: none; border-bottom-color: var(--ink); }
  .wrap { padding-top: 32px; }
}

@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

@media print {
  body { background: none; padding: 0 !important; }
  .top, .tabs, .demo-bar, .foot, .skip, .no-print, .flash { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  h1 { font-size: 2rem; }
  .table-scroll { overflow: visible; }
}
