/* =====================================================================
   Westervaldt & Madsen Bygg – designsystem
   Svartvit grund från logotypen, semantiska färger bara för status.
   Typsnitt: Archivo (smal bredd i rubriker ekar loggans ordbild).
   ===================================================================== */
:root {
  --bg: #F3F4F4; --surface: #FFFFFF; --surface-2: #ECEEEE; --hover: #F0F1F1;
  --ink: #121315; --ink-2: #3B3F43; --muted: #686D72; --line: #E0E3E4; --line-strong: #C7CCCE;
  --primary: #121315; --on-primary: #FFFFFF;
  --ok: #1E7348; --ok-bg: #E2F2E8; --warn: #8F5A00; --warn-bg: #FBEFD5;
  --crit: #B3261E; --crit-bg: #FBE6E4; --info: #2453B8; --info-bg: #E5ECFA;
  --shadow: 0 1px 2px rgba(18,19,21,.05), 0 4px 16px rgba(18,19,21,.05);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 10px; --r-sm: 7px;
  --sidebar: 252px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0C0D0E; --surface: #151719; --surface-2: #1C1F21; --hover: #1A1D1F;
  --ink: #F0F1F2; --ink-2: #C8CBCE; --muted: #8E949A; --line: #25292C; --line-strong: #383D41;
  --primary: #F0F1F2; --on-primary: #0C0D0E;
  --ok: #55C48F; --ok-bg: #11291C; --warn: #E6AB45; --warn-bg: #2C220F;
  --crit: #F4776B; --crit-bg: #321513; --info: #86A8F5; --info-bg: #141F38;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0C0D0E; --surface: #151719; --surface-2: #1C1F21; --hover: #1A1D1F;
  --ink: #F0F1F2; --ink-2: #C8CBCE; --muted: #8E949A; --line: #25292C; --line-strong: #383D41;
  --primary: #F0F1F2; --on-primary: #0C0D0E;
  --ok: #55C48F; --ok-bg: #11291C; --warn: #E6AB45; --warn-bg: #2C220F;
  --crit: #F4776B; --crit-bg: #321513; --info: #86A8F5; --info-bg: #141F38;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark; }

/* Logotyp: svart i ljust tema, vit i mörkt */
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none; } :root:not([data-theme="light"]) .logo-dark { display: block; } }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.ic { flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

h1, h2, h3 { margin: 0; font-stretch: 88%; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 28px; font-weight: 700; line-height: 1.15; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
.label { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Skal ---------- */
.app { min-height: 100%; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px calc(16px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; text-decoration: none; }
.brand .sym { height: 34px; width: auto; }
.brand .word { height: 15px; width: auto; max-width: 160px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav .group { margin: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
.nav a .phase { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 500; }
.nav a[aria-current="page"] .phase { color: inherit; opacity: .7; }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }

.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 15; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 16; background: var(--bg); }
.topbar-in { display: flex; align-items: center; gap: 12px; padding-block: 10px; }
.topbar .mbrand { display: none; align-items: center; gap: 8px; text-decoration: none; }
.topbar .mbrand .sym { height: 28px; width: auto; }
.topbar .mbrand .word { height: 12px; width: auto; }
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; height: 40px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 0 12px 0 38px; }
.search .ic { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.search-pop { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); max-height: 60vh; overflow: auto; padding: 6px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 10px; border-radius: 999px; text-decoration: none; }
.user-chip:hover { background: var(--hover); }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user-chip .who b { font-size: 13.5px; font-weight: 600; }
.user-chip .who span { font-size: 12px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }

.main { margin-left: var(--sidebar); min-width: 0; }
.wrap { max-width: 1240px; margin: 0 auto; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
.page { padding-block: 26px 48px; display: flex; flex-direction: column; gap: 22px; }

.demo-bar { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--line); font-size: 13px; }
.demo-bar .wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-block: 7px; }
.demo-bar b { font-weight: 700; letter-spacing: .04em; }
.demo-bar select { border: 1px solid currentColor; background: transparent; border-radius: 6px; padding: 2px 6px; font-size: 13px; }

.bottom-nav { display: none; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface); border-radius: 16px 16px 0 0;
  padding: 10px max(16px, env(safe-area-inset-left, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-right, 0px)); max-height: 85vh; overflow: auto; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 4px auto 12px; }
.sheet .nav a { padding: 12px 10px; }

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .topbar .mbrand { display: flex; }
  .topbar .search { display: none; }
  .user-chip .who { display: none; }
  .page { padding-block: 18px calc(96px + env(safe-area-inset-bottom, 0px)); gap: 18px; }
  h1 { font-size: 24px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 10px; border: 0; background: none;
    text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; min-height: 56px; }
  .bottom-nav [aria-current="page"] { color: var(--ink); }
}

/* ---------- Sidhuvud ---------- */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ph .t { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ph .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500; }
.crumb:hover { color: var(--ink); }

