/* Ordremottak for Atillitum AS, demo. Lyst, rolig og praktisk. */
:root {
  color-scheme: light;
  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --ink: #17202A;
  --ink-2: #46515D;
  --ink-3: #66707C;
  --line: #E0E4E9;
  --line-2: #CBD2DA;
  --brand: #1F4E79;
  --brand-2: #173E61;
  --brand-soft: #E7EFF7;
  --ok: #1B7A4A;
  --ok-text: #145C38;
  --ok-soft: #E8F5EE;
  --ok-line: #B5DCC5;
  --warn: #8A5300;
  --warn-ico: #C47A00;
  --warn-soft: #FFF5E1;
  --warn-line: #EFD198;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .05);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.55; overflow-x: hidden; font-feature-settings: "calt" 0; }
h1, h2, h3, h4 { line-height: 1.25; }
a { color: var(--brand); }
a:hover { color: var(--brand-2); }
button, input, select { font: inherit; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wrap { max-width: 1360px; margin: 0 auto; padding: 0 24px; }

/* Topp */
.demo-stripe { margin: 0; padding: 8px 16px; background: var(--warn-soft); border-bottom: 1px solid var(--warn-line); color: #5E3B00; font-size: 13.5px; text-align: center; }
.appbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.appbar-inner { display: flex; align-items: center; gap: 28px; min-height: 60px; }
.brand { display: grid; line-height: 1.2; text-decoration: none; color: var(--ink); flex: none; }
.brand:hover { color: var(--ink); }
.brand-name { font-weight: 700; font-size: 16px; }
.brand-app { font-size: 13px; color: var(--ink-3); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 550; font-size: 14.5px; display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { background: var(--surface-2); color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }
.count:empty { display: none; }
.user { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink-2); flex: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 650; font-size: 12.5px; display: grid; place-items: center; flex: none; }

.intro { padding: 26px 0 18px; max-width: 860px; }
.intro h1 { font-size: 28px; margin: 0; font-weight: 700; letter-spacing: -0.005em; }
.intro-sub { margin: 2px 0 10px; color: var(--ink-3); font-size: 15px; }
.intro p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.intro.small { padding-bottom: 14px; }
.intro.small h1 { margin-bottom: 4px; }

/* Knapper */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14.5px; font-weight: 600; line-height: 1.2; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn[disabled] { background: #E3E8EE; border-color: #E3E8EE; color: #7D8792; cursor: not-allowed; }
.btn.quiet { background: transparent; }
.btn.small { font-size: 13px; padding: 6px 10px; }
.btn:focus-visible, .mail-row:focus-visible, .link-btn:focus-visible, .drop:focus-within, .tabs a:focus-visible, .seg button:focus-visible { outline: 3px solid #8DB4E2; outline-offset: 2px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; text-decoration: underline; font-size: 14px; }
.link { font-size: 14px; font-weight: 550; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.panel-head .muted { font-size: 13px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Innboks */
.inbox-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.mail-list { list-style: none; margin: 0; padding: 0; }
.mail-list li + li { border-top: 1px solid var(--line); }
.mail-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 14px 16px; text-decoration: none; color: inherit; }
.mail-row:hover { background: var(--surface-2); color: inherit; }
.from-av { width: 40px; height: 40px; border-radius: 50%; background: #E9EDF2; color: var(--ink-2); font-weight: 650; font-size: 13.5px; display: grid; place-items: center; }
.mail-row.unread .from-av { background: var(--brand-soft); color: var(--brand); }
.mr-main { display: grid; gap: 2px; min-width: 0; }
.mr-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.mr-top b { font-weight: 600; white-space: nowrap; }
.mail-row.unread .mr-top b, .mail-row.unread .mr-subj { font-weight: 700; }
.mr-addr { color: var(--ink-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mr-top time { margin-left: auto; color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.mr-subj { font-weight: 550; overflow-wrap: anywhere; }
.mr-prev { color: var(--ink-3); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 4px; font-size: 13px; }
.att { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.att svg { flex: none; }
.att.none { color: var(--ink-3); }
.mr-state { color: var(--ink-3); }
.mr-state.s-ny { color: var(--brand); font-weight: 600; }
.mr-state.s-apnet { color: var(--warn); font-weight: 600; }
.mr-state.s-fil { color: var(--ok-text); font-weight: 600; }
.mr-state.s-venter { color: var(--warn); font-weight: 600; }
.mr-state.s-ren { color: var(--ok-text); font-weight: 600; }
.batch { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 12px 16px; background: var(--ok-soft); border-bottom: 1px solid var(--ok-line); }
.batch p { margin: 0; font-size: 14px; color: var(--ok-text); flex: 1 1 260px; }
.mr-hint { margin-top: 4px; font-size: 13px; color: var(--brand); }

.today { width: 100%; border-collapse: collapse; font-size: 14px; }
.today th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12.5px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.today td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.today tr:last-child td { border-bottom: 0; }
.today td.nr { font-weight: 600; font-variant-numeric: tabular-nums; }
.today tr.st-venter td:last-child { color: var(--warn); }
.today tr.st-erstattet td { color: var(--ink-3); text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .25); }
.today tr.st-erstattet td:last-child { text-decoration: none; }

.connect-list { margin: 0; padding: 12px 16px 14px 36px; display: grid; gap: 8px; font-size: 14.5px; color: var(--ink-2); }
.connect-list li::marker { color: var(--brand); font-weight: 650; }
.upload-body { padding: 14px 16px; }
.drop { display: grid; gap: 3px; justify-items: center; text-align: center; padding: 16px 14px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop strong { font-size: 14.5px; }
.drop span { font-size: 13px; color: var(--ink-2); }
.drop u { color: var(--brand); }
.fine { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-3); }
.reset { margin: 14px 2px 0; font-size: 13px; }

/* Bestilling */
.back { margin: 18px 0 12px; }
.order-layout { display: grid; grid-template-columns: 410px minmax(0, 1fr); gap: 20px; align-items: start; }
.order-mail { position: sticky; top: 14px; max-height: calc(100vh - 28px); overflow: auto; border-radius: var(--radius); }
.mail-card { overflow: hidden; }
.mail-meta { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.mail-meta h2 { margin: 0 0 8px; font-size: 16.5px; font-weight: 650; overflow-wrap: anywhere; }
.mail-meta dl { margin: 0; display: grid; gap: 2px; font-size: 13.5px; }
.mail-meta dl > div { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 6px; }
.mail-meta dt { color: var(--ink-3); }
.mail-meta dd { margin: 0; overflow-wrap: anywhere; }
.mail-text { padding: 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; border-bottom: 1px solid var(--line); }
.attach { padding: 12px 16px 16px; background: var(--surface-2); }
.att-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.att-head span { display: grid; min-width: 0; flex: 1; }
.att-head b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.att-head small { font-size: 12.5px; color: var(--ink-3); }
.pdf-preview { display: block; }
.pdf-preview img { width: 100%; display: block; border: 1px solid var(--line-2); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.no-att { margin: 0; color: var(--ink-3); font-size: 13.5px; }
.doc-object { width: 100%; height: 70vh; border: 0; display: block; background: #fff; }
.placeholder { margin: 0; padding: 18px 8px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.sheet-view { background: #fff; border: 1px solid var(--line-2); }
.grid { border-collapse: collapse; font-size: 12px; font-family: Calibri, Carlito, var(--font); }
.grid th { background: #EEF1F4; color: var(--ink-3); font-weight: 500; padding: 2px 6px; border: 1px solid #D9DEE4; text-align: center; min-width: 26px; }
.grid td { padding: 2px 6px; border: 1px solid #E3E7EB; white-space: nowrap; }

.order-panel { overflow: hidden; }
.order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 18px 12px; border-bottom: 1px solid var(--line); }
.order-head h2 { margin: 0; font-size: 19px; font-weight: 650; }
.order-head p { margin: 2px 0 0; font-size: 13.5px; }
.state { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.state.s-apnet, .state.s-venter { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.state.s-klar { color: var(--brand); background: var(--brand-soft); border-color: #C5D7EA; }
.state.s-fil { color: var(--ok-text); background: var(--ok-soft); border-color: var(--ok-line); }
.state.s-avvist { color: var(--ink-2); background: var(--surface-2); border-color: var(--line-2); }
#ordre-innhold { padding: 16px 18px 20px; }
.reading { display: flex; align-items: center; gap: 10px; color: var(--brand); font-weight: 550; padding: 6px 0; }
.reading .muted { font-weight: 400; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--brand-soft); border-top-color: var(--brand); animation: snurr .8s linear infinite; flex: none; }
@keyframes snurr { to { transform: rotate(360deg); } }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 20px; margin: 0 0 18px; }
.facts > div { min-width: 0; }
.facts dt { font-size: 12.5px; color: var(--ink-3); }
.facts dd { margin: 1px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.facts.small { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 0 0 10px; }
.facts.small dd { font-size: 13.5px; }

.ordre-main h3, #ordre-innhold h3, .zirius h3, .mail-draft h3 { font-size: 15.5px; font-weight: 650; margin: 0 0 10px; }
.checks { margin-bottom: 20px; }
.chk-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chk { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13.5px; transition: background .2s, border-color .2s; }
.chk[data-s="ok"] { background: #F6FBF8; border-color: #D5EBDD; }
.chk[data-s="warn"] { background: var(--warn-soft); border-color: var(--warn-line); }
.chk > div { display: grid; gap: 1px; min-width: 0; }
.chk b { font-weight: 650; font-size: 14px; }
.chk span { color: var(--ink-2); overflow-wrap: anywhere; }
.ico { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; margin-top: 1px; }
.ico svg { width: 13px; height: 13px; }
.ico.ok { background: var(--ok); color: #fff; }
.ico.warn { background: var(--warn-ico); color: #fff; }
.ico .spinner { width: 15px; height: 15px; border-width: 2px; }

.lines-sec { margin-bottom: 20px; }
.lines { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.lines th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12.5px; padding: 8px 8px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.lines th.num { text-align: right; }
.lines td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lines td.st { width: 46px; white-space: nowrap; }
.lines td.st .ln { color: var(--ink-3); font-size: 12.5px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.lines td.theirs { width: 25%; }
.lines td.ours { width: 30%; }
.lines td.ours b { font-weight: 650; white-space: nowrap; }
.lines .vname { display: block; color: var(--ink-2); font-size: 12.5px; }
.lines .desc { display: block; }
.lines td.qty { white-space: nowrap; }
.lines td.price .sub, .lines td.lev, .lines td.lev .sub { white-space: nowrap; }
.lines tr.held td { background: #FBFBFC; color: var(--ink-3); }
.sub { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; white-space: normal; }
.sub.warn { color: var(--warn); font-weight: 550; }
.sub.ok { color: var(--ok-text); }
.lines-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.lines-foot .fine { margin: 0; }
.total { margin: 0; display: flex; gap: 16px; font-size: 14.5px; }
.total span { color: var(--ink-2); }
.total b { font-variant-numeric: tabular-nums; }

/* Avvik som må avgjøres */
.decide { margin: 4px 0 18px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 10px; }
.sec-head h3 { margin: 0 !important; }
.sec-head .muted { font-size: 13px; }
.issue { border: 1px solid var(--warn-line); background: var(--warn-soft); border-radius: 8px; padding: 12px 14px 12px; margin: 0 0 10px; min-width: 0; }
.issue.done { border-color: var(--ok-line); background: #F6FBF8; }
.issue legend { display: flex; align-items: flex-start; gap: 8px; font-weight: 650; font-size: 14.5px; padding: 0; float: left; width: 100%; margin-bottom: 6px; }
.issue legend + * { clear: both; }
.issue > p { margin: 0 0 8px; font-size: 14px; color: var(--ink-2); clear: both; }
.choices { display: grid; gap: 4px; }
.choice { display: flex; align-items: flex-start; gap: 10px; padding: 7px 10px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; font-size: 14px; background: rgba(255, 255, 255, .55); }
.choice:hover { border-color: var(--line-2); background: #fff; }
.choice.on { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 1px var(--brand) inset; }
.choice input[type="radio"] { accent-color: var(--brand); width: 17px; height: 17px; margin: 2px 0 0; flex: none; }
.choice-text { display: grid; gap: 4px; min-width: 0; }
.choice-text small { color: var(--ink-3); font-size: 12.5px; }
.mark { font-style: normal; font-size: 12px; font-weight: 600; color: var(--brand); margin-left: 4px; }
.pick, .price-input, .date-input, .field input, .field select { font-size: 14px; color: var(--ink); padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; max-width: 100%; min-width: 0; }
.pick { width: 100%; }
.price-input { width: 140px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13.5px; cursor: pointer; color: var(--ink-2); }
.check input { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; }
.newcust { margin-top: 8px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.nc-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr) 160px; gap: 10px; }
.field { display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-2); min-width: 0; }
.field.inline { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.hint { font-size: 12.5px; color: var(--ink-3); margin: 8px 0 0; }

.approve-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 14px 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.approve-text { margin: 0; font-size: 14px; font-weight: 550; color: var(--ink-2); }
.approve-text[data-igjen] { color: var(--warn); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stamp { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--ok-soft); border: 1px solid var(--ok-line); font-weight: 600; }
.stamp.wait { background: var(--warn-soft); border-color: var(--warn-line); }
.stamp.stop { background: var(--surface-2); border-color: var(--line-2); color: var(--ink-2); }
.decisions { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.decisions li { display: flex; gap: 8px; align-items: flex-start; }
.decisions .ico { width: 18px; height: 18px; }
.learned { margin: 10px 0 0; font-size: 13.5px; color: var(--ink-2); padding: 8px 12px; background: var(--surface-2); border-radius: 8px; border: 1px solid var(--line); }

/* Ordren i Zirius, i full bredde under bestillingen */
.zcard { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 10px; background: var(--ok-soft); border: 1px solid var(--ok-line); margin-bottom: 12px; }
.zcard > .ico { width: 26px; height: 26px; margin-top: 0; }
.zcard > .ico svg { width: 16px; height: 16px; }
.zcard h3 { margin: 0 0 2px !important; font-size: 17px !important; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.zcard-meta { margin: 0 0 6px; font-size: 14px; color: var(--ink-2); }
.zcard-note { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.tag.eks { color: var(--ink-2); background: #fff; border-color: var(--line-2); font-weight: 600; }
.file-details { margin-top: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.file-details > summary { cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: 14.5px; color: var(--brand); list-style-position: inside; }
.file-details > summary .muted { font-weight: 400; font-size: 13px; }
.file-details[open] > summary { border-bottom: 1px solid var(--line); }
.file-inner { padding: 12px 14px 14px; }
.next-down { margin: 10px 0 0; font-size: 13.5px; color: var(--ink-3); }
.order-result { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px 22px; }
.order-result h3 { font-size: 16px; font-weight: 650; margin: 0 0 10px; }
.zirius { margin: 0; }
.swipe { display: none; margin: 0 0 6px; font-size: 12.5px; color: var(--ink-3); }
.z-how { margin: 0 0 12px; font-size: 14.5px; }
.notice { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--warn-soft); border: 1px solid var(--warn-line); font-size: 13.5px; color: var(--ink-2); }
.notice b { color: var(--ink); }
.notice.soft { background: var(--surface-2); border-color: var(--line); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 9px; background: #EBEEF2; margin: 2px 0 10px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.z-note { margin: 0 0 12px; font-size: 13.5px; color: var(--ink-2); }
.z-sub { font-size: 13px !important; font-weight: 650; color: var(--ink-2); margin: 14px 0 6px !important; }
.file-table { border: 1px solid var(--line); border-radius: 8px; }
.ftable { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.ftable th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 6px 8px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.ftable td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ftable tr:last-child td { border-bottom: 0; }
.ftable .rn { color: var(--ink-3); width: 28px; }
.ftable tr.free td { background: #F4F7FB; }
.ftable tr.free td:nth-child(9) { white-space: normal; min-width: 280px; }
.ftable .empty { color: #B3BBC4; font-size: 11.5px; }
.raw { margin: 0; padding: 10px 12px; background: #F7F8FA; border: 1px solid var(--line); border-radius: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); max-height: 240px; overflow: auto; }
.dl-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }

/* Utkast */
.mail-draft { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.mail-draft .card { max-width: 860px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid; }
.tag.draft { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.mail { overflow: hidden; }
.mail-head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 3px; background: var(--surface-2); }
.mail-head .mail-row { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 8px; font-size: 14px; padding: 0; }
.mail-head .mail-row > span:first-child { color: var(--ink-3); }
.mail-head .mail-row > span:last-child { overflow-wrap: anywhere; }
.mail-body { padding: 14px 16px 6px; font-size: 14.5px; line-height: 1.6; outline: none; }
.mail-body p { margin: 0 0 12px; }
.mail-body ul { margin: -4px 0 12px; padding-left: 20px; }
.mail-body[contenteditable="true"] { background: #FCFDFF; box-shadow: inset 0 0 0 2px var(--brand-soft); }
.mail-lines { border-collapse: collapse; margin: 0 0 12px; font-size: 13.5px; width: 100%; }
.mail-lines td { padding: 4px 10px 4px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.mail-lines td:last-child { padding-right: 0; }
.mail-lines tr.sum td { border-bottom: 0; padding-top: 6px; font-weight: 600; }
.mail-actions { display: flex; gap: 10px; align-items: center; padding: 12px 16px 16px; flex-wrap: wrap; }
.mail-actions .muted { font-size: 13px; }

/* Kunder */
.cust-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.cust { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.cust.new { border-color: var(--ok-line); box-shadow: 0 0 0 1px var(--ok-line); }
.cust header { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.cust-av { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 700; display: grid; place-items: center; flex: none; font-size: 13.5px; }
.cust h3 { margin: 0; font-size: 15.5px; }
.cust header p { margin: 0; font-size: 13px; color: var(--ink-3); }
.cust h4 { margin: 4px 0 4px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.hist { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.hist li { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); }
.hist li span:first-child { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Varer */
.price-note { position: sticky; top: 0; z-index: 5; margin: 0 0 12px; padding: 9px 14px; background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: 8px; color: #5E3B00; font-weight: 600; font-size: 14px; }
.lead-note { margin: -4px 0 12px; }
.search-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.search-row input { width: 320px; max-width: 100%; }
.catalog { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.catalog th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.catalog th.num { text-align: right; }
.catalog td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.catalog td.nr { white-space: nowrap; font-weight: 600; }
.catalog td.grp { color: var(--ink-2); font-size: 12.5px; }

/* Bunn */
.site-foot { margin-top: 40px; border-top: 1px solid var(--line); background: var(--surface); padding: 22px 0 30px; font-size: 14px; color: var(--ink-2); }
.site-foot p { margin: 0 0 8px; }
.site-foot .made { color: var(--ink-3); font-size: 13.5px; margin: 0; }
.errorbox { padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--warn-line); background: var(--warn-soft); }
.errorbox p { margin: 0 0 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); max-width: calc(100vw - 32px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Smalere skjermer */
@media (max-width: 1180px) {
  .order-layout { grid-template-columns: minmax(0, 1fr); }
  .order-mail { position: static; max-height: none; overflow: visible; }
  .pdf-preview img { max-height: 340px; object-fit: cover; object-position: top; }
}
@media (max-width: 980px) {
  .inbox-layout { grid-template-columns: minmax(0, 1fr); }
  .inbox-side { display: grid; gap: 16px; }
  .inbox-side .panel + .panel { margin-top: 0; }
  .chk-list { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .appbar-inner { flex-wrap: wrap; gap: 4px 12px; padding-top: 8px; padding-bottom: 6px; }
  .brand { flex: 1; }
  .tabs { order: 3; flex-basis: 100%; margin: 0 -8px; }
  .user-name { display: none; }
  .nc-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .nc-grid .field:nth-child(2) { grid-column: 1 / -1; order: -1; }
  .cust-grid { grid-template-columns: minmax(0, 1fr); }

  /* Linjene som kort */
  .lines thead { display: none; }
  .lines, .lines tbody { display: block; }
  .lines tr.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
  .lines td { display: block; border: 0; padding: 0; width: auto !important; }
  .lines td.st { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
  .lines td.st .ln::before { content: "Linje "; }
  .lines td.theirs, .lines td.ours { grid-column: 1 / -1; }
  .lines td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
  .lines td.num { text-align: left; }
  .lines td.price .sub { white-space: normal; }
  .lines tr.held { background: #FBFBFC; }

  .today thead { display: none; }
  .today, .today tbody { display: block; }
  .today tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .today td { border: 0; padding: 0; }
  .today td.nr { grid-row: span 2; }
  .today td[data-label="Kl."], .today td[data-label="Linjer"] { display: none; }
  .today td[data-label="Deres ordrenr"]::before { content: "Deres ordrenr "; color: var(--ink-3); }
  .today td.kunde { font-weight: 550; }
  .today td[data-label="Status"] { grid-column: 2; font-size: 13px; color: var(--ink-3); }

  .catalog thead { display: none; }
  .catalog, .catalog tbody { display: block; border: 0; background: transparent; }
  .catalog tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 12px; padding: 10px 12px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
  .catalog td { border: 0; padding: 0; }
  .catalog td.navn { grid-column: 1 / -1; order: -1; font-weight: 600; }
  .catalog td.nr { order: -2; grid-column: 1 / -1; }
  .catalog td.grp { grid-column: 1 / -1; }
  .catalog td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
  .catalog td.nr::before, .catalog td.navn::before { display: none; }
  .catalog td.num { text-align: left; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .demo-stripe { font-size: 12.5px; padding: 7px 12px; }
  .intro { padding: 18px 0 14px; }
  .intro h1 { font-size: 23px; }
  .intro p { font-size: 15px; }
  .panel-head { padding: 12px 14px; }
  .mail-row { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 12px 14px; }
  .from-av { width: 34px; height: 34px; font-size: 12.5px; }
  .mr-addr { display: none; }
  .order-head { padding: 12px 14px; flex-direction: column; gap: 6px; }
  .order-head h2 { font-size: 17.5px; }
  #ordre-innhold { padding: 14px 14px 18px; }
  .facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 14px; }
  .mail-meta, .mail-text, .attach { padding-left: 14px; padding-right: 14px; }
  .pdf-preview img { max-height: 230px; }
  .issue { padding: 10px 10px; }
  .choice { padding: 7px 8px; }
  .approve-bar { padding: 12px; }
  .approve-bar .actions { width: 100%; }
  .approve-bar .btn.primary { flex: 1; }
  .order-result { padding: 14px 14px 18px; margin-top: 16px; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; padding: 8px 6px; }
  .swipe { display: block; }
  .ftable tr.free td:nth-child(9) { min-width: 340px; }
  .pick, .price-input, .date-input, .field input, .field select { font-size: 16px; }
  .mail-body { padding: 12px 12px 4px; font-size: 14.5px; }
  .mail-lines, .mail-lines tbody { display: block; }
  .mail-lines tr { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 0 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
  .mail-lines td { border: 0; padding: 0; }
  .mail-lines td:nth-child(3) { display: none; }
  .mail-lines td.num { text-align: left; }
  .mail-lines td:last-child { text-align: right; }
  .mail-lines tr.sum { grid-template-columns: minmax(0, 1fr) auto; border: 0; }
  .mail-lines tr.sum td:first-child, .mail-lines tr.sum td:nth-child(3) { display: none; }
  .mail-actions { padding: 10px 12px 14px; }
  .cust { padding: 12px 14px; }
  .facts.small { grid-template-columns: minmax(0, 1fr); }
  .search-row input { width: 100%; }
  .field.inline { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .8s !important; }
}
