/* === Egenkontroll fotvård – styles === */

* { box-sizing: border-box; }

/* === Klinik-tema (Kry/Min Doktor-DNA) === */
:root {
  --bg: #ffffff;             /* var #f5f6f8 — Klinik vill ha ren vit huvudbakgrund */
  --panel: #ffffff;
  --sidebar-bg: #fafbfd;     /* ljust sidofält */
  --sidebar-line: #eaecf0;
  --ink: #0a1628;            /* djupare navy för rubriker */
  --ink-soft: #4b5566;
  --muted: #6a7587;
  --line: #eaecf0;           /* tunnare/ljusare linjer */
  --line-strong: #cdd2dc;
  --accent: #0d6e6e;         /* deep teal — Klinik-signaturen */
  --accent-strong: #075454;  /* för hover/active CTA */
  --accent-soft: #e6f4f4;    /* pale teal background */
  --cta-dark: #0a1628;       /* dark CTA-yta för "DAGENS HYGIEN"-kortet */
  --good: #0d6e6e;           /* teal blir success-färg */
  --good-soft: #dff5e1;
  --warn: #a55a14;
  --warn-soft: #fdefdc;
  --bad: #a52119;
  --bad-soft: #fbe4e2;
  --shadow: 0 1px 2px rgba(10, 22, 40, .04), 0 4px 12px rgba(10, 22, 40, .05);
  --shadow-lg: 0 1px 2px rgba(10, 22, 40, .06), 0 12px 32px rgba(10, 22, 40, .08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

html, body { margin: 0; padding: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; /* iOS prevents zoom-on-focus when input >= 16px */
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

/* === Layout === */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; min-height: 100dvh; }

.topbar { display: none; }   /* visas bara mobilt */
.backdrop { display: none; } /* visas bara mobilt + öppen */

.sidebar {
  background: var(--sidebar-bg);
  color: var(--ink-soft);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  padding: 24px 14px;
  border-right: 1px solid var(--sidebar-line);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 6px 22px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 7px;
  background: var(--accent);
  display: grid; place-items: center; font-weight: 700; color: white;
  font-size: 13px; letter-spacing: .5px;
}
.brand-title { font-weight: 600; color: var(--ink); letter-spacing: -.1px; font-size: 15px; }
.brand-sub {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 1.5px; margin-top: 1px;
}

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-group {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px;
  color: #9aa3b0; padding: 18px 12px 8px; font-weight: 700;
}
button.nav-group-toggle {
  display: flex; justify-content: space-between; align-items: center;
  background: transparent; border: none; cursor: pointer;
  width: 100%; text-align: left;
  margin-top: 6px;
  border-radius: 6px;
  transition: background 100ms;
}
button.nav-group-toggle:hover { background: #f0f3f6; color: var(--ink); }
.nav-group-chevron {
  transition: transform 150ms;
  font-size: 10px; color: #9aa3b0;
}
button.nav-group-toggle.expanded .nav-group-chevron { transform: rotate(180deg); }
.nav-collapse {
  max-height: 0; overflow: hidden;
  transition: max-height 200ms ease;
}
.nav-collapse.expanded {
  max-height: 600px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 6px;
  color: var(--ink-soft); text-decoration: none; cursor: pointer;
  border: none; background: transparent; text-align: left; width: 100%;
  font-size: 14px;
  min-height: 40px;
  position: relative;
  transition: background 100ms, color 100ms;
}
.nav-item .nav-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex-shrink: 0;
  color: #9aa3b0;
  transition: color 100ms;
}
.nav-item .nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover, .nav-item:focus-visible {
  background: #f0f3f6; color: var(--ink); outline: none;
}
.nav-item:hover .nav-icon, .nav-item:focus-visible .nav-icon { color: var(--ink); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  background: var(--accent); border-radius: 0 2px 2px 0;
}
.nav-item.active .nav-icon { color: var(--accent); }
.nav-item .badge {
  margin-left: auto; background: var(--accent); color: white; font-size: 11px;
  padding: 2px 8px; border-radius: 999px; min-width: 22px; text-align: center;
  font-weight: 600;
}
.nav-item.active .badge { background: var(--accent); }

.sidebar-foot {
  padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--sidebar-line);
}
.main { padding: 28px 36px 80px; max-width: 1100px; }

/* === Typography === */
h1 { font-size: 24px; margin: 0 0 4px; line-height: 1.25; }
h2 { font-size: 18px; margin: 24px 0 8px; line-height: 1.3; }
h3 { font-size: 15px; margin: 18px 0 6px; line-height: 1.3; }
.lede { color: var(--ink-soft); margin: 0 0 22px; max-width: 64ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* === Cards === */
.card {
  background: var(--panel);
  border: 1px solid rgba(227, 230, 236, .6);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow:
    0 1px 2px rgba(20, 30, 50, .04),
    0 8px 24px rgba(20, 30, 50, .06);
}
.card h2 { margin-top: 0; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: white; color: var(--ink); font-weight: 500;
  font-size: 14px;
  min-height: 44px;            /* touch target */
  -webkit-tap-highlight-color: transparent;
  transition: border-color 80ms, background 80ms, color 80ms;
}
.btn:hover, .btn:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--accent-strong); color: white; border-color: var(--accent-strong);
}
.btn-ghost {
  background: transparent; border-color: transparent; color: var(--muted);
}
.btn-ghost:hover { background: #f0f3f6; color: var(--ink); border-color: transparent; }
.btn-danger { color: var(--bad); border-color: var(--line-strong); background: white; }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn .btn-label, .btn-soft span { display: inline-block; }

/* === Forms === */
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-grid.col-1 { grid-template-columns: 1fr; }
.form-grid.col-3 { grid-template-columns: 1fr 1fr 1fr; }

label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-soft); }
label.field input, label.field textarea, label.field select {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 12px;
  background: #f3f5f9;        /* subtle gray bg så formfälten inte ser ut som checkbox-rader */
  color: var(--ink);
  font-size: 16px;             /* iOS no-zoom */
  min-height: 44px;
  width: 100%;
  -webkit-appearance: none; appearance: none;
  transition: background 100ms, border-color 100ms, box-shadow 100ms;
}
label.field input:hover:not(:focus),
label.field textarea:hover:not(:focus),
label.field select:hover:not(:focus) { background: #ecf0f5; }
label.field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%237b8597' stroke-width='1.6' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
label.field input:focus, label.field textarea:focus, label.field select:focus {
  outline: none;
  background: white;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
label.field textarea { min-height: 80px; resize: vertical; }
label.checkbox { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); cursor: pointer; min-height: 44px; }
label.checkbox input { width: 20px; height: 20px; }

.hint { font-size: 13px; color: var(--muted); }

/* === Lists / tables === */
.list { display: grid; gap: 8px; }
.row {
  display: grid; gap: 10px; align-items: start;
  grid-template-columns: 1fr;
  background: white; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.row.row-grid { grid-template-columns: 1fr auto; }

/* Checklist: en grupperad lista med subtila dividers, inte separata kort */
.checklist {
  display: flex; flex-direction: column;
  background: white;
  border-radius: 10px;
  margin: 0 -8px;     /* dra ut till kortets kanter inom .card */
}
.check-item {
  display: grid; grid-template-columns: 32px 1fr; gap: 14px; align-items: center;
  padding: 14px 16px;
  border: none; border-radius: 0;
  background: transparent;
  cursor: pointer; min-height: 56px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: background 100ms;
}
.check-item:not(:last-child)::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 0;
  height: 1px; background: var(--line);
}
.check-item:hover { background: rgba(47, 109, 240, .04); }
.check-item:active { background: var(--accent-soft); }
.check-item:active input[type="checkbox"] { transform: scale(0.92); }
.check-item.checked {
  background: rgba(31, 138, 76, .055);
}
.check-item.checked > div { color: var(--ink); font-weight: 500; }

/* Custom checkbox — ersätter native för en mer polerad känsla */
.check-item input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 24px; height: 24px;
  border: 2px solid var(--line-strong);
  border-radius: 7px;
  margin: 0;
  background: white;
  cursor: pointer;
  position: relative;
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.check-item input[type="checkbox"]:hover { border-color: var(--accent); }
.check-item input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.check-item input[type="checkbox"]:checked {
  background: var(--good);
  border-color: var(--good);
  animation: check-pop 220ms cubic-bezier(.34, 1.6, .64, 1);
}
.check-item input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px; top: 2px;
  width: 6px; height: 12px;
  border: solid white;
  border-width: 0 2.6px 2.6px 0;
  transform: rotate(45deg);
}
@keyframes check-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25); }
  70%  { transform: scale(0.92); }
  100% { transform: scale(1); }
}

