:root {
  --green: #2E7D46;
  --green-dark: #1F5A32;
  --green-light: #E8F5EC;
  --blue: #3B6FA0;
  --blue-light: #E9F1F8;
  --purple: #6C4F9C;
  --purple-light: #F1ECF8;
  --amber: #C97B18;
  --amber-light: #FCF1E1;
  --red: #B3403B;
  --red-light: #FBEAE9;
  --text: #1F2A24;
  --text-muted: #5B6A61;
  --bg: #F5F7F6;
  --card-bg: #FFFFFF;
  --border: #E2E8E4;
  --radius: 16px;
}

* { box-sizing: border-box; }

/* ---------- Ikoner (SVG, erstatter emoji for et enhetlig uttrykk) ---------- */
.icon { width: 22px; height: 22px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 13px; height: 13px; }
.icon-inline { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #DDE3DF;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 24px 12px;
  color: var(--text);
}

.phone {
  width: 400px;
  max-width: 100%;
  min-height: 780px;
  background: var(--bg);
  border-radius: 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  overflow: hidden;
  position: relative;
  border: 8px solid #111;
}

.statusbar {
  display: flex;
  justify-content: space-between;
  padding: 10px 20px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.screen {
  display: none;
  flex-direction: column;
  padding: 8px 20px 24px;
  min-height: 700px;
}
.screen.active { display: flex; }

/* ---------- Innlogging ---------- */
.login-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.login-logo { text-align: center; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin: 0 0 20px; }
.login-error {
  color: var(--red);
  font-size: 12.5px;
  font-weight: 600;
  margin: 0 0 10px;
}
.login-error[hidden] { display: none; }
.login-footnote {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 20px;
}

.admin-login-intro {
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
  margin: 0 0 18px;
}

/* ---------- Admin-panel ---------- */
.admin-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.admin-card-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  margin: 0 0 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.admin-badge {
  font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  white-space: nowrap;
}
.admin-badge.is-idle { background: var(--green-light); color: var(--green-dark); }
.admin-badge.is-busy { background: var(--amber-light); color: var(--amber); }
.admin-stat-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; color: var(--text); padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.admin-stat-row:last-child { border-bottom: none; }
.admin-stat-row .admin-stat-value { font-weight: 700; }
.admin-stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.admin-class-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px;
  margin-top: 4px;
}
.admin-class-grid div { font-size: 12px; color: var(--text); display: flex; justify-content: space-between; }
.admin-class-grid span { font-weight: 700; }
.admin-refresh-row { display: flex; gap: 8px; margin-bottom: 12px; }
.admin-refresh-row button { flex: 1; }
.admin-updated { font-size: 10.5px; color: var(--text-muted); text-align: center; margin: 4px 0 14px; }

/* ---------- Forside ---------- */
.home-header { margin: 12px 0 20px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 20px; }
.home-header-actions { display: flex; align-items: center; gap: 4px; }
.header-icon-btn {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 4px; display: flex; align-items: center; justify-content: center;
}

/* ---------- Om iFlow ---------- */
.about-logo { font-size: 20px; text-align: center; margin: 12px 0 10px; }
.about-badge {
  display: block;
  width: fit-content;
  margin: 0 auto 20px;
  background: var(--green-light);
  color: var(--green-dark);
  border: 1px solid var(--green);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 11.5px;
  font-weight: 700;
}
.about-text { font-size: 13px; line-height: 1.55; color: var(--text-muted); margin: 0 0 14px; }

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.card-icon { display: flex; align-items: center; justify-content: center; width: 26px; color: var(--green-dark); flex-shrink: 0; }
.card-icon .icon { width: 24px; height: 24px; }
.card-text { display: flex; flex-direction: column; gap: 2px; }
.card-text strong { font-size: 15px; }
.card-text small { color: var(--text-muted); font-size: 12.5px; }

.card-primary { background: var(--green-light); border-color: var(--green); }
.card-disabled { opacity: 0.55; }
.card-disabled .card-icon { color: var(--text-muted); }

