﻿/* BTG Infra KMA â€“ calm industrial slate/blue */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --sidebar: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #38bdf8;
  --accent: #0369a1;
  --accent-hover: #0284c7;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --success: #166534;
  --success-bg: #dcfce7;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.9em; background: #eef2f7; padding: 0.1em 0.35em; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.muted { color: var(--muted); font-size: 0.9rem; }
.lede { max-width: 48rem; color: #334155; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 1.5rem; padding: 0 0.35rem; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 8px;
  background: linear-gradient(135deg, #0ea5e9, #0369a1);
  color: #fff; font-weight: 700; font-size: 0.75rem;
  display: grid; place-items: center; letter-spacing: 0.04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: #f8fafc; font-size: 0.95rem; }
.brand-text span { font-size: 0.75rem; color: #94a3b8; }

.nav { display: flex; flex-direction: column; gap: 0.2rem; }
.nav a {
  color: var(--sidebar-text);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
}
.nav a:hover { background: rgba(148, 163, 184, 0.12); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(56, 189, 248, 0.15); color: var(--sidebar-active); }

.search-box { margin-top: 1.25rem; display: flex; gap: 0.35rem; }
.search-box input {
  flex: 1; min-width: 0; border: 1px solid #334155; background: #0f172a;
  color: #e2e8f0; border-radius: 6px; padding: 0.45rem 0.55rem; font-size: 0.85rem;
}
.search-box button {
  border: none; background: #0369a1; color: #fff; border-radius: 6px;
  padding: 0.45rem 0.6rem; cursor: pointer; font-size: 0.8rem;
}
.sidebar-foot { margin-top: auto; padding: 1rem 0.35rem 0; color: #64748b; }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.85rem 1.5rem; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.page-heading { margin: 0; font-size: 1.15rem; font-weight: 600; flex: 1; }
.top-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.menu-toggle {
  display: none; border: 1px solid var(--border); background: #fff;
  border-radius: 8px; padding: 0.35rem 0.6rem; cursor: pointer;
}

.content { padding: 1.5rem; max-width: 960px; width: 100%; margin: 0 auto; }

.btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 8px; padding: 0.45rem 0.85rem; font-size: 0.9rem;
  cursor: pointer; text-decoration: none; font-weight: 500;
}
.btn:hover { background: #f8fafc; text-decoration: none; color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: transparent; }

.flash-wrap { padding: 0.75rem 1.5rem 0; max-width: 960px; margin: 0 auto; width: 100%; }
.flash { padding: 0.65rem 0.9rem; border-radius: 8px; margin-bottom: 0.5rem; }
.flash-success { background: var(--success-bg); color: var(--success); }

.hero {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem 1.75rem; box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.hero h2 { margin: 0 0 0.5rem; font-size: 1.45rem; }
.stat-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.1rem; }
.stat {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  padding: 0.65rem 1rem; min-width: 120px;
}
.stat strong { display: block; font-size: 1.05rem; }
.stat span { font-size: 0.8rem; color: var(--muted); }

.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem; margin-bottom: 1.25rem;
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow); color: inherit; text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover {
  border-color: #7dd3fc; box-shadow: 0 4px 12px rgba(3, 105, 161, 0.12);
  text-decoration: none; color: inherit;
}
.card h3 { margin: 0 0 0.4rem; font-size: 1.05rem; color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.15rem 1.35rem; margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 0.75rem; font-size: 1.05rem; }

.doc-list, .link-list, .search-results { list-style: none; padding: 0; margin: 0; }
.doc-list li, .link-list li, .search-results li {
  padding: 0.65rem 0; border-bottom: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; align-items: baseline;
}
.doc-list.compact li { padding: 0.4rem 0; }
.doc-list li:last-child, .search-results li:last-child { border-bottom: none; }
.search-results .snippet { width: 100%; margin: 0.2rem 0 0; color: #475569; font-size: 0.9rem; }

/* Markdown document body */
.doc-body {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.75rem 2rem; box-shadow: var(--shadow);
}
.doc-body h1 { font-size: 1.6rem; margin-top: 0; border-bottom: 2px solid var(--border); padding-bottom: 0.4rem; }
.doc-body h2 { font-size: 1.25rem; margin-top: 1.6rem; color: #0c4a6e; }
.doc-body h3 { font-size: 1.08rem; margin-top: 1.25rem; }
.doc-body p, .doc-body li { max-width: 70ch; }
.doc-body blockquote {
  margin: 1rem 0; padding: 0.75rem 1rem; border-left: 4px solid #38bdf8;
  background: #f0f9ff; color: #0c4a6e;
}
.doc-body table {
  width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.92rem;
  display: block; overflow-x: auto;
}
.doc-body th, .doc-body td {
  border: 1px solid #cbd5e1; padding: 0.45rem 0.65rem; text-align: left; vertical-align: top;
}
.doc-body th { background: #e2e8f0; font-weight: 600; }
.doc-body tr:nth-child(even) td { background: #f8fafc; }
.doc-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.doc-meta { display: none; }
.path-hint { margin-top: 1rem; }

.edit-form textarea, .settings-form input, .settings-form textarea,
.mall-form input, .mall-form textarea, .mall-form select,
.search-form input {
  width: 100%; font: inherit; padding: 0.55rem 0.7rem;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.edit-form textarea { font-family: var(--mono); font-size: 0.88rem; line-height: 1.45; min-height: 60vh; }
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
}
.form-grid label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 500; font-size: 0.9rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.search-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; max-width: 36rem; }
.search-form input { flex: 1; }

@media (max-width: 800px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 30;
    transform: translateX(-100%); transition: transform 0.2s;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .doc-body { padding: 1.1rem; }
}

/* Print */
@media print {
  .no-print, .sidebar, .topbar, .flash-wrap, .menu-toggle { display: none !important; }
  .layout, .main-wrap, .content { display: block; max-width: none; padding: 0; margin: 0; }
  body { background: #fff; }
  .doc-body, .mall-form, .print-area {
    border: none; box-shadow: none; padding: 0;
  }
  .doc-meta { display: block; margin-bottom: 1rem; font-size: 0.85rem; color: #334155; }
  a { color: inherit; text-decoration: none; }
}


/* Revision / Ã¥rshjul */
.content:has(.revision-stats),
.content:has(.year-wheel) { max-width: 1100px; }

.revision-stats { margin-bottom: 1.25rem; }
.stat-danger { border-color: #fecaca; background: #fef2f2; }
.stat-danger strong { color: #b91c1c; }
.stat-warn { border-color: #fde68a; background: #fffbeb; }
.stat-warn strong { color: #a16207; }
.stat-info { border-color: #bae6fd; background: #f0f9ff; }
.stat-info strong { color: #0369a1; }

.badge {
  display: inline-block; font-size: 0.75rem; font-weight: 600;
  padding: 0.2rem 0.5rem; border-radius: 999px; white-space: nowrap;
}
.badge-forfallen { background: #fee2e2; color: #991b1b; }
.badge-denna_manad { background: #fef3c7; color: #92400e; }
.badge-ok { background: #dcfce7; color: #166534; }

.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.9rem;
}
.data-table th, .data-table td {
  border-bottom: 1px solid var(--border); padding: 0.65rem 0.5rem;
  text-align: left; vertical-align: top;
}
.data-table th {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--muted); font-weight: 600;
}
.data-table tr.row-forfallen { background: #fff5f5; }
.data-table tr.row-denna_manad { background: #fffbeb; }
.path-cell { font-size: 0.75rem; }
.notes-cell { max-width: 12rem; color: #475569; font-size: 0.85rem; }
.actions-cell { min-width: 7rem; }
.inline-form {
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
  margin-top: 0.35rem;
}
.input-sm {
  font: inherit; font-size: 0.8rem; padding: 0.3rem 0.45rem;
  border: 1px solid var(--border); border-radius: 6px; min-width: 8rem;
  max-width: 12rem;
}
.btn-sm {
  padding: 0.28rem 0.55rem; font-size: 0.8rem; border-radius: 6px;
}
.edit-deadline { margin-top: 0.4rem; font-size: 0.85rem; }
.edit-deadline summary { cursor: pointer; color: var(--accent); }
.deadline-form {
  display: flex; flex-direction: column; gap: 0.4rem;
  margin-top: 0.45rem; padding: 0.55rem; background: #f8fafc;
  border: 1px solid var(--border); border-radius: 8px; max-width: 18rem;
}
.deadline-form label {
  display: flex; flex-direction: column; gap: 0.2rem;
  font-size: 0.8rem; font-weight: 500;
}
.deadline-form input {
  font: inherit; padding: 0.35rem 0.45rem;
  border: 1px solid var(--border); border-radius: 6px;
}

.year-wheel {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.wheel-month {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 8px; padding: 0.75rem 0.85rem;
}
.wheel-month.current-month {
  border-color: #38bdf8; background: #f0f9ff;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25);
}
.wheel-month h4 { margin: 0 0 0.5rem; font-size: 0.9rem; color: #0c4a6e; }
.wheel-month ul { list-style: none; padding: 0; margin: 0; }
.wheel-month li {
  padding: 0.35rem 0; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.85rem;
}
.wheel-month li:first-child { border-top: none; }
.empty-month { margin: 0; }

.flash-error { background: #fee2e2; color: #991b1b; }


/* Revision checklist */
.content:has(.revision-check-form) { max-width: 820px; }
.revision-check-meta .meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem 1.25rem;
  margin-bottom: 0.85rem;
}
.checklist-progress {
  margin: 0;
  padding: 0.65rem 0.85rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  color: #0c4a6e;
}
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.checklist-item {
  margin: 0;
}
.checklist-label {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  min-height: 3.25rem;
  transition: border-color 0.15s, background 0.15s;
}
.checklist-label:hover {
  border-color: #7dd3fc;
  background: #f0f9ff;
}
.checklist-box {
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.checklist-text {
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text);
}
.checklist-label:has(.checklist-box:checked) {
  border-color: #86efac;
  background: #f0fdf4;
}
.checklist-notes {
  width: 100%;
  font: inherit;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  min-height: 6rem;
}
.checklist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.25rem 0 1.5rem;
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Checklist info popup */
.checklist-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem 1rem;
  width: 100%;
}
.checklist-row .checklist-label {
  flex: 1 1 16rem;
}
.checklist-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  flex: 0 0 auto;
  margin-top: 0.2rem;
}
.checklist-info-link,
.checklist-how-link {
  flex: 0 0 auto;
  padding: 0.25rem 0.5rem;
  border: none;
  background: transparent;
  color: #2563eb;
  font: inherit;
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
}
.checklist-info-link:hover,
.checklist-how-link:hover {
  color: #1d4ed8;
}
.help-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: min(32rem, 92vw);
  width: 100%;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
}
.help-dialog.help-dialog-wide {
  max-width: min(52rem, 96vw);
}
.help-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.help-dialog-inner {
  padding: 1.25rem 1.35rem 1.1rem;
}
.help-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.help-dialog-heading {
  min-width: 0;
  flex: 1 1 auto;
}
.help-dialog-header h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.35;
  color: #0f172a;
}
.help-dialog-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: #64748b;
}
.help-dialog-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
}
.help-dialog-body {
  color: #334155;
  line-height: 1.55;
}
.help-dialog-explanation {
  white-space: pre-wrap;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.help-dialog-intro {
  margin: 0 0 0.75rem;
  color: #475569;
}
.help-dialog-doc-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.help-dialog-doc-scroll {
  max-height: 55vh;
  overflow: auto;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: #f8fafc;
}
.help-dialog-doc-body {
  font-size: 0.95rem;
}
.help-dialog-doc-body h1 { font-size: 1.35rem; }
.help-dialog-doc-body h2 { font-size: 1.15rem; }
.how-to-know-list {
  margin: 0;
  padding-left: 1.25rem;
}
.how-to-know-list li {
  margin: 0.4rem 0;
}
.help-dialog-footer {
  margin-top: 1.1rem;
  display: flex;
  justify-content: flex-end;
}


/* Saved mall view */
.mall-saved-meta { margin-bottom: 1rem; }
.meta-dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem 1.25rem;
  margin: 0;
}
.meta-dl dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 600;
  margin: 0;
}
.meta-dl dd {
  margin: 0.15rem 0 0;
}
.mall-saved-fields th[scope="row"] {
  text-transform: none;
  letter-spacing: 0;
  color: inherit;
  font-weight: 600;
  width: 35%;
}
.mall-saved-fields td {
  white-space: pre-wrap;
}

/* EC2 egenkontroll wizard / saved */
.card-featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
  background: linear-gradient(180deg, #f0f7ff 0%, var(--surface) 100%);
}
.card-featured h3 { color: var(--accent); }
.checkbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem;
}
.check-card {
  display: flex; gap: 0.65rem; align-items: flex-start;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 0.85rem; background: var(--surface); cursor: pointer;
  font-weight: 500;
}
.check-card input { margin-top: 0.2rem; }
.check-card small { display: block; font-weight: 400; margin-top: 0.15rem; }
.badge-info { background: #e0f2fe; color: #075985; }
.checkpoint-table .cp-note { width: 100%; min-width: 10rem; font-size: 0.85rem; }
.checkpoint-table .cp-init { width: 4.5rem; }
.checkpoint-table .ok-cell { white-space: nowrap; }
.checkpoint-table .cp-result-toggles { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-start; }
.checkpoint-table .ok-toggle { display: inline-flex; align-items: center; gap: 0.35rem; }
.checkpoint-table .small { font-size: 0.75rem; }
.print-only { display: none; }
@media print {
  .print-only { display: inline; }
  .checkpoint-table textarea, .checkpoint-table input[type="text"] {
    border: none; resize: none; background: transparent;
  }
  .checkpoint-table input[type="checkbox"] { display: none; }
  .ok-toggle .no-print { display: none; }
}


/* Checkpoint attachments (egenkontroll) */
.visually-hidden-form {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.cp-attachments {
  margin-top: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}
.cp-attach-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted, #64748b);
  margin-bottom: 0.35rem;
}
.cp-attach-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.cp-attach-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.35rem 0.25rem 0.35rem;
}
.cp-attach-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.cp-attach-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #e2e8f0;
}
.cp-attach-name {
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 10rem;
}
.cp-attach-empty { padding: 0.15rem 0; }
.cp-attach-delete-form { margin: 0; }
.btn-attach-del {
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: #b91c1c;
}
.cp-attach-upload { margin-top: 0.5rem; }
.cp-attach-file-label {
  display: inline-flex;
  cursor: pointer;
  margin: 0;
}
.cp-attach-file-label .btn {
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
}
.cp-attach-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.cp-attach-print { font-size: 0.8rem; margin-top: 0.25rem; }

@media print {
  .cp-attach-thumb,
  .cp-attach-upload,
  .cp-attach-delete-form,
  .cp-attach-label,
  .cp-attach-empty { display: none !important; }
  .cp-attach-list { display: none !important; }
  .cp-attach-print { display: block !important; }
  .cp-attachments { border-top: none; padding-top: 0.15rem; }
}

/* Projekt (lagring: arkiv) */
.badge-status-aktiv { background: #dcfce7; color: #166534; }
.badge-status-avslutad { background: #e2e8f0; color: #334155; }
.badge-status-arkiverad { background: #fef3c7; color: #92400e; }
.badge-projekttyp {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-projekttyp-bemanning { background: #e0e7ff; color: #3730a3; }
.badge-projekttyp-entreprenad { background: #ccfbf1; color: #115e59; }
.badge-projekttyp-okand { background: #f1f5f9; color: #64748b; }

.projekttyp-panel { margin-bottom: 1rem; }
.projekttyp-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
}
.projekttyp-legend {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  padding: 0;
}
.projekttyp-hint { margin: 0 0 0.85rem; }
.req-star { color: #b91c1c; }
.projekttyp-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.projekttyp-card {
  display: block;
  cursor: pointer;
  margin: 0;
  font-weight: 500;
}
.projekttyp-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.projekttyp-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.projekttyp-card:hover .projekttyp-card-body {
  border-color: #94a3b8;
}
.projekttyp-card input:focus-visible + .projekttyp-card-body {
  outline: 2px solid var(--accent, #0284c7);
  outline-offset: 2px;
}
.projekttyp-card input:checked + .projekttyp-card-body {
  border-color: var(--accent, #0284c7);
  background: #f0f9ff;
  box-shadow: 0 0 0 1px var(--accent, #0284c7);
}
.projekttyp-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}
.projekttyp-card-desc { font-size: 0.85rem; }
@media (max-width: 560px) {
  .projekttyp-choices { grid-template-columns: 1fr; }
}

/* Projekt overview filters + cards */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.1rem;
}
.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #fff);
  color: var(--muted, #64748b);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.filter-tab:hover {
  border-color: #7dd3fc;
  color: var(--accent, #0369a1);
  text-decoration: none;
}
.filter-tab.active {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0c4a6e;
}
.filter-count {
  display: inline-flex;
  min-width: 1.35rem;
  justify-content: center;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: 0.78rem;
  color: #475569;
}
.filter-tab.active .filter-count {
  background: #bae6fd;
  color: #0c4a6e;
}
.project-cards {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}
.project-card-top h3 { margin: 0; flex: 1; }
.project-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  margin: 0.15rem 0 0.35rem;
  color: var(--muted, #64748b);
  font-size: 0.9rem;
}
.project-card-stats { margin: 0.35rem 0 0; font-size: 0.85rem; }

@media (max-width: 560px) {
  .filter-tabs { gap: 0.35rem; }
  .filter-tab { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
  .project-cards { grid-template-columns: 1fr; }
}
.empty-state { text-align: left; padding: 0.35rem 0; }
.empty-state h3 { margin-top: 0; }
.check-inline { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.arkiv-picker { max-height: 22rem; overflow: auto; padding: 0.15rem; }
.arkiv-readonly { border: none; margin: 0; padding: 0; min-inline-size: 0; }
.arkiv-edit-meta summary {
  cursor: pointer; color: var(--accent); font-weight: 500;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.92rem;
}
.breadcrumb a { color: var(--accent); text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--muted, #64748b); }
.breadcrumb-current { color: var(--text, #0f172a); font-weight: 600; }

.folder-icon { font-size: 1.15rem; line-height: 1; }
.inline-create {
  grid-template-columns: 1fr auto;
  align-items: end;
}
.ny-mapp-form { margin-top: 0.25rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.section-head h3 { margin-top: 0; }

/* OneDrive-like explorer */
.explorer-panel { padding-top: 1rem; }
.explorer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-bottom: 0.75rem;
}
.explorer-location { font-size: 0.9rem; }
.explorer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.explorer-action { position: relative; }
.explorer-action > summary {
  list-style: none;
  cursor: pointer;
}
.explorer-action > summary::-webkit-details-marker { display: none; }
.explorer-popover,
.row-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 16rem;
  max-width: min(28rem, 92vw);
  padding: 0.85rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.65rem;
  background: var(--panel-bg, #fff);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}
.explorer-popover-wide { min-width: min(28rem, 92vw); }
.explorer-popover label,
.row-popover label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.55rem;
  font-size: 0.9rem;
}
.explorer-table .col-name { width: 36%; }
.explorer-table .col-type { width: 12%; }
.explorer-table .col-status { width: 12%; white-space: nowrap; }
.explorer-table .col-changed { width: 14%; white-space: nowrap; }
.explorer-table .col-actions { width: 26%; white-space: normal; }
.explorer-row-folder td { background: #f8fafc; }
.explorer-row:hover td { background: #f1f5f9; }
.explorer-item-link {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.55rem;
  color: inherit;
  text-decoration: none;
  max-width: 100%;
}
.explorer-item-link:hover strong { color: var(--accent); text-decoration: underline; }
.explorer-icon { flex-shrink: 0; line-height: 1.2; font-size: 1.05rem; }
.explorer-notes { display: block; font-size: 0.85rem; margin-top: 0.15rem; }
.badge-folder { background: #e0e7ff; color: #3730a3; }
.row-action { position: relative; display: inline-block; }
.row-action > summary {
  list-style: none;
  cursor: pointer;
}
.row-action > summary::-webkit-details-marker { display: none; }
.row-popover { right: 0; left: auto; min-width: 14rem; }
.explorer-empty {
  text-align: center;
  padding: 2rem 1rem;
  border: 1px dashed var(--border, #cbd5e1);
  border-radius: 0.75rem;
  background: #f8fafc;
}

/* Explorer drag-and-drop upload */
.explorer-dropzone {
  position: relative;
  border: 2px dashed transparent;
  border-radius: 0.75rem;
  padding: 0.35rem;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.explorer-dropzone-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.4rem;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.75rem;
  border: 1px dashed var(--border, #cbd5e1);
  border-radius: 0.55rem;
  background: #f8fafc;
  font-size: 0.9rem;
}
.explorer-dropzone-status {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
}
.explorer-dropzone.is-dragover {
  border-color: var(--accent, #2563eb);
  background: rgba(37, 99, 235, 0.06);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
}
.explorer-dropzone.is-dragover .explorer-dropzone-hint {
  border-color: var(--accent, #2563eb);
  background: rgba(37, 99, 235, 0.1);
  color: #1e3a8a;
}
.explorer-dropzone.is-uploading {
  opacity: 0.85;
  pointer-events: none;
}
.explorer-row-folder.is-drop-target td {
  background: rgba(37, 99, 235, 0.14) !important;
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: -2px;
}
.explorer-row-folder.is-drop-target .explorer-item-link strong {
  color: var(--accent, #2563eb);
}

.explorer-empty-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.actions-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

/* ---------- Mobile / multi-user Phase 1 ---------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  -webkit-tap-highlight-color: rgba(3, 105, 161, 0.15);
}
.btn, .menu-toggle, .nav a, .search-box button,
.checklist-label, .check-card, .explorer-action > summary,
.row-action > summary {
  min-height: 44px;
  touch-action: manipulation;
}
.btn {
  padding: 0.6rem 1rem;
}
.btn-block { width: 100%; justify-content: center; }
.menu-toggle {
  min-width: 44px;
  min-height: 44px;
  font-size: 1.25rem;
  align-items: center;
  justify-content: center;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 25;
}
.sidebar-close {
  display: none;
  margin-left: auto;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}
.user-chip {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.35rem;
  color: #e2e8f0;
}
.user-chip strong { font-size: 0.9rem; }
.logout-link {
  display: inline-block;
  color: #7dd3fc;
  font-size: 0.85rem;
  margin-bottom: 0.65rem;
  min-height: 44px;
  line-height: 44px;
}
.lan-hint { border-left: 4px solid #38bdf8; }
.lan-banner a { word-break: break-all; }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 45%, #0c4a6e 100%);
}
.login-card {
  width: 100%;
  max-width: 24rem;
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem 1.35rem 1.75rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.login-brand { margin-bottom: 1.25rem; }
.login-brand .brand-text strong { color: #0f172a; }
.login-brand .brand-text span { color: #64748b; }
.login-card h1 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
  font-size: 0.9rem;
}
.login-form input {
  font: inherit;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 44px;
}

@media (max-width: 800px) {
  .sidebar-backdrop.is-visible { display: block; }
  .sidebar {
    width: min(300px, 88vw);
    max-width: 100%;
    box-shadow: 8px 0 30px rgba(0,0,0,0.25);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-flex; align-items: center; justify-content: center; }
  .brand { width: 100%; }
  .nav a {
    padding: 0.75rem 0.85rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .search-box input, .search-box button { min-height: 44px; }
  .topbar {
    padding: 0.65rem 0.85rem;
    padding-top: max(0.65rem, env(safe-area-inset-top));
    gap: 0.5rem;
  }
  .page-heading { font-size: 1.05rem; }
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1 1 auto; justify-content: center; }
  .content {
    padding: 1rem 0.85rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
  .flash-wrap { padding: 0.75rem 0.85rem 0; }
  .hero { padding: 1.15rem; }
  .hero h2 { font-size: 1.25rem; }
  .cards { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; padding: 1rem; }
  .form-grid label input,
  .form-grid label textarea,
  .form-grid label select,
  .settings-form input,
  .settings-form textarea,
  .mall-form input,
  .mall-form textarea,
  .mall-form select {
    min-height: 44px;
    font-size: 16px; /* avoid iOS zoom */
  }
  .table-wrap, .explorer-panel .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.25rem;
    padding-bottom: 0.25rem;
  }
  .data-table, .explorer-table {
    min-width: 36rem;
  }
  .explorer-toolbar {
    gap: 0.45rem;
  }
  .explorer-toolbar .btn,
  .explorer-action > summary.btn {
    flex: 1 1 calc(50% - 0.45rem);
    justify-content: center;
  }
  .explorer-popover,
  .row-popover {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    top: auto;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    max-width: none;
    width: auto;
    max-height: 70vh;
    overflow: auto;
  }
  .help-dialog {
    max-width: min(100vw - 1rem, 32rem);
    margin: auto;
  }
  .checklist-row {
    flex-direction: column;
  }
  .checklist-links { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .checkpoint-table { display: block; overflow-x: auto; }
  .actions-cell { min-width: 0; }
  .year-wheel { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .year-wheel { grid-template-columns: 1fr; }
  .stat-row { gap: 0.65rem; }
  .stat { min-width: calc(50% - 0.4rem); flex: 1 1 calc(50% - 0.4rem); }
}

/* ---------- Tidsregistrering ---------- */
.btn-danger {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}
.btn-danger:hover { background: #991b1b; color: #fff; border-color: #991b1b; }

.tid-subnav { margin-bottom: 0.75rem; }
.tid-date-line { margin: 0 0 1rem; }
.tid-section-title {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
}
.tid-btn-lg {
  width: 100%;
  justify-content: center;
  min-height: 52px;
  font-size: 1.15rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
}
.tid-start-form,
.tid-action-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.tid-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
  font-size: 0.95rem;
}
.tid-field input,
.tid-field select,
.tid-select {
  min-height: 48px;
  font-size: 1.05rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  width: 100%;
}
.tid-active-panel {
  border-color: #7dd3fc;
  background: linear-gradient(180deg, #f0f9ff 0%, #fff 55%);
}
.tid-active-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.tid-active-head .tid-section-title { margin: 0; }
.tid-elapsed {
  font-variant-numeric: tabular-nums;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.tid-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 1rem;
  margin: 0 0 1rem;
}
.tid-meta dt {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tid-meta dd { margin: 0.1rem 0 0; font-weight: 600; }
.tid-meta .full { grid-column: 1 / -1; }

.tid-entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.tid-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
}
.tid-entry-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}
.tid-entry-dur { font-weight: 600; color: var(--accent); }
.tid-entry-note { font-size: 0.9rem; }
.tid-entry-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.tid-entry-actions form { margin: 0; }

.tid-week-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.tid-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.tid-day-head h3 { margin: 0; font-size: 1.05rem; }
.tid-day-today { border-color: #7dd3fc; }
.tid-entry-list.compact .tid-entry { padding: 0.55rem 0.7rem; background: #fff; }

.tid-report-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
  align-items: end;
}
.tid-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
}
.tid-datetime-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.tid-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.tid-report-table th,
.tid-report-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.45rem;
  text-align: left;
  vertical-align: top;
}
.tid-report-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

@media (max-width: 560px) {
  .tid-meta { grid-template-columns: 1fr; }
  .tid-datetime-row { grid-template-columns: 1fr; }
  .tid-week-nav { justify-content: center; text-align: center; }
  .tid-entry-actions { width: 100%; }
  .tid-entry-actions .btn { flex: 1; justify-content: center; min-height: 44px; }
}

@media print {
  .tid-subnav, .tid-report-filters { display: none !important; }
  .tid-report-table th, .tid-report-table td {
    border: 1px solid #cbd5e1;
    padding: 0.35rem 0.4rem;
  }
}





/* Compact inline row action buttons */
.btn-compact {
  padding: 0.12rem 0.4rem;
  font-size: 0.72rem;
  border-radius: 5px;
  line-height: 1.2;
  gap: 0.15rem;
  font-weight: 500;
}
.btn-danger {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff;
}
.btn-danger:hover {
  background: #fef2f2;
  color: #991b1b;
}
.actions-cell {
  gap: 0.25rem;
  align-items: center;
}
.actions-cell .btn-compact,
.actions-cell .row-action > summary.btn-compact {
  min-height: 1.65rem;
  padding: 0.12rem 0.4rem;
  font-size: 0.72rem;
}
.actions-cell .inline-form,
.actions-cell .row-inline-danger {
  display: inline-flex;
  margin: 0;
  padding: 0;
  gap: 0;
}
.actions-cell .atgard-status {
  margin-left: 0.15rem;
  flex: 0 0 auto;
}

/* Ã¥tgÃ¤rdslista status icons */
.atgard-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  min-width: 1.4rem;
  height: 1.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
}
.atgard-status-done {
  color: #15803d;
  background: #dcfce7;
}
.atgard-status-pending {
  color: #b91c1c;
  background: #fee2e2;
}
.actions-cell:has(.atgard-status) {
  justify-content: flex-start;
}


/* PDF package multi-select */
.pdf-paket-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}
.pdf-paket-hint {
  font-size: 0.85rem;
  white-space: nowrap;
}
.explorer-table .col-select {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}
.explorer-table .col-select input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  cursor: pointer;
}
.pdf-paket-check {
  margin: 0;
  cursor: pointer;
}
.pdf-paket-select-all-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.55rem;
}
.pdf-paket-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text, #0f172a);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}
.pdf-paket-select-all input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  cursor: pointer;
  flex: 0 0 auto;
}
.pdf-paket-select-all--header {
  justify-content: center;
  width: 100%;
}

/* PDF package order dialog (after multi-select) */
.pdf-paket-order-dialog {
  max-width: min(28rem, 94vw);
}
.pdf-paket-order-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(55vh, 24rem);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.pdf-paket-order-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: #f8fafc;
  transition: box-shadow 0.12s ease, background 0.12s ease, opacity 0.12s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.pdf-paket-order-item.is-dragging {
  opacity: 0.55;
  background: #e8f5f0;
  box-shadow: 0 0 0 2px #0b6e4f;
  z-index: 2;
}
.pdf-paket-order-handle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  min-height: 2.25rem;
  padding: 0.15rem 0.25rem;
  color: #64748b;
  font-size: 1rem;
  letter-spacing: -0.15em;
  line-height: 1;
  border-radius: 6px;
  cursor: grab !important;
  touch-action: none;
}
.pdf-paket-order-handle:active,
.pdf-paket-order-item.is-dragging .pdf-paket-order-handle {
  cursor: grabbing !important;
}
.pdf-paket-order-num {
  flex: 0 0 1.6rem;
  width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #0b6e4f;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}
.pdf-paket-order-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.95rem;
  line-height: 1.35;
  color: #0f172a;
  word-break: break-word;
}
.pdf-paket-order-footer {
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.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;
}


/* ---- Checkpoint attachment drop target ---- */
.cp-attachments.cp-drop-active,
.ek-row.cp-drop-active,
tr.cp-drop-active {
  outline: 2px dashed var(--accent, #0b6e4f);
  outline-offset: 2px;
  background: rgba(11, 110, 79, 0.08);
  border-radius: 6px;
  transition: background 0.12s ease, outline-color 0.12s ease;
}
.cp-attachments.cp-drop-active {
  position: relative;
}
.cp-attachments.cp-drop-active::after {
  content: "SlÃ¤pp filer hÃ¤r fÃ¶r att bifoga";
  display: block;
  margin-top: 0.4rem;
  padding: 0.45rem 0.6rem;
  border: 1px dashed var(--accent, #0b6e4f);
  border-radius: 4px;
  color: var(--accent, #0b6e4f);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}
.ek-row.cp-drop-active .cp-attachments,
tr.cp-drop-active .cp-attachments {
  outline: none;
  background: transparent;
}
@media (hover: none) {
  /* Touch devices: keep file picker primary; drop styles still fine if OS supports */
  .cp-attachments.cp-drop-active::after {
    content: "SlÃ¤pp eller klistra in filer hÃ¤r";
  }
}


/* ===== Platsgjutning egenkontroll (sectioned layout) ===== */
/* Clear phase / category / checkpoint hierarchy â€” readable spacing, keep all functions */
.ek-sheet {
  background: #fff;
  border: 1px solid var(--border, #cbd5e0);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  max-width: 1180px;
}
.ek-sheet-title {
  text-align: center;
  margin: 0 0 0.55rem;
  border-bottom: 2px solid #1a365d;
  padding-bottom: 0.55rem;
}
.ek-sheet-title h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #1a365d;
  letter-spacing: 0.01em;
  line-height: 1.25;
}
.ek-sheet-subtitle, .ek-sheet-title .ek-sheet-subtitle {
  margin: 0.25rem 0 0;
  color: #4a5568;
  font-size: 0.88rem;
  line-height: 1.35;
}
.ek-sheet-note { font-size: 0.82rem; margin: 0.65rem 0 0.45rem; line-height: 1.4; }

.ek-header-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 0.75rem;
  border: 1px solid #a0aec0;
  border-radius: 6px;
  overflow: hidden;
}
.ek-header-row {
  display: grid;
  grid-template-columns: 11rem 1fr;
  border-bottom: 1px solid #cbd5e0;
  min-height: 2.1rem;
}
.ek-header-row:last-child { border-bottom: none; }
.ek-header-label {
  background: #edf2f7;
  font-weight: 650;
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  display: flex;
  align-items: center;
  color: #1a365d;
  border-right: 1px solid #cbd5e0;
  line-height: 1.25;
}
.ek-header-value { padding: 0; display: flex; align-items: stretch; }
.ek-header-value input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.3rem 0.55rem;
  font-size: 0.9rem;
  line-height: 1.3;
  min-height: 2.1rem;
  box-sizing: border-box;
}
.ek-header-value input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent, #2b6cb0) 45%, transparent);
  outline-offset: -2px;
}

.ek-col-heads {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.25rem 4rem 4.75rem;
  gap: 0.35rem;
  margin: 0.85rem 0 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #4a5568;
  padding: 0.4rem 0.65rem;
  background: #edf2f7;
  border: 1px solid #a0aec0;
  border-radius: 6px 6px 0 0;
  align-items: end;
  line-height: 1.2;
}
.ek-col-heads small { font-weight: 500; text-transform: none; letter-spacing: 0; display: block; }
.ek-col-head-ok, .ek-col-head-ej { text-align: center; }
.ek-col-head-kontroll, .ek-col-head-anm { text-align: center; }
.ek-col-head-sub { display: none; }

/* Phase = distinct card block */
.ek-phase {
  margin-top: 1.15rem;
  border: 1px solid #a0aec0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(26, 54, 93, 0.06);
}
.ek-phase:first-of-type { margin-top: 0.35rem; }
.ek-phase-banner {
  background: #1a365d;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.55rem 0.85rem;
  letter-spacing: 0.02em;
  line-height: 1.3;
  border-radius: 0;
}

/* Category / subcategory card section */
.ek-sub {
  border: none;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  padding-bottom: 0.15rem;
}
.ek-sub:first-of-type { border-top: none; }
.ek-sub + .ek-sub {
  margin-top: 0.15rem;
  border-top: 2px solid #cbd5e0;
}
.ek-sub-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(180deg, #ebf4ff 0%, #e2effc 100%);
  color: #1a365d;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid #bee3f8;
  border-left: 4px solid #2b6cb0;
  line-height: 1.3;
}
.ek-sub-header .ek-sub-label {
  display: inline;
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.ek-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.25rem 4rem 4.75rem;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid #cbd5e0;
  align-items: start;
  min-height: 2.6rem;
  background: #fff;
}
.ek-row:last-child { border-bottom: none; }
.ek-row { background: #fff; }
.ek-row + .ek-row { border-top: 1px solid #edf2f7; }
.ek-row > * {
  border-right: none;
  padding: 0.1rem 0.15rem;
  box-sizing: border-box;
}
.ek-row-sub {
  display: none; /* category label moved to .ek-sub-header */
}
.ek-sub-label {
  display: block;
  background: transparent;
  padding: 0;
  border-radius: 0;
}
.ek-row-text { padding: 0.1rem 0.25rem; }
.ek-cp-text {
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 500;
  color: #1a202c;
}
.ek-cp-anmarkning {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.4rem;
  max-width: 100%;
}
.ek-anm-label {
  font-size: 0.7rem;
  font-weight: 650;
  color: #64748b;
  line-height: 1.1;
}
.ek-anm-label .cp-note-label,
select.cp-note-label {
  display: block;
  width: auto;
  max-width: 100%;
  font-size: 0.7rem;
  font-weight: 650;
  color: #64748b;
  line-height: 1.2;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
  background: #fff;
  margin: 0;
}
.cp-note-cell {
  min-width: 10rem;
  vertical-align: top;
}
.cp-note-cell .ek-anm-label {
  margin-bottom: 0.2rem;
}
.ek-anm-print-label {
  display: none;
  font-size: 0.7rem;
  font-weight: 650;
  color: #334155;
  margin-bottom: 0.15rem;
}
.ek-cp-anmarkning .cp-note,
.ek-row-text input.cp-note {
  width: 100%;
  max-width: 100%;
  font-size: 0.85rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  padding: 0.3rem 0.45rem;
  background: #fff;
  line-height: 1.3;
  min-height: 1.75rem;
  box-sizing: border-box;
}
.ek-field-label {
  display: none;
  font-size: 0.7rem;
  color: #718096;
  margin-bottom: 0.1rem;
}
.ek-row-kontroll,
.ek-row-anm {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0.1rem 0.15rem;
}
.ek-row-kontroll input[type="date"],
.ek-row-anm textarea {
  width: 100%;
  font-size: 0.85rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  padding: 0.3rem 0.35rem;
  background: #fff;
  line-height: 1.25;
  min-height: 2rem;
  box-sizing: border-box;
}
.ek-row-anm textarea {
  resize: vertical;
  min-height: 2rem;
  max-height: 5rem;
}
.ek-row-ok, .ek-row-ej {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0.1rem 0.1rem;
}

/* OK / Ej aktuell boxes â€” readable, still distinct */
.ek-platsgjutning .cp-result-box,
.ek-row .cp-result-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 3.25rem;
  width: 100%;
  max-width: 4.25rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.3rem;
  border: 1.5px solid var(--border, #cbd5e0);
  border-radius: 6px;
  background: var(--surface, #fff);
  cursor: pointer;
  user-select: none;
  text-align: center;
  box-sizing: border-box;
}
.ek-platsgjutning .cp-result-box input[type="checkbox"],
.ek-row .cp-result-box input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: #276749;
  flex-shrink: 0;
}
.ek-platsgjutning .cp-result-ej input[type="checkbox"],
.ek-row .cp-result-ej input[type="checkbox"] {
  accent-color: #92400e;
}
.ek-platsgjutning .cp-result-label,
.ek-row .cp-result-label {
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: 0;
}
.ek-platsgjutning .cp-result-ok:has(input:checked),
.ek-row .cp-result-ok:has(input:checked) {
  border-color: #276749;
  background: #ecfdf3;
  box-shadow: 0 0 0 1px #276749 inset;
}
.ek-platsgjutning .cp-result-ej:has(input:checked),
.ek-row .cp-result-ej:has(input:checked) {
  border-color: #b45309;
  background: #fffbeb;
  box-shadow: 0 0 0 1px #b45309 inset;
}

/* Collapsible attachments â€” keep compact under each point */
.ek-platsgjutning .cp-attachments,
.ek-row .cp-attachments {
  margin-top: 0.35rem;
  padding-top: 0;
  border-top: none;
}
.ek-attach-details {
  margin: 0;
}
.ek-attach-details > summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  padding: 0.15rem 0;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.ek-attach-details > summary::-webkit-details-marker { display: none; }
.ek-attach-details > summary::before {
  content: "+";
  font-size: 0.7rem;
  color: #94a3b8;
}
.ek-attach-details[open] > summary::before { content: "-"; }
.ek-attach-details[open] {
  margin-top: 0.25rem;
  padding-top: 0.3rem;
  border-top: 1px dashed var(--border, #cbd5e0);
}
.ek-platsgjutning .cp-attach-list { gap: 0.35rem; }
.ek-platsgjutning .cp-attach-item { padding: 0.2rem 0.3rem; border-radius: 4px; }
.ek-platsgjutning .cp-attach-thumb { width: 40px; height: 40px; border-radius: 4px; }
.ek-platsgjutning .cp-attach-name { font-size: 0.75rem; max-width: 10rem; }
.ek-platsgjutning .cp-attach-upload { margin-top: 0.3rem; }
.ek-platsgjutning .cp-attach-file-label .btn {
  min-height: 1.75rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
}
.ek-platsgjutning .btn-attach-del {
  min-width: 1.6rem;
  min-height: 1.6rem;
  font-size: 1rem;
}
.ek-attach-has { color: #2b6cb0; }
.ek-attach-empty-hint { font-weight: 500; color: #94a3b8; }

.ek-preview-panel { padding: 0.85rem 1rem !important; }
.ek-preview-panel h3 { margin: 0 0 0.45rem; font-size: 1.05rem; }
.ek-preview-panel .ek-phase {
  margin-top: 0.85rem;
}
.ek-preview-panel .ek-phase-banner {
  font-size: 0.9rem;
  padding: 0.45rem 0.75rem;
}
.ek-preview-list { margin: 0.15rem 0 0.35rem 0; padding: 0; }
.ek-preview-list li {
  margin: 0;
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
  line-height: 1.35;
  border-bottom: 1px solid #e2e8f0;
  list-style: none;
}
.ek-preview-list li:last-child { border-bottom: none; }
.ek-sub-preview {
  border-top: 1px solid #e2e8f0;
}
.ek-sub-preview .ek-sub-header,
.ek-sub-preview .ek-sub-label,
.ek-preview-panel .ek-sub-label {
  font-weight: 700;
  color: #1a365d;
  font-size: 0.82rem;
  margin: 0;
  padding: 0.4rem 0.75rem;
  background: linear-gradient(180deg, #ebf4ff 0%, #e2effc 100%);
  border-bottom: 1px solid #bee3f8;
  border-left: 4px solid #2b6cb0;
}

@media (max-width: 900px) {
  .ek-header-row { grid-template-columns: 1fr; min-height: 0; }
  .ek-header-label {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
  }
  .ek-header-value input { min-height: 2.25rem; font-size: 0.9rem; padding: 0.35rem 0.55rem; }
  .ek-col-heads { display: none; }
  .ek-field-label { display: block; }
  .ek-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "text text"
      "kontroll kontroll"
      "ok ej";
    gap: 0.35rem;
    padding: 0.65rem 0.7rem;
    min-height: 0;
  }
  .ek-row > * { padding: 0.15rem 0.1rem; }
  .ek-row-sub { display: none; }
  .ek-row-text { grid-area: text; }
  .ek-row-kontroll { grid-area: kontroll; }
  .ek-row-ok { grid-area: ok; }
  .ek-row-ej { grid-area: ej; }
  .ek-cp-text { font-size: 0.92rem; }
  .ek-platsgjutning .cp-result-box,
  .ek-row .cp-result-box {
    min-width: 4.5rem;
    max-width: none;
    min-height: 2.75rem;
    padding: 0.4rem 0.45rem;
    gap: 0.2rem;
  }
  .ek-platsgjutning .cp-result-label,
  .ek-row .cp-result-label { font-size: 0.75rem; }
  .ek-platsgjutning .cp-result-box input[type="checkbox"],
  .ek-row .cp-result-box input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
  }
  .ek-row-kontroll input[type="date"],
  .ek-row-anm textarea,
  .ek-cp-anmarkning .cp-note { font-size: 0.9rem; min-height: 2.15rem; }
  .ek-phase { margin-top: 1rem; }
  .ek-sub-header { font-size: 0.9rem; padding: 0.5rem 0.75rem; }
}

@media print {
  .ek-sheet { box-shadow: none; border: none; padding: 0; max-width: none; }
  .ek-anm-print-label { display: block !important; }
  select.cp-note-label { display: none !important; }
  .ek-sheet-title { padding-bottom: 0.25rem; margin-bottom: 0.2rem; }
  .ek-sheet-title h2 { font-size: 12pt; }
  .ek-sheet-subtitle { font-size: 9pt; }
  .ek-sheet-note { font-size: 8pt; margin: 0.3rem 0; }
  .ek-header-row { min-height: 1rem; }
  .ek-header-label { font-size: 8pt; padding: 0.1rem 0.3rem; }
  .ek-header-value input { font-size: 8.5pt; padding: 0.08rem 0.25rem; min-height: 1rem; }
  .ek-phase {
    margin-top: 0.55rem;
    box-shadow: none;
    border: 1pt solid #4a5568;
  }
  .ek-phase-banner {
    background: #fff !important;
    color: #1a365d !important;
    border-bottom: 1.5pt solid #1a365d;
    font-size: 10pt;
    padding: 0.2rem 0.4rem;
  }
  .ek-sub-header {
    background: #f0f4f8 !important;
    border-left: 3pt solid #1a365d;
    font-size: 9pt;
    padding: 0.15rem 0.4rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .ek-row {
    break-inside: avoid;
    min-height: 0;
    border-bottom: 0.75pt solid #a0aec0;
    padding: 0.25rem 0.35rem;
  }
  .ek-row > * { padding: 0.08rem 0.15rem; }
  .ek-cp-text { font-size: 8.5pt; line-height: 1.25; }
  .ek-header-value input, .ek-row-kontroll input, .ek-row-anm textarea, .ek-cp-anmarkning .cp-note {
    border: none !important; background: transparent !important;
  }
  .ek-platsgjutning .cp-result-box,
  .ek-row .cp-result-box {
    min-height: auto;
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0;
  }
  .ek-attach-details > summary { display: none !important; }
}

/* Editable Form/Armering/Betong spec lines inside checkpoint rows */
.ek-cp-inline {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.ek-inline-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
}
.ek-inline-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1a202c;
  white-space: nowrap;
}
.ek-inline-input {
  flex: 1 1 12rem;
  min-width: 8rem;
  font-size: 0.88rem;
  line-height: 1.3;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  background: #fff;
  box-sizing: border-box;
}
.ek-inline-date {
  flex: 0 1 10rem;
  min-width: 8rem;
  max-width: 12rem;
}
.ek-inline-defaults {
  margin: 0.85rem 0;
}
.ek-inline-defaults .ek-inline-default-row {
  margin: 0;
}
@media print {
  .ek-inline-input, .ek-inline-date {
    border: none;
    border-bottom: 1px solid #a0aec0;
    border-radius: 0;
    padding-left: 0;
    background: transparent;
  }
}

/* Autosave status on egenkontroll UtfÃ¶r */
.ek-autosave-status {
  display: inline-flex;
  align-items: center;
  margin-right: 0.75rem;
  font-size: 0.85rem;
  min-height: 1.25rem;
}
.ek-autosave-status.is-saving { color: #64748b; }
.ek-autosave-status.is-saved { color: #15803d; }
.ek-autosave-status.is-error { color: #b91c1c; font-weight: 600; }
.btn-autosave-backup.btn-primary {
  background: #475569;
  border-color: #475569;
}
.btn-autosave-backup.btn-primary:hover {
  background: #334155;
  border-color: #334155;
}


/* UtfÃ¶rd och lÃ¥st banner */
.ek-locked-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #ecfdf5;
  border: 1px solid #86efac;
  color: #14532d;
}
.ek-locked-banner-text {
  flex: 1 1 12rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
}
.ek-locked-banner-hint {
  flex: 1 1 100%;
  font-size: 0.9rem;
  color: #166534;
}
.ek-unlock-form,
.ek-unlock-form-top {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}
.ek-unlock-btn {
  white-space: nowrap;
  border-color: #ca8a04;
  color: #854d0e;
  background: #fef9c3;
}
.ek-unlock-btn:hover {
  background: #fde047;
  border-color: #a16207;
  color: #713f12;
}
.ek-locked-banner .ek-unlock-btn {
  flex: 0 0 auto;
}


/* Finger signature pad (platschef underskrift) */
.ek-sig-pad {
  margin-top: 0.45rem;
  max-width: 28rem;
}
.ek-sig-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.25rem;
}
.ek-sig-canvas-wrap {
  position: relative;
  border: 1.5px dashed #94a3b8;
  border-radius: 0.5rem;
  background: #fff;
  touch-action: none;
  overflow: hidden;
}
.ek-sig-canvas {
  display: block;
  width: 100%;
  height: 140px;
  cursor: crosshair;
  touch-action: none;
  background: transparent;
}
.ek-sig-preview {
  display: block;
  max-width: 100%;
  max-height: 140px;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.25rem;
}
.ek-sig-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.ek-sig-actions .btn-sm {
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
}
.ek-sig-status.is-saving { color: #64748b; }
.ek-sig-status.is-saved { color: #15803d; }
.ek-sig-status.is-error { color: #b91c1c; font-weight: 600; }
.ek-sig-empty { margin: 0.25rem 0 0; }
@media (max-width: 640px) {
  .ek-sig-pad { max-width: none; }
  .ek-sig-canvas { height: 160px; }
}
@media print {
  .ek-sig-pad { display: none !important; }
}

/* Najtång cursor (photo, arrow angle): open default, closed while pressing */
html, body,
html *:not(input):not(textarea):not(select):not([contenteditable="true"]):not(.ek-sig-canvas):not(.pdf-paket-order-handle) {
  cursor: url('/static/cursors/najtang.png') 1 5, auto !important;
}
a, button, [role="button"], .btn, input[type="submit"], input[type="button"],
label[for], summary, .clickable, .nav a, .tabs a {
  cursor: url('/static/cursors/najtang-pointer.png') 1 5, pointer !important;
}
input, textarea, select, [contenteditable="true"] {
  cursor: text !important;
}
.ek-sig-canvas {
  cursor: crosshair !important;
}
[disabled], .disabled, [aria-disabled="true"] {
  cursor: not-allowed !important;
}
html.btg-cursor-closed,
html.btg-cursor-closed body,
html.btg-cursor-closed *:not(input):not(textarea):not(select):not([contenteditable="true"]):not(.ek-sig-canvas):not(.pdf-paket-order-handle) {
  cursor: url('/static/cursors/najtang-closed.png') 1 5, auto !important;
}
html.btg-cursor-closed a,
html.btg-cursor-closed button,
html.btg-cursor-closed [role="button"],
html.btg-cursor-closed .btn,
html.btg-cursor-closed input[type="submit"],
html.btg-cursor-closed input[type="button"],
html.btg-cursor-closed label[for],
html.btg-cursor-closed summary,
html.btg-cursor-closed .clickable,
html.btg-cursor-closed .nav a,
html.btg-cursor-closed .tabs a {
  cursor: url('/static/cursors/najtang-closed.png') 1 5, pointer !important;
}
.pdf-paket-order-handle {
  cursor: grab !important;
}
.pdf-paket-order-item.is-dragging,
.pdf-paket-order-item.is-dragging .pdf-paket-order-handle {
  cursor: grabbing !important;
}
html.btg-cursor-closed .pdf-paket-order-handle {
  cursor: grab !important;
}
html.btg-cursor-closed .pdf-paket-order-item.is-dragging,
html.btg-cursor-closed .pdf-paket-order-item.is-dragging .pdf-paket-order-handle {
  cursor: grabbing !important;
}





/* Egenkontroll översikt: utförd rad + statusbadges */
.explorer-row.ek-row-utford td {
  background: #f1f8f4;
}
.explorer-row.ek-row-utford:hover td {
  background: #e7f4ec;
}
.ek-status-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.ek-status-utford {
  background: #d9f0e2;
  color: #1b5e3a;
  border: 1px solid #b7dfc6;
}
.ek-status-atgard {
  background: #fff6e8;
  color: #8a5a10;
  border: 1px solid #f0d9a8;
}
.doc-list li.ek-row-utford {
  background: #f1f8f4;
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
}

/* Entreprenad create wizard */
.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0.65rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.wizard-progress-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #0f172a;
}
.wizard-steps {
  display: flex;
  gap: 0.45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.wizard-steps li {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #64748b;
}
.wizard-steps li.is-active {
  background: #0f766e;
  color: #fff;
}
.wizard-steps li.is-done {
  background: #99f6e4;
  color: #115e59;
}
.wizard-step-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}
.wizard-actions {
  margin-top: 1.25rem;
}
.kontakt-fieldset {
  margin: 1.25rem 0 0;
  padding: 1rem 1rem 0.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.kontakt-fieldset legend {
  padding: 0 0.4rem;
  font-weight: 600;
  font-size: 0.95rem;
}
.notes-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
  margin-top: 1rem;
}
.form-error {
  color: #b91c1c;
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}
.mall-form input.is-invalid,
.mall-form textarea.is-invalid,
.mall-form select.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}
.kma-doc-picker {
  margin-top: 0.75rem;
}
.kma-doc-card strong { display: block; }

/* Project page – entreprenad meta + KMA todo */
.projekt-meta-dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1.25rem;
  margin: 0.9rem 0 0;
}
.projekt-meta-dl > div.full { grid-column: 1 / -1; }
.projekt-meta-dl dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin: 0;
}
.projekt-meta-dl dd {
  margin: 0.1rem 0 0;
  font-weight: 500;
}
.kma-todo-panel {
  border-top: 1px solid #e2e8f0;
  padding-top: 1rem;
}
.kma-todo-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}
.kma-todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.kma-todo-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}
.kma-todo-item.is-done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.kma-todo-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  min-width: 0;
  flex: 1;
}
.kma-todo-main strong { font-size: 0.98rem; }
.kma-todo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.inline-form { display: inline; margin: 0; }
.badge-kma-todo { background: #ffedd5; color: #9a3412; }
.badge-kma-done { background: #dcfce7; color: #166534; }

@media (max-width: 640px) {
  .projekt-meta-dl { grid-template-columns: 1fr; }
  .wizard-progress { flex-direction: column; align-items: flex-start; }
}


/* Entreprenad wizard extras (alignment with arkiv_new.html) */
.wizard-pane { margin-top: 0; }
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.65rem;
}
.check-card {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.7rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.check-card:has(input:checked) {
  border-color: #0f766e;
  background: #f0fdfa;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 1rem;
}
input.is-invalid, textarea.is-invalid, select.is-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

/* Organisationsnummer lookup */
.orgnummer-row { display: flex; flex-direction: column; gap: 0.35rem; }
.orgnummer-label { display: flex; flex-direction: column; gap: 0.35rem; }
.orgnummer-input-wrap {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
}
.orgnummer-input-wrap input[type="text"] { flex: 1 1 12rem; min-width: 10rem; }
.orglookup-status { margin: 0; min-height: 1.2em; font-size: 0.9rem; }
.orglookup-status.is-busy { color: var(--muted, #666); }
.orglookup-status.is-ok { color: #0a7a3e; }
.orglookup-status.is-err { color: #b00020; }