.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .3px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #cfdcff;
}
.tag.good { background: var(--good-soft); color: var(--good); border-color: #b8dcc6; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: #f1d5a8; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: #f0c1bd; }
.tag.muted { background: #eef0f4; color: var(--ink-soft); border-color: var(--line); }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
}
.table-scroll table { min-width: 480px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }

/* === Risk cards === */
.risk-card { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.risk-card.inactive { opacity: .6; }
.risk-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.risk-title { font-weight: 600; font-size: 15px; }

/* === Banners / microcopy === */
.banner {
  border-left: 3px solid var(--accent); padding: 12px 14px; background: var(--accent-soft);
  border-radius: 6px; color: var(--ink); margin: 10px 0 18px;
}
.banner.muted { background: #eef1f6; border-left-color: var(--line-strong); color: var(--ink-soft); }

/* === Grid / dashboard === */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi {
  background: white; border: 1px solid var(--line); border-radius: 12px; padding: 14px;
}
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 22px; font-weight: 600; margin-top: 4px; }

/* === Toggle switch === */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.switch input { display: none; }
.switch .track {
  width: 40px; height: 22px; background: var(--line-strong); border-radius: 999px;
  position: relative; transition: background 120ms;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  background: white; border-radius: 50%; transition: transform 120ms;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* === Hero (Idag) === */
.hero { margin-bottom: 22px; }
.hero-meta {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700;
}
.hero-title {
  font-size: 36px; margin: 8px 0 6px; font-weight: 600;
  letter-spacing: -.4px; color: var(--ink);
}
.hero-sub { font-size: 15px; color: var(--ink-soft); margin: 0; }
.hero-streak {
  display: inline-block; font-size: 12px; color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px; border-radius: 999px; font-weight: 600;
  letter-spacing: .2px;
}

/* === Idag-grid: 3 kort sida vid sida (streak / dagens / tillsyn-redo) === */
.idag-grid {
  display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 980px) {
  .idag-grid { grid-template-columns: 1fr; }
}

/* === Quick check (CTA "DAGENS HYGIEN" — dark navy som Klinik-mockupen) === */
.quick-check {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--cta-dark);
  color: white; padding: 22px 24px; border-radius: 12px;
  box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
  min-height: 156px; justify-content: space-between;
}
.quick-check.done {
  background: white; color: var(--ink);
  border: 1px solid var(--good-soft);
  box-shadow: var(--shadow);
}
.quick-check.done .quick-check-meta { color: var(--ink-soft); }
.quick-check-text { display: flex; flex-direction: column; gap: 6px; }
.quick-check-text::before {
  content: "DAGENS HYGIEN";
  font-size: 11px; font-weight: 700; color: rgba(255,255,255,.55);
  letter-spacing: 1.5px;
}
.quick-check.done .quick-check-text::before { color: var(--good); }
.quick-check-title { font-size: 18px; font-weight: 600; line-height: 1.3; }
.quick-check-meta { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.quick-check-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.quick-check .btn-primary {
  background: var(--accent); color: white; border-color: var(--accent);
}
.quick-check .btn-primary:hover { background: var(--accent-strong); color: white; border-color: var(--accent-strong); }
.quick-check.done .btn-primary { background: var(--ink); color: white; border-color: var(--ink); }

/* === KPI-card (streak) === */
.kpi-card {
  background: white; border: 1px solid var(--line); border-radius: 12px;
  padding: 22px 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
  min-height: 156px; justify-content: space-between;
}
.kpi-card-label {
  font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 1.5px;
}
.kpi-card-value {
  font-size: 48px; font-weight: 600; color: var(--ink);
  letter-spacing: -1.5px; line-height: 1;
}
.kpi-card-value-suffix {
  font-size: 14px; font-weight: 500; color: var(--muted);
  margin-left: 6px; letter-spacing: 0;
}
.kpi-bar {
  height: 6px; background: var(--line); border-radius: 3px; overflow: hidden;
}
.kpi-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 200ms; }
.kpi-card-foot { font-size: 12px; color: var(--ink-soft); }
.btn-ghost-light {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.55); color: white;
  font-weight: 500; backdrop-filter: blur(2px);
}
.btn-ghost-light:hover, .btn-ghost-light:focus-visible {
  background: rgba(255,255,255,.22); border-color: white; color: white;
}

/* Soft-fyllda buttons (för snabbåtgärder & sekundära CTA) */
.btn-soft {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  font-weight: 600;
}
.btn-soft:hover, .btn-soft:focus-visible {
  background: #d8e3ff; color: var(--accent); border-color: transparent;
}
.btn-soft svg { color: var(--accent); }

.quick-inline {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: var(--accent-soft); border-color: #cfdcff;
  flex-wrap: wrap;
}

.btn-lg {
  font-size: 16px; padding: 14px 24px; border-radius: 10px; font-weight: 600;
  min-height: 50px;
}

/* === Readiness === */
.readiness {
  background: white; border: 1px solid var(--line); border-radius: 12px;
  padding: 22px 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
  min-height: 156px;
}
.readiness-head {
  display: flex; flex-direction: column; gap: 6px;
}
.readiness-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px;
  font-weight: 700;
}
.readiness-status {
  font-size: 20px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.readiness.good .readiness-status { color: var(--ink); }
.readiness.warn .readiness-status { color: var(--ink); }
.readiness-list { margin: 12px 0 0; padding: 0; list-style: none; color: var(--ink-soft); }
.readiness-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.readiness-list li:first-child { border-top: none; padding-top: 4px; }
.readiness-foot {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end;
}
.readiness-status {
  display: inline-flex; align-items: center; gap: 8px;
}
.readiness-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
}
.readiness-icon.good { background: var(--good-soft); color: var(--good); }

