/* FONT-SKALERT */
/* GeoTask Pro — tema og nye komponenter (lastes etter style.css)
 *
 * Prinsipper (jf. mobile-app-ui-design):
 *  - 8-punkts rutenett (4/8/12/16/24/32/48)
 *  - Fire tekststørrelser: 12 · 14 · 16 · 24 (+ 32 for store tall), to hovedvekter: 500/600 og 700
 *  - 60/30/10: nøytral bunn, mørk tekst, blå aksent kun for hovedhandlinger
 *  - Myke, fargetonede skygger; trykkflater minst 44 px; trykk-zone nederst på mobil
 */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e5e9f0;
  --line-strong: #d5dbe5;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --brand: #2563eb;
  --brand-600: #1d4ed8;
  --brand-50: #eff6ff;
  --brand-100: #dbeafe;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-2: 0 1px 2px rgba(15, 23, 42, 0.05), 0 12px 28px rgba(30, 41, 90, 0.08);
  --shadow-brand: 0 8px 20px rgba(37, 99, 235, 0.28);
  --nav-h: 64px;
  --header-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(0.2, 0.8, 0.3, 1);
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body { overscroll-behavior-y: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.gt-icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }
i[data-icon] { display: inline-block; width: 18px; height: 18px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }

/* ---------- Knapper ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; letter-spacing: 0;
  transition: transform .12s var(--ease), background .15s ease, box-shadow .15s ease, opacity .15s ease, border-color .15s ease;
}
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 12px; border-radius: 10px; gap: 6px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn-primary:hover { background: var(--brand-600); }
.btn-primary:disabled { opacity: 0.5; box-shadow: none; }
.btn-dark { background: var(--text); color: #fff; box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
.btn-dark:hover { background: #1e293b; }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid transparent; }
.btn-ghost:hover { background: #eaeef4; color: var(--text); }
.btn-danger-ghost:hover { background: #fef2f2; border-color: #fecaca; }
.icon-btn { width: 44px; height: 44px; border-radius: var(--r-md); background: transparent; color: var(--text-2); }
.icon-btn:hover { background: #eaeef4; color: var(--text); }
.icon-btn.floating { background: rgba(255, 255, 255, 0.96); box-shadow: var(--shadow-2); border: 1px solid var(--line); color: var(--text); }
.link-btn { font-weight: 600; font-size: 12px; color: var(--brand); border-radius: 6px; padding: 4px; }
.link-btn:hover { color: var(--brand-600); text-decoration: underline; }
.btn .btn-label { white-space: nowrap; }

/* ---------- Topplinje ---------- */
.app-header {
  height: var(--header-h); padding: 0 24px; gap: 16px;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line); box-shadow: none;
}
.header-left { gap: 8px; min-width: 0; }
.header-right { gap: 12px; min-width: 0; }
.brand { background: none; border: none; padding: 4px 8px 4px 0; border-radius: var(--r-md); color: inherit; }
.brand:hover .brand-name { color: var(--brand); }
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px; color: #fff; --brand-pin-hole: #1d4ed8;
  background: linear-gradient(145deg, #3b82f6 0%, #1d4ed8 100%);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); transition: color .15s ease; }
.header-title { display: none; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.header-back { display: none; }

.view-switch { background: #eef1f6; padding: 4px; border-radius: 14px; gap: 2px; }
.view-btn {
  min-height: 36px; padding: 6px 16px; border-radius: 10px; gap: 8px;
  font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text-3);
}
.view-btn:hover:not(:disabled):not(.active) { color: var(--text); }
.view-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.06); }
.view-btn.active .gt-icon { color: var(--brand); }
.view-btn:disabled { opacity: 0.4; }

.project-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 220px; min-height: 36px; padding: 6px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.project-chip:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.project-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.user-menu-btn { height: 44px; background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; }
.user-menu-btn:hover { background: #fff; border-color: var(--line-strong); }
.user-avatar { background: linear-gradient(145deg, #3b82f6, #1d4ed8); font-weight: 700; }
.user-avatar-xl { width: 56px; height: 56px; font-size: 14px; }
.user-menu-panel { width: 264px; border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.user-menu-info { padding: 16px; gap: 12px; align-items: center; }
.user-menu-info-text { min-width: 0; }
.user-menu-name { font-size: 13px; }
.user-menu-email { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-role { font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--text-3); font-weight: 500; margin-top: 4px; }
.user-menu-item { min-height: 48px; padding: 12px 16px; font-size: 13px; font-weight: 600; gap: 12px; color: var(--text-2); }
.user-menu-item:hover { background: var(--surface-2); color: var(--text); }
.user-menu-logout { color: var(--danger); }
.user-menu-chevron { color: var(--text-3); }

/* ---------- Skall og visningsruting ---------- */
.app-shell { background: var(--bg); }
.page-panel { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; background: var(--bg); }

#app[data-view="HOME"] .sidebar,
#app[data-view="DASH"] .sidebar,
#app[data-view="HOME"] .mobile-overlay,
#app[data-view="DASH"] .mobile-overlay { display: none !important; }
#app[data-view="HOME"] .bulk-select-btn,
#app[data-view="DASH"] .bulk-select-btn,
#app[data-view="HOME"] .bulk-action-bar,
#app[data-view="DASH"] .bulk-action-bar,
#app:not([data-view="MAP"]) .map-tools-left,
#app:not([data-view="MAP"]) .overlay-manage-btn,
#app:not([data-view="MAP"]) .backup-manage-btn,
#app:not([data-view="MAP"]) .overlay-editor-toolbar,
#app:not([data-view="MAP"]) #task-location-pick-toolbar,
#app:not([data-view="MAP"]) #cable-points-edit-toolbar { display: none !important; }

/* ---------- Sidebar (filter + oppgaveliste) ---------- */
.sidebar { background: var(--surface); border-right: 1px solid var(--line); width: 340px; }
.sidebar-top { padding: 16px; border-bottom: 1px solid var(--line); }
.sidebar-actions { gap: 8px; margin-bottom: 16px; }
.search-box input, .table-search input {
  min-height: 44px; padding: 8px 12px 8px 40px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface-2); font-size: 13px; color: var(--text); transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.search-box input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); outline: none; }
.search-box .search-icon, .search-box > .gt-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.chip-toggle { min-height: 44px; padding: 8px 12px; border-radius: var(--r-md); font-size: 12px; font-weight: 600; color: var(--text-2); }
.chip-toggle.active { background: var(--text); border-color: var(--text); color: #fff; }
.sort-select { min-height: 44px; border-radius: var(--r-md); font-size: 12px; font-weight: 600; }
.filter-label { font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-3); margin-bottom: 8px; }
.filter-group-project .filter-label { color: var(--brand); }
.chip { min-height: 32px; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text-2); }
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }
.chip-dot { width: 8px; height: 8px; }
.project-picker-btn { min-height: 44px; border-radius: var(--r-md); border-color: var(--line); font-weight: 600; }
.project-picker-chevron { color: var(--text-3); }
.project-picker-item .gt-icon { pointer-events: none; }
.project-picker-item-rename, .project-picker-item-pin, .project-picker-item-members, .project-picker-item-del, .project-picker-item-move {
  display: inline-flex; align-items: center; justify-content: center;
}

.task-list { padding: 12px 12px 24px; }
.task-card { border-radius: var(--r-lg); border: 1px solid var(--line); padding: 16px; box-shadow: var(--shadow-1); margin-bottom: 8px; }
.task-card:hover { box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.task-card.selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.task-card-title { font-size: 13px; font-weight: 600; }
.task-card-status { font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.task-card-id, .task-card-footer { font-size: 12px; }
.task-card-priority, .task-card-project { font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 600; padding: 2px 8px; }
.task-card-desc { font-size: 12px; }
.task-list-empty { padding: 32px 16px; text-align: center; color: var(--text-3); }

/* ---------- Kart: flytende kontroller ---------- */
.bulk-select-btn, .overlay-manage-btn, .backup-manage-btn, .cable-draw-btn, .street-view-btn, .locate-me-btn, .move-mode-btn {
  width: 48px; height: 48px; color: var(--text-2); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-2);
}
.bulk-select-btn.active, .cable-draw-btn.active, .locate-me-btn.active, .move-mode-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.street-view-btn.active { background: #facc15; color: #111827; border-color: #facc15; }
.map-instructions { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.duplicate-banner { display: inline-flex; align-items: center; gap: 8px; }
.map-filter-panel { border-radius: var(--r-lg); border-color: var(--line); box-shadow: var(--shadow-2); }
.map-filter-header { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); background: var(--surface); }
.bulk-action-bar { border-radius: var(--r-lg); background: var(--text); }
.cable-draw-toolbar { border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.startloc-toolbar { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1003; }

/* ---------- Felles sidekomponenter ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 21px; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 4px; font-size: 13px; font-weight: 500; color: var(--text-3); }
.section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.project-section { margin-bottom: 32px; }

.kpi-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.kpi strong { display: block; font-size: 21px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi span:not(.kpi-icon) { font-size: 12px; color: var(--text-3); }
.kpi-icon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tone-blue { background: #dbeafe; color: #1d4ed8; }
.tone-amber { background: #fef3c7; color: #b45309; }
.tone-orange { background: #ffedd5; color: #c2410c; }
.tone-red { background: #fee2e2; color: #b91c1c; }
.tone-green { background: #dcfce7; color: #15803d; }
.tone-teal { background: #ccfbf1; color: #0f766e; }
.tone-violet { background: #ede9fe; color: #6d28d9; }
.tone-slate { background: #e2e8f0; color: #475569; }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .search-box-lg { flex: 1 1 280px; position: relative; min-width: 0; }
.toolbar .search-box-lg input { width: 100%; }
.toolbar .search-box-lg > .gt-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.toolbar-right { display: flex; gap: 8px; align-items: center; }
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap > .gt-icon { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.select-wrap select {
  appearance: none; -webkit-appearance: none; min-height: 44px; padding: 8px 32px 8px 36px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer;
}
.segmented-icons { display: inline-flex; background: #eef1f6; padding: 4px; border-radius: var(--r-md); }
.segmented-icons button { width: 40px; height: 36px; border: none; background: transparent; border-radius: 10px; color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; }
.segmented-icons button.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1); }
.chip-scroller { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 16px; margin: 0 -4px; padding-left: 4px; scrollbar-width: none; }
.chip-scroller::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.filter-chip:hover { border-color: var(--line-strong); }
.filter-chip.active { background: var(--text); border-color: var(--text); color: #fff; }
.filter-chip .count { font-size: 12px; font-weight: 600; opacity: 0.7; font-variant-numeric: tabular-nums; }

/* ---------- Prosjektkort ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.project-card {
  position: relative; display: flex; flex-direction: column; gap: 16px; padding: 20px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-1);
  transition: transform .18s var(--ease), box-shadow .18s ease, border-color .18s ease;
}
.project-card::before { content: ''; position: absolute; left: 20px; right: 20px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); opacity: 0.85; }
@media (hover: hover) { .project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); } }
.project-card:active { transform: scale(0.99); }
.project-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.project-card-top { display: flex; align-items: center; gap: 12px; }
.project-badge { width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.project-badge-lg { width: 64px; height: 64px; border-radius: 20px; }
.project-card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.project-card-title h3 { margin: 0; max-width: 100%; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-btn { width: 44px; height: 44px; margin: -8px -8px -8px 0; border: none; background: transparent; border-radius: 50%; color: #b6bfce; display: inline-flex; align-items: center; justify-content: center; transition: color .15s ease, background .15s ease, transform .15s var(--ease); }
.pin-btn:hover { background: #f1f5f9; color: #f59e0b; }
.pin-btn.on { color: #f59e0b; }
.pin-btn.on .gt-icon { fill: currentColor; }
.pin-btn:active { transform: scale(0.9); }
.project-card-desc { margin: -4px 0 0; font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-card-progress-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.done-flag { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); }
.statusbar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: #e8ecf2; gap: 2px; }
.statusbar-seg { display: block; height: 100%; min-width: 4px; transition: width .4s var(--ease); }
.statusbar-seg:first-child { border-radius: 999px 0 0 999px; }
.statusbar-seg:last-child { border-radius: 0 999px 999px 0; }
.statusbar-seg:only-child { border-radius: 999px; }
.project-card-stats { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.project-card-stats strong { color: var(--text); font-variant-numeric: tabular-nums; }
.stat-warn { display: inline-flex; align-items: center; gap: 4px; color: #b45309; }
.meta-item { display: inline-flex; align-items: center; gap: 4px; }
.project-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
.project-card-actions { display: inline-flex; align-items: center; gap: 8px; }
.chip-action { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; transition: background .15s ease, color .15s ease; }
.chip-action:hover { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }

.project-grid.is-list { grid-template-columns: 1fr; gap: 8px; }
.project-card.is-list { flex-direction: row; align-items: center; gap: 24px; padding: 12px 20px; }
.project-card.is-list::before { display: none; }
.project-card.is-list .project-card-top { flex: 0 1 320px; }
.project-card.is-list .project-card-desc { display: none; }
.project-card.is-list .project-card-progress { flex: 1 1 240px; }
.project-card.is-list .project-card-stats { flex: 0 0 auto; }
.project-card.is-list .project-card-foot { margin: 0; padding: 0; border: none; flex: 0 0 auto; }

.role-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; background: #eef1f6; color: #475569; }
.role-owner { background: #fef3c7; color: #92400e; }
.role-admin { background: #ede9fe; color: #5b21b6; }
.role-editor { background: #dbeafe; color: #1e40af; }
.role-viewer { background: #e2e8f0; color: #475569; }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 24px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-xl); }
.empty-state.compact { padding: 32px 16px; background: transparent; border: none; }
.empty-state h2, .empty-state h3 { margin: 8px 0 0; font-size: 14px; font-weight: 700; }
.empty-state p { margin: 0 0 16px; max-width: 420px; color: var(--text-3); }
.empty-art { width: 72px; height: 72px; border-radius: 24px; background: var(--brand-50); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.empty-state.compact .empty-art { width: 56px; height: 56px; border-radius: 18px; }

/* ---------- Dashboard ---------- */
.dash-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 24px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-1);
  position: relative; overflow: hidden;
}
.dash-hero::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--accent); }
.dash-hero-main { display: flex; gap: 16px; align-items: flex-start; min-width: 0; flex: 1 1 360px; }
.dash-hero-text { min-width: 0; }
.dash-hero-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dash-hero h1 { margin: 0; font-size: 21px; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.dash-desc { margin: 4px 0; color: var(--text-2); max-width: 64ch; }
.dash-hero-text .small { margin: 0; }
.dash-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.kpi-grid { display: grid; grid-template-columns: minmax(260px, 1.4fr) repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-tile {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; padding: 16px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); color: inherit; font: inherit;
}
.kpi-tile > strong { font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi-tile > span:last-child { font-size: 12px; color: var(--text-3); }
.kpi-link { cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s ease, border-color .15s ease; }
@media (hover: hover) { .kpi-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); } }
.kpi-progress { flex-direction: row; align-items: center; gap: 16px; }
.kpi-progress-text { display: flex; flex-direction: column; }
.kpi-progress-text strong { font-size: 14px; font-weight: 700; }
.kpi-progress-text span, .kpi-progress-text small { font-size: 12px; color: var(--text-3); }