/* ---------- Knappar och fält ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary); font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { opacity: .9; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--hover); opacity: 1; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--ink-2); }
.icon-btn:hover { background: var(--hover); }

.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form .full { grid-column: 1 / -1; }
.form .third { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .flabel { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--crit); font-weight: 500; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
.field [aria-invalid="true"] { border-color: var(--crit); }
.suffix { position: relative; }
.suffix input { padding-right: 46px; }
.suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13.5px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ink); }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: var(--r-sm); gap: 3px; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 7px 14px; border-radius: 5px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--ink); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 6px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.banner.crit { background: var(--crit-bg); color: var(--crit); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }

/* ---------- Ytor ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-b { padding: 18px; }
.section { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .cols-3, .cols-2 { grid-template-columns: 1fr; } .form { grid-template-columns: 1fr; } .cols-4 { gap: 10px; } }

/* KPI-kort */
.kpi { display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  text-decoration: none; min-width: 0; transition: border-color .15s; }
a.kpi:hover { border-color: var(--line-strong); }
.kpi .v { font-size: 28px; font-weight: 700; font-stretch: 88%; line-height: 1.05; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi .v small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.kpi .src { font-size: 11.5px; color: var(--muted); display: flex; gap: 4px; align-items: center; margin-top: auto; }
.kpi.missing .v { color: var(--muted); }
.kpi .tag { align-self: flex-start; }
@media (max-width: 640px) { .kpi { padding: 13px 12px 12px; } .kpi .v { font-size: 23px; } }

/* Status */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.crit { background: var(--crit-bg); color: var(--crit); }
.pill.muted { color: var(--muted); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; border: 1px solid var(--line-strong); color: var(--muted); }
.tag.demo { border-color: var(--warn); color: var(--warn); }

/* Listor och tabeller */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.row-link { display: flex; align-items: center; gap: 14px; padding: 13px 18px; text-decoration: none; min-width: 0; }
.row-link:hover { background: var(--hover); }
.row-link .main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-link .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-link .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-link .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { cursor: pointer; }
table.t tbody tr:hover { background: var(--hover); }
table.t .num { text-align: right; white-space: nowrap; }
table.t .nr { color: var(--muted); font-size: 13px; white-space: nowrap; }
table.t .name { font-weight: 600; }
table.t a { text-decoration: none; }
.only-mobile { display: none; }
@media (max-width: 760px) { .only-desktop { display: none; } .only-mobile { display: block; } }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); text-decoration: none; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.chip b { font-weight: 600; color: var(--muted); }
.chip[aria-current="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chip[aria-current="true"] b { color: inherit; opacity: .7; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .search { max-width: 340px; display: block; }

/* Notiser */
.notice { display: flex; gap: 12px; padding: 12px 18px; text-decoration: none; align-items: flex-start; }
.notice:hover { background: var(--hover); }
.notice .dot { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.notice.crit .dot { background: var(--crit-bg); color: var(--crit); }
.notice.warn .dot { background: var(--warn-bg); color: var(--warn); }
.notice.info .dot { background: var(--info-bg); color: var(--info); }
.notice .txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.notice .txt b { font-weight: 600; }
.notice .txt span { font-size: 13px; color: var(--muted); }

/* Diagram: projekt per fas */
.funnel { display: flex; flex-direction: column; gap: 9px; padding: 16px 18px 18px; }
.funnel a { display: grid; grid-template-columns: 112px minmax(0, 1fr) 28px; gap: 10px; align-items: center; text-decoration: none; font-size: 13.5px; }
.funnel .bar { height: 10px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.funnel .bar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; min-width: 2px; }
.funnel a:hover .bar i { opacity: .8; }
.funnel .n { text-align: right; font-weight: 600; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); }
.progress.late i { background: var(--crit); }

/* Säljprocess */
.stepper { display: flex; gap: 4px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.stepper::-webkit-scrollbar { display: none; }
.step { flex: 1 0 auto; display: flex; flex-direction: column; gap: 7px; min-width: 92px; }
.step i { height: 4px; border-radius: 2px; background: var(--line); }
.step span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.step.done i { background: var(--muted); }
.step.cur i { background: var(--ink); }
.step.cur span { color: var(--ink); }

/* Detaljlistor */
dl.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; margin: 0; }
dl.facts div { min-width: 0; }
dl.facts dt { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
dl.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
dl.facts .full { grid-column: 1 / -1; }
@media (max-width: 520px) { dl.facts { grid-template-columns: 1fr; } }
.econ { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.econ > div { padding: 14px 18px; border-top: 1px solid var(--line); min-width: 0; }
.econ > div:nth-child(odd) { border-right: 1px solid var(--line); }
.econ > div:nth-child(-n+2) { border-top: 0; }
.econ .v { font-size: 19px; font-weight: 700; font-stretch: 88%; }
.econ .lab { font-size: 12px; color: var(--muted); font-weight: 600; }
.coming { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.coming div { border: 1px dashed var(--line-strong); border-radius: var(--r-sm); padding: 12px; display: flex; flex-direction: column; gap: 3px; }
.coming b { font-size: 14px; }
.coming span { font-size: 12px; color: var(--muted); }
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; font-size: 13.5px; font-weight: 500; }
.person .avatar { width: 26px; height: 26px; font-size: 11px; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty b { color: var(--ink); font-size: 16px; }
.skeleton { height: 120px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2), var(--hover), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 12px); z-index: 60; background: var(--primary); color: var(--on-primary);
  padding: 11px 16px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1023px) { .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } }

/* Inloggning */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 22px; }
.auth-card .logo { display: flex; justify-content: center; }
.auth-card .logo img { width: 170px; height: auto; }
.page-enter { animation: enter .22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (min-width: 1024px) { .demo-bar { margin-left: var(--sidebar); } }
.kpi .label { overflow-wrap: anywhere; }

/* Tidsbank */
.norms { overflow: hidden; }
.norm + .norm { border-top: 1px solid var(--line); }
.norm summary { list-style: none; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto auto 18px; gap: 14px; align-items: center; padding: 13px 18px; cursor: pointer; }
.norm summary::-webkit-details-marker { display: none; }
.norm summary:hover { background: var(--hover); }
.norm summary .code { font-weight: 700; color: var(--muted); font-size: 13.5px; }
.norm summary .nt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.norm summary .nt b { font-weight: 600; overflow-wrap: anywhere; }
.norm summary .nh { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; white-space: nowrap; }
.norm summary .nh b { font-size: 17px; font-stretch: 88%; }
.norm summary > .ic { color: var(--muted); transition: transform .15s; }
.norm[open] summary > .ic { transform: rotate(90deg); }
.norm[open] summary { background: var(--surface-2); }
.norm-b { padding: 6px 18px 18px; display: flex; flex-direction: column; gap: 14px; background: var(--surface-2); }
table.t.plain tbody tr { cursor: default; }
table.t.plain tbody tr:hover { background: transparent; }
table.t.plain { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); }
table.t tfoot td { padding: 11px 14px; font-weight: 700; border-top: 1px solid var(--line-strong); }
.calc { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 16px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px; }
.calc-out { display: flex; flex-direction: column; gap: 2px; min-height: 44px; justify-content: center; }
.calc-out .big { font-size: 24px; font-weight: 700; font-stretch: 88%; line-height: 1.1; }
@media (max-width: 640px) {
  .norm summary { grid-template-columns: minmax(0, 1fr) auto 18px; gap: 4px 10px; padding: 12px 16px; }
  .norm summary .code { grid-column: 1 / -1; }
  .norm summary .pill { display: none; }
  .norm-b { padding: 4px 12px 14px; }
  .calc { grid-template-columns: 1fr; }
}