.status-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  flex-shrink: 0;
}
.status-icon.warn { background: var(--warn-soft); color: var(--warn); }
.status-icon.good { background: var(--good-soft); color: var(--good); }
.status-icon.bad  { background: var(--bad-soft); color: var(--bad); }

.link {
  background: none; border: none; padding: 0; color: var(--accent); cursor: pointer;
  font: inherit; text-align: left;
}
.link:hover { text-decoration: underline; }

/* === Alert card === */
.card.alert { border-left: 4px solid var(--bad); }
.alert-list { list-style: none; padding: 0; margin: 0; }
.alert-list li {
  padding: 10px 0; border-bottom: 1px solid var(--line);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.alert-list li:last-child { border-bottom: none; }

/* === Timeline (Klinik: status-dot + 2-rad-text + relative time höger) === */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  display: grid; grid-template-columns: 16px 1fr auto; gap: 14px;
  padding: 16px 4px; border-bottom: 1px solid #f1f3f6;
  align-items: start;
}
.timeline li:first-child { padding-top: 8px; }
.timeline li:last-child { border-bottom: none; padding-bottom: 4px; }
.timeline-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); margin-top: 4px; flex-shrink: 0;
}
.timeline-dot.warn { background: var(--warn); }
.timeline-content { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.timeline-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.timeline-sub { font-size: 12px; color: var(--ink-soft); }
.timeline-time { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* === Sticker === */
.sticker {
  display: inline-block; font-size: 11px; padding: 2px 6px; border-radius: 4px;
  background: #fff5d4; color: #6e5300; border: 1px solid #f1dd99; margin-left: 6px;
}

/* === Empty state === */
.empty {
  border: 1px dashed var(--line-strong); border-radius: 12px;
  padding: 22px; text-align: center; color: var(--muted); background: white;
}
.divider { height: 1px; background: var(--line); margin: 12px 0; }

/* === Toast === */
.toast {
  position: fixed; bottom: calc(22px + var(--safe-bottom)); right: 22px;
  background: #1c2330; color: white; padding: 12px 16px;
  border-radius: 8px; box-shadow: var(--shadow); font-size: 14px;
  opacity: 0; transition: opacity .2s; pointer-events: none;
  z-index: 1000;
  max-width: calc(100vw - 44px);
}
.toast.show { opacity: 1; }

/* === Hamburger / topbar (mobile) === */
.hamburger {
  width: 44px; height: 44px; border: none; background: transparent;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 0; border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.hamburger span {
  display: block; width: 22px; height: 2px; background: white; border-radius: 2px;
  transition: transform 120ms, opacity 120ms;
}
.app.menu-open .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.app.menu-open .hamburger span:nth-child(2) { opacity: 0; }
.app.menu-open .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* === Tablet (medium) === */
@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid.col-3 { grid-template-columns: 1fr 1fr; }
  .main { padding: 24px 24px 80px; }
}

/* === Mobile === */
@media (max-width: 760px) {
  .app { display: block; min-height: 100vh; min-height: 100dvh; }

  /* Bottom padding so FAB doesn't occlude primary CTA / list rows */
  .main { padding-bottom: calc(96px + var(--safe-bottom)); }

  /* Topbar visible */
  .topbar {
    display: flex; align-items: center; gap: 8px;
    background: #0f1626; color: white;
    padding: calc(8px + var(--safe-top)) 12px 8px;
    position: sticky; top: 0; z-index: 30;
    min-height: calc(48px + var(--safe-top));
  }
  .topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; min-width: 0; }
  .topbar-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-sync { flex-shrink: 0; }
  .topbar-sync #sync-indicator { max-width: 50vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

  /* Sidebar becomes drawer */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 84%; max-width: 320px; height: 100dvh; height: 100vh;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    z-index: 50; overflow-y: auto;
    padding-top: calc(20px + var(--safe-top));
    padding-bottom: calc(20px + var(--safe-bottom));
  }
  .app.menu-open .sidebar { transform: translateX(0); box-shadow: 0 10px 40px rgba(0,0,0,.5); }
  .sidebar .brand { display: none; } /* topbar visar redan */

  /* Backdrop */
  .backdrop {
    display: block; position: fixed; inset: 0; z-index: 40;
    background: rgba(0,0,0,.45); opacity: 0; pointer-events: none;
    transition: opacity 200ms;
  }
  .app.menu-open .backdrop { opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; touch-action: none; }

  .main { padding: 16px 14px 80px; max-width: 100%; }
  h1 { font-size: 22px; }
  .hero-title { font-size: 22px; }

  .quick-check { flex-direction: column; align-items: stretch; }
  .quick-check-actions { flex-direction: column; align-items: stretch; }
  .quick-check-actions .btn { width: 100%; justify-content: center; }
  .quick-inline { flex-direction: column; align-items: stretch; }
  .quick-inline .btn { width: 100%; justify-content: center; }

  .form-grid, .form-grid.col-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  .timeline li { grid-template-columns: 1fr; gap: 2px; padding: 12px 0; }
  .alert-list li { padding: 12px 0; }
  .btn-row .btn { flex: 1 1 auto; justify-content: center; }
  .card { padding: 14px 16px; }
  .card-head h2 { font-size: 16px; }

  .nav-item { padding: 12px 14px; min-height: 48px; font-size: 15px; }
  .switch { gap: 8px; }
}