.ring { position: relative; width: var(--size, 92px); height: var(--size, 92px); flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg) scaleY(-1); }
.ring-track { fill: none; stroke: #e8ecf2; stroke-width: 3.6; }
.ring-value { fill: none; stroke: var(--ok); stroke-width: 3.6; stroke-linecap: round; transition: stroke-dasharray .6s var(--ease); }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.ring-label strong { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: 12px; color: var(--text-3); }

.dash-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-1); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.card-head h2 .gt-icon { color: var(--text-3); }
.card-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.card-attention { border-color: #fde2c8; background: linear-gradient(180deg, #fffaf5, var(--surface) 70%); }
.card-attention .card-head h2 .gt-icon { color: var(--warn); }

.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.legend strong { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.prio-bars h3 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.prio-row { display: grid; grid-template-columns: 64px 1fr 32px; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 13px; color: var(--text-2); }
.prio-row strong { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 999px; background: #e8ecf2; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; transition: width .5s var(--ease); }

.tabs { display: inline-flex; background: #eef1f6; padding: 4px; border-radius: var(--r-md); align-self: flex-start; }
.tab { min-height: 36px; padding: 4px 16px; border: none; background: transparent; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1); }
.breakdown { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.breakdown-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.breakdown-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.breakdown-head strong { min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.pad { padding: 0; margin: 0; }

.lg { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.lg-created { background: #93c5fd; }
.lg-done { background: var(--ok); }

.task-mini { list-style: none; margin: 0; padding: 8px 8px 12px; display: flex; flex-direction: column; }
.task-mini-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 12px; min-height: 56px; border: none; background: transparent; border-radius: var(--r-md); text-align: left; color: inherit; font: inherit; transition: background .15s ease; }
.task-mini-row:hover { background: var(--surface-2); }
.task-mini-ico { width: 36px; height: 36px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.task-mini-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-mini-main strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-mini-main .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.team-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.team-list li { display: flex; align-items: center; gap: 12px; }
.team-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.team-who strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-who .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.role-explainer { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.role-explainer p { margin: 0; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; flex-shrink: 0; letter-spacing: 0.02em; }
.avatar-md { width: 40px; height: 40px; font-size: 12px; }
.avatar-lg { width: 48px; height: 48px; font-size: 13px; }
.skeleton-list { display: flex; flex-direction: column; gap: 12px; }
.skeleton { display: block; height: 40px; border-radius: var(--r-md); background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 50%, #eef1f6 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px 20px 20px; }
.admin-tile { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); color: var(--text); font: inherit; transition: background .15s ease, border-color .15s ease, transform .15s var(--ease); }
.admin-tile:hover { background: var(--surface-2); border-color: var(--line-strong); }
.admin-tile:active { transform: scale(0.99); }
.admin-tile > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-tile strong { font-size: 13px; font-weight: 600; }
.admin-tile small { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-tile > .gt-icon:last-child { color: var(--text-3); }
.admin-ico { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.admin-danger { border-color: #fecaca; }
.admin-danger:hover { background: #fef2f2; }

/* ---------- Tabell ---------- */
#table-view { overflow: auto; background: var(--bg); -webkit-overflow-scrolling: touch; }
.table-toolbar { position: sticky; top: 0; z-index: 4; display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 12px; background: var(--bg); border-bottom: none; justify-content: flex-start; align-items: stretch; }
.table-toolbar-main { display: flex; align-items: center; gap: 8px; }
.table-search { position: relative; flex: 1; min-width: 0; }
.table-search input { width: 100%; }
.table-status-chips { overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.table-status-chips::-webkit-scrollbar { display: none; }
.table-summary { font-size: 12px; color: var(--text-3); min-height: 16px; }
.task-table { width: calc(100% - 32px); margin: 0 16px 24px; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.task-table thead th:first-child { border-top-left-radius: var(--r-lg); }
.task-table thead th:last-child { border-top-right-radius: var(--r-lg); }
.task-table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--r-lg); }
.task-table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--r-lg); }
/* Kolonner som er overflødige i et smalt skrivebordsvindu: detaljene finnes i oppgavevinduet */
.task-table.single-project th:nth-child(4), .task-table.single-project td:nth-child(4) { display: none; }
@media (min-width: 1025px) and (max-width: 1500px) {
  .task-table th:nth-child(10), .task-table td:nth-child(10), .task-table th:nth-child(11), .task-table td:nth-child(11) { display: none; }
}
.task-table thead th {
  position: sticky; top: var(--toolbar-h, 0px); z-index: 2; background: var(--surface-2);
  padding: 12px 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; text-transform: none; color: var(--text-3); text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.task-table tbody td { padding: 12px 10px; font-size: 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.task-table tbody tr:last-child td { border-bottom: none; }
.task-table tbody tr { transition: background .12s ease; }
.task-table tbody tr:hover { background: var(--surface-2); }
.task-table tbody tr.row-selected { background: var(--brand-50); }
.task-table .col-title { min-width: 180px; max-width: 220px; }
.task-table .col-title strong { display: block; font-weight: 600; }
.cell-desc { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.cell-empty { color: #b6bfce; }
.col-id { color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.col-date { white-space: nowrap; color: var(--text-2); }
.col-address { max-width: 220px; color: var(--text-2); }
.entity-chip, .status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.entity-chip { background: color-mix(in srgb, var(--c) 10%, transparent); color: color-mix(in srgb, var(--c) 80%, #000); }
.status-pill { background: color-mix(in srgb, var(--c) 14%, transparent); color: color-mix(in srgb, var(--c) 72%, #000); }
.prio-pill { display: inline-flex; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #eef1f6; color: #475569; }
.prio-medium { background: #dbeafe; color: #1e40af; }
.prio-high { background: #ffedd5; color: #9a3412; }
.prio-urgent { background: #fee2e2; color: #b91c1c; }
.table-actions { white-space: nowrap; text-align: right; }
.table-actions button { width: 32px; height: 32px; border: none; background: transparent; border-radius: 10px; color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; transition: background .15s ease, color .15s ease; }
.table-actions .edit:hover { background: var(--brand-50); color: var(--brand); }
.table-actions .del:hover { background: #fef2f2; color: var(--danger); }
.table-empty { padding: 48px 16px; text-align: center; color: var(--text-3); }
.load-more-wrap { padding: 8px 0 24px; text-align: center; }

/* ---------- Modaler ---------- */
.modal-overlay { background: rgba(15, 23, 42, 0.5); }
.modal-card { border-radius: var(--r-xl); box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28); border: 1px solid var(--line); }
.modal-header { padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.modal-header-title { display: flex; align-items: center; gap: 12px; }
.modal-header-icon { width: 36px; height: 36px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.modal-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 12px 20px; }
.field label { font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text-2); margin-bottom: 8px; }
.field input, .field select, .field textarea, .modal-body input[type="text"], .modal-body input[type="email"], .modal-body input[type="password"], .modal-body select, .modal-body textarea {
  min-height: 44px; border-radius: var(--r-md); border: 1px solid var(--line); font-size: 13px; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus, .modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.field textarea, .modal-body textarea { min-height: 88px; }
.field-optional { font-weight: 500; color: var(--text-3); }
.field-hint { margin: 8px 0 0; font-size: 12px; color: var(--text-3); }
.form-section-title { font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text-3); }

.member-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.member-row-name { font-size: 13px; font-weight: 600; }
.member-row-email { font-size: 12px; color: var(--text-3); }
.member-role-select { min-height: 40px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.member-row-remove { width: 40px; height: 40px; border: none; background: transparent; color: var(--text-3); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.member-row-remove:hover { background: #fef2f2; color: var(--danger); }
.members-empty-hint { font-size: 12px; color: var(--text-3); }

.profile-hero { display: flex; align-items: center; gap: 16px; padding-bottom: 16px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.profile-hero-name { font-size: 14px; font-weight: 700; }
.profile-hero-role { font-size: 12px; color: var(--text-3); }
.profile-body .field { margin-bottom: 16px; }
.profile-message { margin: 0; padding: 12px; border-radius: var(--r-md); font-size: 13px; font-weight: 500; }
.profile-message.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.profile-message.bad { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.access-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.access-list li { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
.access-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Bunnmeny (mobil) ---------- */
.bottom-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-progress { grid-column: 1 / -1; }
}

@media (max-width: 1024px) {
  :root { --header-h: 56px; }
  .app-header { padding: calc(var(--safe-t)) 8px 0 8px; height: calc(var(--header-h) + var(--safe-t)); gap: 8px; }
  .view-switch, .header-new-task, .project-chip { display: none !important; }
  .brand-name { display: none; }
  .brand { padding: 4px; }
  .header-title { display: block; }
  .header-back:not(.hidden) { display: inline-flex; }
  .header-back:not(.hidden) ~ .brand { display: none; }
  #mobile-sidebar-toggle { display: none; }
  .user-menu-btn { width: 44px; padding: 4px; justify-content: center; gap: 0; border-color: transparent; background: transparent; }
  .user-menu-btn-name, .user-menu-chevron { display: none; }
  .user-menu-panel { width: min(300px, calc(100vw - 16px)); }

  .page { padding: 16px 16px 32px; }
  .page-head h1, .dash-hero h1 { font-size: 21px; }
  .kpi-strip { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 12px; }
  .dash-columns { grid-template-columns: minmax(0, 1fr); }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-hero { padding: 16px; }
  .dash-hero-actions { width: 100%; }
  .dash-hero-actions .btn { flex: 1 1 auto; }

  /* Bunnmeny: sist i flex-kolonnen, så kartets knapper ligger over den */
  .bottom-nav {
    display: flex; align-items: stretch; justify-content: space-around; flex-shrink: 0; z-index: 1100;
    background: rgba(255, 255, 255, 0.96); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--line); padding: 4px 8px var(--safe-b); height: calc(var(--nav-h) + var(--safe-b));
  }
  .bottom-nav-btn {
    position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    border: none; background: transparent; color: var(--text-3); font-size: 12px; font-weight: 600; border-radius: var(--r-md);
    transition: color .15s ease, transform .12s var(--ease);
  }
  .bottom-nav-btn:active { transform: scale(0.94); }
  .bottom-nav-btn.active { color: var(--brand); }
  .bottom-nav-btn.active::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
  .bottom-nav-btn.has-dot::after { content: ''; position: absolute; top: 8px; right: calc(50% - 18px); width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid #fff; box-sizing: content-box; }
  .bottom-nav-fab { flex: 0 0 72px; }
  .fab-circle { width: 56px; height: 56px; margin-top: -24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(145deg, #3b82f6, #1d4ed8); color: #fff; box-shadow: 0 10px 24px rgba(37, 99, 235, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.25); border: 4px solid var(--bg); }

  /* Sidebar blir en høyde-sheet fra venstre, over bunnmenyen */
  .sidebar { width: min(420px, 100vw); box-shadow: var(--shadow-2); }

  /* Tabell → kort */
  .table-toolbar { padding: 12px 16px 8px; }
  .btn-label { display: none; }
  #export-excel-btn { padding: 8px 12px; }
  .task-table { display: block; width: auto; margin: 0 16px 16px; background: transparent; border: none; box-shadow: none; }
  .task-table thead { display: none; }
  .task-table tbody { display: flex; flex-direction: column; gap: 12px; }
  .task-table tbody tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 16px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  }
  .task-table tbody tr:hover { background: var(--surface); }
  .task-table tbody td { display: none; padding: 0; border: none; font-size: 13px; border-radius: 0 !important; }
  .task-table tbody td.col-title { display: block; order: 1; flex: 1 1 60%; max-width: none; min-width: 0; }
  .task-table tbody td.col-title strong { font-size: 14px; }
  .cell-desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; max-width: none; }
  .task-table tbody td[data-label="Status"] { display: block; order: 2; flex: 0 0 auto; align-self: flex-start; }
  .task-table tbody td.col-id { display: block; order: 3; flex: 1 1 100%; font-size: 12px; margin-top: -4px; }
  .task-table tbody td[data-label="Prosjekt"], .task-table tbody td[data-label="Type"], .task-table tbody td[data-label="Område"],
  .task-table tbody td[data-label="Utstyr"], .task-table tbody td[data-label="Prioritet"] { display: inline-flex; order: 4; flex: 0 0 auto; }
  .task-table tbody td .cell-empty { display: none; }
  .task-table tbody td.col-address, .task-table tbody td.col-date { display: block; order: 5; flex: 1 1 100%; font-size: 12px; color: var(--text-3); max-width: none; }
  .task-table tbody td.col-date { order: 6; margin-top: -4px; }
  .task-table tbody td.table-actions { display: flex; order: 9; flex: 1 1 100%; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
  .task-table tbody td.table-actions button { width: 44px; height: 44px; }
  .task-table tbody td.table-select-col { display: none; }
  .task-table.bulk-mode tbody td.table-select-col { display: block; order: 0; flex: 0 0 auto; }

  .modal-sheet .modal-card { border-radius: 24px 24px 0 0; }
  .modal-footer { padding-bottom: calc(12px + var(--safe-b)); }
}

@media (max-width: 640px) {
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1 1 auto; }
  .page-head-actions .btn-label { display: inline; }
  .toolbar-right { width: 100%; justify-content: space-between; }
  .select-wrap { flex: 1; }
  .select-wrap select { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-tile > strong { font-size: 21px; }
  .admin-grid { grid-template-columns: 1fr; }
  .legend { grid-template-columns: 1fr; }
  .project-card { padding: 16px; }
  .project-card.is-list { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; }
  .project-card.is-list .project-card-top, .project-card.is-list .project-card-progress { flex: none; }
}

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

/* =====================================================================
   Runde 2: kartets toppmeny, verktøy, prosjektvelger, arkiv/papirkurv,
   organisasjoner, ikonvalg og webview-tilpasninger
   ===================================================================== */

.modal-overlay { backdrop-filter: none; -webkit-backdrop-filter: none; }
.content-area { z-index: 1; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 6px 16px rgba(220, 38, 38, 0.25); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-danger:disabled { opacity: 0.45; box-shadow: none; }

/* ---------- Kartets toppmeny ---------- */
.map-filter-toggle-wrap { display: none !important; }
.map-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1100; padding: 12px; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.map-topbar > * { pointer-events: auto; }
.map-topbar-row { position: relative; display: flex; align-items: center; gap: 8px; }
.map-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-2); font-size: 13px; font-weight: 600; color: var(--text);
  transition: transform .12s var(--ease), box-shadow .15s ease;
}
.map-chip:active { transform: scale(0.98); }
.map-chip-project { flex: 1 1 auto; min-width: 0; max-width: 360px; }
.map-chip-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.map-chip-chevron { color: var(--text-3); }
.map-icon-btn {
  position: relative; width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  color: var(--text-2); box-shadow: var(--shadow-2); display: inline-flex; align-items: center; justify-content: center;
}
.map-icon-btn:active { transform: scale(0.96); }
.map-icon-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-sizing: content-box;
}
.map-topbar-chips { overflow: hidden; }
.map-topbar-chips .chip-row { flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.map-topbar-chips .chip-row::-webkit-scrollbar { display: none; }
.map-topbar-chips .chip { background: rgba(255, 255, 255, 0.97); box-shadow: var(--shadow-1); flex-shrink: 0; min-height: 36px; }
.map-topbar-chips .chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.map-topbar-chips .chip.active .chip-dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55); }

.map-search-slot { flex-shrink: 0; }
.map-search-slot .map-search {
  position: relative; top: auto; left: auto; z-index: 3; overflow: visible; height: 44px;
  border: 1px solid var(--line); box-shadow: var(--shadow-2); border-radius: 22px;
}
.map-search-slot .map-search.expanded { position: absolute; left: 0; right: 0; top: 0; width: auto; }
.map-search-slot .map-search input { font-size: 14px; }
.map-search-slot .map-search-results { top: 52px; left: 0; right: 0; width: auto; border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.map-search-slot .map-search-result { padding: 14px 16px; min-height: 56px; }
.map-search-slot .map-search-result-sub { text-transform: none; font-size: 12px; font-weight: 500; letter-spacing: 0; }

#map-view .leaflet-top.leaflet-right { margin-top: 76px; }
@media (min-width: 1025px) {
  .map-topbar { right: auto; width: min(780px, calc(100% - 120px)); }
  #map-filter-open { display: none; }
  #map-view .leaflet-top.leaflet-right { margin-top: 12px; }
}

/* ---------- Kartverktøy nede til høyre ---------- */
.map-tools-right { position: absolute; right: 12px; bottom: 16px; z-index: 1002; display: flex; flex-direction: column; gap: 12px; }
.map-tools-right > button {
  position: static !important; inset: auto !important; width: 48px; height: 48px; border-radius: 50%; margin: 0;
  display: inline-flex; align-items: center; justify-content: center; background: #fff; color: var(--text-2);
  border: 1px solid var(--line); box-shadow: var(--shadow-2);
}
.map-tools-right > button:disabled { opacity: 0.4; }
.map-tools-right .cables-visible-btn.active { color: var(--brand); }
.map-tools-right .cables-visible-btn:not(.active) { color: var(--text-3); background: #f1f5f9; }
.map-tools-right .street-view-btn.active { background: #facc15; color: #111827; border-color: #facc15; box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.35), var(--shadow-2); }
.map-tools-right .cable-draw-btn.active, .map-tools-right .move-mode-btn.active, .map-tools-right .locate-me-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.gps-status { right: 72px; bottom: 20px; max-width: calc(100% - 200px); }
.streetview-armed #map { cursor: crosshair; }
#map-view.streetview-armed::after {
  content: 'Trykk et sted i kartet for å hoppe inn i Street View'; position: absolute; top: 124px; left: 50%; transform: translateX(-50%);
  z-index: 1001; background: #facc15; color: #111827; padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 12px;
  box-shadow: var(--shadow-2); pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
@media (min-width: 1025px) { #map-view.streetview-armed::after { top: 84px; } }

/* ---------- Sidemeny = kun filtre ---------- */
.sidebar-head { display: none; align-items: center; justify-content: space-between; margin: -4px 0 8px; }
.sidebar-head h2 { margin: 0; font-size: 14px; font-weight: 700; }
.sidebar { overflow: hidden; }
.sidebar-top { max-height: none !important; height: 100%; overflow-y: auto; border-bottom: none; padding-bottom: 24px; }
.sidebar-apply { display: none; }
.task-list { display: none !important; }

/* ---------- Ikonvalg ---------- */
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.icon-choice {
  height: 44px; border: 1px solid var(--line); background: #fff; border-radius: 12px; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.icon-choice:hover { background: var(--surface-2); }
.icon-choice.selected { background: var(--brand-50); border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
.row-icon { display: inline-flex; vertical-align: -3px; margin-right: 6px; }
.kind-badge { display: inline-flex; padding: 2px 8px; border-radius: 999px; background: #ccfbf1; color: #0f766e; font-size: 12px; font-weight: 600; }

/* ---------- Kabelskjema ---------- */
.check-row { display: flex !important; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; text-transform: none; }
.check-row input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; margin-top: 2px; accent-color: var(--brand); flex-shrink: 0; }
.check-row strong { display: block; font-size: 13px; color: var(--text); }
.check-row small { display: block; font-size: 12px; font-weight: 400; color: var(--text-3); line-height: 1.4; margin-top: 2px; }

/* ---------- Prosjektvelger ---------- */
.switcher .modal-card, .org-sheet .modal-card, #project-menu-sheet .modal-card, #delete-project-sheet .modal-card { max-width: 560px; }
.switcher-body { display: flex; flex-direction: column; gap: 12px; }
.switcher-search { position: relative; }
.switcher-search input { width: 100%; padding-left: 44px; }
.switcher-search > .gt-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.switch-list { display: flex; flex-direction: column; gap: 4px; }
.switch-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px; text-align: left;
  border: 1px solid transparent; border-radius: 14px; background: transparent; color: var(--text);
  transition: background .12s ease, border-color .12s ease;
}
.switch-row:hover { background: var(--surface-2); }
.switch-row:active { background: #eaeef4; }
.switch-row.current { background: var(--brand-50); border-color: var(--brand-100); }
.switch-row.current > .gt-icon:last-child { color: var(--brand); }
.switch-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.switch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.switch-main strong { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.switch-main strong .gt-icon { color: #f59e0b; fill: #f59e0b; flex-shrink: 0; }
.switch-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.switch-count { min-width: 32px; height: 28px; padding: 0 8px; border-radius: 999px; background: #eef1f6; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; color: var(--text-2); }
.switch-group { margin: 12px 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.switch-archived { margin-top: 8px; }
.switch-archived summary { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; font-weight: 600; color: var(--text-3); cursor: pointer; }
.switch-empty { text-align: center; padding: 24px 0; }

/* ---------- Prosjektverktøy ---------- */
.menu-body { display: flex; flex-direction: column; gap: 4px; }
.menu-project { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 8px; }
.menu-project-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.menu-project-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-group { margin: 12px 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.menu-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 8px; text-align: left; border: none; background: transparent; border-radius: var(--r-md); color: var(--text); font: inherit; }
.menu-row:hover { background: var(--surface-2); }
.menu-row:active { background: #eaeef4; }
.menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.menu-text strong { font-size: 13px; font-weight: 600; }
.menu-text small { font-size: 12px; color: var(--text-3); }
.menu-row > .gt-icon:last-child { color: var(--text-3); }
.menu-danger .menu-text strong { color: var(--danger); }

/* ---------- Sletting ---------- */
.delete-body { display: flex; flex-direction: column; gap: 16px; }
.danger-box { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; border-radius: var(--r-md); padding: 12px 16px; }
.danger-box p { margin: 0; }
.danger-box a { color: #991b1b; font-weight: 600; }
code { background: #eef1f6; padding: 1px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translate(-50%, 24px); z-index: 6000;
  max-width: min(480px, calc(100vw - 32px)); padding: 12px 16px; border-radius: var(--r-md); background: var(--text); color: #fff;
  font-size: 13px; font-weight: 500; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.3); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: #991b1b; }
@media (min-width: 1025px) { .toast { bottom: 24px; } }

/* ---------- Arkiv, papirkurv og infobokser ---------- */
.info-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px; background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--r-md); color: #1e3a8a; }
.info-banner > .gt-icon { flex-shrink: 0; }
.info-banner p { margin: 0; flex: 1; font-size: 13px; }
.info-banner-archive { background: #f1f5f9; border-color: var(--line-strong); color: var(--text-2); }
.role-archived { background: #e2e8f0; color: #475569; }
.role-org { background: #ecfeff; color: #155e75; }
.chip-line { display: flex; flex-wrap: wrap; gap: 4px; }
.project-card.is-archived { background: #f8fafc; }
.project-card.is-archived .project-badge { filter: grayscale(1); opacity: 0.8; }
.project-card.is-trashed { cursor: default; opacity: 0.95; }
.trash-actions { gap: 8px; flex-wrap: wrap; }
.count-pill { margin-left: 4px; padding: 0 8px; border-radius: 999px; background: #eef1f6; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: none; letter-spacing: 0; }

/* ---------- Organisasjoner ---------- */
.org-body { display: flex; flex-direction: column; gap: 16px; }
.org-picker { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.org-select select { min-width: 220px; }
.org-create, .org-rename { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.org-create input, .org-rename input { flex: 1 1 200px; min-width: 0; }
.org-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.org-title { display: flex; align-items: center; gap: 8px; }
.org-head .small { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 0; }
.org-section { margin: 4px 0 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.role-guide { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); padding: 0 12px; }
.role-guide summary { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; font-weight: 600; cursor: pointer; }
.role-guide ul { list-style: none; margin: 0; padding: 0 0 12px; display: flex; flex-direction: column; gap: 12px; }
.role-guide li { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12px; color: var(--text-2); }
.role-guide li.mine { color: var(--text); }
.org-members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.org-member { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.org-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.org-add-row input { flex: 1 1 220px; min-width: 0; }
.org-danger { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); }
.role-org-owner { background: #fef3c7; color: #92400e; }
.role-org-admin { background: #ede9fe; color: #5b21b6; }
.role-org-member { background: #e2e8f0; color: #475569; }

/* ---------- Webview / app-følelse på telefon ---------- */
@media (max-width: 1024px) {
  html, body { overscroll-behavior: none; touch-action: manipulation; }
  body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  input, textarea, select, [contenteditable], code { -webkit-user-select: text; user-select: text; }
  .sidebar-actions { display: none; }
  .sidebar-head { display: flex; }
  .sidebar-apply {
    display: flex; position: sticky; bottom: 0; margin-top: 16px; min-height: 52px; font-size: 14px;
    box-shadow: 0 -8px 16px rgba(255, 255, 255, 0.95), var(--shadow-brand);
  }
  .map-instructions { max-width: calc(100% - 168px); white-space: normal; text-align: center; line-height: 1.3; bottom: 16px; }
  .org-select select { min-width: 0; width: 100%; }
  .org-select { flex: 1; }
  .org-add-row .btn { flex: 1 1 100%; }
}
@media (max-width: 640px) {
  .switch-row { min-height: 68px; }
  .map-chip-project { max-width: none; }
}

/* =====================================================================
   Runde 3: kommandopalett, temavelger, større modaler, organisasjonsfilter
   ===================================================================== */

kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
}

/* ---------- Søkeknapp (kommandoknapp) ---------- */
.cmd-btn {
  display: inline-flex; align-items: center; gap: 10px; min-width: 240px; min-height: 40px; padding: 6px 8px 6px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-1);
  color: var(--text-3); font-size: 13px; font-weight: 500; text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .12s var(--ease);
}
.cmd-btn:hover { border-color: var(--line-strong); color: var(--text); box-shadow: var(--shadow-2); }
.cmd-btn:active { transform: scale(0.98); }
.cmd-btn-label { flex: 1; white-space: nowrap; }
.cmd-btn kbd { margin-left: auto; }
#map-cmd-open { display: none; }
@media (max-width: 1280px) {
  .cmd-btn { min-width: 0; padding-right: 8px; }
  .cmd-btn-label { display: none; }
  .cmd-btn kbd { margin-left: 4px; }
}
@media (max-width: 1024px) {
  .cmd-btn { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%; border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
  .cmd-btn kbd { display: none; }
  #app[data-view="MAP"] #cmdk-open { display: none; }
  #map-cmd-open { display: inline-flex; }
}

/* ---------- Kommandopalett ---------- */
.cmdk {
  position: fixed; inset: 0; z-index: 7000; display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px; background: rgba(15, 23, 42, 0.5);
}
.cmdk.hidden { display: none; }
.cmdk-card {
  width: 100%; max-width: 680px; max-height: min(72vh, 680px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 28px 72px rgba(15, 23, 42, 0.4);
  animation: cmdkIn .16s var(--ease);
}
@keyframes cmdkIn { from { opacity: 0; transform: translateY(-8px) scale(0.985); } to { opacity: 1; transform: none; } }
.cmdk-input-row { display: flex; align-items: center; gap: 12px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line); color: var(--text-3); flex-shrink: 0; }
.cmdk-input-row input { flex: 1; min-width: 0; min-height: 60px; border: none !important; outline: none; box-shadow: none !important; background: transparent; color: var(--text); font-size: 15px; font-family: inherit; }
.cmdk-input-row input::placeholder { color: var(--text-3); }
.cmdk-close { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text-3); font-size: 12px; font-weight: 600; }
.cmdk-close-x { display: none; }
.cmdk-list { flex: 1; overflow-y: auto; padding: 8px; overscroll-behavior: contain; scroll-padding: 8px; }
.cmdk-group { margin-bottom: 8px; }
.cmdk-group-title { display: flex; align-items: center; gap: 8px; padding: 8px 12px 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.cmdk-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border-radius: 12px; cursor: pointer; }
.cmdk-item.active { background: var(--brand-50); }
.cmdk-item.active::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--brand); }
.cmdk-ico { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cmdk-ico.neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.cmdk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cmdk-title { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-title mark { background: rgba(250, 204, 21, 0.4); color: inherit; border-radius: 3px; padding: 0 1px; }
.cmdk-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-enter { opacity: 0; color: var(--text-3); display: inline-flex; }
.cmdk-item.active .cmdk-enter { opacity: 1; }
.cmdk-note { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 60px; font-size: 12px; color: var(--text-3); }
.cmdk-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--brand); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cmdk-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 40px 16px; text-align: center; color: var(--text-3); }
.cmdk-empty p { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--text); }
.cmdk-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.cmdk-foot kbd { margin-right: 4px; }
.cmdk-foot-right { margin-left: auto; }
@media (max-width: 1024px) {
  .cmdk { padding: calc(8px + var(--safe-t)) 8px 8px; }
  .cmdk-card { max-height: calc(100dvh - 16px - var(--safe-t)); border-radius: 16px; }
  .cmdk-input-row input { font-size: 14px; min-height: 56px; }
  .cmdk-close-text { display: none; }
  .cmdk-close-x { display: inline-flex; }
  .cmdk-close { min-width: 36px; width: 36px; padding: 0; border-radius: 50%; }
  .cmdk-foot { display: none; }
  .cmdk-item { min-height: 56px; }
}

/* ---------- Temavelger i brukermenyen ---------- */
.theme-block { padding: 12px 16px; border-top: 1px solid var(--line); }
.theme-label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.theme-switch { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.theme-switch button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 4px 8px; border: none; background: transparent; border-radius: 10px; color: var(--text-3); font-size: 12px; font-weight: 600; transition: background .12s ease, color .12s ease; }
.theme-switch button:hover { color: var(--text); }
:root[data-theme-pref="light"] .theme-switch [data-theme-set="light"],
:root[data-theme-pref="dark"] .theme-switch [data-theme-set="dark"],
:root[data-theme-pref="system"] .theme-switch [data-theme-set="system"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18); }

/* ---------- Organisasjonsfilter ---------- */
.org-filter select { min-width: 190px; }
.switcher-body .org-filter { align-self: stretch; }
.switcher-body .org-filter select { width: 100%; }
.org-scope { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.org-projects { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.org-projects button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); text-align: left; color: var(--text); font: inherit; }
.org-projects button:hover { background: var(--surface-2); }
.org-project-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .org-filter { flex: 1; } .org-filter select { min-width: 0; width: 100%; } }

/* ---------- Gamle adressesøk skjules (erstattet av kommandopaletten) ---------- */
.map-search { display: none !important; }

/* ---------- Større modaler på datamaskin ---------- */
@media (min-width: 1025px) {
  .modal-overlay { padding: 32px; }
  .modal-card { max-width: 780px; max-height: 92vh; max-height: 92dvh; border-radius: 22px; }
  #task-modal .modal-card { max-width: 980px; }
  #members-modal .modal-card, #apikeys-modal .modal-card, #cable-modal .modal-card, #overlay-modal .modal-card,
  #backup-modal .modal-card, #bulk-edit-modal .modal-card, #new-type-modal .modal-card,
  #project-create-modal .modal-card, #project-edit-modal .modal-card, #profile-modal .modal-card { max-width: 820px; }
  .switcher .modal-card, .org-sheet .modal-card, #project-menu-sheet .modal-card { max-width: 820px; }
  #delete-project-sheet .modal-card { max-width: 680px; }
  .modal-header { padding: 20px 32px; }
  .modal-header h2 { font-size: 16px; }
  .modal-body { padding: 28px 32px; }
  .modal-footer { padding: 16px 32px; }
  #task-modal .task-form { padding: 28px 32px; }
  .switch-list { gap: 6px; }
  .menu-body { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; align-content: start; }
  .menu-body .menu-project, .menu-body .menu-group { grid-column: 1 / -1; }
}

/* =====================================================================
   Runde 4: installasjonsbanner
   ===================================================================== */
.install-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 1090;
  display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  animation: bannerIn .3s var(--ease);
}
@keyframes bannerIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.install-banner img { border-radius: 10px; flex-shrink: 0; }
.install-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.install-banner-text strong { font-size: 13px; }
.install-banner-text span { font-size: 12px; color: var(--text-3); }
.install-banner .icon-btn { width: 40px; height: 40px; }
@media (min-width: 1025px) { .install-banner { display: none !important; } }

/* =====================================================================
   Runde 5: filterlister uten tekst som forsvinner, fremdriftslisten,
   toast med handling og tilkoblingsstatus
   ===================================================================== */

/* Navnene i Type/Område/Utstyr-listene får hele bredden og brytes over flere linjer. */
.project-picker-item { flex-wrap: wrap; align-items: flex-start; row-gap: 4px; min-height: 40px; padding: 8px 10px; }
.project-picker-item .proj-dot { margin-top: 5px; }
.project-picker-item-name { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.35; font-size: 13px; }
.project-picker-item-count { margin-top: 2px; font-size: 12px; }
.project-picker-list { max-height: min(360px, 48vh); }

/* Handlinger (flytt opp/ned, endre navn, slett): skjult til «Rediger liste» er på. */
.picker-actions { display: none; flex: 1 1 100%; justify-content: flex-end; align-items: center; gap: 6px; padding-top: 6px; margin-top: 2px; border-top: 1px dashed var(--line); }
.project-picker.editing .picker-actions { display: flex; }
.project-picker.editing .picker-actions button {
  opacity: 1; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.project-picker.editing .picker-actions button:disabled { opacity: 0.35; }
.project-picker.editing .picker-actions .project-picker-item-del { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.project-picker.editing .project-picker-item.active .picker-actions button { color: var(--text); }
.project-picker-sort-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.picker-edit-toggle { min-height: 36px; }

/* Fremdrift per gruppe */
.breakdown-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breakdown-tools .select-wrap select { min-height: 36px; padding: 4px 28px 4px 34px; font-size: 12px; }
.breakdown-search { position: relative; flex: 1 1 180px; min-width: 140px; }
.breakdown-search input { width: 100%; min-height: 36px; padding: 4px 12px 4px 34px; font-size: 13px; }
.breakdown-search > .gt-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.breakdown-count { margin-left: auto; }
.breakdown.scroll { max-height: 460px; overflow-y: auto; padding-right: 8px; overscroll-behavior: contain; }
.breakdown-more { align-self: flex-start; min-height: 36px; }
#breakdown-list { display: flex; flex-direction: column; gap: 12px; }
.breakdown-name { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }

/* Toast med handling */
.toast-interactive { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
.toast-text { flex: 1; }
.toast-action { flex-shrink: 0; min-height: 36px; padding: 6px 14px; border: none; border-radius: 10px; background: #fff; color: #111827; font-weight: 700; font-size: 13px; }
.toast-x { flex-shrink: 0; width: 32px; height: 32px; border: none; background: transparent; color: inherit; opacity: 0.8; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }

/* Tilkoblingsstatus */
.conn-banner {
  position: fixed; top: calc(var(--header-h) + var(--safe-t) + 8px); left: 50%; transform: translateX(-50%); z-index: 1200;
  max-width: calc(100vw - 24px); padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; text-align: center;
  background: #fef3c7; color: #92400e; border: 1px solid #fde68a; box-shadow: var(--shadow-2);
}
.conn-banner[data-tone="ok"] { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.conn-banner.hidden { display: none; }

/* =====================================================================
   Runde 6: egen nedtrekksmeny og tydelig redigeringsmodus
   ===================================================================== */

/* Pil på alle nedtrekksfelt (innebygd pil er skjult av appearance: none) */
select:not([multiple]):not([data-native]) {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  padding-right: 36px;
}
select:not([multiple]):disabled { cursor: not-allowed; opacity: 0.6; }
select[aria-expanded="true"] { border-color: var(--brand) !important; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }

.dd-backdrop { position: fixed; inset: 0; z-index: 7900; background: rgba(15, 23, 42, 0.5); animation: ddFade .15s ease; }
@keyframes ddFade { from { opacity: 0; } to { opacity: 1; } }
.dd-menu {
  position: fixed; z-index: 8000; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-2);
  animation: ddIn .12s var(--ease);
}
@keyframes ddIn { from { opacity: 0; transform: translateY(-4px) scale(0.99); } to { opacity: 1; transform: none; } }
.dd-list { overflow-y: auto; padding: 6px; overscroll-behavior: contain; flex: 1; }
.dd-item {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text); user-select: none; -webkit-user-select: none;
}
.dd-item.active { background: var(--surface-2); }
.dd-item.is-selected { color: var(--brand); font-weight: 600; }
.dd-item.is-selected.active { background: var(--brand-50); }
.dd-item.is-disabled { opacity: 0.45; cursor: not-allowed; }
.dd-label { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.dd-check { display: inline-flex; flex-shrink: 0; color: var(--brand); }
.dd-group { padding: 10px 12px 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.dd-empty { padding: 20px 12px; text-align: center; color: var(--text-3); font-size: 13px; }
.dd-search { position: relative; padding: 8px 8px 0; }
.dd-search > .gt-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-30%); color: var(--text-3); pointer-events: none; }
.dd-search input { width: 100%; min-height: 40px; padding: 6px 12px 6px 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 14px; outline: none; }
.dd-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }
.dd-sheet {
  left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 78dvh; border-radius: 22px 22px 0 0; border-bottom: none;
  padding-bottom: var(--safe-b); animation: ddSheet .22s var(--ease);
}
@keyframes ddSheet { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.dd-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 0; }
.dd-title { padding: 12px 20px 4px; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.dd-sheet .dd-item { min-height: 56px; font-size: 14px; padding: 10px 14px; }

/* ---------- Redigeringsmodus i filterlistene: tydelige, merkede knapper ---------- */
.project-picker.editing { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 14px; }
.project-picker.editing .project-picker-sort-row { background: var(--brand-50); border-radius: 10px; padding: 6px 8px; margin: 4px 6px; }
.project-picker.editing .project-picker-sort-row::before { content: 'Redigerer listen'; font-size: 12px; font-weight: 700; color: var(--brand); margin-right: auto; }
.project-picker.editing .project-picker-sort-row .link-btn:not(.picker-edit-toggle) { display: none; }
.picker-edit-toggle { min-height: 36px; padding: 4px 10px; border-radius: 10px; }
.project-picker.editing .picker-edit-toggle { background: var(--brand); color: #fff; font-weight: 700; padding: 6px 16px; text-decoration: none; }

.project-picker.editing .project-picker-item { padding: 10px; border: 1px solid var(--line); background: var(--surface); margin-bottom: 6px; border-radius: 12px; }
.project-picker.editing .project-picker-item.active { background: var(--surface); color: var(--text); border-color: var(--brand); }
.project-picker.editing .project-picker-item.active .project-picker-item-count { color: var(--text-3); }
.project-picker.editing .picker-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1 1 100%; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line-strong);
}
.project-picker.editing .picker-actions button {
  opacity: 1; width: auto; height: auto; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); color: var(--text);
  font-size: 12.5px; font-weight: 600; line-height: 1.2;
}
.project-picker.editing .picker-actions button::after { content: attr(title); }
.project-picker.editing .picker-actions button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.project-picker.editing .picker-actions button:disabled { opacity: 0.35; }
.project-picker.editing .picker-actions .project-picker-item-del { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.project-picker.editing .picker-actions .project-picker-item-del:hover { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); border-color: var(--danger); }

@media (max-width: 640px) {
  .toolbar-right { flex-wrap: wrap; }
  .toolbar-right .org-filter { flex: 1 1 100%; }
  .toolbar-right .org-filter select { width: 100%; }
  .toolbar-right > .select-wrap:not(.org-filter) { flex: 1 1 0; }
}

/* =====================================================================
   Runde 7: rader i lister skal aldri krympes, og skjemafelt forblir 16 px på touch
   ===================================================================== */

/* Flex-kolonner med rulling krympet radene slik at innhold (f.eks. redigeringsknapper) ble klippet. */
.project-picker-list > *,
.members-list > *,
.switch-list > *,
.org-members > *,
.org-projects > *,
.menu-body > *,
.modal-body > *,
.dd-list > *,
.cmdk-list > * { flex-shrink: 0; }
.project-picker-list > .project-picker-item { height: auto; min-height: 40px; overflow: visible; }

/* Skjemafelt på touch-enheter må være 16 px, ellers zoomer iOS inn når man trykker i feltet. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  select, textarea { font-size: 16px !important; }
}

/* Redigeringsknapper i én kompakt rad: ikon over kort tekst */
.project-picker.editing .picker-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 6px; padding-top: 8px; }
.project-picker.editing .picker-actions button {
  flex-direction: column; gap: 2px; min-height: 52px; padding: 6px 2px; font-size: 11px; line-height: 1.15; text-align: center; overflow-wrap: anywhere;
}

/* =====================================================================
   Runde 8: kompakt tetthet for mus-enheter (desktop) + ny redigeringsmodus.
   Telefon og nettbrett beholder store trykkflater (44 px).
   ===================================================================== */

@media (min-width: 1025px) and (pointer: fine) {
  :root { --header-h: 52px; }

  /* Topplinje */
  .app-header { height: 52px; padding: 0 16px; gap: 12px; }
  .brand-icon { width: 30px; height: 30px; border-radius: 9px; }
  .brand-name { font-size: 14px; }
  .view-switch { padding: 3px; border-radius: 11px; }
  .view-btn { min-height: 28px; padding: 3px 12px; font-size: 12.5px; gap: 6px; border-radius: 8px; }
  .cmd-btn { min-height: 32px; min-width: 200px; padding: 4px 6px 4px 12px; font-size: 12.5px; border-radius: 10px; }
  .header-right { gap: 8px; }
  .project-chip { min-height: 30px; padding: 4px 10px; font-size: 12px; }
  .user-menu-btn { height: 34px; padding: 3px 10px 3px 3px; }
  .user-avatar { width: 26px; height: 26px; font-size: 10px; }
  .btn { min-height: 32px; padding: 5px 12px; font-size: 12.5px; border-radius: 10px; gap: 6px; }
  .btn-sm { min-height: 28px; padding: 3px 10px; font-size: 12px; border-radius: 8px; }
  .btn-lg { min-height: 44px; }
  .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
  .user-menu-item { min-height: 40px; padding: 8px 14px; font-size: 12.5px; }

  /* Sidemeny: filtre */
  .sidebar { width: 300px; }
  .sidebar-top { padding: 12px; }
  .sidebar-actions { margin-bottom: 10px; gap: 6px; }
  .search-row { gap: 6px; margin-bottom: 12px; }
  .search-box input, .table-search input { min-height: 32px; padding: 4px 10px 4px 32px; font-size: 12.5px; border-radius: 10px; }
  .search-box .search-icon, .search-box > .gt-icon { left: 11px; width: 15px; height: 15px; }
  .chip-toggle, .sort-select { min-height: 32px; padding: 4px 10px; font-size: 12px; border-radius: 10px; }
  .filter-group { margin-bottom: 10px; }
  .filter-label { font-size: 11px; margin-bottom: 4px; }
  .filter-group-project { padding: 8px 10px 10px; margin-bottom: 12px; border-radius: 12px; }
  .project-picker-btn { min-height: 32px; padding: 4px 10px; font-size: 12.5px; border-radius: 9px; gap: 8px; font-weight: 500; }
  .project-picker-main .project-picker-btn { min-height: 34px; font-weight: 600; }
  .project-picker-count { font-size: 11px; }
  .project-picker-chevron { width: 14px; height: 14px; }
  .project-picker-item { min-height: 28px; padding: 4px 8px; gap: 8px; font-size: 12.5px; font-weight: 500; border-radius: 8px; }
  .project-picker-item-name { font-size: 12.5px; line-height: 1.3; }
  .project-picker-item-count { font-size: 11px; }
  .project-picker-search { min-height: 30px; padding: 5px 10px; font-size: 12.5px; }
  .project-picker-sort-row { padding: 2px 6px; }
  .project-picker-sort-row .link-btn, .picker-edit-toggle { min-height: 26px; font-size: 11.5px; }
  .type-picker-create input, .type-picker-create .btn { min-height: 30px; font-size: 12px; }
  .project-picker-list { max-height: min(320px, 44vh); padding: 4px; }
  .chip { min-height: 26px; padding: 2px 10px; font-size: 11.5px; }
  .chip-dot { width: 7px; height: 7px; }
  .sidebar-filter-summary { font-size: 11.5px; }

  /* Kart: toppmeny og verktøy */
  .map-topbar { padding: 10px; gap: 6px; }
  .map-chip { min-height: 34px; padding: 4px 12px; font-size: 12.5px; }
  .map-icon-btn { width: 34px; height: 34px; }
  .map-topbar-chips .chip { min-height: 26px; padding: 2px 10px; font-size: 11.5px; }
  .map-tools-right { gap: 8px; right: 12px; }
  .map-tools-right > button { width: 38px; height: 38px; }
  .bulk-select-btn, .overlay-manage-btn, .backup-manage-btn { width: 38px; height: 38px; }
  .map-instructions { font-size: 11.5px; padding: 6px 14px; }
  #map-view .leaflet-top.leaflet-right { margin-top: 8px; }

  /* Nedtrekksmeny */
  .dd-item { min-height: 32px; padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
  .dd-menu { border-radius: 12px; }
  select:not([multiple]) { padding-right: 32px; }
  .select-wrap select { min-height: 32px; font-size: 12.5px; padding-top: 4px; padding-bottom: 4px; }

  /* Sider */
  .page { padding: 20px 24px 40px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1, .dash-hero h1 { font-size: 20px; }
  .eyebrow { font-size: 12.5px; }
  .kpi { padding: 12px 14px; gap: 10px; }
  .kpi strong { font-size: 20px; }
  .kpi-icon { width: 34px; height: 34px; border-radius: 10px; }
  .kpi-tile { padding: 12px 14px; }
  .kpi-tile > strong { font-size: 24px; }
  .toolbar .search-box-lg input { min-height: 36px; }
  .filter-chip { min-height: 30px; padding: 4px 12px; font-size: 12.5px; }
  .project-grid { gap: 12px; }
  .project-card { padding: 14px 16px; gap: 10px; }
  .project-card-title h3 { font-size: 14px; }
  .project-badge { width: 36px; height: 36px; border-radius: 11px; }
  .dash-hero { padding: 16px 20px; }
  .card-head { padding: 12px 16px 0; }
  .card-head h2 { font-size: 14px; }
  .card-body { padding: 12px 16px 16px; gap: 12px; }
  .admin-tile { min-height: 52px; padding: 8px 10px; }
  .menu-row { min-height: 48px; }

  /* Tabell */
  .task-table thead th { padding: 8px 10px; }
  .task-table tbody td { padding: 7px 10px; font-size: 12.5px; }
  .table-toolbar { padding: 12px 16px 8px; }

  /* Modaler */
  .modal-header { padding: 14px 24px; }
  .modal-header h2 { font-size: 15px; }
  .modal-body { padding: 20px 24px; gap: 14px; }
  .modal-footer { padding: 12px 24px; }
  #task-modal .task-form { padding: 20px 24px; gap: 20px; }
  .field input, .field select, .field textarea, .modal-body input[type="text"], .modal-body input[type="email"],
  .modal-body input[type="password"], .modal-body select { min-height: 34px; font-size: 12.5px; padding-top: 5px; padding-bottom: 5px; }
  .field label { font-size: 11.5px; margin-bottom: 5px; }
  .switch-row { min-height: 52px; }
  .cmdk-input-row input { min-height: 52px; font-size: 15px; }
  .cmdk-item { min-height: 44px; }
}

/* ---------- Redigeringsmodus i filterlistene: rolig verktøylinje per rad ---------- */
.project-picker.editing { outline: none; box-shadow: 0 0 0 1px var(--brand-100); border-radius: 12px; }
.project-picker.editing .project-picker-sort-row { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; margin: 4px 6px; padding: 3px 4px 3px 10px; }
.project-picker.editing .project-picker-sort-row::before { content: 'Redigerer listen'; font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-right: auto; }
.project-picker.editing .picker-edit-toggle { background: var(--brand); color: #fff; padding: 2px 12px; min-height: 26px; border-radius: 7px; font-size: 12px; font-weight: 600; }

.project-picker.editing .project-picker-item {
  background: transparent; border: none; border-bottom: 1px solid var(--line); border-radius: 0; margin: 0; padding: 7px 8px 4px;
}
.project-picker.editing .project-picker-item:last-child { border-bottom: none; }
.project-picker.editing .project-picker-item.active { background: transparent; color: var(--text); box-shadow: inset 2px 0 0 var(--brand); }
.project-picker.editing .project-picker-item:hover { background: var(--surface-2); }
.project-picker.editing .picker-actions {
  display: flex; flex: 1 1 100%; justify-content: flex-end; gap: 2px; margin: 0; padding: 0; border: none;
}
.project-picker.editing .picker-actions button {
  opacity: 1; width: auto; height: 26px; min-height: 26px; flex-direction: row; gap: 4px; padding: 0 8px;
  border: none; border-radius: 6px; background: transparent; color: var(--text-2); font-size: 11.5px; font-weight: 500; line-height: 1;
}
.project-picker.editing .picker-actions button::after { content: attr(data-short); }
.project-picker.editing .picker-actions button:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border: none; }
.project-picker.editing .picker-actions button:disabled { opacity: 0.3; }
.project-picker.editing .picker-actions .project-picker-item-del { color: var(--danger); border: none; }
.project-picker.editing .picker-actions .project-picker-item-del:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border: none; }
@media (pointer: coarse) {
  .project-picker.editing .picker-actions button { height: 36px; min-height: 36px; padding: 0 12px; font-size: 12.5px; }
}

/* Filterboksene (Prosjekt/Type/Område/Utstyr) litt større på desktop */
@media (min-width: 1025px) and (pointer: fine) {
  .sidebar { width: 312px; }
  .filter-group { margin-bottom: 12px; }
  .filter-label { font-size: 11.5px; margin-bottom: 6px; }
  .project-picker-btn { min-height: 40px; padding: 7px 12px; font-size: 13px; border-radius: 11px; gap: 10px; }
  .project-picker-main .project-picker-btn { min-height: 44px; font-size: 13.5px; }
  .filter-group-project { padding: 10px 12px 12px; }
  .project-picker-count { font-size: 11.5px; }
  .project-picker-chevron { width: 16px; height: 16px; }
  .project-picker-item { min-height: 34px; padding: 6px 10px; font-size: 13px; }
  .project-picker-item-name { font-size: 13px; }
  .project-picker-search { min-height: 34px; font-size: 13px; }
  .search-box input { min-height: 36px; font-size: 13px; }
  .chip-toggle, .sort-select { min-height: 36px; font-size: 12.5px; }
}

/* Markør for valgt adresse (prikk + nøyaktighetssirkel) */
.address-marker { position: relative; }
.address-marker-dot {
  position: absolute; top: 5px; left: 5px; width: 12px; height: 12px; border-radius: 50%;
  background: #dc2626; border: 2.5px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,0.55);
}
.address-marker-pulse {
  position: absolute; top: 1px; left: 1px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(220,38,38,0.35); animation: address-marker-pulse 2s ease-out infinite;
}
@keyframes address-marker-pulse { 0% { transform: scale(0.4); opacity: 1; } 100% { transform: scale(2); opacity: 0; } }
.address-popup { display: flex; flex-direction: column; gap: 4px; padding: 2px; }
.address-popup-title { font-weight: 600; font-size: 14px; color: var(--text); }
.address-popup-sub { font-size: 12px; color: var(--text-2); }
.address-popup-prec { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text); margin-top: 4px; }
.address-popup-prec span { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; flex-shrink: 0; }
.address-popup-prec.address-prec-exact span { background: #dc2626; }
.address-popup-coords { font-size: 11.5px; color: var(--text-3, var(--text-2)); font-variant-numeric: tabular-nums; }
.address-popup-remove { align-self: flex-start; margin-top: 6px; }

/* Flervalg: handlingslinjen ligger nederst over bunnmenyen på telefon/nettbrett (ikke bak toppknappene) */
.bulk-clear-icon { display: none; }
@media (max-width: 1024px) {
  .bulk-action-bar {
    top: auto; bottom: 12px; left: 12px; right: 12px; transform: none; max-width: none;
    padding: 8px 8px 8px 16px; gap: 10px; justify-content: space-between;
    animation: bulk-bar-in .22s var(--ease, ease-out);
  }
  #bulk-action-count { font-size: 14px; }
  .bulk-action-buttons { gap: 6px; }
  .bulk-action-buttons .btn { min-height: 44px; padding: 8px 16px; font-size: 14px; }
  .bulk-action-buttons .btn-danger-ghost { color: #fca5a5; }
  .bulk-action-buttons #bulk-clear-btn { width: 44px; padding: 0; }
  .bulk-clear-icon { display: inline-flex; }
  /* Verktøyknappene nederst til venstre/høyre skal ikke havne bak linjen når flervalg er i bruk */
  .content-area:has(.bulk-action-bar:not(.hidden)) .map-tools-left,
  .content-area:has(.bulk-action-bar:not(.hidden)) .map-instructions { visibility: hidden; }
}
@keyframes bulk-bar-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 1024px) {
  .content-area:has(.bulk-action-bar:not(.hidden)) .map-tools-right { bottom: 84px; transition: bottom .2s ease; }
}
@media (max-width: 1024px) {
  .bulk-action-bar #bulk-edit-btn { background: var(--brand); color: #fff; border-color: var(--brand); }
}

/* =====================================================================
   Kabeltegning: profesjonelt tegnepanel, sikte på touch, gummistrikk og punkter som kan dras.
   Alle flytende verktøylinjer (tegn, plasser, rediger punkter, startområde, underlag) ligger
   nederst over bunnmenyen på telefon/nettbrett, ikke bak knappene i toppen.
   ===================================================================== */
.cable-draw-panel {
  flex-direction: column; align-items: stretch; gap: 8px;
  width: min(460px, calc(100vw - 24px)); padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line);
}
.cdp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cdp-title { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; }
.cdp-title .gt-icon, .cdp-title svg { color: var(--brand); }
.cdp-stats { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
#cable-draw-length { color: var(--brand); min-width: 3.2em; text-align: right; }
.cdp-sep { color: var(--text-3); }
.cable-draw-panel #cable-draw-hint { white-space: normal; font-size: 12.5px; font-weight: 500; line-height: 1.35; color: var(--text-2); }
.cable-draw-panel .cable-draw-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cable-draw-panel .cable-draw-toolbar-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.cdp-finish { flex: 1 1 auto; }
.cable-draw-panel:not(.aim) .cdp-add { display: none; }
.cable-draw-panel.aim .cdp-add { flex: 1 1 100%; min-height: 48px; font-size: 15px; font-weight: 600; background: var(--brand); color: #fff; border-color: var(--brand); }

/* Sikte (kryss i midten av kartet) */
.cable-draw-crosshair { position: absolute; top: 50%; left: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; z-index: 1001; pointer-events: none; }
.cable-draw-crosshair::before, .cable-draw-crosshair::after { content: ''; position: absolute; background: #2563eb; box-shadow: 0 0 0 1.5px #fff; border-radius: 1px; }
.cable-draw-crosshair::before { left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; -webkit-mask: linear-gradient(#000 0 38%, transparent 38% 62%, #000 62%); mask: linear-gradient(#000 0 38%, transparent 38% 62%, #000 62%); }
.cable-draw-crosshair::after { top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; -webkit-mask: linear-gradient(90deg, #000 0 38%, transparent 38% 62%, #000 62%); mask: linear-gradient(90deg, #000 0 38%, transparent 38% 62%, #000 62%); }
.cable-draw-crosshair span { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #2563eb; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.4); transition: transform .12s ease, background .12s ease; }
.cable-draw-crosshair.snapped span { background: #16a34a; transform: scale(1.7); }
.cable-draw-crosshair.snapped::before, .cable-draw-crosshair.snapped::after { background: #16a34a; }

/* Punkter under tegning */
.cable-vertex { cursor: grab; }
.cable-vertex::before { content: ''; position: absolute; inset: -10px; }
.cable-vertex span { position: absolute; inset: 5px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,0.45); }
.cable-vertex.is-start span { background: #16a34a; inset: 3px; }
.cable-vertex.is-last span { inset: 3px; box-shadow: 0 0 0 4px rgba(37,99,235,0.28), 0 1px 5px rgba(0,0,0,0.45); }
.cable-vertex:active { cursor: grabbing; }

@media (max-width: 1024px) {
  .cable-draw-toolbar, .overlay-editor-toolbar {
    top: auto; bottom: 12px; left: 12px; right: 12px; transform: none; max-width: none; width: auto;
    z-index: 1003; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 12px 14px;
    animation: bulk-bar-in .22s var(--ease, ease-out);
  }
  .cable-draw-toolbar > span:not(.cdp-stats) { flex: 1 1 100%; white-space: normal; font-size: 13px; line-height: 1.35; }
  .cable-draw-toolbar-actions { flex: 1 1 100%; }
  .cable-draw-toolbar-actions .btn { flex: 1 1 0; min-height: 44px; font-size: 14px; }
  .cable-draw-panel { flex-wrap: nowrap; }
  .cable-draw-panel .cable-draw-toolbar-actions .btn { min-height: 44px; }
  .cable-draw-panel .cdp-undo, .cable-draw-panel .cdp-cancel { flex: 0 0 auto; padding-left: 14px; padding-right: 14px; }
  .cable-draw-panel .cdp-finish { flex: 1 1 0; }
  /* Mens en tegneverktøylinje er åpen, skjules knappene som ellers havner bak den */
  .content-area:has(.cable-draw-toolbar:not(.hidden)) :is(.map-tools-right, .map-tools-left, .map-instructions),
  .content-area:has(.overlay-editor-toolbar:not(.hidden)) :is(.map-tools-right, .map-tools-left, .map-instructions) { visibility: hidden; }
}

/* Sammenleggbare skjemaseksjoner (Ikon i kartet / Farge på markøren): lukket som standard */
.form-collapse { gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.form-collapse-summary {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; cursor: pointer;
  list-style: none; user-select: none; border-radius: var(--r-md); -webkit-tap-highlight-color: transparent;
}
.form-collapse-summary::-webkit-details-marker { display: none; }
.form-collapse-summary:hover { background: var(--surface-2); }
.form-collapse-summary .form-section-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text); }
.form-collapse-summary .form-section-title::after { display: none; }
.form-collapse-value { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.form-collapse-value .collapse-icon { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 9px; background: var(--brand-50, var(--surface-2)); color: var(--brand); }
.form-collapse-value .collapse-swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong, var(--line)); }
.form-collapse-value .collapse-text { font-variant-numeric: tabular-nums; }
.form-collapse-chevron { color: var(--text-3); transition: transform .18s ease; flex-shrink: 0; }
.form-collapse[open] > .form-collapse-summary .form-collapse-chevron { transform: rotate(180deg); }
.form-collapse[open] > .form-collapse-summary { border-bottom: 1px solid var(--line); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.form-collapse-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.form-collapse-body .field-hint { margin: 0; }

/* ---------- Tilleggsoppgaver ---------- */
.lbl-short { display: none; }
.geotask-marker-extra {
  position: absolute; top: -5px; left: -9px; min-width: 24px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: #f59e0b; color: #fff; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  font-size: 10px; font-weight: 800; line-height: 13px; text-align: center; font-variant-numeric: tabular-nums; box-sizing: border-box; white-space: nowrap;
}
.geotask-marker-extra.done { background: #16a34a; }
.extras-note { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.extras-parent { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.extras-parent .link-btn { font-weight: 600; text-align: left; }
.extras-list { display: flex; flex-direction: column; gap: 6px; }
.extras-list:empty { display: none; }
.extras-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); cursor: pointer;
}
.extras-row:hover { background: var(--surface-2); }
.extras-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.extras-row-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.extras-row-status { font-size: 12px; font-weight: 600; flex-shrink: 0; }
.extras-add-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; }
#extras-modal .modal-card { max-width: 520px; }

@media (max-width: 1024px) {
  /* Flervalg-linjen: tittel og X på første rad, handlingsknappene delt likt på rad to */
  .bulk-action-bar { flex-wrap: wrap; row-gap: 8px; }
  .bulk-action-buttons { display: contents; }
  #bulk-action-count { flex: 1 1 0; order: 1; }
  .bulk-action-bar::after { content: ''; order: 2; flex-basis: 100%; height: 0; }
  #bulk-clear-btn { order: 2; }
  #bulk-extras-btn, #bulk-edit-btn, #bulk-delete-btn { order: 3; flex: 1 1 0; justify-content: center; }
  #bulk-extras-btn { display: inline-flex; align-items: center; gap: 6px; }
  .lbl-long { display: none; }
  .lbl-short { display: inline; }
  .content-area:has(.bulk-action-bar:not(.hidden)) .map-tools-right { bottom: 136px; }
}
@media (min-width: 1025px) {
  #bulk-extras-btn { display: inline-flex; align-items: center; gap: 6px; }
}
@media (max-width: 1024px) {
  .bulk-action-bar #bulk-extras-btn { background: rgba(255,255,255,0.14); color: #fff; border-color: transparent; }
}

/* Ny type-dialogen kan åpnes fra tilleggsoppgave-skjemaet og må ligge øverst */
#new-type-modal { z-index: 5100; }

/* =====================================================================
   Kartlag-panel (maplayers.js): bakgrunnskart, kartlag, skala og koordinater
   ===================================================================== */
.gt-layers-ctl a.gt-layers-toggle { display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.gt-layers-ctl a.gt-layers-toggle.active { background: var(--brand); color: #fff; }

.gt-layers-panel {
  position: absolute; z-index: 1100; right: 60px; top: 12px; width: 372px; max-height: calc(100% - 24px);
  display: flex; flex-direction: column; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-xl, 18px); box-shadow: var(--shadow-3, 0 18px 48px rgba(15, 23, 42, 0.28));
  overflow: hidden; animation: glp-in .16s ease-out;
}
.gt-layers-panel.hidden { display: none; }
@keyframes glp-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.glp-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 10px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.glp-head-title { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.glp-head-title svg { color: var(--brand); }
.glp-close { width: 34px; height: 34px; border: none; background: transparent; color: var(--text-2); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.glp-close:hover { background: var(--surface-2); color: var(--text); }
.glp-body { overflow-y: auto; padding: 4px 14px 14px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.glp-section { margin-top: 14px; }
.glp-title { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); display: flex; align-items: baseline; justify-content: space-between; }
.glp-title span { font-weight: 500; text-transform: none; letter-spacing: 0; }

.glp-bases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.glp-base { display: flex; flex-direction: column; gap: 6px; padding: 0; border: none; background: transparent; text-align: center; cursor: pointer; color: var(--text-2); }
.glp-thumb { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); transition: box-shadow .12s ease, transform .12s ease; }
.glp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.glp-base:hover .glp-thumb { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--text-3); }
.glp-base.active .glp-thumb { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.glp-check { position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; }
.glp-base-name { font-size: 12px; font-weight: 600; line-height: 1.2; }
.glp-base.active .glp-base-name { color: var(--text); }

.glp-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.glp-row { border-bottom: 1px solid var(--line); }
.glp-row:last-child { border-bottom: none; }
.glp-row-main { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; min-height: 52px; }
.glp-row-main:hover { background: var(--surface-2); }
.glp-row-icon { width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.glp-row.on .glp-row-icon { background: var(--brand-50, var(--surface-2)); color: var(--brand); }
.glp-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.glp-row-name { font-size: 13px; font-weight: 600; color: var(--text); }
.glp-row-desc { font-size: 11.5px; color: var(--text-3); line-height: 1.3; }
.glp-switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.glp-switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.glp-knob { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong, #cbd5e1); transition: background .15s ease; }
.glp-knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform .15s ease; }
.glp-switch input:checked + .glp-knob { background: var(--brand); }
.glp-switch input:checked + .glp-knob::after { transform: translateX(16px); }
.glp-switch input:focus-visible + .glp-knob { outline: 2px solid var(--brand); outline-offset: 2px; }
.glp-opacity { display: flex; align-items: center; gap: 10px; padding: 0 12px 10px 54px; font-size: 11.5px; color: var(--text-3); }
.glp-opacity input[type="range"] { flex: 1; min-width: 0; accent-color: var(--brand); height: 24px; }
.glp-opacity output { width: 36px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.glp-zoomhint { margin: -4px 12px 10px 54px; font-size: 11.5px; color: var(--warn, #b45309); }
.glp-zoomhint[hidden] { display: none; }
.glp-note { margin: 12px 2px 0; font-size: 11.5px; color: var(--text-3); }

/* Skala og koordinater */
.gt-mapstatus {
  position: absolute; z-index: 900; top: 66px; left: 12px; display: flex; align-items: center; gap: 10px;
  padding: 5px 10px; border-radius: 10px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line);
  box-shadow: var(--shadow-1); font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; max-width: calc(100% - 24px);
}
.gt-mapstatus.hidden { display: none; }
.gms-scale { display: inline-flex; flex-direction: column; gap: 1px; align-items: flex-start; }
.gms-bar { display: block; height: 5px; border: 2px solid var(--text-2); border-top: none; min-width: 20px; box-sizing: content-box; }
.gms-label { font-size: 10.5px; font-weight: 600; line-height: 1; }
.gms-coords { border: none; background: transparent; color: inherit; font: inherit; padding: 2px 2px; cursor: pointer; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gms-coords:hover { background: var(--surface-2); color: var(--text); }

@media (max-width: 1024px) {
  .gt-layers-panel {
    left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: min(78%, 640px);
    border-radius: 20px; animation: glp-up .2s ease-out;
  }
  .glp-bases { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .glp-row-main { min-height: 56px; }
  .glp-close { width: 44px; height: 44px; }
  .glp-opacity input[type="range"] { height: 32px; }
  .gt-mapstatus { top: 80px; font-size: 11px; }
  .gms-coords { min-height: 28px; }
}
@keyframes glp-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (min-width: 1025px) and (pointer: fine) {
  .gt-layers-panel { width: 360px; }
  .glp-row-main { min-height: 48px; padding: 8px 12px; }
  .gt-mapstatus { top: 60px; }
}
/* Skjul statuslinjen mens en tegneverktøylinje er åpen på telefon */
@media (max-width: 1024px) {
  .content-area:has(.cable-draw-toolbar:not(.hidden)) .gt-mapstatus { visibility: hidden; }
}

@media (min-width: 640px) and (max-width: 1024px) {
  .gt-layers-panel { left: auto; width: 460px; }
}

/* Google-kart i kartlag-panelet */
.glp-thumb-google { display: flex; align-items: center; justify-content: center; }
.glp-thumb-google .glp-g { font-weight: 800; font-size: 20px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); }
.glp-thumb-google.g-g-road { background: linear-gradient(135deg, #e8eaed 0 45%, #fbe9a6 45% 55%, #aadaff 55%); }
.glp-thumb-google.g-g-road .glp-g { color: #4285f4; text-shadow: none; }
.glp-thumb-google.g-g-sat { background: linear-gradient(135deg, #2f4a2a, #4b6b3c 55%, #1f2f3d); }
.glp-thumb-google.g-g-hybrid { background: linear-gradient(135deg, #2f4a2a, #4b6b3c 55%, #1f2f3d); box-shadow: inset 0 0 0 100px rgba(255, 255, 255, 0.05); }
.glp-thumb-google.g-g-hybrid::before { content: ''; position: absolute; left: -10%; right: -10%; top: 48%; height: 5px; background: rgba(255, 220, 120, 0.9); transform: rotate(-18deg); }
.glp-thumb-google.g-g-terrain { background: linear-gradient(135deg, #cfe8c4, #e6dcb8 55%, #b9a77a); }
.glp-thumb-google.g-g-terrain .glp-g { color: #34a853; text-shadow: none; }
.glp-error { color: var(--danger); }

/* Invitasjoner i organisasjonsvinduet */
.org-invites { margin-top: 18px; }
.org-invite-result { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.org-invite-result input[readonly] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.org-invite-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.org-invite { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); }
.org-invite .team-who { flex: 1; min-width: 0; }

/* =====================================================================
   Varsler (klokke) og kommentarer med @-nevnelser
   ===================================================================== */
.notif { position: relative; display: inline-flex; }
.notif-btn { position: relative; width: 38px; height: 38px; border-radius: 12px; color: var(--text-2); }
.notif-btn:hover { background: var(--surface-2); color: var(--text); }
.notif-btn.has-unread { color: var(--brand); }
.notif-badge {
  position: absolute; top: 1px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger, #dc2626); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center;
  border: 2px solid var(--surface, #fff); box-sizing: content-box; font-variant-numeric: tabular-nums;
}
.notif-badge.hidden { display: none; }

.notif-panel {
  position: absolute; top: calc(100% + 10px); right: -8px; z-index: 1300; width: 400px; max-height: min(640px, calc(100vh - 90px));
  display: flex; flex-direction: column; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; animation: glp-in .14s ease-out;
}
.notif-panel.hidden { display: none; }
.n-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.n-head strong { font-size: 14px; }
.n-head-actions { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.n-head-actions .link-btn { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.n-head-actions .link-btn[disabled] { opacity: .45; pointer-events: none; }
.n-close { display: none; width: 36px; height: 36px; }
.n-body { overflow-y: auto; overscroll-behavior: contain; }
.n-list { list-style: none; margin: 0; padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.n-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 10px; border: none; background: transparent;
  border-radius: 12px; color: inherit; cursor: pointer; position: relative;
}
.n-item:hover { background: var(--surface-2); }
.n-item.unread { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.n-item.unread:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.n-ico { width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--surface-2); color: var(--text-2); }
.n-ico.tone-blue { background: #dbeafe; color: #1d4ed8; }
.n-ico.tone-green { background: #dcfce7; color: #15803d; }
.n-ico.tone-amber { background: #fef3c7; color: #b45309; }
.n-ico.tone-violet { background: #ede9fe; color: #6d28d9; }
.n-ico.tone-slate { background: #e2e8f0; color: #475569; }
.n-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.n-text { font-size: 13px; line-height: 1.35; }
.n-text em { font-style: normal; font-weight: 600; }
.n-snippet { font-size: 12.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.n-meta { font-size: 11.5px; color: var(--text-3); }
.n-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); flex-shrink: 0; margin-top: 6px; }
.n-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 34px 24px; color: var(--text-3); font-size: 12.5px; }
.n-empty strong { color: var(--text); font-size: 14px; }
.n-foot { padding: 8px 14px; border-top: 1px solid var(--line); text-align: center; flex-shrink: 0; }
.n-foot .link-btn { font-size: 12px; }

@media (max-width: 1024px) {
  .notif { position: static; }
  .notif-panel {
    position: fixed; left: 8px; right: 8px; top: calc(var(--header-h) + var(--safe-t, 0px) + 6px); width: auto; max-height: calc(100vh - var(--header-h) - 90px);
    border-radius: 20px; z-index: 1400;
  }
  .n-close { display: inline-flex; }
  .n-item { padding: 12px 10px; }
  .notif-btn { width: 44px; height: 44px; }
}

/* ---------- Kommentarer ---------- */
.c-thread { display: flex; flex-direction: column; gap: 14px; }
.c-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.c-item { display: flex; gap: 10px; align-items: flex-start; }
.c-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; color: hsl(var(--h) 60% 28%); background: hsl(var(--h) 75% 90%);
}
.c-item-main { flex: 1; min-width: 0; }
.c-item-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.c-name { font-size: 13px; color: var(--text); }
.c-time { font-size: 11.5px; color: var(--text-3); }
.c-item-actions { margin-left: auto; display: inline-flex; gap: 2px; opacity: 0; transition: opacity .12s ease; }
.c-item:hover .c-item-actions, .c-item:focus-within .c-item-actions { opacity: 1; }
@media (pointer: coarse) { .c-item-actions { opacity: 1; } }
.c-act { width: 28px; height: 28px; border: none; background: transparent; color: var(--text-3); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.c-act:hover { background: var(--surface-2); color: var(--text); }
.c-act-danger:hover { color: var(--danger, #dc2626); }
.c-body { font-size: 13.5px; line-height: 1.5; color: var(--text); word-wrap: break-word; overflow-wrap: anywhere; margin-top: 2px; }
.c-body a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.c-mention { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--brand-50, #eff6ff); color: var(--brand); font-weight: 600; }
.c-mention-me { background: #fef3c7; color: #92400e; }
.c-context {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; margin-top: 2px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); font-size: 11.5px; cursor: pointer;
}
.c-context span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-context:hover { border-color: var(--line-strong); color: var(--text); }
.c-empty { margin: 0; font-size: 13px; color: var(--text-3); }
.c-more { align-self: center; }

.c-composer { display: flex; flex-direction: column; gap: 6px; }
.c-input-wrap { position: relative; }
.c-composer textarea {
  width: 100%; box-sizing: border-box; resize: none; min-height: 44px; max-height: 180px; padding: 10px 12px; line-height: 1.45;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px;
}
.c-composer textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.c-actions { display: flex; align-items: center; gap: 8px; }
.c-hint { flex: 1; font-size: 11.5px; color: var(--text-3); }
.c-at { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.c-at:hover { border-color: var(--line-strong); color: var(--brand); }
.c-actions:not(:has(.c-hint)) .c-send { margin-left: auto; }
.c-actions .c-send { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.c-error { margin: 0; font-size: 12px; color: var(--danger, #dc2626); }
.c-error.hidden { display: none; }
.c-mention-list {
  position: fixed; z-index: 6500; display: flex; flex-direction: column; padding: 4px; box-sizing: border-box;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); max-height: 240px; overflow-y: auto;
}
.c-mention-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: none; background: transparent; color: var(--text); font-size: 13px; text-align: left; border-radius: 8px; min-height: 40px; }
.c-mention-item.active, .c-mention-item:hover { background: var(--surface-2); }
.c-mention-item .c-avatar { width: 26px; height: 26px; font-size: 10px; }
.c-compact textarea { min-height: 64px; }

.c-feed-count:not(:empty) { background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.c-feed-body .c-thread { gap: 12px; }
#comments-section .c-thread { gap: 12px; }
.profile-notify { margin-top: 4px; }
.profile-notify small { display: block; color: var(--text-3); font-weight: 400; margin-top: 2px; }
.profile-notify .switch-text { display: block; }
#assignee-field { margin-top: 8px; }
.profile-notify .switch-text { flex: 1; min-width: 0; }
.profile-notify input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--brand); }

/* «Vis i kart»-knapper i varsler og kommentarer */
.n-row { display: flex; align-items: center; gap: 2px; }
.n-row .n-item { flex: 1; min-width: 0; }
.n-map { width: 36px; height: 36px; flex-shrink: 0; border: none; background: transparent; color: var(--text-3); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.n-map:hover { background: var(--surface-2); color: var(--brand); }
.c-context-row { display: inline-flex; gap: 6px; flex-wrap: wrap; max-width: 100%; margin-top: 2px; }
.c-context-row .c-context { margin-top: 0; }
.c-context-map { color: var(--brand); }

/* Frister */
.due-input-row { display: flex; align-items: center; gap: 12px; }
.due-input-row input[type="date"] { flex: 1; min-width: 0; }
.due-chip { display: inline-flex; align-items: center; margin: 2px 0 0 8px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; vertical-align: middle; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.due-chip.due-overdue { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.due-chip.due-today { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.due-chip.due-soon { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.due-chip.due-done { opacity: .65; }
.task-mini-row .due-chip { margin: 0 0 0 auto; flex-shrink: 0; }
.n-ico.tone-red { background: #fee2e2; color: #b91c1c; }

/* Arbeidsordre / prosjektrapport (forhåndsvisning) */
.report-overlay { position: fixed; inset: 0; z-index: 7000; display: flex; flex-direction: column; background: #e5e7eb; }
.report-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px calc(10px); padding-top: calc(10px + var(--safe-t, 0px)); background: var(--surface); border-bottom: 1px solid var(--line); }
.report-title { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.report-opts { display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.report-opts select { min-height: 34px; margin-left: 6px; }
.report-check { display: inline-flex; align-items: center; gap: 6px; }
.report-actions { margin-left: auto; display: inline-flex; gap: 8px; }
.report-body { position: relative; flex: 1; min-height: 0; display: flex; justify-content: center; padding: 12px; overflow: hidden; }
.report-frame { width: min(900px, 100%); height: 100%; border: 1px solid #cbd5e1; background: #fff; box-shadow: 0 6px 24px rgba(15, 23, 42, 0.18); border-radius: 4px; opacity: 0; }
.report-frame.ready { opacity: 1; }
.report-loading { position: absolute; top: 40%; left: 0; right: 0; text-align: center; color: #475569; font-size: 14px; }
@media (max-width: 640px) {
  .report-body { padding: 0; }
  .report-frame { border-radius: 0; border: none; }
  .report-actions .btn { min-height: 40px; }
}
@media print { .report-overlay { display: none !important; } }

/* Frakoblet bruk */
.offline-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid #fde68a;
  background: #fef3c7; color: #92400e; font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer;
}
.offline-pill.hidden { display: none; }
.offline-pill.is-offline { background: #1f2937; border-color: #1f2937; color: #fff; }
.offline-pill.is-syncing svg { animation: off-spin 1s linear infinite; }
@keyframes off-spin { to { transform: rotate(360deg); } }
@media (max-width: 1024px) { .offline-pill { height: 32px; padding: 0 10px; } }
.offline-sheet { z-index: 5200; }
.offline-body { display: flex; flex-direction: column; gap: 10px; }
.offline-status { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #dcfce7; color: #166534; font-size: 13.5px; }
.offline-status.is-offline { background: #1f2937; color: #fff; }
.offline-h { margin: 8px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.offline-queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.offline-queue li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.offline-queue li:last-child { border-bottom: none; }
.oq-ico { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.oq-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.oq-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oq-text small { color: var(--text-3); font-size: 11.5px; }
.offline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.offline-progress { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); }
.offline-progress.hidden { display: none; }
.op-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.op-bar i { display: block; height: 100%; background: var(--brand); transition: width .2s ease; }
.due-chip.pending-chip { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }

/* «Vis i kart» øverst i oppgaveskjemaet */
.modal-header-actions { display: inline-flex; align-items: center; gap: 6px; }
.modal-header-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 420px) { #task-show-map-btn span { display: none; } #task-show-map-btn { padding: 0; width: 44px; justify-content: center; } }

/* =====================================================================
   Sjekklister: utfylling på oppgaver og designer
   ===================================================================== */
.cl-pill { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; background: var(--brand-50, #eff6ff); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); white-space: nowrap; }
.cl-pill.soft { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }
.cl-pill.warn { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.cl-dev-pill { display: inline-flex; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.cl-dev-pill.hidden { display: none; }
.due-chip.cl-chip { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.due-chip.cl-chip.ok { background: #dcfce7; color: #166534; border-color: #bbf7d0; }

.cl-root { display: flex; flex-direction: column; gap: 10px; }
.cl-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.cl-card.complete { border-color: #bbf7d0; }
.cl-card-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: none; background: transparent; text-align: left; color: inherit; cursor: pointer; min-height: 56px; }
.cl-card-head:hover { background: var(--surface-2); }
.cl-card-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-50, #eff6ff); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cl-card.complete .cl-card-ico { background: #dcfce7; color: #15803d; }
.cl-card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cl-card-title strong { font-size: 13.5px; }
.cl-card-sub { display: flex; gap: 6px; flex-wrap: wrap; }
.cl-card-prog { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cl-prog { width: 64px; height: 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; display: inline-block; }
.cl-prog i { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width .2s ease; }
.cl-prog i.ok { background: #16a34a; }
.cl-count { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 32px; text-align: right; }
.cl-chev { color: var(--text-3); transition: transform .15s ease; }
.cl-card.open .cl-chev { transform: rotate(180deg); }
.cl-card-body { padding: 4px 14px 12px; border-top: 1px solid var(--line); }
.cl-card-body.hidden { display: none; }
.cl-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.cl-card-foot .link-btn { display: inline-flex; align-items: center; gap: 5px; color: var(--danger, #dc2626); font-size: 12px; }
.cl-saved { min-height: 16px; }
.cl-saved.bad { color: var(--danger, #dc2626); }
.cl-none { margin: 0; }
.cl-add { position: relative; align-self: flex-start; }
.cl-add-menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 280px; max-width: min(92vw, 360px); display: flex; flex-direction: column; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); }
.cl-add-menu.hidden { display: none; }
.cl-add-menu button { display: flex; flex-direction: column; gap: 1px; text-align: left; padding: 9px 12px; border: none; background: transparent; border-radius: 8px; color: var(--text); }
.cl-add-menu button:hover { background: var(--surface-2); }
.cl-add-menu span { font-size: 11.5px; color: var(--text-3); }

/* Skjema */
.cl-form { display: flex; flex-direction: column; }
.cl-heading { margin: 16px 0 4px; padding-bottom: 5px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--text-2); border-bottom: 1px solid var(--line); }
.cl-heading:first-child { margin-top: 8px; }
.cl-field { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.cl-field:last-child { border-bottom: none; }
.cl-label { font-size: 13px; font-weight: 600; margin-bottom: 5px; line-height: 1.35; }
.cl-req { color: var(--danger, #dc2626); margin-left: 3px; font-weight: 700; }
.cl-help { font-size: 11.5px; color: var(--text-3); margin: -2px 0 6px; }
.cl-meta { margin-top: 4px; font-size: 11px; color: var(--text-3); }
.cl-field.dev { background: color-mix(in srgb, #ef4444 6%, transparent); border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.cl-input { width: 100%; box-sizing: border-box; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; }
textarea.cl-input { min-height: 74px; resize: vertical; line-height: 1.45; }
.cl-input:focus, .cl-comment:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.cl-input.bad { border-color: #ef4444; background: #fef2f2; }
.cl-num { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cl-num .cl-input { width: 150px; }
.cl-unit { font-weight: 700; color: var(--text-2); }
.cl-range { font-size: 11.5px; color: var(--text-3); }
.cl-warn { margin-top: 4px; font-size: 11.5px; color: #b91c1c; font-weight: 600; }
.cl-check { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; min-height: 32px; }
.cl-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.cl-check-box { flex-shrink: 0; width: 24px; height: 24px; border: 2px solid var(--line-strong); border-radius: 7px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; transition: background .12s ease, border-color .12s ease; }
.cl-check input:checked + .cl-check-box { background: #16a34a; border-color: #16a34a; }
.cl-check input:checked + .cl-check-box::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.cl-check input:focus-visible + .cl-check-box { outline: 2px solid var(--brand); outline-offset: 2px; }
.cl-check-text { font-size: 13.5px; font-weight: 600; line-height: 1.4; padding-top: 2px; }
.cl-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--surface); max-width: 100%; }
.cl-seg-btn { min-height: 40px; padding: 0 16px; border: none; border-right: 1px solid var(--line); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 700; cursor: pointer; }
.cl-seg-btn:last-child { border-right: none; }
.cl-seg-btn:hover:not(:disabled) { background: var(--surface-2); }
.cl-seg-btn.seg-OK.on { background: #16a34a; color: #fff; }
.cl-seg-btn.seg-AVVIK.on { background: #dc2626; color: #fff; }
.cl-seg-btn.seg-IR.on { background: #64748b; color: #fff; }
.cl-comment { display: block; width: 100%; box-sizing: border-box; margin-top: 7px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; resize: vertical; }
.cl-comment.hidden { display: none; }
.cl-comment.needs { border-color: #ef4444; background: #fef2f2; }
.cl-sign { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 10px; background: #f0fdf4; border: 1px solid #bbf7d0; font-size: 13px; color: #166534; flex-wrap: wrap; }
.cl-sign .link-btn { margin-left: auto; font-size: 12px; }
.cl-sign-btn { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 640px) {
  .cl-card-head { padding: 10px; }
  .cl-prog { width: 44px; }
  .cl-seg { display: flex; width: 100%; }
  .cl-seg-btn { flex: 1; padding: 0 6px; min-height: 44px; }
  .cl-input { font-size: 16px; }
  .cl-num .cl-input { width: 130px; }
}

/* Designer */
.cld-overlay { z-index: 5300; }
.cld-card { width: min(1180px, 100%); height: min(92vh, 900px); max-height: 92vh; display: flex; flex-direction: column; }
.cld-loading { padding: 40px; text-align: center; color: var(--text-3); }
.cld-body { overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.cld-intro { margin: 0; line-height: 1.5; }
.cld-new { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cld-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cld-tpl { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.cld-tpl.archived { opacity: .65; }
.cld-tpl-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-50, #eff6ff); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cld-tpl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cld-tpl-main strong { font-size: 14.5px; }
.cld-tpl-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cld-tpl-actions { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.cld-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 20px; text-align: center; color: var(--text-3); border: 1px dashed var(--line-strong); border-radius: 14px; }
.cld-empty strong { color: var(--text); font-size: 15px; }
.cld-archived-toggle { font-size: 12.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.danger:hover:not(:disabled) { color: var(--danger, #dc2626); }
.icon-btn:disabled { opacity: .3; }

.cld-tabs { display: none; padding: 8px 14px 0; gap: 6px; }
.cld-tabs button { flex: 1; min-height: 40px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; font-weight: 600; color: var(--text-2); }
.cld-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.cld-editor { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); }
.cld-pane { overflow-y: auto; padding: 14px 18px 20px; min-height: 0; }
.cld-preview { background: var(--surface-2); border-left: 1px solid var(--line); }
.cld-preview-head { display: flex; align-items: center; gap: 7px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--text-3); margin-bottom: 10px; }
.cld-preview-body { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.cld-pv-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 15px; margin-bottom: 4px; }
.cld-settings { display: flex; flex-direction: column; gap: 12px; }
.cld-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cld-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cld-mode { display: flex; gap: 10px; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); }
.cld-mode.on { border-color: var(--brand); background: var(--brand-50, #eff6ff); }
.cld-mode input { margin-top: 3px; accent-color: var(--brand); }
.cld-mode span { display: flex; flex-direction: column; gap: 2px; }
.cld-mode small { color: var(--text-3); font-size: 11.5px; line-height: 1.35; }
.cld-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.cld-toggle input { width: 18px; height: 18px; accent-color: var(--brand); }
.cld-toggle.wide { padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.cld-note { margin: 0; }
.cld-h { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }
.cld-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cld-item { padding: 10px 12px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.cld-item.type-heading { background: var(--surface-2); border-left: 4px solid var(--text-2); }
.cld-item.dragging { opacity: .4; }
.cld-item.drag-over { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.cld-item-head { display: flex; align-items: center; gap: 8px; }
.cld-grip { color: var(--text-3); cursor: grab; display: inline-flex; }
.cld-type { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.cld-type-ico { width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; }
.cld-item-tools { margin-left: auto; display: inline-flex; gap: 2px; }
.cld-label-input, .cld-help-input, .cld-mini input, .cld-options textarea, .cld-settings input[type="text"] { width: 100%; box-sizing: border-box; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; }
.cld-label-input { font-weight: 600; }
.cld-help-input { min-height: 34px; font-size: 12.5px; }
.cld-item-opts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cld-mini { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.cld-mini input { width: 90px; min-height: 34px; }
.cld-options { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.cld-options textarea { resize: vertical; }
.cld-add { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.cld-add-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cld-add-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border: 1.5px dashed var(--line-strong); border-radius: 11px; background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.cld-add-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-50, #eff6ff); }
.cld-errors { display: flex; flex-direction: column; gap: 3px; margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: 12.5px; }
.cld-errors.hidden { display: none; }

@media (max-width: 900px) {
  .cld-card { height: 100%; max-height: 100%; border-radius: 0; }
  .cld-overlay { padding: 0; }
  .cld-tabs { display: flex; }
  .cld-editor { display: block; overflow-y: auto; }
  .cld-editor.tab-edit .cld-preview, .cld-editor.tab-preview .cld-edit { display: none; }
  .cld-pane { padding: 12px 14px 20px; overflow: visible; }
  .cld-preview { border-left: none; }
  .cld-row2, .cld-modes { grid-template-columns: 1fr; }
  .cld-tpl { flex-wrap: wrap; }
  .cld-tpl-actions { width: 100%; justify-content: flex-end; }
}
.modal-overlay .modal-card.cld-card { width: min(1180px, 100%); max-width: 1180px; height: min(92vh, 900px); }
@media (max-width: 900px) { .modal-overlay .modal-card.cld-card { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; } }

/* Forhåndsvisning av PDF: panel med luft rundt og papirark på lys bakgrunn */
.report-overlay { background: rgba(15, 23, 42, 0.58); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); align-items: center; justify-content: center; padding: clamp(10px, 3.2vw, 36px); }
.report-panel { width: min(1060px, 100%); height: 100%; max-height: 100%; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: #d7dde6; box-shadow: 0 30px 80px rgba(2, 6, 23, 0.45); }
.report-panel .report-bar { padding-top: 10px; border-radius: 0; }
.report-panel .report-body { padding: 0; background: #d7dde6; }
.report-panel .report-frame { width: 100%; height: 100%; border: none; box-shadow: none; border-radius: 0; background: transparent; }
@media (max-width: 640px) { .report-overlay { padding: 8px; } .report-panel { border-radius: 14px; } }

.cl-foot-actions { display: inline-flex; align-items: center; gap: 14px; }
.cl-foot-actions .cl-pdf { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.cld-tpl-actions { display: inline-flex; align-items: center; gap: 6px; }
.cld-tpl-actions-inner { display: inline-flex; align-items: center; gap: 6px; }
.report-overlay { z-index: 7500; }

/* Valg i verktøylinjen i PDF-forhåndsvisningen */
.report-field { display: inline-flex; align-items: center; gap: 8px; }
.report-field-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.rep-select { position: relative; display: inline-flex; align-items: center; }
.select-wrap.rep-select > .gt-icon:first-child { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.select-wrap.rep-select > .rep-chevron { position: absolute; left: auto; right: 11px; color: var(--text-3); pointer-events: none; }
.report-opts .rep-select select {
  appearance: none; -webkit-appearance: none; min-height: 38px; margin: 0; padding: 6px 32px 6px 33px; min-width: 190px;
  border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease;
}
.report-opts .rep-select select:hover { border-color: var(--text-3); }
.report-opts .rep-select select:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.report-chip-toggle { display: inline-flex; align-items: center; gap: 9px; min-height: 38px; padding: 0 13px 0 10px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.report-chip-toggle:hover { border-color: var(--text-3); }
.report-chip-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.rct-box { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-radius: 6px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; transition: background .12s ease, border-color .12s ease; }
.report-chip-toggle input:checked + .rct-box { background: var(--brand); border-color: var(--brand); }
.report-chip-toggle input:checked + .rct-box::after { content: ""; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.report-chip-toggle input:focus-visible + .rct-box { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 640px) { .report-opts { width: 100%; } .report-opts .rep-select select { min-width: 0; width: 100%; } .report-field { flex: 1; } .rep-select { flex: 1; } }

/* Annotasjoner ved oppgaver i kartet */
.map-tools-right .labels-visible-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.leaflet-tooltip.task-annot {
  display: flex; flex-direction: column; gap: 1px; max-width: 280px; padding: 3px 8px 4px; white-space: normal;
  background: rgba(255, 255, 255, .94); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .18); pointer-events: none; font-family: inherit;
}
.leaflet-tooltip.task-annot::before { display: none; }
.task-annot .annot-title { font-size: 11.5px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-annot .annot-title b { color: var(--brand); font-weight: 700; }
.task-annot .annot-desc { font-size: 10.5px; line-height: 1.25; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.annot-far .leaflet-tooltip.task-annot { display: none; }
@media (max-width: 640px) { .leaflet-tooltip.task-annot { max-width: 200px; padding: 2px 6px 3px; } .task-annot .annot-desc { display: none; } }

/* Bilder på sjekklistefelt */
.cl-photos { margin-top: 8px; }
.cl-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-bottom: 8px; }
.cl-photo { position: relative; margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.cl-photo.pending { opacity: .7; }
.cl-photo-img { display: block; aspect-ratio: 4 / 3; background: var(--surface-2, #f1f5f9); }
.cl-photo-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cl-photo-del { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(15, 23, 42, .62); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cl-photo-del:hover { background: #dc2626; }
.cl-photo-tag { position: absolute; top: 5px; left: 5px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: #fff; background: #475569; }
.cl-photo-tag.tag-AFTER { background: #15803d; } .cl-photo-tag.tag-DEVIATION { background: #dc2626; }
.cl-photo-tagsel { border: none; border-top: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 12px; padding: 6px 8px; width: 100%; color: var(--text-2); cursor: pointer; }
.cl-photo-cap { border: none; border-top: 1px solid var(--line); background: transparent; font-size: 12px; padding: 6px 8px; width: 100%; color: var(--text); box-sizing: border-box; }
.cl-photo-cap:focus-visible { outline: none; background: color-mix(in srgb, var(--brand) 6%, transparent); }
.cl-photo-cap-ro { padding: 5px 8px 6px; font-size: 12px; color: var(--text-2); }
.cl-photo-add { display: flex; flex-wrap: wrap; gap: 8px; }
.cl-photo-add.busy { opacity: .55; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .cl-cam-btn { display: none; } }
/* Bildetekst på vanlige vedlegg */
.attachment-item { position: relative; }
.attachment-cap { position: absolute; left: 0; right: 0; bottom: 0; border: none; padding: 3px 6px; font-size: 11px; text-align: left; color: #fff; background: rgba(15, 23, 42, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.attachment-cap:not(.has) { opacity: 0; } .attachment-item:hover .attachment-cap, .attachment-cap.has { opacity: 1; }
@media (hover: none) { .attachment-cap:not(.has) { opacity: 1; } }

/* Gjentakende oppgaver */
.recur-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.recur-row > select { flex: 1; min-width: 150px; }
.recur-every { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.recur-every input { width: 64px; text-align: center; }
.recur-more { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.recur-opt { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.recur-opt > span { text-transform: none; letter-spacing: 0; }
.field-hint.warn { color: #b45309; }
.rec-chip { display: inline-flex; align-items: center; gap: 4px; background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand); }
@media (max-width: 640px) { .recur-more { grid-template-columns: 1fr; } }

/* Push-varsler i profilen */
.push-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.push-row .switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.push-row small { color: var(--text-3); font-size: 12px; line-height: 1.4; }
.push-actions { display: inline-flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .push-row { flex-direction: column; align-items: stretch; } .push-actions { justify-content: flex-start; } }

/* Måling og arbeidsområder i kartet */
.map-tools-right .measure-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.measure-panel .md-modes { display: flex; gap: 6px; margin: 8px 0 6px; }
.md-mode { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.md-mode.on { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); border-color: var(--brand); }
.md-hint { display: block; font-size: 12px; color: var(--text-3); line-height: 1.4; margin-bottom: 8px; }
.leaflet-container.md-active { cursor: crosshair; }
.md-vertex { display: flex; align-items: center; justify-content: center; }
.md-vertex span { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid #2563eb; box-shadow: 0 1px 4px rgba(15, 23, 42, .4); }
.md-seg { pointer-events: none; }
.md-seg span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; padding: 2px 7px; border-radius: 999px; background: rgba(255, 255, 255, .95); color: #0f172a; font-size: 11px; font-weight: 700; box-shadow: 0 1px 4px rgba(15, 23, 42, .3); }
.md-seg.md-total span { background: #2563eb; color: #fff; font-size: 12px; }
.zone-chip-wrap span.zone-chip { position: absolute; transform: translate(-50%, -50%); display: inline-flex; flex-direction: column; align-items: center; white-space: nowrap; padding: 3px 10px 4px; border-radius: 10px; background: rgba(255, 255, 255, .95); color: #0f172a; border: 2px solid var(--c, #2563eb); font-size: 12px; font-weight: 700; line-height: 1.2; box-shadow: 0 2px 6px rgba(15, 23, 42, .25); cursor: pointer; }
.zone-chip small { font-size: 10.5px; font-weight: 600; color: #475569; }
.zone-far .zone-chip-wrap { display: none; }
.zone-summary { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 8%, transparent); color: var(--text-2); font-size: 13px; }
.zone-color-input { width: 64px; height: 38px; padding: 2px; }

/* Toppmenyen (Prosjekter / Dashboard / Kart / Tabell) skal stå stille når man bytter visning:
   plasseringen styres av venstre del (merket) og ikke av hvor bred høyre del er (prosjektmerke, søk, bruker). */
@media (min-width: 1025px) {
  .app-header { justify-content: flex-start; }
  .app-header .header-left { flex: 0 0 auto; }
  .app-header .view-switch { flex: 0 0 auto; margin-left: 12px; }
  .app-header .header-right { margin-left: auto; }
}

/* Kartverktøy samlet i en meny (se assets/js/maptools.js) */
.map-tools-right { position: absolute; }
.map-tools-right > .map-tools-fab { position: relative !important; }
.map-tools-right > .map-tools-fab.open, .map-tools-right > .map-tools-fab.has-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.map-tools-fab .mt-dot { position: absolute; top: 7px; right: 7px; width: 10px; height: 10px; border-radius: 50%; background: #facc15; border: 2px solid #fff; }
.map-tools-panel {
  position: absolute; right: calc(100% + 10px); bottom: 0; width: 248px; max-height: calc(100vh - 160px); overflow-y: auto;
  padding: 6px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(15, 23, 42, .22); z-index: 1100;
  transform-origin: bottom right; animation: mt-pop .14s ease-out;
}
@keyframes mt-pop { from { opacity: 0; transform: scale(.94) translateY(6px); } to { opacity: 1; transform: none; } }
.map-tools-panel .mt-group { padding: 4px 0; }
.map-tools-panel .mt-group + .mt-group { border-top: 1px solid var(--line); }
.map-tools-panel .mt-title { padding: 4px 10px 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.mt-row { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 12px; cursor: pointer; transition: background .12s ease; }
.mt-row:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.mt-row.off { opacity: .45; cursor: not-allowed; }
:is(.map-tools-right, .map-tools-left) .mt-row > button {
  position: static !important; inset: auto !important; width: 36px !important; height: 36px !important; min-width: 36px; border-radius: 10px !important; margin: 0 !important;
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text-2); border: none; box-shadow: none;
}
:is(.map-tools-right, .map-tools-left) .mt-row > button.active { background: var(--brand); color: #fff; }
:is(.map-tools-right, .map-tools-left) .mt-row > button.street-view-btn.active { background: #facc15; color: #111827; box-shadow: none; }
:is(.map-tools-right, .map-tools-left) .mt-row > button.cables-visible-btn:not(.active) { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text-3); }
.mt-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.mt-label { font-size: 13px; font-weight: 600; color: var(--text); }
.mt-hint { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-sw { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.mt-row[data-kind="toggle"] .mt-sw { width: 30px; height: 18px; border-radius: 999px; background: color-mix(in srgb, var(--text) 18%, transparent); position: relative; transition: background .15s ease; }
.mt-row[data-kind="toggle"] .mt-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .3); transition: transform .15s ease; }
.mt-row[data-kind="toggle"].on .mt-sw { background: var(--brand); }
.mt-row[data-kind="toggle"].on .mt-sw::after { transform: translateX(12px); }
.mt-row[data-kind="mode"].on .mt-sw { background: var(--brand); }
.mt-row.on .mt-label { color: var(--brand); }
@media (max-width: 640px) { .map-tools-panel { width: min(248px, calc(100vw - 84px)); } }
.gps-status { bottom: 24px; right: 76px; }
@media (max-width: 640px) { .gps-status { right: 60px; bottom: 20px; } }

/* Venstre meny: Kartunderlag og backup */
.map-tools-left { position: absolute; left: 12px; bottom: 16px; z-index: 1002; display: flex; flex-direction: column; gap: 12px; }
.map-tools-left > button {
  position: static !important; inset: auto !important; width: 48px; height: 48px; border-radius: 50%; margin: 0;
  display: inline-flex; align-items: center; justify-content: center; background: #fff; color: var(--text-2);
  border: 1px solid var(--line); box-shadow: var(--shadow-2); position: relative !important;
}
.map-tools-left > .map-tools-fab.open, .map-tools-left > .map-tools-fab.has-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.map-tools-panel.mt-left { right: auto; left: calc(100% + 10px); transform-origin: bottom left; }
@media (max-width: 640px) { .map-tools-left > button { width: 38px; height: 38px; } .map-tools-left { gap: 8px; } }

/* Signaturer */
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sig-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.sig-card.empty { border-style: dashed; align-items: flex-start; }
.sig-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.sig-ok { display: inline-flex; align-items: center; gap: 4px; color: #15803d; font-size: 12px; font-weight: 600; }
.sig-img { height: 78px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--text) 3%, transparent); border-radius: 10px; border-bottom: 2px solid var(--line-strong); }
.sig-img img { max-height: 70px; max-width: 92%; object-fit: contain; }
.sig-meta { font-size: 13px; line-height: 1.4; }
.sig-comment { margin-top: 4px; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--text) 5%, transparent); font-size: 12px; color: var(--text-2); }
.sig-actions { display: flex; justify-content: space-between; gap: 10px; }
.sig-del { color: #dc2626; }
@media (max-width: 640px) { .sig-grid { grid-template-columns: 1fr; } }
.sign-overlay { z-index: 8200; }
.sign-card { max-width: 560px; }
.sign-statement { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 8%, transparent); font-size: 13px; color: var(--text-2); }
.sign-tabs { display: flex; gap: 6px; margin: 4px 0 8px; }
.sign-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.sign-tab.on { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); border-color: var(--brand); }
.sign-pad-wrap { position: relative; border: 1.5px dashed var(--line-strong); border-radius: 14px; background: #fff; overflow: hidden; }
.sign-canvas { display: block; width: 100%; touch-action: none; cursor: crosshair; }
.sign-canvas.typed { cursor: default; pointer-events: none; }
.sign-baseline { position: absolute; left: 16px; bottom: 44px; color: #94a3b8; font-size: 14px; pointer-events: none; }
.sign-pad-wrap::after { content: ""; position: absolute; left: 40px; right: 16px; bottom: 50px; border-bottom: 1px solid #cbd5e1; pointer-events: none; }
.sign-hint { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; color: #94a3b8; font-size: 13px; pointer-events: none; }
.sign-pad-tools { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 10px; }

/* Aktivitetslogg */
.act-list { list-style: none; margin: 0; padding: 0; }
.act-day { padding: 10px 2px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.act-day:first-child { padding-top: 0; }
.act-item { display: flex; gap: 10px; padding: 8px 6px; border-radius: 10px; }
.act-item.clickable { cursor: pointer; }
.act-item.clickable:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.act-ico { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.act-add .act-ico { background: color-mix(in srgb, #16a34a 14%, transparent); color: #15803d; }
.act-del .act-ico { background: color-mix(in srgb, #dc2626 12%, transparent); color: #dc2626; }
.act-main { min-width: 0; flex: 1; }
.act-line { font-size: 13px; line-height: 1.45; color: var(--text-2); overflow-wrap: anywhere; }
.act-line strong { color: var(--text); }
.act-time { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.act-changes { margin: 3px 0 0; padding-left: 16px; font-size: 12px; }
.act-f { color: var(--text-3); } .act-from { text-decoration: line-through; color: var(--text-3); } .act-to { color: var(--text); font-weight: 600; }
.act-quote { margin-top: 3px; padding: 4px 8px; border-left: 3px solid var(--line-strong); font-size: 12px; color: var(--text-3); }
.act-warn { color: #dc2626; }
.act-more, .act-end { text-align: center; padding: 10px 0 2px; }
.act-modal { max-width: 640px; width: 100%; max-height: min(90vh, 820px); display: flex; flex-direction: column; }
.act-filters { display: flex; gap: 10px; padding: 0 20px 12px; flex-wrap: wrap; }
.act-modal-body { overflow-y: auto; flex: 1; }

/* Tegning på bilder */
.attachment-edit { position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(15, 23, 42, .62); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; }
.attachment-item:hover .attachment-edit, .attachment-edit:focus-visible { opacity: 1; }
.attachment-edit:hover { background: var(--brand); }
@media (hover: none) { .attachment-edit { opacity: 1; width: 30px; height: 30px; } }
.attachment-annot, .cl-photo-annot { position: absolute; right: 6px; bottom: 26px; font-size: 12px; background: rgba(250, 204, 21, .95); color: #111827; border-radius: 999px; padding: 0 6px; line-height: 18px; }
.cl-photo-annot { top: 30px; bottom: auto; left: 5px; right: auto; }
.cl-photo-edit { position: absolute; top: 5px; right: 33px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(15, 23, 42, .62); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cl-photo-edit:hover { background: var(--brand); }
.pe-overlay { position: fixed; inset: 0; z-index: 9500; background: #0b1220; display: flex; flex-direction: column; color: #fff; }
.pe-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 14px; background: #0f172a; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.pe-tools { display: flex; gap: 6px; }
.pe-tool { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #e2e8f0; font-size: 13px; font-weight: 600; cursor: pointer; }
.pe-tool.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pe-style { display: flex; align-items: center; gap: 14px; }
.pe-colors, .pe-sizes { display: flex; gap: 6px; }
.pe-color { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid rgba(255, 255, 255, .35); cursor: pointer; padding: 0; }
.pe-color.on { box-shadow: 0 0 0 3px var(--brand); border-color: #fff; }
.pe-size { width: 30px; height: 28px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #e2e8f0; font-weight: 700; cursor: pointer; }
.pe-size.on { background: #fff; color: #0f172a; }
.pe-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.pe-actions .btn-ghost { color: #e2e8f0; }
.pe-actions .btn[disabled] { opacity: .4; }
.pe-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; position: relative; overflow: auto; }
.pe-stage canvas { background: #000; border-radius: 6px; touch-action: none; max-width: 100%; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.pe-msg { position: absolute; color: #cbd5e1; }
.pe-hint { margin: 0; padding: 6px 14px 10px; text-align: center; font-size: 12px; color: #94a3b8; }
body.pe-open { overflow: hidden; }
@media (max-width: 640px) { .pe-tool span { display: none; } .pe-actions { margin-left: 0; width: 100%; justify-content: flex-end; } }

/* Kundegodkjenning av/på */
.sig-toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.sig-toggle-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sig-toggle small { color: var(--text-3); font-size: 12px; line-height: 1.35; }
.sig-toggle input { width: 38px; height: 22px; flex-shrink: 0; cursor: pointer; accent-color: var(--brand); }
.sig-grid.single { grid-template-columns: 1fr; }

/* Varslingsinnstillinger */
.ns-overlay { z-index: 8100; }
.ns-card { max-width: 720px; width: 100%; max-height: min(92vh, 860px); display: flex; flex-direction: column; }
.ns-card .modal-header h2 { display: inline-flex; align-items: center; gap: 10px; }
.ns-body { overflow-y: auto; flex: 1; }
.ns-intro { margin: 0 0 14px; color: var(--text-2); font-size: 13.5px; }
.ns-sec { padding: 14px 0 6px; border-top: 1px solid var(--line); }
.ns-sec:first-of-type { border-top: none; padding-top: 0; }
.ns-sec h3 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.ns-badge { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.ns-matrix { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.ns-row { display: grid; grid-template-columns: 1fr repeat(3, 76px); align-items: center; gap: 4px; padding: 10px 12px; border-top: 1px solid var(--line); }
.ns-row:first-child { border-top: none; }
.ns-row.ns-head { background: color-mix(in srgb, var(--text) 4%, transparent); padding-top: 8px; padding-bottom: 8px; }
.ns-colhead { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.ns-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ns-what strong { font-size: 13.5px; }
.ns-what small { color: var(--text-3); font-size: 12px; line-height: 1.35; }
.ns-cell { display: flex; justify-content: center; cursor: pointer; }
.ns-cell-label { display: none; }
.ns-switch { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 999px; background: color-mix(in srgb, var(--text) 20%, transparent); position: relative; cursor: pointer; transition: background .15s ease; margin: 0; flex-shrink: 0; }
.ns-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .3); transition: transform .15s ease; }
.ns-switch:checked { background: var(--brand); }
.ns-switch:checked::after { transform: translateX(16px); }
.ns-switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ns-push { margin-top: 10px; }
.ns-push .push-row { border-top: none; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.ns-radio { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; cursor: pointer; }
.ns-radio:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.ns-radio input { margin-top: 3px; accent-color: var(--brand); width: 18px; height: 18px; flex-shrink: 0; }
.ns-radio span { display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; }
.ns-radio small { color: var(--text-3); font-size: 12px; }
.ns-search { margin: 6px 0 8px; }
.ns-projects { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.ns-proj { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--line); }
.ns-proj:first-child { border-top: none; }
.ns-proj.focus { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.ns-proj-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ns-proj-name span:last-child { display: flex; flex-direction: column; min-width: 0; }
.ns-proj-name strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-proj-name small { font-size: 11.5px; color: var(--text-3); }
.ns-seg { display: inline-flex; padding: 3px; border-radius: 11px; background: color-mix(in srgb, var(--text) 7%, transparent); flex-shrink: 0; }
.ns-seg-btn { border: none; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-3); cursor: pointer; }
.ns-seg-btn.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, .15); }
.ns-seg-btn.on.mode-OFF { color: #dc2626; }
.ns-seg-btn.on.mode-DIRECT { color: var(--brand); }
.ns-saved { margin-right: 10px; }
.ns-saved.bad { color: #dc2626; }
.profile-notify-row { border-top: 1px solid var(--line); }
.n-head-actions .n-settings { width: 30px; height: 30px; }
@media (max-width: 640px) {
  .ns-row { grid-template-columns: 1fr; gap: 8px; }
  .ns-row.ns-head { display: none; }
  .ns-row .ns-cell { display: inline-flex; flex-direction: row-reverse; justify-content: space-between; align-items: center; padding: 2px 0; }
  .ns-cell-label { display: inline; font-size: 13px; color: var(--text-2); }
  .ns-proj { flex-direction: column; align-items: stretch; }
  .ns-seg { width: 100%; } .ns-seg-btn { flex: 1; }
}

/* Aktivitetsgraf (uke/dag) */
.act-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.act-seg { display: inline-flex; padding: 3px; border-radius: 11px; background: color-mix(in srgb, var(--text) 7%, transparent); }
.act-seg-btn { border: none; background: transparent; padding: 6px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-3); cursor: pointer; }
.act-seg-btn.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, .15); }
.act-controls .select-wrap { margin-left: auto; }
.act-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.act-summary > div { padding: 9px 12px; border-radius: 12px; background: color-mix(in srgb, var(--text) 4%, transparent); display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.act-summary strong { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-summary span { font-size: 11.5px; color: var(--text-3); }
.act-plot { display: grid; grid-template-columns: 30px 1fr; gap: 8px; height: 220px; margin-bottom: 8px; }
.act-y { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; padding-bottom: 34px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; transform: translateY(-6px); }
.act-area { position: relative; }
.act-lines { position: absolute; inset: 0 0 34px 0; pointer-events: none; }
.act-lines i { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--line); }
.act-lines i:first-child { border-top: 1px solid var(--line-strong); }
.act-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; }
.act-col { position: relative; display: flex; flex-direction: column; border-radius: 8px; outline: none; }
.act-col:hover, .act-col:focus-visible { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.act-col.weekend { background: color-mix(in srgb, var(--text) 3%, transparent); }
.act-col.current .act-x b { color: var(--brand); }
.act-bars { flex: 1; min-height: 0; display: flex; align-items: flex-end; justify-content: center; gap: 1px; padding: 0 1px; }
.act-bar { position: relative; flex: 1 1 0; min-width: 2px; max-width: 22px; min-height: 2px; border-radius: 4px 4px 0 0; transition: height .35s ease; }
.act-bar em { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10px; font-weight: 600; color: var(--text-2); padding-bottom: 1px; }
.act-created { background: linear-gradient(180deg, #60a5fa, #3b82f6); }
.act-done { background: linear-gradient(180deg, #34d399, #16a34a); }
.act-x { height: 34px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; line-height: 1.2; }
.act-x b { font-weight: 700; color: var(--text-2); }
.act-x small { font-size: 10px; }
.act-tip { display: none; position: absolute; bottom: calc(100% - 34px + 6px); left: 50%; transform: translateX(-50%); z-index: 5; min-width: 150px; padding: 8px 10px; border-radius: 10px; background: #0f172a; color: #fff; box-shadow: 0 8px 24px rgba(15, 23, 42, .3); font-size: 12px; pointer-events: none; flex-direction: column; gap: 3px; white-space: nowrap; }
.act-tip.left { left: 0; transform: none; } .act-tip.right { left: auto; right: 0; transform: none; }
.act-tip span { display: flex; align-items: center; gap: 6px; } .act-tip b { margin-left: auto; padding-left: 12px; }
.act-col:hover .act-tip, .act-col:focus-visible .act-tip { display: flex; }
.act-legend { display: flex; gap: 8px; margin-bottom: 6px; }
.act-lg { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: 12px; color: var(--text-3); cursor: pointer; }
.act-lg.on { color: var(--text); border-color: var(--line-strong); background: var(--surface); }
.lg-done { background: var(--ok); }
.act-table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.act-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.act-table th, .act-table td { padding: 8px 12px; text-align: left; border-top: 1px solid var(--line); }
.act-table thead th { position: sticky; top: 0; background: var(--surface); border-top: none; z-index: 1; box-shadow: 0 1px 0 var(--line); }
.act-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.act-table tr.current td { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.act-table tfoot td { font-weight: 700; background: color-mix(in srgb, var(--text) 4%, transparent); }
.act-sort { border: none; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.act-sort.on { color: var(--text); } .act-sort span { opacity: .7; }
.act-mini { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--text) 8%, transparent); margin-right: 10px; vertical-align: middle; overflow: hidden; }
.act-mini i { display: block; height: 100%; border-radius: 3px; }
.act-now { font-size: 10px; font-weight: 700; color: var(--brand); text-transform: uppercase; margin-left: 6px; }
@media (max-width: 640px) {
  .act-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .act-plot { height: 190px; }
  .act-controls .select-wrap { margin-left: 0; }
  .act-bar em { display: none; }
}

/* Dokumenter på dashboardet */
.doc-count { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text-2); margin-left: 6px; }
.doc-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 16px 14px; border: 1.5px dashed var(--line-strong); border-radius: 14px; color: var(--text-2); cursor: pointer; transition: border-color .12s ease, background .12s ease; }
.doc-drop:hover, .doc-drop:focus-visible, .doc-drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); outline: none; }
.doc-drop > svg { color: var(--brand); }
.doc-drop strong { font-size: 13.5px; color: var(--text); }
.doc-upcat { margin-top: 8px; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); cursor: default; }
.doc-upcat select { min-height: 30px; padding: 2px 26px 2px 10px; font-size: 12.5px; }
.doc-queue { display: flex; flex-direction: column; gap: 6px; }
.doc-queue:not(:empty) { margin-top: 10px; }
.doc-up { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--text) 5%, transparent); font-size: 13px; }
.doc-up small { margin-left: auto; color: var(--text-3); }
.doc-up.bad { background: color-mix(in srgb, #dc2626 8%, transparent); } .doc-up.bad small { color: #dc2626; }
.doc-tools { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.doc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.doc-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-top: 1px solid var(--line); }
.doc-row:first-child { border-top: none; }
.doc-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; background: none; border: none; padding: 8px 6px; border-radius: 10px; cursor: pointer; color: inherit; font: inherit; }
.doc-main:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.doc-badge { flex-shrink: 0; width: 40px; height: 44px; border-radius: 8px; display: inline-flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 10px; font-weight: 800; letter-spacing: .04em; color: #fff; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c)); position: relative; }
.doc-badge::before { content: ""; position: absolute; top: 0; right: 0; width: 12px; height: 12px; background: rgba(255, 255, 255, .45); border-bottom-left-radius: 6px; }
.doc-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doc-text strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 11.5px; color: var(--text-3); }
.doc-cat { font-weight: 700; color: var(--brand); }
.doc-desc { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-actions { display: inline-flex; gap: 4px; flex-shrink: 0; }
.doc-act { width: 34px; height: 34px; background: transparent; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.doc-act:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.doc-empty { padding: 10px 0 0; margin: 0; }
.de-file { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.doc-viewer { position: fixed; inset: 0; z-index: 9400; background: #0b1220; display: flex; flex-direction: column; color: #fff; }
.dv-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #0f172a; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.dv-bar .icon-btn, .dv-bar .btn-ghost { color: #e2e8f0; background: transparent; }
.dv-bar .icon-btn:hover, .dv-bar .btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.dv-title { flex: 1; min-width: 0; display: flex; flex-direction: column; margin: 0 6px; }
.dv-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-title .muted { color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; }
.dv-frame { width: 100%; height: 100%; border: none; background: #fff; }
.dv-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.dv-text { margin: 0; padding: 18px; width: 100%; height: 100%; overflow: auto; background: #fff; color: #0f172a; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; box-sizing: border-box; }
.dv-none { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px; max-width: 420px; }
.dv-none .doc-badge { width: 56px; height: 62px; font-size: 13px; }
.dv-none .muted { color: #94a3b8; }
@media (max-width: 640px) { .dv-bar .btn-ghost span, #dv-edit { font-size: 0; } .dv-sub { display: none; } .doc-actions .doc-act:nth-child(2) { display: none; } }

/* Tilpass dashboardet */
.dash-lock[aria-pressed="true"] { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.dash-editbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 14px; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--brand) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); font-size: 13px; color: var(--text-2); position: sticky; top: 8px; z-index: 40; backdrop-filter: blur(6px); }
.dash-editbar > span:first-child { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-editbar-btns { display: inline-flex; gap: 8px; }
.dash-editing .dash-block { position: relative; padding-top: 42px; outline: 2px dashed color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 3px; border-radius: 16px; }
.dash-editing .dash-block > .card, .dash-editing .dash-block > section.card { margin-top: 0; }
.dash-grip { position: absolute; top: 4px; left: 6px; right: 6px; height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px 0 8px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; z-index: 3; }
.dash-grip:active { cursor: grabbing; }
.dash-grip-title { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dash-grip-btns { display: inline-flex; gap: 2px; }
.dash-gbtn { width: 28px; height: 28px; border-radius: 8px; border: none; background: transparent; color: var(--brand); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.dash-gbtn:hover { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.dash-block.dragging { opacity: .96; box-shadow: 0 24px 60px rgba(15, 23, 42, .35); transform: rotate(.6deg); background: var(--bg, var(--surface)); border-radius: 16px; }
.dash-ph { border-radius: 16px; border: 2px dashed var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