.home-footer {
  margin-top: auto;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 16px;
}

/* ---------- Sub-header ---------- */
.subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
  padding: 8px 0 16px;
}
.back-btn {
  background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text);
  width: 28px;
}
.home-btn {
  background: none; border: none; cursor: pointer; color: var(--text);
  width: 28px; padding: 0;
  display: flex; align-items: center; justify-content: flex-end;
}

/* ---------- Kamera ---------- */
.camera-area { flex: 1; display: flex; align-items: center; justify-content: center; }
.camera-frame-guide {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  background: #16201A;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#preview-img { display: none; width: 100%; height: 100%; object-fit: cover; }
#camera-stream { display: none; width: 100%; height: 100%; object-fit: cover; }
#camera-placeholder { color: #cfe0d4; text-align: center; font-size: 13px; padding: 0 30px; }

#redact-canvas {
  display: none;
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
  cursor: crosshair;
  touch-action: none;
}

.privacy-warning {
  margin-top: 12px;
  background: var(--red-light);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.privacy-warning[hidden] { display: none; }
.privacy-warning-text {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; color: var(--red); font-weight: 600; line-height: 1.4;
}
.privacy-warning-actions { display: flex; gap: 8px; margin-top: 10px; }

.link-btn {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px;
  background: none; border: none; padding: 0;
  font-size: 12px; color: var(--text-muted); cursor: pointer;
  font-family: inherit;
}
.link-btn[hidden] { display: none; }

.redact-controls { margin-top: 12px; }
.redact-controls[hidden] { display: none; }
.redact-hint { font-size: 11.5px; color: var(--text-muted); margin: 0 0 8px; }
.redact-buttons { display: flex; gap: 8px; }
.redact-buttons .btn-secondary, .redact-buttons .btn-primary { flex: 1; }

.samples-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.samples-grid[hidden] { display: none; }
.sample-thumb {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  padding: 0;
  cursor: pointer;
  background: var(--card-bg);
}
.sample-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame-corner { position: absolute; width: 26px; height: 26px; border: 3px solid #7CD79A; }
.frame-corner.tl { top: 24px; left: 24px; border-right: none; border-bottom: none; }
.frame-corner.tr { top: 24px; right: 24px; border-left: none; border-bottom: none; }
.frame-corner.bl { bottom: 60px; left: 24px; border-right: none; border-top: none; }
.frame-corner.br { bottom: 60px; right: 24px; border-left: none; border-top: none; }

.case-ref-row { margin-top: 14px; }
#login-submit-btn, #admin-login-submit-btn { margin-top: 20px; }
.case-ref-label { display: block; font-size: 11.5px; color: var(--text-muted); margin-bottom: 6px; }
.case-ref-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
}

.camera-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 4px 6px;
  gap: 10px;
}
.btn-shutter {
  width: 62px; height: 62px; border-radius: 50%;
  border: 4px solid var(--green);
  background: white;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-secondary {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  flex: 1;
  display: flex; align-items: center; justify-content: center;
}
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.camera-hint { text-align: center; font-size: 11.5px; color: var(--text-muted); margin-top: 8px; }

/* ---------- Analyserer ---------- */
.analyzing-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}
.progress-ring { position: relative; width: 150px; height: 150px; margin-bottom: 8px; }
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.ring-fg {
  fill: none; stroke: var(--green); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 264; stroke-dashoffset: 264;
  transition: stroke-dashoffset 0.2s linear;
}
.progress-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: var(--green-dark);
}
.analyzing-sub { color: var(--text-muted); font-size: 12.5px; }

/* ---------- Resultat ---------- */
.result-body { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }

.wound-type-card {
  background: var(--green-light);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.wound-type-row { display: flex; justify-content: space-between; align-items: center; }
.wound-type-badge { font-weight: 700; font-size: 16px; color: var(--green-dark); }
.wound-type-conf { font-size: 13px; color: var(--text-muted); }
.wound-type-examiner { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.wound-type-examiner[hidden] { display: none; }
.wound-type-note { font-size: 11.5px; color: var(--text-muted); margin: 8px 0 4px; line-height: 1.4; }
.explain-toggle { font-size: 12.5px; color: var(--green-dark); cursor: pointer; font-weight: 600; margin-top: 4px; }
.explain-content[hidden] { display: none; }
.explain-image { width: 100%; border-radius: 12px; display: block; margin-top: 8px; }
.explain-image-legend { font-size: 10.5px; color: var(--text-muted); margin: 6px 0 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.swatch-green { background: var(--green); }
.swatch-orange { background: var(--amber); }
.explain-list { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: var(--text); }
.explain-list li { margin-bottom: 4px; }

.section-title { font-size: 14px; margin: 4px 0 0; color: var(--text); }

/* ---------- Tilbakemelding (Tsetlin-korreksjon) ---------- */
.feedback-box {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--green);
}
.feedback-question { font-size: 12px; font-weight: 600; color: var(--text); margin: 0 0 8px; }
.feedback-actions { display: flex; gap: 8px; }
.btn-feedback {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px;
  padding: 9px 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--green);
  background: var(--card-bg);
  color: var(--green-dark);
}
.btn-feedback-correct { border-color: var(--amber); color: var(--amber); }
.feedback-correct-panel { display: flex; gap: 8px; margin-top: 8px; }
.feedback-correct-panel[hidden] { display: none; }
.feedback-select {
  flex: 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px;
  font-size: 16px;
  font-family: inherit;
  background: var(--card-bg);
  color: var(--text);
}
.btn-feedback-save { flex: 0 0 auto; border-color: var(--amber); color: var(--amber); }
.feedback-done { font-size: 12px; color: var(--green-dark); font-weight: 600; margin: 8px 0 0; }

.feedback-collapsed[hidden] { display: none; }
.feedback-collapsed button.times-icon-btn#feedback-reopen-btn {
  width: auto; height: auto; padding: 6px 10px; gap: 6px;
  display: inline-flex; align-items: center;
  border: 1px solid var(--green); border-radius: 999px;
  color: var(--green-dark); background: var(--green-light);
}
.feedback-collapsed-label { font-size: 11.5px; font-weight: 600; }
.feedback-expanded[hidden] { display: none; }

.times-list { display: flex; flex-direction: column; gap: 10px; }
.times-item {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
}
.times-icon {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white;
}
.times-text-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.times-text strong { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.times-text span.times-value { display: block; font-size: 13.5px; margin-top: 1px; }

.times-label-btn {
  font-size: 12.5px; color: var(--text-muted); font-weight: 600;
  background: none; border: none; padding: 0; margin: 0; font-family: inherit;
  cursor: pointer; text-align: left;
  border-bottom: 1px dotted var(--text-muted);
  line-height: 1.3;
}
.times-label-btn:hover { color: var(--text); border-bottom-color: var(--text); }

.times-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.times-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0;
  border: none; background: none; cursor: pointer;
  color: var(--text-muted); border-radius: 6px;
}
.times-icon-btn:hover { background: var(--bg); }
.times-edit-btn { color: var(--amber); }
.times-edit-btn.times-icon-btn-done { color: var(--green-dark); cursor: default; }
.times-edit-btn.times-icon-btn-done:hover { background: none; }
.times-edit-btn:disabled { opacity: 1; }

.times-help-panel {
  margin-top: 6px; padding: 8px 10px; background: var(--blue-light); border-radius: 10px;
  font-size: 11.5px; color: var(--text); line-height: 1.4;
}
.times-help-panel[hidden] { display: none; }
.times-help-panel p { margin: 0 0 4px; }
.times-help-panel p:last-child { margin-bottom: 0; }
.times-help-value strong { color: var(--text); font-size: 11.5px; }

.times-feedback-panel { display: flex; gap: 6px; margin-top: 6px; }
.times-feedback-panel[hidden] { display: none; }
.times-feedback-select {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 6px;
  font-family: inherit;
  background: var(--card-bg);
  color: var(--text);
}
.times-feedback-save {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--green);
  color: var(--green-dark);
  background: var(--card-bg);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
}