/* === Print styles === */
.no-print { }
.print-only { display: none; }

@media print {
  body { background: white; font-size: 12px; }
  .no-print, .topbar, .backdrop { display: none !important; }
  .print-only { display: block; }
  .app { display: block; }
  .main { padding: 0; max-width: 100%; }
  .card { break-inside: avoid; box-shadow: none; border-color: #ccc; padding: 12px 14px; }
  h1 { font-size: 20px; }
  h2 { font-size: 14px; break-after: avoid; }
  .report-section { break-inside: avoid; }
  a { color: black; text-decoration: none; }
  .table-scroll { overflow: visible; }
  .table-scroll table { min-width: 0; }
}

/* === Sync indicator === */
.topbar-sync { margin-left: auto; padding-right: 8px; }
#sync-indicator {
  font-size: 12px; color: #c4cce1; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.08); white-space: nowrap;
  transition: opacity 200ms;
}
#sync-indicator:empty { display: none; }
#sync-indicator[data-status="syncing"],
#sync-indicator[data-status="pending"] { background: rgba(255,255,255,.10); }
#sync-indicator[data-status="synced"]  { color: #b8e7c5; }
#sync-indicator[data-status="failed"]  { color: #ffb3ad; background: rgba(165,33,25,.25); }
#sync-indicator[data-status="offline"] { color: #ffd99a; background: rgba(165,90,20,.25); }

