﻿/* Frukta – design tokens (logo palette: navy 14325C, orange FF8A1F / FFB24D, green 1E7F3A; cream background FFF4E6) */
:root {
  --brand: #14325c;
  --brand-dark: #0e2442;
  --accent: #ff8a1f;
  --brand-tint: #ffe8cc;
  --bg: #fff4e6;
  --surface: #fff;
  --text: #1f2933;
  --muted: #667085;
  --line: #eadfcf;
  --ok: #1e7f3a;
  --err: #b42318;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--brand-dark); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; color: var(--brand-dark); }

/* top bar */
.topbar { display: flex; align-items: center; gap: 1.5rem; padding: 0 1.5rem; height: 60px;
  background: var(--surface); border-bottom: 3px solid var(--accent); position: sticky; top: 0; z-index: 10; box-shadow: var(--shadow); }
.brand img { height: 40px; width: auto; display: block; }
.mainnav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; }
.mainnav a { padding: .5rem .9rem; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 500; white-space: nowrap; }
.mainnav a:hover { background: var(--brand-tint); }
.mainnav a.active { background: var(--brand); color: #fff; }
.who { display: flex; align-items: center; gap: 1rem; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.who-user { color: var(--text); font-weight: 600; }
.content { max-width: 1400px; margin: 1.5rem auto; padding: 0 1.5rem; }

/* cards & forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.card.empty { max-width: 640px; }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .9rem; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .6rem .75rem; font: inherit; color: var(--text);
  border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.btn { display: inline-block; padding: .6rem 1.1rem; font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.btn-primary { background: var(--brand); color: #fff; width: 100%; margin-top: .25rem; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); padding: .35rem .8rem; }
.btn-ghost:hover { background: var(--bg); }
.alert { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.alert-error { background: #fef3f2; color: var(--err); border: 1px solid #fecdca; }
.alert-ok { background: #ecfdf3; color: var(--ok); border: 1px solid #abefc6; }
.hint { color: var(--muted); font-size: .8rem; margin: -.4rem 0 1rem; }

/* login */
.auth { background: linear-gradient(160deg, var(--brand-tint), var(--bg) 60%); min-height: 100vh; }
.auth-wrap { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: block; margin: 0 auto 1.25rem; height: 72px; width: auto; }
.auth-card h1 { text-align: center; }
.auth-links { display: flex; justify-content: space-between; margin-top: 1.1rem; font-size: .85rem; }

/* tables for the modules to come */
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
table.grid th { text-align: left; background: #fff9f0; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.grid th, table.grid td { padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
table.grid tr:hover td { background: #fff9f0; }

@media (max-width: 800px) { .who-client { display: none; } .topbar { gap: .75rem; padding: 0 .75rem; } }
@media print { .topbar { display: none; } body { background: #fff; } }

/* ---- customer module ---- */
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.btn-inline { width: auto; margin-top: 0; text-decoration: none; }
a.btn { text-decoration: none; }
.btn-secondary { background: var(--brand-tint); color: var(--brand-dark); }
.btn-secondary:hover { background: #ffd9ae; }
.btn-danger { background: #fff; color: var(--err); border-color: #fecdca; }
.btn-danger:hover:not(:disabled) { background: #fef3f2; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.badge { display: inline-block; font-size: .7rem; font-weight: 600; padding: .1rem .5rem; margin-left: .5rem; border-radius: 999px; background: #fef3f2; color: var(--err); vertical-align: middle; }

.kunde-head { padding: 1rem 1.25rem; margin-bottom: 1rem; display: grid; gap: .6rem; }
.kh-row { display: flex; align-items: flex-end; gap: .6rem; flex-wrap: wrap; }
.kh-row label.inline { margin: 0; flex: 1; min-width: 220px; max-width: 560px; }
.kh-row .btn { height: 2.4rem; display: inline-flex; align-items: center; }
.kh-msg { margin-left: auto; align-self: center; font-weight: 600; text-decoration: none; background: #fff7e0; color: #8a5a00; padding: .35rem .8rem; border-radius: 999px; }
.opt-inactive { color: var(--muted); }

.letters { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 1rem; }
.letters a, .letters .off { min-width: 2.1rem; text-align: center; padding: .35rem .5rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; text-decoration: none; font-weight: 600; }
.letters a:hover { background: var(--brand-tint); }
.letters a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.letters .off { color: #b5b9c2; background: transparent; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }

.cust-title { margin-bottom: .75rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: .55rem 1rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--brand-dark); border-bottom-color: var(--accent); }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 1.25rem; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid label { margin-bottom: .8rem; }
.form-grid fieldset:disabled input, fieldset[disabled] input, fieldset[disabled] select, fieldset[disabled] textarea { background: #fbf4ea; color: var(--text); border-color: transparent; }
.checks { display: flex; gap: 1.5rem; flex-wrap: wrap; }
label.check { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--text); font-weight: 500; }
label.check input { width: auto; margin: 0; }
.actions { display: flex; align-items: center; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 1.5rem; align-items: start; }
.revenue { display: grid; gap: 1rem; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

table.grid.compact th, table.grid.compact td { padding: .35rem .7rem; font-size: .88rem; }
table.grid thead th[colspan] { background: var(--brand-tint); color: var(--brand-dark); text-transform: none; letter-spacing: 0; font-size: .85rem; }
tr.row-muted td { background: #f5ecdf; color: var(--muted); }

/* ---- subscriptions ---- */
.text-err { color: var(--err); }
.hint { display: block; font-weight: 400; margin: .25rem 0 0; }
h2 { font-size: 1.1rem; margin: 0 0 .9rem; color: var(--brand-dark); }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: .45rem 1rem; margin: 0 0 1rem; }
.kv dt { color: var(--muted); font-weight: 600; font-size: .85rem; padding-top: .15rem; }
.kv dd { margin: 0; }
.ro { display: flex; flex-direction: column; margin-bottom: .8rem; }
.ro span { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; }
.inline-form { display: inline-flex; align-items: center; gap: .5rem; margin-left: .75rem; }
.inline-form.wrap { flex-wrap: wrap; margin: 0 0 1rem; display: flex; align-items: flex-end; }
.inline-form select, .inline-form input { margin-top: 0; width: auto; }
label.inline { display: flex; flex-direction: column; margin: 0; font-size: .8rem; }
.addline { background: #fff9f0; padding: .75rem; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 1rem; }
.addline select, .addline input, table.lines select, table.lines input { padding: .35rem .5rem; width: auto; margin-top: .2rem; }
.narrow { width: 5rem !important; }
.wide-input { width: 14rem !important; }
.table-scroll { overflow-x: auto; }
table.lines td { vertical-align: middle; }
tr.date-start td { border-top: 2px solid var(--line); }
.btn-small { padding: .3rem .7rem; font-size: .85rem; }
.btn-icon { padding: .2rem .55rem; background: #fff; border-color: var(--line); color: var(--text); line-height: 1.2; }
.btn-icon:hover { background: var(--brand-tint); }
.btn-del:hover { background: #fef3f2; }
@media (max-width: 800px) { .kv { grid-template-columns: 1fr; } }

/* ---- orders ---- */
table.orders td, table.orders th { white-space: nowrap; }
table.orders tr.group-head td { background: var(--brand-tint); color: var(--brand-dark); }
table.orders tr.sum-row td { background: #fff9f0; border-top: 1px solid var(--line); }
table.orders tr.sum-row.total td { background: var(--brand-tint); }
table.orders tr.editing td { background: #fffbea; }
table.orders tr.comment-row td { color: var(--muted); font-size: .85rem; padding-top: 0; }

/* assigned resources / personnel on an order list: a chip with a remove button */
form.assigned { display: inline-flex; align-items: center; gap: .15rem; margin: 0 .35rem .25rem 0; padding: .1rem .15rem .1rem .6rem; border-radius: 999px; background: var(--brand-tint); color: var(--brand-dark); font-size: .85rem; }
.chip-x { border: 0; background: transparent; color: var(--brand-dark); font-size: 1rem; line-height: 1; padding: .15rem .4rem; border-radius: 999px; cursor: pointer; }
.chip-x:hover, .chip-x:focus-visible { background: var(--err); color: #fff; }

/* quantity boxes in a table (Ab.adm): the unit sits beside the box */
table.grid td input.qty { display: inline-block; margin-top: 0; padding: .35rem .5rem; text-align: right; }

/* "Rediger" links jump to the form below the list; leave room for the sticky header and scroll smoothly unless the user prefers not to */
h2[id] { scroll-margin-top: 5.5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* Kjørelister: three-month calendar. Colours mean: none / to approve / all approved / exception moves a list here */
.cal-row { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-bottom: .75rem; }
table.cal { border-collapse: separate; border-spacing: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem; }
table.cal caption { font-weight: 600; padding: .35rem; text-align: center; color: var(--brand-dark); }
table.cal caption a { text-decoration: none; font-size: 1.2rem; padding: 0 .5rem; }
table.cal th { font-size: .75rem; color: var(--muted); font-weight: 600; padding: .15rem; }
table.cal td { padding: 0; text-align: center; min-width: 2.2rem; height: 2rem; border-radius: 6px; }
table.cal td a { display: block; line-height: 2rem; text-decoration: none; color: var(--text); border-radius: 6px; }
.cal-none { background: #fff; }
.cal-todo { background: #cfe3fb; }
.cal-ok { background: #cdeed7; }
.cal-exception { background: #ffd9a8; }
td.cal-sel { outline: 2px solid var(--err); outline-offset: 0; }
table.cal td a.cal-red { color: var(--err); font-weight: 600; }
.cal-legend { color: var(--muted); font-size: .85rem; }
.cal-key { display: inline-block; width: 1.6rem; height: .9rem; border: 1px solid var(--line); border-radius: 3px; vertical-align: middle; margin: 0 .25rem 0 .9rem; }
tr.row-ok td { background: #eefaf1; }
tr.row-exception td { background: #fff2de; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; color: var(--brand-dark); }

/* printed delivery list (Kjørelister > Kjøreliste): font, sizes, uppercase etc. come from the client's layout settings via CSS variables */
.dl-actions { display: flex; gap: 1.25rem; justify-content: flex-end; margin: .5rem 0; }
.dl { background: #fff; padding: 1rem; border-radius: var(--radius); font-family: var(--dl-font), sans-serif; font-size: var(--dl-size); font-weight: var(--dl-weight); }
.dl-upper { text-transform: uppercase; }
.dl-head { font-size: var(--dl-head); color: var(--dl-head-color); margin: 0 0 .25rem; font-weight: bold; }
.dl-table, .dl-summary, .dl-ifco { border-collapse: collapse; width: 100%; margin: .5rem 0; }
.dl-summary { width: 50%; }
.dl-table th, .dl-summary th { text-align: left; border-top: calc(var(--dl-line) + 1px) solid #000; border-bottom: calc(var(--dl-line) + 1px) solid #000; padding: .2rem .35rem; font-weight: inherit; text-transform: none; letter-spacing: 0; font-size: inherit; background: #fff; color: #000; }
.dl-table td, .dl-summary td { padding: .2rem .35rem; vertical-align: middle; }
.dl-table tr.dl-first td { border-top: var(--dl-line) solid #000; }
.dl-table tbody tr:last-child td { border-bottom: calc(var(--dl-line) + 1px) solid #000; }
.dl .c { text-align: center; }
.dl .r { text-align: right; }
.dl .phone { white-space: pre-line; }
.dl-bottom { display: flex; gap: 2rem; align-items: flex-start; }
.dl-bottom > div { flex: 1; }
.dl-ifco td { border: 1px solid #000; padding: .8rem; background: #fff; }
.dl-ifco td.blank { width: 30%; }
@media print {
  .dl { padding: 0; border-radius: 0; }
  .dl-actions, .mainnav { display: none !important; }
  .content { padding: 0 !important; }
}

/* delivery notes (Kjørelister > Følgesedler): one A4 page per delivery address */
.dn { background: #fff; padding: 1.5rem; margin: 0 0 1rem; border-radius: var(--radius); max-width: 760px; font-size: 11pt; color: #000; }
.dn-title { font-size: 1.4rem; margin: 0 0 .25rem; color: #000; }
.dn hr { border: 0; border-top: 1px solid #000; margin: .5rem 0; }
.dn-head { width: 100%; border-collapse: collapse; margin: .75rem 0; }
.dn-head td { vertical-align: top; padding: .3rem .4rem; }
.dn-head td.k { width: 12%; white-space: nowrap; }
.dn-lines { width: 100%; border-collapse: collapse; margin-top: .75rem; }
.dn-lines th { text-align: left; border-bottom: 1px solid #000; padding: .3rem .4rem; background: #fff; color: #000; text-transform: none; letter-spacing: 0; font-size: inherit; }
.dn-lines td { padding: .3rem .4rem; border-bottom: 1px solid #ccc; }
.dn .r { text-align: right; }
@media print {
  .dn { border-radius: 0; padding: 0; margin: 0; max-width: none; page-break-after: always; break-after: page; }
  .dn:last-of-type { page-break-after: auto; break-after: auto; }
}

/* packing slips and labels: one piece per unit, one per page */
.ps { background: #fff; padding: 1.5rem; margin: 0 0 1rem; border-radius: var(--radius); color: #000; font-size: 11pt; box-sizing: content-box; }
.ps .strong, .ps .strong td { font-weight: 600; font-size: 1.1em; }
.dn-head td.r, .dn-head td.k.r { text-align: right; }
.lb { background: #fff; width: 400px; padding: 1rem 1.25rem; margin: 0 0 1rem; border-radius: var(--radius); color: #000; box-sizing: content-box; }
.lb-big { font-size: 15pt; font-weight: 600; line-height: 1.35; margin-bottom: .6rem; }
@media print {
  .ps, .lb { border-radius: 0; margin: 0; page-break-after: always; break-after: page; }
  .ps:last-of-type, .lb:last-of-type { page-break-after: auto; break-after: auto; }
}

/* several delivery lists after each other ("Alle kjørelister"): one list per printed page; weekly summary matrix */
.dl-sheet { margin-bottom: 1rem; }
.dl-week { width: 100%; }
@media print {
  .dl-sheet { margin: 0; page-break-after: always; break-after: page; }
  .dl-sheet:last-of-type { page-break-after: auto; break-after: auto; }
}
.cal-links { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; margin: .5rem 0 0; }
