/* psykkonsult.se — clean clinical, minimal, mobile-first */

:root {
  --bg: #ffffff;
  --surface: #f7f9fb;
  --border: #e2e8ee;
  --text: #1c2733;
  --muted: #5b6b7b;
  --accent: #0f6b8c;        /* clinical teal-blue */
  --accent-soft: #e6f1f5;
  --accent-strong: #0a4f67;
  --danger: #b3261e;        /* used for akut/varning sections */
  --danger-soft: #fbeceb;
  --radius: 10px;
  --maxw: 880px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.7rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.015em;
  color: var(--accent-strong);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.brand .mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.brand .mark svg { width: 24px; height: 24px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-tag { font-size: 0.7rem; font-style: italic; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.site-nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.4rem;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.3rem 0.55rem;
  border-radius: 7px;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--accent); background: var(--accent-soft); }
.site-nav a.active { color: var(--accent-strong); font-weight: 600; }
.site-nav a.nav-akut { color: var(--danger) !important; font-weight: 400 !important; }

/* ---------- Layout ---------- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.6rem 1.1rem 4rem;
}

.page-title { margin: 0.4rem 0 0.2rem; font-size: 1.55rem; letter-spacing: -0.02em; }
.page-sub { margin: 0 0 1.6rem; color: var(--muted); font-size: 0.98rem; }

h2.section-title {
  font-size: 1.15rem;
  margin: 2rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

/* ---------- Hub cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  margin-top: 1rem;
}
.card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s, transform .05s;
}
.card:hover { border-color: var(--accent); box-shadow: 0 2px 14px rgba(15,107,140,0.08); }
.card:active { transform: translateY(1px); }
.card .kicker { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); font-weight: 700; }
.card h3 { margin: 0.35rem 0 0.3rem; font-size: 1.08rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.card.akut { border-color: rgba(179,38,30,0.30); }
.card.akut h3 { color: var(--danger); }
.card.akut:hover { border-color: var(--danger); box-shadow: 0 2px 14px rgba(179,38,30,0.10); }

/* ---------- Reference link list ---------- */
.linklist { list-style: none; padding: 0; margin: 0.6rem 0 0; display: grid; gap: 0.55rem; }
.linklist a.linkrow {
  display: flex; align-items: center; gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
}
.linklist a.linkrow:hover { border-color: var(--accent); background: var(--accent-soft); }
.linklist .lk-logo {
  width: 30px; height: 30px; flex: none;
  border-radius: 7px; object-fit: contain;
  background: #fff; border: 1px solid var(--border); padding: 3px;
}
.linklist .lk-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.linklist .lk-name { font-weight: 600; }
.linklist .lk-desc { color: var(--muted); font-size: 0.88rem; }
.linklist .lk-ext { margin-left: auto; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 0.6rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 520px; }
thead th {
  text-align: left;
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface); }
td.placeholder, .placeholder { color: #9aa7b4; font-style: italic; }

/* ---------- Detail / accordion blocks ---------- */
details.block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.7rem 0;
  overflow: hidden;
  background: var(--bg);
}
details.block > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.85rem 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
details.block > summary::-webkit-details-marker { display: none; }
details.block > summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-weight: 400;
  font-size: 1.2rem;
}
details.block[open] > summary::after { content: "\2013"; }
details.block > summary:hover { background: var(--surface); }
details.block .body { padding: 0.3rem 1rem 1rem; }

.tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.45rem;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.tag.akut { background: var(--danger-soft); color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.secondary { background: transparent; color: var(--accent-strong); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.4rem 0 0.2rem; }

/* ---------- Psykisk status reference ---------- */
.status-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.7rem 0;
  overflow: hidden;
}
.status-section > h3 {
  margin: 0;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.status-section > h3 .ico {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--accent);
}
.status-section > h3 .ico svg { width: 100%; height: 100%; display: block; }
.status-section > h3 .num {
  color: var(--accent-strong);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 1.1em;
}
.status-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 0.5rem 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
}
.status-row:last-child { border-bottom: none; }
.status-row .label { font-weight: 600; color: var(--text); }
.status-row .label .sub { display: block; font-weight: 400; color: var(--muted); font-size: 0.82rem; }
.status-row .desc { color: var(--muted); font-size: 0.92rem; }
.status-row.single { grid-template-columns: 1fr; }
.status-row.single .desc { color: var(--text); }