/* On desktop, show indicator at sidebar bottom + as floating chip */
@media (min-width: 761px) {
  .topbar-sync { display: none; }
  #sync-indicator {
    position: fixed; bottom: calc(16px + var(--safe-bottom)); left: 16px;
    z-index: 30; background: white; color: var(--ink-soft);
    border: 1px solid var(--line); box-shadow: var(--shadow);
    padding: 8px 14px; font-size: 13px;
  }
  #sync-indicator[data-status="failed"]  { background: var(--bad-soft); color: var(--bad); border-color: #f0c1bd; }
  #sync-indicator[data-status="offline"] { background: var(--warn-soft); color: var(--warn); border-color: #f1d5a8; }
  #sync-indicator[data-status="synced"]  { background: var(--good-soft); color: var(--good); border-color: #b8dcc6; }
}

/* === Modal === */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 22, 38, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: fade-in .15s ease-out;
}
.modal {
  position: relative;
  background: white; border-radius: 14px; padding: 24px;
  max-width: 460px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px - var(--safe-top) - var(--safe-bottom));
  overflow-y: auto;
  animation: slide-up .18s ease-out;
}
.modal h2 { margin: 0 6px 6px 0; font-size: 20px; padding-right: 36px; }
.modal-close {
  position: absolute; top: 8px; right: 8px;
  width: 44px; height: 44px;
  border: 0; background: transparent; color: var(--muted);
  border-radius: 8px;
  display: grid; place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.modal-close:hover, .modal-close:focus-visible {
  background: var(--line); color: var(--ink); outline: none;
}
.modal-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px;
  justify-content: flex-end;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* === Wizard ("Avsluta dagen") === */
.wizard-progress {
  display: flex; gap: 6px; margin-bottom: 14px;
}
.wizard-progress span {
  display: block; flex: 1; height: 6px; border-radius: 3px;
  background: var(--line);
  transition: background 200ms;
}
.wizard-progress span.done    { background: var(--good); }
.wizard-progress span.current { background: var(--accent); }

.wizard-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  margin-top: 18px; padding: 14px 16px;
  background: white; border-radius: 12px;
  box-shadow:
    0 1px 2px rgba(20, 30, 50, .04),
    0 8px 24px rgba(20, 30, 50, .08);
  position: sticky; bottom: calc(12px + var(--safe-bottom));
}
.wizard-foot-right {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}