.times-item.tissue .times-icon { background: var(--green); }
.times-item.infection .times-icon { background: var(--red); }
.times-item.moisture .times-icon { background: var(--blue); }
.times-item.edge .times-icon { background: var(--amber); }
.times-item.skin .times-icon { background: var(--purple); }

.summary-box {
  background: var(--blue-light);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.4;
}

.btn-primary {
  background: var(--green);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

.procedure-step {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.procedure-step-header {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: none; border: none; padding: 12px; cursor: pointer; text-align: left; font-family: inherit;
}
.step-num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--green-light); color: var(--green-dark);
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; flex-shrink: 0;
}
.step-header-text { flex: 1; min-width: 0; }
.step-header-text strong { display: block; font-size: 13.5px; }
.step-header-text .step-product { font-size: 12.5px; color: var(--green-dark); font-weight: 600; margin-top: 2px; }
.step-toggle { font-size: 13px; color: var(--text-muted); flex-shrink: 0; }
.step-explain {
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
  padding: 0 12px 12px 50px;
}
.step-explain[hidden] { display: none; }

.procedure-step.level-orange { background: var(--amber-light); border-color: var(--amber); }
.procedure-step.level-orange .step-num { background: var(--card-bg); color: var(--amber); border: 1.5px solid var(--amber); }
.procedure-step.level-orange .step-product { color: var(--amber); }

.procedure-step.level-red { background: var(--red-light); border-color: var(--red); }
.procedure-step.level-red .step-num { background: var(--card-bg); color: var(--red); border: 1.5px solid var(--red); }
.procedure-step.level-red .step-product { color: var(--red); }

.disclaimer-box {
  font-size: 11px; color: var(--text-muted); background: #FFF7E0; border-radius: 10px; padding: 10px 12px; line-height: 1.4;
}
.disclaimer-wrap { margin-top: 4px; }
.disclaimer-toggle { margin-bottom: 6px; }

/* ---------- Dokumenter (journaltekst) ---------- */
.journal-textarea {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--card-bg);
  resize: vertical;
}
.btn-copy {
  background: var(--card-bg);
  border: 1px solid var(--green);
  color: var(--green-dark);
  border-radius: 12px;
  padding: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Arkiv ---------- */
.archive-empty { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 40px; }

.search-row {
  position: relative;
  margin-bottom: 12px;
}
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  background: var(--card-bg);
  color: var(--text);
}
.search-input:focus { outline: none; border-color: var(--green); }
.search-input[hidden] { display: none; }

.show-archived-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  margin: 0 0 12px;
  cursor: pointer;
}
.show-archived-toggle[hidden] { display: none; }
.show-archived-toggle input { margin: 0; accent-color: var(--green); }

.archive-case-card.is-archived { opacity: 0.6; }
.archived-badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: var(--border); color: var(--text-muted); white-space: nowrap;
}

.person-action-row { display: flex; gap: 8px; margin-bottom: 14px; }
.person-action-row button {
  flex: 1;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-archive { background: var(--card-bg); border: 1px solid var(--border); color: var(--text); }
.btn-restore { background: var(--green-light); border: 1px solid var(--green); color: var(--green-dark); }
.btn-danger { background: var(--red-light); border: 1px solid var(--red); color: var(--red); }
.archived-notice {
  font-size: 11.5px; color: var(--text-muted); margin: 0 0 12px;
  background: var(--bg); border-radius: 10px; padding: 8px 10px;
}

.entry-action-row { display: flex; gap: 4px; margin-top: 6px; }
.entry-action-row .times-icon-btn { width: 26px; height: 26px; }

.archive-case-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  font-family: inherit;
}
.archive-case-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.archive-case-ref { font-weight: 700; font-size: 14.5px; color: var(--green-dark); }
.archive-case-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.archive-trend-badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.trend-up { background: var(--green-light); color: var(--green-dark); }
.trend-down { background: var(--red-light); color: var(--red); }
.trend-flat { background: var(--border); color: var(--text-muted); }