@media (max-width: 600px) {
  .status-row { grid-template-columns: 1fr; gap: 0.15rem; padding: 0.6rem 0.85rem; }
  .status-row .desc { font-size: 0.88rem; }
}

/* ---------- Akut B52 box ---------- */
.akutbox {
  border: 1.5px solid var(--danger);
  border-radius: var(--radius);
  background: var(--danger-soft);
  padding: 0.9rem 1.1rem;
  margin: 0.8rem 0 1.2rem;
}
.akutbox-title {
  color: var(--danger);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.akutbox-row {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.35rem 0;
  border-top: 1px solid rgba(179,38,30,0.18);
}
.akutbox-row:first-of-type { border-top: none; }
.akutbox-key {
  flex: none;
  width: 1.6rem;
  text-align: center;
  font-weight: 700;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
}
.akutbox-row .txt { color: var(--text); font-size: 0.93rem; }
.akutbox-row .txt b { font-weight: 600; }
.akutbox-foot { margin-top: 0.6rem; font-size: 0.82rem; color: var(--muted); }

/* ---------- Drug cards (psykofarmaka) ---------- */
.drugcard {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.6rem 0;
  background: var(--bg);
}
.drug-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.8rem; }
.drug-name { font-weight: 700; font-size: 0.98rem; }
.drug-dose { color: var(--accent-strong); font-size: 0.9rem; font-weight: 600; }
.drug-obs { margin-top: 0.45rem; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.drug-obs .obs-label {
  display: inline-block; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: 0.05rem 0.35rem; margin-right: 0.45rem; vertical-align: 1px;
}
.sub-label { font-size: 0.95rem; font-weight: 700; color: var(--accent-strong); margin: 1.6rem 0 0.4rem; }
.drug-obs b { color: var(--text); }
table.compact { min-width: 0; }
table.compact td:first-child { font-weight: 600; }
table.vgr { font-size: 0.85rem; }
table.vgr th, table.vgr td { text-align: center; }
table.vgr td.lbl { text-align: left; font-weight: 600; background: var(--surface); }
table.vgr td.sub { text-align: left; }
table.vgr small { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 400; }
table.vgr .div { border-left: 2px solid var(--accent); }
table.vgr thead th { background: var(--accent-soft); color: var(--accent-strong); border-bottom-color: #cfe3ea; }
table.vgr td.lpt { color: var(--accent-strong); font-weight: 600; }
table.vgr td.lrv { color: #b56a00; font-weight: 600; }
table.vgr tbody tr:hover td { background: var(--accent-soft); }
.req { color: var(--danger); font-weight: 700; }
.reqg { color: #2e7d32; font-weight: 700; }
.hsl { color: #2e7d32; font-weight: 600; }
table.hand td:first-child { font-weight: 400; }
.legend { font-size: 0.8rem; color: var(--muted); margin: 0.6rem 0 0; line-height: 1.6; }

/* ---------- Notes ---------- */
.note {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.note.todo { border-left-color: #c79a13; background: #fdf8e9; color: #6b5612; }
.note.danger { border-left-color: var(--danger); background: var(--danger-soft); color: #7d1a15; }
.note.danger b { color: var(--danger); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 1.5rem 1.1rem 2.5rem;
}
.site-footer a { color: var(--accent); text-decoration: none; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr; }
  .site-header .inner { padding: 0.6rem 0.9rem; }
  .brand { font-size: 1.45rem; }
  .brand .mark { width: 32px; height: 32px; border-radius: 9px; }
  .brand .mark svg { width: 20px; height: 20px; }
  .site-nav { width: 100%; margin-left: 0; }
  main { padding: 1.2rem 0.9rem 3rem; }
  .page-title { font-size: 1.35rem; }
  .linklist .lk-ext { display: none; }
}

/* Elaxel thumbs (kardiologi) */
.axcell { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; }
.thumb { width:18px; height:18px; flex:none; vertical-align:middle; stroke-width:2.6; }
.thumb.up { stroke:#2e7d5b; }
.thumb.down { stroke:#b3261e; }
.thumb.flip { transform:scaleX(-1); }