.summary-list {
  list-style: none; padding: 0; margin: 0;
}
.summary-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.summary-list li:last-child { border-bottom: none; }
.summ-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.summ-value { font-size: 15px; color: var(--ink); text-align: right; }

@media (max-width: 760px) {
  .wizard-foot { flex-direction: column; align-items: stretch; padding: 12px; }
  .wizard-foot .btn { width: 100%; justify-content: center; }
  .wizard-foot-right { flex-direction: column; align-items: stretch; }
}

/* === Kom-igång-checklist === */
.card.komigang { border-left: 4px solid var(--accent); background: var(--accent-soft); }
.card.komigang .card-head h2 { color: var(--accent); }
.komigang-list { list-style: none; padding: 0; margin: 4px 0 0; }
.komigang-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid rgba(13,110,110,.1);
}
.komigang-list li:first-child { border-top: none; }
.komigang-check {
  width: 22px; height: 22px; border-radius: 50%;
  background: white; border: 2px solid var(--accent);
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent); font-weight: 700; font-size: 13px;
}
.komigang-list li.klar .komigang-check {
  background: var(--accent); color: white;
}
.komigang-text { flex: 1; min-width: 0; color: var(--ink); font-size: 14px; }
.komigang-list li.klar .komigang-text { color: var(--ink-soft); text-decoration: line-through; }