.archive-summary-box {
  background: var(--blue-light);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.archive-summary-caption { font-size: 11px; color: var(--text-muted); margin: 2px 0 4px; }
.trend-chart-svg { width: 100%; height: auto; display: block; margin: 4px 0 2px; }
.trend-chart-grid-line { stroke: var(--border); stroke-width: 1; }
.trend-chart-line { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.trend-chart-dot { fill: var(--card-bg); stroke: var(--green); stroke-width: 2.5; }
.trend-chart-xlabel { font-size: 8px; fill: var(--text-muted); }
.trend-chart-value { font-size: 9px; font-weight: 700; fill: var(--text); }
.archive-summary-scores { display: flex; align-items: center; gap: 10px; font-size: 13px; margin: 8px 0; }
.archive-summary-scores .trend-up, .archive-summary-scores .trend-down, .archive-summary-scores .trend-flat {
  font-size: 16px; font-weight: 700; background: none; padding: 0;
}
.archive-summary-text { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.4; }

.archive-entry-score-row { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; }
.archive-entry-score { font-size: 12px; font-weight: 700; color: var(--text); }
.archive-entry-delta { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }

.archive-new-exam-btn { margin-bottom: 4px; }
.archive-multi-hint { font-size: 11.5px; color: var(--text-muted); margin: 0 0 12px; }

.archive-add-wound-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--green-light);
  border: 1.5px dashed var(--green);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 4px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.archive-add-wound-card:hover { background: var(--green-light-hover, var(--green-light)); border-style: solid; }
.archive-add-wound-icon {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--green); color: white;
}
.archive-add-wound-text { display: flex; flex-direction: column; gap: 1px; }
.archive-add-wound-text strong { font-size: 13.5px; color: var(--green-dark); }
.archive-add-wound-text small { font-size: 11.5px; color: var(--text-muted); }