/* Flikar */
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-top: -6px; }
.tabs-line a { padding: 10px 14px; text-decoration: none; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs-line a:hover { color: var(--ink); }
.tabs-line a[aria-current="page"] { color: var(--ink); border-color: var(--ink); }
button.chip { cursor: pointer; }

/* Kalkylredigerare */
.est-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.est-sum { position: sticky; top: calc(76px + env(safe-area-inset-top, 0px)); }
@media (max-width: 1180px) { .est-grid { grid-template-columns: minmax(0, 1fr); } .est-sum { position: static; } }
.hgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.hgrid .full { grid-column: 1 / -1; }
@media (max-width: 760px) { .hgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.input { min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); width: 100%; min-width: 0; }
.input:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.input[aria-invalid] { border-color: var(--crit); background: var(--crit-bg); }
.input:disabled, .field input:disabled { background: var(--surface-2); color: var(--ink-2); }

.eline { display: grid; grid-template-columns: 150px minmax(0, 1fr) 120px 120px 48px 132px 36px;
  grid-template-areas: "k d d d r sum del" "q q c1 c2 . sum ."; gap: 8px 10px; align-items: start; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.eline .k { grid-area: k; } .eline .d { grid-area: d; } .eline .q { grid-area: q; } .eline .c1 { grid-area: c1; } .eline .c2 { grid-area: c2; }
.eline .r { grid-area: r; } .eline .sum { grid-area: sum; } .eline > :last-child { grid-area: del; }
.eline .d { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.eline .meta { font-size: 12px; color: var(--muted); }
.eline .warn-t { color: var(--warn); font-weight: 600; }
.eline .q { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.eline .qi { display: grid; grid-template-columns: minmax(0, 1fr) 70px; gap: 4px; }
.eline .fl, .eline .c1 > span, .eline label.c2 > span { font-size: 11px; color: var(--muted); font-weight: 600; }
.eline .c1, .eline .c2 { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.eline span.c2 { align-self: end; padding-bottom: 10px; }
.eline .r { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 4px; font-size: 11px; color: var(--muted); font-weight: 600; }
.eline .r input { width: 18px; height: 18px; accent-color: var(--ink); }
.eline .sum { display: flex; flex-direction: column; align-items: flex-end; text-align: right; padding-top: 6px; }
.eline .sum b { white-space: nowrap; font-size: 15px; }
.eline .del { width: 36px; height: 36px; }
#lines > .empty { padding: 26px 18px; }
@media (max-width: 1023px) {
  .eline { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "k del" "d d" "q q" "c1 c2" "r sum"; gap: 8px 10px; padding: 14px; }
  .eline .q { max-width: none; }
  .eline .r { flex-direction: row; gap: 8px; padding-top: 0; align-self: center; font-size: 13px; }
  .eline > :last-child { justify-self: end; }
}
.addbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; }
.picker { border-top: 1px solid var(--line); background: var(--surface-2); padding: 12px 14px; }
.picker-h { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.picker .list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); max-height: 340px; overflow: auto; }
.picker .row-link { width: 100%; border: 0; background: transparent; text-align: left; }
.sumbody { display: flex; flex-direction: column; gap: 14px; }
.sumlist { margin: 0; display: flex; flex-direction: column; }
.sumlist > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.sumlist dt { color: var(--ink-2); }
.sumlist dd { margin: 0; text-align: right; display: flex; flex-direction: column; font-weight: 600; }
.sumlist dd .small { font-weight: 400; }
.sumlist .tot { border-bottom: 2px solid var(--ink); }
.sumlist .tot dt, .sumlist .tot dd { font-weight: 700; font-size: 16px; }
.tbtg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tbtg div { display: flex; flex-direction: column; gap: 3px; background: var(--surface-2); border-radius: var(--r-sm); padding: 10px; min-width: 0; }
.tbtg b { font-size: 15px; font-stretch: 88%; white-space: nowrap; }
.tbtg .neg { color: var(--crit); }

/* Offert */
.actions-col { display: flex; flex-direction: column; gap: 8px; }
.actions-col .btn { width: 100%; }
.paper { background: #fff; color: #121315; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); padding: 44px 48px 30px; font-size: 13.5px; line-height: 1.5; color-scheme: light; }
.paper .muted { color: #686D72; }
.paper .ph-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.paper .brandmark { display: flex; align-items: center; gap: 10px; }
.paper .brandmark img:first-child { height: 46px; width: auto; }
.paper .brandmark img:last-child { height: 15px; width: auto; }
.paper .doc { display: flex; flex-direction: column; align-items: flex-end; }
.paper .doc b { font-size: 26px; letter-spacing: .02em; line-height: 1; }
.paper .doc span { font-size: 12px; color: #686D72; margin-top: 4px; }
.paper .parties { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 8px; }
.paper .parties > div { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.paper .lbl { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #686D72; margin-bottom: 4px; }
.paper h4 { margin: 20px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; border-bottom: 1px solid #D5D9DA; padding-bottom: 5px; }
.paper p { margin: 0 0 6px; }
.paper ul { margin: 0; padding-left: 18px; }
.paper li { margin: 2px 0; }
.paper .pt { width: 100%; border-collapse: collapse; }
.paper .pt td { padding: 5px 6px; }
.paper .pt td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.paper .pt .b td { font-weight: 700; }
.paper .pt .sep td { border-top: 1px solid #D5D9DA; }
.paper .pt .hl td { background: #F2F3F3; font-size: 14.5px; }
.paper .fine { font-size: 11.5px; color: #686D72; margin-top: 8px; }
.paper .sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 34px; }
.paper .sigs span { border-top: 1px solid #121315; padding-top: 4px; font-size: 11px; color: #686D72; }
.paper footer { margin-top: 30px; padding-top: 8px; border-top: 1px solid #D5D9DA; font-size: 10.5px; color: #686D72; }
@media (max-width: 640px) { .paper { padding: 22px 16px; font-size: 13px; } .paper .parties { grid-template-columns: 1fr; } .paper .sigs { grid-template-columns: 1fr; } }

/* Mängdhjälp */
.linkbtn { border: 0; background: none; padding: 4px 0 0; color: var(--ink-2); font-size: 12.5px; font-weight: 600; display: inline-flex; gap: 5px; align-items: center; align-self: flex-start; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--ink); }
.qhelp { margin: 0 14px 12px; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); display: flex; flex-direction: column; gap: 12px; }
.qh-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qh-head .icon-btn { margin-left: auto; }
.qh-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; }
.qh-out { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 40px; }
.qh-out > div { display: flex; flex-direction: column; }
.qh-out .big { font-size: 20px; font-stretch: 88%; }

/* Fältarbete */
.crit-t { color: var(--crit); }
.hbar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; width: 100%; max-width: 260px; }
.hbar i { display: block; height: 100%; background: var(--ink); }
.hbar.near i { background: var(--warn); }
.hbar.over i { background: var(--crit); }
.kpi .hbar { max-width: none; }
.wilist .wi { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 12px 18px; flex-wrap: wrap; }
.wi-main { display: flex; gap: 12px; min-width: 0; flex: 1 1 320px; }
.wi-n { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; color: var(--ink-2); }
.wi-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.wi-bar { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.wi-act { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.wi-act > .pill { display: none; }
.wi-edit { padding: 14px 18px; background: var(--surface-2); }
.seg.sm button, .seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 5px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button:disabled { cursor: default; }
.addrow { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.addrow .input:first-child { flex: 1 1 220px; }
.addrow select.input { flex: 1 1 260px; }
.tform { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.tform:has(#t-project) { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, .9fr) minmax(0, .7fr); }
.tform:has(#t-project) .tnote { grid-column: 1 / 4; }
.tform .tnote { grid-column: 1 / -2; }
@media (max-width: 760px) { .tform, .tform:has(#t-project) { grid-template-columns: 1fr 1fr; } .tform .tnote, .tform:has(#t-project) .tnote { grid-column: 1 / -1; } .tform .field:first-child { grid-column: 1 / -1; } .tform .btn { grid-column: 1 / -1; } }
.tday-h { display: flex; justify-content: space-between; padding: 10px 18px; background: var(--surface-2); border-top: 1px solid var(--line); }
.te { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 18px; }
.te-main { display: flex; flex-direction: column; min-width: 0; }
.te-main span { overflow-wrap: anywhere; }
.icon-btn.confirm { color: var(--crit); background: var(--crit-bg); }
.weekstrip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.wd { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wd span { font-size: 12px; color: var(--muted); font-weight: 600; }
.wd b { font-size: 16px; font-stretch: 88%; }
.wd.we { background: var(--surface-2); }
.wd.today { border-color: var(--ink); }
.wd.tot { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.wd.tot span { color: inherit; opacity: .75; }
@media (max-width: 640px) { .weekstrip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.atalist .ata { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.ata p { margin: 0; }
.ata-h { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ata-n { font-weight: 700; font-size: 12.5px; color: var(--muted); }
.ata-econ { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--line); }
.ata-price { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }
.ata-approve { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
@media (max-width: 640px) { .ata-price, .ata-approve { grid-template-columns: 1fr; } }
.ata-act { display: flex; gap: 8px; flex-wrap: wrap; }
.devlist .dev { padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.dev p { margin: 0; }
.dev-h { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.devclose { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.devclose .input { flex: 1 1 240px; }
.cllist .cli { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; border-left: 3px solid transparent; }
.cli.ok { border-left-color: var(--ok); }
.cli.avvikelse { border-left-color: var(--crit); background: var(--crit-bg); }
.cli.ej_aktuell { opacity: .8; }
.cli-t { display: flex; gap: 12px; }
.cli-t > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cli-n { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.cli-a { display: flex; gap: 10px; flex-wrap: wrap; padding-left: 38px; }
.cli-a .cmt { flex: 1 1 220px; min-height: 38px; }
.cli .seg button { min-height: 34px; }
.devnew { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px; margin-left: 38px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); }
.devnew b { flex-basis: 100%; }
.devnew .input:first-of-type { flex: 1 1 240px; }
@media (max-width: 640px) { .cli-a, .devnew { padding-left: 0; margin-left: 0; } }

/* ---------- Planering ---------- */
:root { --violet: #5B3FB0; --violet-bg: #ECE6FA; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --violet: #B9A4F5; --violet-bg: #231B3A; } }
:root[data-theme="dark"] { --violet: #B9A4F5; --violet-bg: #231B3A; }
.k-arbete { --k: var(--info); --kb: var(--info-bg); }
.k-ue { --k: var(--warn); --kb: var(--warn-bg); }
.k-leverans { --k: var(--ok); --kb: var(--ok-bg); }
.k-kundmote { --k: var(--violet); --kb: var(--violet-bg); }
.k-ledighet { --k: var(--muted); --kb: var(--surface-2); }
.k-paminnelse { --k: var(--ink-2); --kb: var(--surface); }
.kdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--kb); border: 2px solid var(--k); flex: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-tools { display: flex; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; align-items: center; }
.cal-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.cal-title { margin-left: 6px; font-size: 18px; }
.seg a.segl { display: block; padding: 7px 12px; border-radius: 5px; font-weight: 600; font-size: 13px; color: var(--muted); text-decoration: none; }
.seg a.segl[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.conf-list { margin: 4px 0 2px; padding-left: 18px; }
.conf-list a { color: inherit; }
.cal-scroll { overflow-x: auto; margin-inline: -4px; padding-inline: 4px; }
.cal { min-width: 760px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.cal-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); border-top: 1px solid var(--line); }
.cal-row:first-child { border-top: 0; }
.cal-who { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-right: 1px solid var(--line); background: var(--surface); min-width: 0; }
.cal-who > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.cal-who b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-who .hbar { height: 4px; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.cal-head { position: sticky; top: 0; background: var(--surface-2); }
.cal-head .cal-who { background: var(--surface-2); align-items: center; }
.cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-days > div { position: relative; padding: 8px 10px; font-size: 13px; color: var(--muted); font-weight: 600; border-left: 1px solid var(--line); display: flex; align-items: center; gap: 4px; }
.cal-days > div:first-child { border-left: 0; }
.cal-days b { color: var(--ink); font-size: 15px; }
.cal-days .today b { background: var(--primary); color: var(--on-primary); border-radius: 999px; padding: 0 7px; }
.cal-days .we { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.cal-add { margin-left: auto; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); opacity: 0; }
.cal-days > div:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-add:hover { background: var(--hover); color: var(--ink); }
@media (hover: none) { .cal-add { opacity: 1; } }
.cal-lane { position: relative; min-height: 58px; }
.cal-bg { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-bg i { border-left: 1px solid var(--line); }
.cal-bg i:first-child { border-left: 0; }
.cal-bg i.we { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--surface-2) 70%, transparent) 6px 12px); }
.cal-bg i.today { background: color-mix(in srgb, var(--info-bg) 55%, transparent); }
.cal-bg i.conf { background: var(--crit-bg); }
.cal-bg i.drop { background: color-mix(in srgb, var(--primary) 12%, transparent); outline: 2px dashed var(--ink-2); outline-offset: -3px; }
.cal-bars { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 4px 0; padding: 8px 0; align-content: start; pointer-events: none; min-height: 58px; }
.cal-empty { grid-column: 1 / -1; padding: 8px 12px; }
.bk { pointer-events: auto; margin: 0 4px; display: flex; align-items: center; gap: 5px; min-width: 0; padding: 5px 8px; border-radius: 6px; text-decoration: none;
  background: var(--kb); color: var(--k); border-left: 3px solid var(--k); font-size: 13px; font-weight: 600; line-height: 1.25; cursor: pointer; }
.bk .bk-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.bk small { margin-left: auto; font-weight: 500; color: var(--k); white-space: nowrap; }
.bk.k-ledighet { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface) 6px 12px); }
.bk.k-paminnelse { border: 1px dashed var(--line-strong); border-left: 3px solid var(--k); }
.bk.cut-s { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.bk.cut-e { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.bk.conf { box-shadow: inset 0 0 0 2px var(--crit); color: var(--crit); }
.bk[draggable="true"] { cursor: grab; }
.bk.dragging { opacity: .45; }
.bk:hover { filter: brightness(.97); }
.month { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.month-h, .month-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-h div { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); }
.mday { min-height: 108px; padding: 6px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mday:nth-child(7n+1) { border-left: 0; }
.mday.out { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.mday.out .mday-n { color: var(--muted); }
.mday.we { background: color-mix(in srgb, var(--surface-2) 35%, transparent); }
.mday.conf { background: var(--crit-bg); }
.mday-n { font-weight: 600; font-size: 13px; text-decoration: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 999px; }
.mday-n:hover { background: var(--hover); }
.mday.today .mday-n { background: var(--primary); color: var(--on-primary); }
.mbk { display: block; font-size: 12px; padding: 2px 6px; border-radius: 4px; background: var(--kb); color: var(--ink); border-left: 3px solid var(--k);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.mbk b { color: var(--k); margin-right: 4px; }
.mbk.conf { box-shadow: inset 0 0 0 1.5px var(--crit); }
@media (max-width: 760px) { .mday { min-height: 64px; padding: 3px; } .mbk { font-size: 0; padding: 0; height: 6px; border-left-width: 0; background: var(--k); } .mbk b { display: none; } }
.agenda { display: flex; flex-direction: column; gap: 16px; }
.ag-day h3 { font-size: 14px; display: flex; gap: 8px; align-items: center; margin-bottom: 6px; text-transform: capitalize; }
.ag-day .list { border: 1px solid var(--line); border-radius: var(--r-sm); }
.ag-item { padding: 11px 14px; }
.ag-empty { margin: 0; padding-left: 2px; }

/* ---------- Bilder och dokument ---------- */
.upl { display: flex; flex-direction: column; gap: 12px; border-radius: var(--r); transition: background .15s; }
.upl.over { background: var(--info-bg); outline: 2px dashed var(--info); outline-offset: -6px; }
.upl-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; justify-content: space-between; }
.upl-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.upl-btns label { cursor: pointer; }
.upl-btns label:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.upl-status { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.upl-status li { padding: 6px 10px; border-radius: 6px; background: var(--surface-2); overflow-wrap: anywhere; }
.upl-status li.ok { background: var(--ok-bg); color: var(--ok); }
.upl-status li.crit { background: var(--crit-bg); color: var(--crit); }
.fgrid { list-style: none; margin: 0; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; } }
.ftile { width: 100%; display: flex; flex-direction: column; gap: 8px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; border-radius: var(--r-sm); }
.ftile:hover .fmedia img { transform: scale(1.03); }
.fmedia { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; border: 1px solid var(--line); }
.fmedia img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.ftype { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); }
.ftype b { font-size: 12px; letter-spacing: .06em; }
.fcat { position: absolute; left: 6px; top: 6px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.62); color: #fff; }
.fpub { position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; }
.fmeta { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 0 2px; }
.fmeta b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox { padding: 0; border: 0; width: min(1180px, 96vw); max-width: none; height: min(820px, 92vh); max-height: none; border-radius: var(--r); background: var(--surface); color: var(--ink); }
.lightbox::backdrop { background: rgba(0,0,0,.72); }
.lb-in { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: 100%; }
.lb-media { background: #0b0b0c; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.lb-media img, .lb-media video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.lb-media iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.lb-media .empty { color: #ddd; }
.lb-side { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); }
.lb-top { display: flex; align-items: center; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
#lbform { overflow-y: auto; padding: 16px; }
.lb-form { display: flex; flex-direction: column; gap: 12px; }
.lb-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; }
.lb-facts dt { color: var(--muted); }
.lb-facts dd { margin: 0; overflow-wrap: anywhere; }
.lb-pub { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.lb-pub legend { padding: 0 4px; }
.lb-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 820px) {
  .lightbox { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
  .lb-in { grid-template-columns: 1fr; grid-template-rows: 45vh minmax(0, 1fr); }
  .lb-side { border-left: 0; }
  .lb-top { order: -1; }
}
.compare { position: relative; aspect-ratio: 4 / 3; max-height: 560px; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); user-select: none; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare .cmp-top { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare .cmp-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3); pointer-events: none; }
.compare .cmp-line::after { content: ""; position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.35); }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare input[type=range]:focus-visible ~ .cmp-line, .compare:focus-within .cmp-line { background: var(--info); }
.cmp-lbl { position: absolute; top: 10px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(0,0,0,.62); color: #fff; pointer-events: none; }
.cmp-lbl.l { left: 10px; } .cmp-lbl.r { right: 10px; }

/* ---------- Diagram ---------- */
.chart { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "y plot" ". x" ". cap"; gap: 4px 8px; }
.ch-y { grid-area: y; display: flex; flex-direction: column; justify-content: space-between; text-align: right; font-size: 11.5px; padding-block: 2px; white-space: nowrap; }
.ch-plot { grid-area: plot; position: relative; height: 200px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ch-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ch-line { fill: none; stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.ch-dot { fill: var(--ink); stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; }
.ch-dot.neg { fill: var(--crit); }
.ch-zero { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ch-thr { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.ch-neg { fill: var(--crit-bg); }
.ch-bar { fill: var(--ink-2); }
.ch-bar.neg { fill: var(--crit); }
.ch-hits { position: absolute; inset: 0; display: flex; }
.ch-hits span { flex: 1; cursor: crosshair; outline-offset: -2px; }
.ch-hits span.on { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.ch-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 6px 9px; border-radius: 6px; white-space: pre; pointer-events: none; z-index: 2; box-shadow: var(--shadow); }
.ch-x { grid-area: x; display: flex; font-size: 11.5px; min-width: 0; overflow: hidden; }
.ch-x span { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: visible; }
.chart figcaption { grid-area: cap; display: flex; align-items: center; gap: 6px; }
.ch-key.thr { display: inline-block; width: 18px; border-top: 2px dashed var(--warn); }
@media (max-width: 640px) { .ch-plot { height: 160px; } .ch-y { font-size: 10.5px; } }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.t td.num, .t th.num { text-align: right; }
.neg-t { color: var(--crit); }
.concepts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.concepts div { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; color: var(--ink-2); }
.concepts b { display: block; color: var(--ink); margin-bottom: 2px; }
@media (max-width: 900px) { .concepts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .concepts { grid-template-columns: 1fr; } }
.scen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
@media (max-width: 900px) { .scen { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .scen { grid-template-columns: 1fr; } }
details.wk > summary { cursor: pointer; list-style: none; }
details.wk > summary::-webkit-details-marker { display: none; }
.wk-items { margin: 0; padding: 4px 0 8px 18px; font-size: 13px; color: var(--ink-2); }
.wk-items li { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.ok-t { color: var(--ok); }

/* ---------- Dagbok och AI ---------- */
.diary { padding: 14px 18px; display: flex; flex-direction: column; gap: 6px; }
.diary-h { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.diary p { margin: 0; white-space: pre-wrap; }
.ai-answer { white-space: pre-wrap; line-height: 1.55; }
.ai-ctx { white-space: pre-wrap; font-size: 12px; background: var(--surface-2); padding: 10px; border-radius: var(--r-sm); max-height: 300px; overflow: auto; margin: 8px 0 0; }
fieldset.sugg { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
fieldset.sugg legend { padding: 0 4px; font-weight: 600; }
textarea.input { resize: vertical; }
button.chip { background: var(--surface); cursor: pointer; font: inherit; color: inherit; text-align: left; }

/* ---------- Kundportal ---------- */
.portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
@media (max-width: 520px) { .portal-grid { grid-template-columns: 1fr; } }
.portal-card { text-decoration: none; transition: border-color .15s; }
.portal-card:hover { border-color: var(--line-strong); }
.portal-card h2 { font-size: 18px; }
.portal-todo { border-color: var(--warn); }
.portal-ata { padding: 14px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: end; }
.portal-ata p { margin: 4px 0 0; }
@media (max-width: 640px) { .portal-ata { grid-template-columns: 1fr; } }
.portal-answer { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.portal-contact { display: flex; gap: 12px; align-items: flex-start; }
.portal-contact > div { display: flex; flex-direction: column; gap: 3px; }
.portal-contact a { display: inline-flex; gap: 6px; align-items: center; }
a.ftile { text-decoration: none; color: inherit; }

/* ---------- Fakturering och bokföring ---------- */
.vstack { display: flex; flex-direction: column; gap: 18px; }
.iline { display: grid; grid-template-columns: 120px minmax(0, 1fr) 80px 70px 130px 80px 60px 110px 36px; gap: 8px; align-items: end; padding: 10px 0; border-bottom: 1px solid var(--line); }
.iline label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.iline label > span { font-size: 11px; color: var(--muted); font-weight: 600; }
.iline .r { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 10px; }
.iline .r > span { font-size: 13px; color: var(--ink); }
.iline .sum { text-align: right; font-weight: 600; padding-bottom: 10px; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .iline { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .iline .d { grid-column: 1 / -1; order: -1; }
  .iline .sum { grid-column: span 2; text-align: left; }
}
.buyer { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 8px; margin-bottom: 8px; }
.totals { display: flex; flex-direction: column; gap: 6px; max-width: 420px; margin-left: auto; }
.totals > div { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.totals > div b { font-weight: 600; }
.totals .tot { border-top: 1px solid var(--line-strong); padding-top: 8px; font-size: 18px; }
.totals .tot b { font-weight: 700; }
.ver { border-bottom: 1px solid var(--line); padding: 12px 18px; }
.ver-h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.ver-h .muted { font-size: 13px; }
.ver table { width: 100%; font-size: 13px; margin-top: 6px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ver td { padding: 2px 6px 2px 0; }
.ver td.num { text-align: right; width: 110px; }
.ver td.acc { width: 56px; font-weight: 600; }

/* ---------- Fakturering ---------- */
.bill-list { display: flex; flex-direction: column; gap: 10px; }
.bill-card { display: flex; gap: 16px; align-items: center; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.bill-card:hover { border-color: var(--ink); box-shadow: var(--shadow); transform: translateY(-1px); }
.bill-card.late { border-left: 4px solid var(--crit); }
.bc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.bc-nr { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.bc-name { font-size: 17px; }
.bc-why { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.bc-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.bc-amount { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.bc-end .btn { margin-top: 4px; pointer-events: none; }
@media (max-width: 560px) { .bill-card { flex-direction: column; align-items: stretch; } .bc-end { flex-direction: row; align-items: center; flex-wrap: wrap; } .bc-end .btn { margin-left: auto; margin-top: 0; } }
.all-done { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 32px 18px; text-align: center; color: var(--ok); }
.all-done b { color: var(--ink); font-size: 17px; }

.done-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 22px; align-items: center; padding: 22px 24px; border-radius: var(--r);
  background: var(--ok-bg); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); animation: done-in .45s cubic-bezier(.2, .9, .3, 1.2) both; }
.done-check svg { width: 64px; height: 64px; fill: none; stroke: var(--ok); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.done-check circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: done-draw .5s .1s ease-out forwards; }
.done-check path { stroke-dasharray: 36; stroke-dashoffset: 36; animation: done-draw .35s .5s ease-out forwards; }
.done-text { display: flex; flex-direction: column; gap: 3px; }
.done-amount { font-size: 32px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; animation: done-in .5s .35s both; }
.done-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
@keyframes done-draw { to { stroke-dashoffset: 0; } }
@keyframes done-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .done-card, .done-amount { animation: none; } .done-check circle, .done-check path { animation: none; stroke-dashoffset: 0; } }
@media (max-width: 560px) { .done-card { grid-template-columns: 1fr; justify-items: start; } .done-check svg { width: 52px; height: 52px; } .done-amount { font-size: 28px; } }

/* ---------- Läraren (rundturer, hjälp, kom igång) ---------- */
.help-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.help-btn:hover { background: var(--hover); }
.g-avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--surface); flex: none; }
.g-avatar.big { width: 56px; height: 56px; }
#guide { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
#guide .g-shade { position: fixed; inset: 0; pointer-events: auto; }
#guide .g-shade.full { background: rgba(10, 12, 14, .55); }
#guide .g-spot { position: fixed; border-radius: 10px; box-shadow: 0 0 0 4px var(--surface), 0 0 0 9999px rgba(10, 12, 14, .55); transition: all .3s ease; pointer-events: none; }
#guide .g-bubble { position: fixed; pointer-events: auto; box-sizing: border-box; max-height: calc(100dvh - 24px); overflow: auto; background: var(--surface); color: var(--ink); border-radius: 14px; padding: 14px 16px 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
  display: flex; flex-direction: column; gap: 8px; transition: top .3s ease, left .3s ease; animation: done-in .3s ease both; }
.g-head { display: flex; align-items: center; gap: 8px; }
.g-head .icon-btn { margin-left: auto; }
.g-bubble h3 { margin: 2px 0 0; font-size: 17px; }
.g-bubble p { margin: 0; line-height: 1.5; color: var(--ink-2); }
.g-dots { display: flex; gap: 5px; margin-top: 2px; }
.g-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.g-dots i.done { background: var(--muted); }
.g-dots i.on { background: var(--ink); width: 18px; border-radius: 4px; }
.g-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { #guide .g-spot, #guide .g-bubble { transition: none; animation: none; } }

#helpdrawer, #welcome { position: fixed; inset: 0; z-index: 900; }
.hd-bg { position: fixed; inset: 0; background: rgba(10, 12, 14, .4); }
.hd { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); box-sizing: border-box; max-width: 100vw; background: var(--surface); box-shadow: -10px 0 40px rgba(0, 0, 0, .2); display: flex; flex-direction: column; animation: hd-in .25s ease both; }
@keyframes hd-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.hd-h { display: flex; gap: 10px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.hd-h h2 { margin: 0; font-size: 18px; }
.hd-h .icon-btn { margin-left: auto; }
.hd-b { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 18px; }
.hd-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; line-height: 1.5; }
.hd-sec { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hd-tour { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.hd-tour:hover { border-color: var(--ink); }
.hd-tour span { display: flex; flex-direction: column; font-weight: 600; }
.hd-tour small { font-weight: 400; color: var(--muted); }
/* Centreras med inset + margin (inte transform), eftersom inanimeringen själv använder transform */
.welcome { position: fixed; inset: 0; margin: auto; height: fit-content; box-sizing: border-box; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--surface); border-radius: 16px; padding: 26px 24px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; animation: done-in .35s ease both; }
.welcome h2 { margin: 6px 0 0; }
.welcome p { margin: 0; line-height: 1.55; color: var(--ink-2); }
.welcome .g-actions { width: 100%; justify-content: flex-end; }
.getting-started .panel-h h2 { display: inline-flex; gap: 8px; align-items: center; }
.getting-started .panel-h .icon-btn { margin-left: 8px; }
.gs-bar { height: 6px; background: var(--surface-2); margin: 0 18px 6px; border-radius: 3px; overflow: hidden; }
.gs-bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width .4s ease; }
.gs-row { display: flex; gap: 12px; align-items: center; padding: 10px 18px; }
.gs-row .main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gs-row .title { font-weight: 600; }
.gs-row .sub { font-size: 13px; color: var(--muted); }
.gs-row.ok .title { color: var(--muted); text-decoration: line-through; }
.gs-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.gs-row.ok .gs-check { background: var(--ok); border-color: var(--ok); color: #fff; }
@media (max-width: 560px) { .gs-row { flex-wrap: wrap; } .gs-row .end { width: 100%; justify-content: flex-end; } }

/* ---------- Importera ---------- */
.imp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.imp-card { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.imp-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; }
.imp-t { display: flex; flex-direction: column; gap: 3px; }
.imp-a { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }

/* ---------- Fakturans utseende ---------- */
.design-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .design-grid { grid-template-columns: 1fr; } }
.preview-pane { position: sticky; top: 76px; }
.pdf-frame { aspect-ratio: 210 / 297; background: var(--surface-2); }
.pdf-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.logo-box { min-height: 84px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); display: grid; place-items: center; padding: 12px;
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.logo-box img { max-height: 90px; max-width: 100%; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.swatch { position: relative; cursor: pointer; }
.swatch input[type=radio] { position: absolute; opacity: 0; }
.swatch > span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.swatch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.swatch.custom { display: inline-flex; gap: 6px; align-items: center; }
.swatch.custom input { width: 38px; height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 2px; background: var(--surface); }

/* ---------- Mobilens startsida ---------- */
.home-h { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.home-h h1 { margin: 0; font-size: 26px; }
.home-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.home-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 14px 12px; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform .1s; -webkit-tap-highlight-color: transparent; }
.home-tile:active { transform: scale(.97); }
.home-tile .ht-ic { width: 40px; height: 40px; border-radius: 11px; background: var(--ink); color: var(--surface); display: grid; place-items: center; margin-bottom: 6px; }
.home-tile b { font-size: 19px; }
.home-tile .ht-line { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.home-tile .ht-sub { font-size: 12.5px; color: var(--muted); }
.home-tile.todo .ht-line { color: var(--warn); }
.home-tile.alert .ht-line, .home-tile.alert .ht-sub { color: var(--crit); }
.home-tiles > :only-child, .home-tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 0; }
.home-more { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; color: inherit; font-weight: 600; }
.home-more span { flex: 1; }
.order-row .order-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px 12px; }
.order-row .order-actions:empty { display: none; }