/* === Mall-banner === */
.mall-banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; margin: 0 0 16px;
  background: #f3f5f9; border-radius: 8px;
  border-left: 3px solid #9aa3b0;
  font-size: 13px; color: var(--ink-soft);
}
.mall-icon {
  flex-shrink: 0; width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #9aa3b0; color: white;
  font-size: 11px; font-weight: 700;
}

/* === Mellan-kund-räknare === */
.kund-counter {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 0;
  flex-wrap: wrap;
}
.kund-count-display { display: flex; align-items: baseline; gap: 10px; }
.kund-count-num {
  font-size: 56px; font-weight: 700; color: var(--accent);
  letter-spacing: -2px; line-height: 1;
}
.kund-count-label { font-size: 14px; color: var(--ink-soft); }

/* === Validering-card === */
.valid-card { padding: 16px 18px; }
.valid-card.valid-bad { border-left: 4px solid var(--bad); background: var(--bad-soft); }
.valid-card.valid-warn { border-left: 4px solid var(--warn); background: var(--warn-soft); }
.valid-card.valid-good { border-left: 4px solid var(--good); }

/* === Radio-row (verksamhetstyp) === */
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer;
  background: white;
  transition: background 100ms, border-color 100ms;
  flex: 1 1 200px;
  min-height: 44px;
}
.radio-item:hover { border-color: var(--line-strong); background: #f9fafc; }
.radio-item.selected {
  border-color: var(--accent); background: var(--accent-soft);
  color: var(--accent); font-weight: 600;
}
.radio-item input[type="radio"] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line-strong); margin: 0;
  flex-shrink: 0; position: relative; cursor: pointer;
}
.radio-item.selected input[type="radio"] { border-color: var(--accent); }
.radio-item input[type="radio"]:checked::after {
  content: ""; position: absolute; inset: 3px;
  border-radius: 50%; background: var(--accent);
}

/* === Filter-pills === */
.filter-pills {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 4px 0;
}
.filter-pill {
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: white;
  color: var(--ink-soft); font-size: 13px; cursor: pointer;
  transition: background 100ms, border-color 100ms, color 100ms;
}
.filter-pill:hover { border-color: var(--line-strong); }
.filter-pill.active {
  background: var(--accent); border-color: var(--accent); color: white;
  font-weight: 600;
}

/* === Personal-väljare === */
.personal-valj {
  display: flex; gap: 16px; align-items: center;
  flex-wrap: wrap;
  border-left: 4px solid var(--accent);
}
.personal-text { flex: 1; min-width: 200px; }
.personal-select {
  min-width: 220px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: white; font-size: 15px; min-height: 44px;
}

/* === Stickskada-protokoll === */
.stickskada-protokoll {
  background: var(--bad-soft); border-radius: 10px;
  padding: 4px 16px 16px; margin-top: 12px;
  border: 1px solid #f0c1bd;
}
.stickskada-protokoll .checklist { background: transparent; }
.stickskada-protokoll .check-item { background: white; }

