/* AW Solutions – affärssystem (/admin). Plain CSS, no build step. */

@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/admin/fonts/inter.woff2) format("woff2"); }


:root {
  --navy-950: #0b1120;
  --navy-900: #111827;
  --navy-800: #1f2937;
  --navy-700: #374151;
  --navy-500: #6b7280;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --subtle: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --muted: #4b5563;
  --faint: #9ca3af;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-ink: #ffffff;
  --accent-text: #1d4ed8;
  --accent-50: #eff6ff;
  --accent-100: #dbeafe;
  --danger: #b42318;
  --danger-50: #fdecea;
  --warn: #8a5a00;
  --warn-50: #fdf4df;
  --ok: #1c7a43;
  --ok-50: #e7f5ec;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(15, 26, 42, .05), 0 1px 1px rgba(15, 26, 42, .03);
  --shadow-lg: 0 18px 50px rgba(8, 18, 33, .22);
  --sidebar: 248px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --tap: 40px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 .75em; }
small, .small { font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pre { white-space: pre-line; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
svg.i.sm { width: 15px; height: 15px; vertical-align: -3px; }
svg.i.lg { width: 22px; height: 22px; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--navy-900); color: #c6d2e1; display: flex; flex-direction: column; padding: 14px 10px 10px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand .word { display: flex; flex-direction: column; line-height: 1.05; }
.brand strong { font: 700 15px/1.1 var(--font); letter-spacing: -.01em; }
.brand small { color: var(--accent); font-size: 10px; letter-spacing: .38em; text-transform: uppercase; margin-top: 4px; }
.nav-group { margin: 6px 0 2px; padding: 8px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #6f82a0; }
.nav a { display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 7px 12px; margin: 1px 0; border-radius: 8px; color: #c6d2e1; font-weight: 500; text-decoration: none; position: relative; }
.nav a:hover { background: var(--navy-800); color: #fff; }
.nav a[aria-current="page"] { background: rgba(16, 179, 238, .13); color: #fff; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav a[aria-current="page"] svg { color: var(--accent); }
.nav .count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; text-align: center; line-height: 20px; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--navy-800); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #dfe7f1; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy-700); color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 13px; flex: none; }
.me .who { min-width: 0; flex: 1; }
.me .who strong { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who span { display: block; font-size: 11.5px; color: #8093ad; }
.me button { background: none; border: 0; color: #8fa2bb; padding: 8px; border-radius: 6px; cursor: pointer; }
.me button:hover { background: var(--navy-800); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 28px; background: rgba(242, 244, 247, .92); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar .mobile-brand { display: none; }
.searchbox { display: flex; align-items: center; gap: 8px; width: min(420px, 100%); height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); color: var(--faint); cursor: text; font: inherit; text-align: left; }
.searchbox:hover { border-color: var(--border-strong); }
.searchbox span { flex: 1; }
.searchbox kbd { font: 11px var(--font); color: var(--faint); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }
.topbar .spacer { flex: 1; }
.iconbtn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; }
.iconbtn:hover { background: var(--panel); border-color: var(--border); color: var(--text); }
.iconbtn .dot { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }
.content { padding: 8px 28px 48px; max-width: 1440px; width: 100%; }
.bottomnav { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin: 10px 0 20px; }
.page-head .titles { min-width: 0; }
.page-head .back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.page-head .sub { color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Panels & grid ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
/* In a grid the gap spaces the panels; a margin would push every panel but the first out of line. */
.grid > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); min-height: 54px; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; }
.panel-head h2 .i { color: var(--muted); }
.panel-head .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.panel-body { padding: 16px 18px; }
.panel-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid.side-main { grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
.stack > * + * { margin-top: 16px; }

/* ---------- Stats ---------- */
.stat { padding: 16px 18px; }
.stat .label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat .value { font-size: 24px; font-weight: 650; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .note { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat .note.bad { color: var(--danger); font-weight: 550; }
.stat.accent { border-top: 3px solid var(--accent); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: var(--tap); padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); color: var(--text); font: 550 13.5px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--subtle); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.dark { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f0c6c2; }
.btn.danger:hover { background: var(--danger-50); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover { background: var(--subtle); color: var(--text); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: var(--tap); padding: 0; }
.btn.small.icon { width: 32px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid var(--muted); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent-text); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--danger); }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #eef1f5; color: #475467; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.pill.plain::before { display: none; }
.pill.gra { background: #eef1f5; color: #475467; }
.pill.bla { background: #e5f3fa; color: #0a6690; }
.pill.gron { background: #e6f4eb; color: #1c7a43; }
.pill.gul { background: #fcf2da; color: #875800; }
.pill.rod { background: #fcebea; color: #b42318; }
.pill.lila { background: #eeeafa; color: #5a3fb8; }
.pill.turkos { background: #e1f4f2; color: #0f766e; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--subtle); border: 1px solid var(--border); color: var(--muted); font-size: 12px; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.badge-late { color: var(--danger); font-weight: 600; }
.badge-soon { color: var(--warn); font-weight: 600; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.one { grid-template-columns: minmax(0, 1fr); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span, .field > .label { font-size: 12.5px; font-weight: 600; color: #334357; }
.field .req { color: var(--danger); margin-left: 2px; }
.field .help { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--danger); font-weight: 550; }
input, select, textarea { font: inherit; color: var(--text); }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea, .input {
  width: 100%; min-height: var(--tap); padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; }
.field textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.field [aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-50) !important; }
.field input[readonly], .field textarea[readonly] { background: var(--subtle); }
.check { display: flex; align-items: flex-start; gap: 9px; min-height: 32px; padding-top: 4px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent-text); flex: none; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-error { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; margin-bottom: 14px; border: 1px solid #f3c7c2; background: var(--danger-50); color: var(--danger); border-radius: 8px; font-weight: 550; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--accent-100); background: var(--accent-50); color: #0b4f6e; }
.notice.warn { border-color: #f1dca8; background: var(--warn-50); color: #6d4700; }
.notice.danger { border-color: #f3c7c2; background: var(--danger-50); color: var(--danger); }
.notice.ok { border-color: #bfe3cc; background: var(--ok-50); color: #14532d; }
.notice .i { margin-top: 1px; }
.notice p:last-child { margin-bottom: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-weight: 650; margin-bottom: 10px; }
.section-title { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 20px 0 10px; }
.section-title:first-child { margin-top: 0; }

/* Combobox */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow-lg); }
.combo-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; min-height: 38px; }
.combo-list li small { display: block; color: var(--muted); }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: var(--accent-50); }
.combo-list li.empty { color: var(--muted); cursor: default; background: none; }

/* ---------- Tables ---------- */
.table-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table-tools .search { position: relative; flex: 1 1 220px; max-width: 360px; }
.table-tools .search .i { position: absolute; left: 11px; top: 11px; color: var(--faint); }
.table-tools .search input { width: 100%; height: 38px; padding: 0 12px 0 34px; border: 1px solid var(--border-strong); border-radius: 8px; }
.table-tools .search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.table-tools select { height: 38px; padding: 0 30px 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; max-width: 200px; }
.table-tools .count { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--subtle); white-space: nowrap; position: sticky; top: 0; }
table.data th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
table.data th button:hover { color: var(--text); }
table.data th .arrow { font-size: 10px; color: var(--accent-text); }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.link { cursor: pointer; }
table.data tbody tr.link:hover td { background: #f8fbfd; }
table.data td .title { font-weight: 600; color: var(--text); }
table.data td .sub { display: block; color: var(--muted); font-size: 12.5px; }
table.data td.actions { text-align: right; white-space: nowrap; width: 1%; }
.more-row { padding: 12px; text-align: center; border-top: 1px solid var(--border); }
.progress { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; }
.progress .bar { flex: 1; height: 6px; border-radius: 3px; background: #e7ebf0; overflow: hidden; min-width: 60px; }
.progress .bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.progress small { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Simple lists */
.list { margin: 0; padding: 0; list-style: none; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); min-height: 52px; }
.list > li:last-child { border-bottom: 0; }
.list > li .grow { flex: 1; min-width: 0; }
.list > li .title { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; }
.list > li .sub { color: var(--muted); font-size: 12.5px; display: block; }
.list > li.link { cursor: pointer; }
.list > li.link:hover { background: #f8fbfd; }
.list .when { min-width: 64px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.2; }
.list .when strong { display: block; font-size: 17px; color: var(--text); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty .i { width: 30px; height: 30px; color: var(--faint); stroke-width: 1.5; margin-bottom: 8px; }
.empty strong { display: block; color: var(--text); font-size: 14.5px; margin-bottom: 4px; }
.empty p { max-width: 420px; margin: 0 auto 12px; }
.empty.small { padding: 18px 16px; }
.empty.small .i { display: none; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.loading::before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; border: 2px solid var(--border-strong); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
/* Long tab rows (Inställningar) continue on the next line instead of scrolling out of view. */
.tabs.wrap { flex-wrap: wrap; overflow: visible; row-gap: 2px; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: 550 13.5px var(--font); white-space: nowrap; cursor: pointer; text-decoration: none; margin-bottom: -1px; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs [aria-current="page"], .tabs [aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { font-size: 11px; background: var(--subtle); border: 1px solid var(--border); border-radius: 9px; padding: 0 6px; color: var(--muted); }
.segmented { display: inline-flex; padding: 3px; background: #e8ecf1; border-radius: 9px; gap: 2px; }
.segmented button, .segmented a { border: 0; background: none; min-height: 32px; padding: 0 12px; border-radius: 7px; font: 550 13px var(--font); color: var(--muted); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.segmented [aria-pressed="true"], .segmented [aria-current="page"] { background: #fff; color: var(--text); box-shadow: var(--shadow); }

/* ---------- Details (definition lists) ---------- */
.dl { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 0 0 16px; }
.timeline li::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--subtle); border: 1px solid var(--border); color: var(--muted); }
.timeline .dot .i { width: 14px; height: 14px; }
.timeline .meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.timeline .meta strong { color: var(--text); font-weight: 600; }
.timeline .body { margin-top: 3px; white-space: pre-line; overflow-wrap: anywhere; }
.timeline .changes { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.timeline .changes del { color: #a14b43; }
.timeline .changes ins { text-decoration: none; color: #1c6b3e; }

/* ---------- Checklist ---------- */
.checklist-section { margin-bottom: 16px; }
.checklist-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.check-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; margin-bottom: 6px; }
.check-item input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent-text); flex: none; }
.check-item .text { flex: 1; min-width: 0; }
.check-item.done .text { color: var(--muted); text-decoration: line-through; }
.check-item .by { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.check-item .tools { display: flex; gap: 2px; opacity: .5; }
.check-item:hover .tools { opacity: 1; }

/* Workflow stepper */
.stepper { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.stepper button { flex: 1 0 auto; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--border); background: #fff; color: var(--muted); font: 550 13px var(--font); border-radius: 8px; cursor: pointer; white-space: nowrap; }
.stepper button .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; background: var(--subtle); border: 1px solid var(--border); }
.stepper button.done { color: var(--text); }
.stepper button.done .n { background: var(--accent-100); border-color: var(--accent-100); color: var(--accent-text); }
.stepper button.current { border-color: var(--accent); background: var(--accent-50); color: var(--text); font-weight: 650; }
.stepper button.current .n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper button:hover { border-color: var(--border-strong); }

/* ---------- Kanban ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.column { background: #e9edf2; border-radius: var(--radius); padding: 10px; min-height: 120px; }
.column.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.column-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; font-weight: 600; }
.column-head small { color: var(--muted); font-weight: 500; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; }
.card:active { cursor: grabbing; }
.card .title { font-weight: 600; display: block; color: var(--text); }
.card .sub { display: block; color: var(--muted); font-size: 12.5px; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 6px; }
.card select { font-size: 12px; border: 1px solid var(--border); border-radius: 6px; padding: 3px 4px; background: #fff; max-width: 150px; }

/* ---------- Calendar ---------- */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.cal-toolbar h2 { font-size: 18px; margin: 0 8px; min-width: 160px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--border); border-top: 1px solid var(--border); background: #fff; border-radius: var(--radius); overflow: hidden; }
.month .dow { padding: 8px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--subtle); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.month .day { min-height: 112px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); cursor: pointer; min-width: 0; }
.month .day:hover { background: #fafcfd; }
.month .day.other { background: #fafbfc; color: var(--faint); }
.month .day .d { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 12.5px; font-weight: 600; }
.month .day.today .d { background: var(--accent); color: var(--accent-ink); }
.ev { display: block; margin-top: 3px; padding: 2px 6px; border-radius: 5px; font-size: 12px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid; background: var(--accent-50); border-color: var(--accent); color: #0b3d55; cursor: pointer; }
.ev.uppdrag { background: #eeeafa; border-color: #7c5ce0; color: #3b2a80; }
.ev.uppgift { background: #fcf2da; border-color: #d99a00; color: #6d4700; }
.ev.uppgift.done { opacity: .55; text-decoration: line-through; }
.ev.extern { background: #eef0f3; border-color: #8a94a6; color: #3d4757; cursor: default; }
.ev.innehall { background: #e1f4f2; border-color: #14a39a; color: #0f5550; }
.ev .t { font-weight: 650; margin-right: 4px; }
.more-ev { font-size: 11.5px; color: var(--muted); margin-top: 2px; display: block; }
.week { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.week-head, .week-allday { display: grid; grid-template-columns: 56px repeat(var(--days), minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.week-head div { padding: 8px 6px; text-align: center; font-size: 12.5px; color: var(--muted); border-left: 1px solid var(--border); }
.week-head div:first-child, .week-allday div:first-child { border-left: 0; }
.week-head .today strong { background: var(--accent); color: var(--accent-ink); border-radius: 12px; padding: 0 7px; }
.week-head strong { display: inline-block; font-size: 15px; color: var(--text); }
.week-allday div { min-height: 30px; padding: 3px; border-left: 1px solid var(--border); font-size: 11px; color: var(--faint); }
.week-body { position: relative; display: grid; grid-template-columns: 56px repeat(var(--days), minmax(0, 1fr)); max-height: calc(100vh - 290px); min-height: 420px; overflow-y: auto; }
.week-hours div { height: 48px; font-size: 11px; color: var(--faint); text-align: right; padding: 0 8px; transform: translateY(-7px); }
.week-col { position: relative; border-left: 1px solid var(--border); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, var(--border) 47px, var(--border) 48px); cursor: cell; }
.week-col.today { background-color: #fbfeff; }
.week-col .ev { position: absolute; left: 3px; right: 3px; white-space: normal; margin: 0; padding: 3px 6px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.week-col .now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 3; }
.agenda .day-block { margin-bottom: 14px; }
.agenda .day-block h3 { font-size: 13px; margin-bottom: 6px; color: var(--muted); }
.agenda .day-block.today h3 { color: var(--accent-text); }
.cal-toolbar h2::first-letter, .agenda .day-block h3::first-letter, .week-head div::first-letter, .month .dow::first-letter, .bars .bar small::first-letter { text-transform: uppercase; }
.readonly-lines td:first-child { min-width: 170px; }

/* ---------- Modal ---------- */
dialog.modal { width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 14px; box-shadow: var(--shadow-lg); color: var(--text); overflow: hidden; }
dialog.modal.wide { width: min(920px, calc(100vw - 24px)); }
dialog.modal.narrow { width: min(460px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(8, 18, 33, .45); }
.modal-inner { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--subtle); }
.modal-foot .left { margin-right: auto; }

/* Search overlay */
.search-results { list-style: none; margin: 10px 0 0; padding: 0; }
.search-results li a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; min-height: 48px; }
.search-results li a:hover, .search-results li a.active { background: var(--accent-50); }
.search-results .type { width: 90px; flex: none; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.search-results .sub { color: var(--muted); font-size: 12.5px; display: block; }

/* Popover menu */
.menu { position: fixed; z-index: 60; min-width: 220px; padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border: 0; background: none; border-radius: 7px; color: var(--text); font: 500 13.5px var(--font); text-align: left; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--subtle); text-decoration: none; }
.menu .sep { height: 1px; background: var(--border); margin: 5px 0; }
.menu .head { padding: 8px 12px 4px; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* Toast */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--navy-900); color: #fff; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .18s ease-out; }
.toast.error { background: var(--danger); }
.toast .i { margin-top: 1px; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 0 0 0 8px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* Auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 20% -10%, #17314f 0, var(--navy-950) 60%); }
.auth-card { width: min(420px, 100%); background: #fff; border-radius: 16px; padding: 30px 28px; box-shadow: var(--shadow-lg); }
.auth-card .brand { color: var(--text); padding: 0 0 18px; }
.auth-card .brand small { color: var(--accent-text); }
.auth-card h1 { font-size: 20px; margin-bottom: 6px; }
.auth-card .field + .field { margin-top: 12px; }
.auth-card .btn.primary { width: 100%; margin-top: 18px; min-height: 44px; }

/* Lines editor (quotes/invoices) */
.lines { width: 100%; border-collapse: collapse; }
.lines th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.lines td { padding: 6px; vertical-align: top; border-bottom: 1px solid var(--border); }
.lines input, .lines textarea { width: 100%; min-height: 36px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; }
.lines textarea { min-height: 34px; resize: vertical; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.lines input:focus, .lines textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.lines .n { width: 86px; }
.lines .u { width: 76px; }
.lines .p { width: 110px; }
.lines .pct { width: 72px; }
.lines .sum { width: 120px; text-align: right; padding-top: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines .tools { width: 1%; white-space: nowrap; padding-top: 8px; }
.lines input.num { text-align: right; }
.totals { margin-left: auto; width: min(340px, 100%); margin-top: 12px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 2px; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 16px; }
.readonly-lines td, .readonly-lines th { padding: 9px 8px; }

/* Bar chart */
.bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 150px; padding: 8px 0 0; }
.bars .bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.bars .bar span { width: 100%; max-width: 34px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .bar.zero span { background: #dfe5ec; }
.bars .bar small { font-size: 11px; color: var(--muted); }

/* Risk matrix */
.risk { display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 6px; border-radius: 6px; font-weight: 700; font-size: 12px; }
.risk.low { background: var(--ok-50); color: var(--ok); }
.risk.mid { background: var(--warn-50); color: var(--warn); }
.risk.high { background: var(--danger-50); color: var(--danger); }
.edit-table { width: 100%; border-collapse: collapse; }
.edit-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--border); }
.edit-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.edit-table input, .edit-table select, .edit-table textarea { width: 100%; min-height: 36px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; }
.edit-table textarea { min-height: 36px; resize: vertical; }

.kpi-row { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.kpi-row div { min-width: 90px; }
.kpi-row strong { display: block; font-size: 18px; }
.kpi-row span { font-size: 12px; color: var(--muted); }
.file-drop { border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); background: var(--subtle); }
.file-drop.over { border-color: var(--accent); background: var(--accent-50); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
.color-select { display: flex; gap: 4px; }
.color-select label { cursor: pointer; }
.color-select input { position: absolute; opacity: 0; }
.color-select span { display: block; width: 22px; height: 22px; border-radius: 6px; border: 2px solid transparent; }
.color-select input:checked + span { border-color: var(--text); }
.color-select input:focus-visible + span { outline: 2px solid var(--accent); }
.c-gra { background: #98a2b3; } .c-bla { background: #1a8fc4; } .c-gron { background: #2f9e5d; } .c-gul { background: #e0a500; } .c-rod { background: #d92d20; } .c-lila { background: #7c5ce0; } .c-turkos { background: #14a39a; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table input { width: 18px; height: 18px; accent-color: var(--accent-text); }
.logo-stage { display: inline-block; max-width: 100%; padding: 14px 18px; margin-bottom: 4px; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.logo-preview { width: auto; max-width: min(280px, 100%); max-height: 64px; display: block; }
.integration { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--border); }
.integration:last-child { border-bottom: 0; }
.integration .grow { flex: 1; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-side { grid-template-columns: minmax(0, 1fr); }
  .grid.side-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .tabs.wrap a { padding: 0 10px; }
  :root { --tap: 44px; }
  body { font-size: 15px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(8, 18, 33, .45); z-index: 25; }
  .nav a { min-height: 46px; font-size: 15px; }
  .topbar { height: 56px; padding: 0 12px; gap: 6px; background: var(--navy-900); color: #fff; }
  .topbar .mobile-brand { display: flex; align-items: center; gap: 8px; color: #fff; }
  .topbar .mobile-brand svg { width: 28px; height: 28px; }
  .topbar .mobile-brand strong { font: 700 15px var(--font); letter-spacing: -.01em; }
  .topbar .searchbox { display: none; }
  .topbar .iconbtn { color: #c6d2e1; width: 44px; height: 44px; }
  .topbar .iconbtn:hover { background: var(--navy-800); border-color: transparent; color: #fff; }
  .topbar .hide-mobile { display: none; }
  .content { padding: 4px 14px calc(88px + env(safe-area-inset-bottom)); }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 60px; border: 0; background: none; color: var(--muted); font: 600 11px var(--font); text-decoration: none; cursor: pointer; }
  .bottomnav .i { width: 22px; height: 22px; }
  .bottomnav [aria-current="page"] { color: var(--accent-text); }
  .page-head { margin: 12px 0 14px; align-items: flex-start; }
  .page-head h1 { font-size: 20px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .page-head .actions .btn.icon, .page-head .actions .segmented { flex: 0 0 auto; }
  .grid.two, .grid.three, .grid.four { grid-template-columns: minmax(0, 1fr); }
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .value { font-size: 19px; }
  .form-grid, .form-grid.three { grid-template-columns: minmax(0, 1fr); }
  .panel-head, .panel-body { padding-left: 14px; padding-right: 14px; }
  .list > li { padding-left: 14px; padding-right: 14px; }
  .dl { grid-template-columns: 110px minmax(0, 1fr); }
  .table-tools .search { max-width: none; flex-basis: 100%; }
  .table-tools select { flex: 1 1 140px; max-width: none; height: 42px; }
  .table-tools .count { width: 100%; margin: 0; }
  /* Tables become cards */
  table.data.cards thead { display: none; }
  table.data.cards, table.data.cards tbody, table.data.cards tr, table.data.cards td { display: block; width: 100%; }
  table.data.cards tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.data.cards td { border: 0; padding: 2px 0; }
  table.data.cards td[data-label]:not(.primary)::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12.5px; }
  table.data.cards td.primary { font-size: 15px; }
  table.data.cards td.hide-mobile, table.data.cards td:empty { display: none; }
  table.data.cards td.actions { text-align: left; padding-top: 8px; }
  table.readonly-lines .m-brief { display: block; }
  table.data.cards.readonly-lines tr { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
  table.data.cards.readonly-lines td.primary { flex: 1; min-width: 0; width: auto; }
  table.data.cards.readonly-lines td.line-sum { width: auto; font-weight: 600; white-space: nowrap; }
  table.readonly-lines td.line-sum::before { display: none; }
  table.data.cards.readonly-lines tr.group td { padding: 6px 0 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .lines thead { display: none; }
  .lines tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .lines td { border: 0; padding: 0; width: auto !important; }
  .lines td.name { grid-column: 1 / -1; }
  .lines td.sum { text-align: left; padding-top: 8px; }
  .lines td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); }
  .week-body { max-height: none; }
  .month .day { min-height: 64px; padding: 3px; }
  .month .ev { font-size: 10.5px; padding: 1px 4px; }
  .month .ev .t { display: none; }
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100dvh; margin: 0; border-radius: 0; }
  dialog.modal .modal-inner { max-height: 100dvh; height: 100%; }
  dialog.modal.narrow { height: auto; max-height: 92dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  dialog.modal.narrow .modal-inner { height: auto; max-height: 92dvh; }
  .modal-body { flex: 1; }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; }
  .toasts { left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); }
  .board { grid-auto-columns: minmax(78vw, 1fr); }
  .check-item .tools { opacity: 1; }
  .stepper button { flex: 0 0 auto; }
}
@media (min-width: 901px) {
  .only-mobile { display: none !important; }
}

@media print {
  .sidebar, .topbar, .bottomnav, .page-head .actions, .table-tools, .toasts { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  .panel { box-shadow: none; }
}

/* ---------- AW Solutions additions ---------- */
.progress.near .bar span { background: #d97706; }
.progress.over .bar span { background: var(--danger); }
.progress.over small { color: var(--danger); font-weight: 600; }
.totals .head { color: var(--muted); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding-top: 12px; }
.totals .head:first-child { padding-top: 0; }
.totals .note { color: var(--muted); font-size: 12.5px; border-top: 1px dashed var(--border-strong); margin-top: 8px; padding-top: 8px; }
table.lines th.rec, table.lines td.rec { width: 72px; text-align: center; }
.rec-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
.rec-toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
table.lines tr.monthly td { background: var(--accent-50); }
.readonly-lines tr.group td { background: var(--subtle); color: var(--muted); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.chip { display: inline-block; border: 1px solid var(--border-strong); background: var(--panel); color: var(--text); border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 12px; cursor: pointer; margin: 6px 6px 0 0; }
.chip:hover { border-color: var(--accent); color: var(--accent-text); }
.btn.tpl { height: auto; min-height: 64px; flex-direction: column; align-items: flex-start; white-space: normal; text-align: left; padding: 10px 14px; gap: 2px; }
.task-check { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.brand svg { width: 34px; height: 34px; flex: none; border-radius: 9px; }
.mobile-brand svg { width: 28px; height: 28px; border-radius: 7px; }

/* Shown only on phones (cards): "1 st × pris" under a quote line. */
.m-brief { display: none; }