.archive-entry {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.archive-entry.is-archived { opacity: 0.6; }
.archive-entry .entry-action-row { padding: 0 12px 10px; justify-content: flex-end; }
.archive-entry-header {
  width: 100%;
  display: flex;
  gap: 12px;
  padding: 12px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.archive-entry-img {
  width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
  background: var(--bg);
  cursor: zoom-in;
}
.archive-entry-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.archive-entry-date { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.archive-entry-type { font-size: 13.5px; font-weight: 700; color: var(--green-dark); margin: 2px 0 4px; }
.archive-entry-times { font-size: 11px; color: var(--text); line-height: 1.5; }
.archive-entry-examiner { font-size: 10.5px; color: var(--text-muted); margin-top: 4px; }
.archive-entry-chevron { align-self: center; font-size: 13px; color: var(--text-muted); flex-shrink: 0; }

.archive-expand-all-btn { margin: 0 0 10px; }
.archive-entry-details { padding: 0 12px 4px; border-top: 1px solid var(--border); margin-top: 2px; }
.archive-entry-details[hidden] { display: none; }
.archive-entry-details .archive-entry-times { margin-top: 10px; }

.archive-entry-expand { padding: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.archive-entry-expand[hidden] { display: none; }
.archive-entry-expand-title { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 10px 0 0; }
.archive-entry-expand-summary { font-size: 12px; color: var(--text); line-height: 1.4; margin: 0; }
.archive-feedback-event {
  font-size: 12px; color: var(--text); background: var(--bg);
  border-radius: 8px; padding: 7px 10px; margin-bottom: 4px;
}
.archive-feedback-event.is-corrected {
  background: var(--amber-light);
  border-left: 3px solid var(--amber);
  font-weight: 600;
}
.archive-entry-journal { min-height: 120px; font-size: 16px; }

/* ---------- Læring ---------- */
.learning-topic { margin-bottom: 4px; }
.learning-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--green-dark); text-transform: uppercase; margin: 0 0 4px; }
.learning-title { font-size: 22px; font-weight: 800; color: var(--text); margin: 0 0 8px; }
.learning-intro { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin: 0 0 16px; }
.learning-accordion { display: flex; flex-direction: column; gap: 10px; }
.learning-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.learning-item.open { border-color: var(--green); }
.learning-item-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.learning-item-toggle { font-size: 18px; font-weight: 700; color: var(--green-dark); flex-shrink: 0; }
.learning-item-body { padding: 0 16px 16px; }
.learning-item-body p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.toast {
  position: absolute; bottom: 24px; left: 20px; right: 20px;
  background: #1F2A24; color: white; text-align: center;
  padding: 10px 14px; border-radius: 10px; font-size: 12.5px;
}

.lightbox {
  position: absolute; inset: 0;
  z-index: 50;
  background: rgba(10, 15, 12, 0.94);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute; top: 16px; right: 16px;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none; color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.lightbox-close .icon { width: 20px; height: 20px; }

/* ---------- Kontakt SamSår (simulert videosamtale) ---------- */
.call-screen {
  padding: 0 !important;
  position: relative;
  background: linear-gradient(180deg, #1B2A22 0%, #0F1913 100%);
  color: white;
  overflow: hidden;
}
.call-video-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 40px 24px;
  position: relative;
}
.call-nurse-avatar-wrap { position: relative; width: 96px; height: 96px; margin-bottom: 14px; }
.call-nurse-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  position: relative; z-index: 1;
}
.call-pulse-ring {
  position: absolute; inset: -8px; border-radius: 50%;
  border: 2px solid var(--green);
  opacity: 0.55;
  animation: call-pulse 2.2s ease-out infinite;
}
@keyframes call-pulse {
  0% { transform: scale(0.9); opacity: 0.55; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
.call-nurse-name { font-size: 15px; font-weight: 700; }
.call-status { font-size: 12.5px; color: #B9C9BF; margin-top: 2px; }
.call-timer { font-size: 12.5px; color: #B9C9BF; margin-top: 2px; font-variant-numeric: tabular-nums; }

.call-messages {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}
.call-message-bubble {
  align-self: flex-start;
  max-width: 85%;
  background: rgba(255,255,255,0.1);
  border-radius: 14px 14px 14px 3px;
  padding: 9px 13px;
  font-size: 12.5px;
  line-height: 1.4;
  animation: call-msg-in 0.25s ease-out;
}
@keyframes call-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.call-self-view {
  position: absolute;
  top: 16px; right: 16px;
  width: 84px; height: 112px;
  border-radius: 12px;
  object-fit: cover;
  background: #0A0F0C;
  border: 1.5px solid rgba(255,255,255,0.25);
  transform: scaleX(-1);
}

.call-demo-badge {
  position: absolute;
  top: 16px; left: 16px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.call-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px 24px 32px;
}
.call-ctrl-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none;
  color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.call-ctrl-btn .icon { width: 22px; height: 22px; }
.call-ctrl-btn.active { background: white; color: #1B2A22; }
.call-hangup-btn { background: var(--red); }
.call-hangup-btn .icon { width: 22px; height: 22px; }

/* ---------- Ekte mobilskjerm: dropp skrivebords-mockupen ----------
   Under ~480px bredde (ekte telefon, ikke en simulert "telefon-i-nettleser"
   på desktop) fjernes den falske rammen/skyggen/statuslinjen - de dupliserer
   bare det den ekte telefonen allerede viser, og den faste min-height gjorde
   at innhold (f.eks. lukkerknappen på Ta bilde) endte utenfor synlig
   viewport og krevde scroll. */
@media (max-width: 480px) {
  body {
    padding: 0;
    align-items: stretch;
    background: var(--bg);
  }
  .phone {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .statusbar { display: none; }
  .screen {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 14px 16px 20px;
  }
  .camera-frame-guide {
    max-height: 34vh;
    max-height: 34dvh;
  }
  .case-ref-row { margin-top: 10px; }
  .camera-controls { padding: 14px 4px 4px; }
  .camera-hint { margin-top: 6px; }
}