/* === Floating Action Button (+1 kund klar) === */
.fab {
  position: fixed;
  right: 22px;
  bottom: calc(22px + var(--safe-bottom));
  z-index: 60;
  width: 64px; height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 0;
  box-shadow: 0 6px 16px rgba(13, 110, 110, 0.32),
              0 2px 4px rgba(13, 110, 110, 0.18);
  cursor: pointer;
  transition: transform 120ms, box-shadow 120ms, background 120ms;
  -webkit-tap-highlight-color: transparent;
}
.fab:hover {
  background: var(--accent-strong);
  transform: scale(1.04);
  box-shadow: 0 10px 22px rgba(13, 110, 110, 0.42);
}
.fab:active { transform: scale(0.94); }
.fab svg { display: block; }
.fab-count {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 26px; height: 26px;
  padding: 0 6px;
  background: var(--ink);
  color: white;
  border: 3px solid white;
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(10, 22, 40, .25);
}
.fab-count[hidden] { display: none; }
.fab.pulse { animation: fab-pulse 240ms cubic-bezier(.34, 1.6, .64, 1); }
@keyframes fab-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  70%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}
@media (max-width: 760px) {
  .fab { width: 60px; height: 60px; right: 16px; bottom: calc(16px + var(--safe-bottom)); }
}
@media print { .fab { display: none !important; } }


/* === Akut-modal options === */
.akut-options {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 8px;
}
.akut-option {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: white; border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 100ms, background 100ms;
  min-height: 64px;
  font: inherit;
  color: inherit;
}
.akut-option:hover, .akut-option:focus-visible {
  border-color: var(--accent); background: var(--accent-soft);
  outline: none;
}
.akut-option .akut-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.akut-option .akut-icon.red    { background: var(--bad-soft); }
.akut-option .akut-icon.orange { background: var(--warn-soft); }
.akut-option .akut-icon.gray   { background: #eef0f4; }
.akut-option-text { flex: 1; min-width: 0; }
.akut-option-text strong { display: block; font-size: 15px; margin-bottom: 2px; }

/* === Idag krävs av dig (smart prioritetslista) === */
.idag-krav {
  background: white; border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; margin-bottom: 22px;
  box-shadow: var(--shadow-lg);
}
.idag-krav h2 { margin: 0 0 14px; font-size: 18px; }
.idag-krav-list { list-style: none; padding: 0; margin: 0; }
.idag-krav-list li {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px; align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.idag-krav-list li:first-child { border-top: none; padding-top: 4px; }
.idag-krav-list li:last-child { padding-bottom: 4px; }
.idag-krav-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.idag-krav-icon.akut    { background: var(--bad-soft);  color: var(--bad); }
.idag-krav-icon.varning { background: var(--warn-soft); color: var(--warn); }
.idag-krav-icon.idag    { background: var(--accent-soft); color: var(--accent); }
.idag-krav-icon.sen     { background: #eef0f4; color: var(--ink-soft); }
.idag-krav-text { min-width: 0; }
.idag-krav-text strong { display: block; font-size: 14px; line-height: 1.35; color: var(--ink); }
.idag-krav-text .small  { color: var(--ink-soft); margin-top: 2px; }
.idag-krav-empty {
  display: flex; align-items: center; gap: 14px;
  padding: 6px 0;
}
.idag-krav-empty .checkmark {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--good-soft);
  color: var(--good);
  display: inline-flex; align-items: center; justify-content: center;
}
@media (max-width: 760px) {
  .idag-krav-list li { grid-template-columns: 32px 1fr; }
  .idag-krav-list li button { grid-column: 1 / -1; justify-self: stretch; }
}

/* === Mellan kunder kompakt === */
.kund-counter-compact {
  display: flex; gap: 16px; align-items: center;
  padding: 8px 0;
}
.kund-counter-compact .kund-count-num { font-size: 36px; }

/* === Field validation === */
label.field input.invalid,
label.field input:invalid:not(:placeholder-shown) {
  border-color: var(--bad);
  box-shadow: 0 0 0 2px var(--bad-soft);
}
label.field .error { font-size: 12px; color: var(--bad); margin-top: 2px; }

/* === Snabbcheck-badge i historik === */
.snab-badge {
  display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: #eef0f4; color: var(--ink-soft); border: 1px solid var(--line); margin-left: 4px;
  letter-spacing: .3px;
}

/* === Toast med ångra-knapp === */
.toast-action {
  background: transparent; border: 1px solid rgba(255,255,255,.4);
  color: white; padding: 4px 10px; border-radius: 6px;
  margin-left: 12px; font-size: 13px; cursor: pointer;
}
.toast-action:hover { background: rgba(255,255,255,.12); border-color: white; }

/* === Reduce motion preference === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
