/* MTOLD AH v1.6.15 â€” gemensamt designsytem (tokens + teman).
 * Varm, modern, vÃ¤lkomnande konsumentprodukt â€” inte adminverktyg.
 * Etablerad CSS: variabler, gradienter, flex/grid, contain/transform.
 * Noll nya dependencies.
 * v1.6.0: facit v3 (11_ah_layout_facit_v3) â€” TYDLIGT LYFT pÃ¥ video-frame,
 * luft video->notes, notes AV = centrerad samma-storlek-video. */

/* ---------- Palett (single source per fÃ¤rg; teman nedan Ã¥teranvÃ¤nder) ---------- */
:root {
  --varm-1: #faf0e1; --varm-2: #f1d3ac; --varm-3: #dda668;
  --mork-1: #3b414b; --mork-2: #23272e; --mork-3: #121418;
  --bla-1: #e4f0fc; --bla-2: #b8d4f0; --bla-3: #7fa9d8;
  --ljus-1: #ffffff; --ljus-2: #f4f0e8; --ljus-3: #dcd4c2;
  --gron-1: #eaf3e8; --gron-2: #c3ddc1; --gron-3: #8fb98d;
  --lila-1: #f1eaf9; --lila-2: #d4c3e9; --lila-3: #a78fd1;
  --green: #2e7d32; --green-dark: #1b5e20;
  --red: #d32f2f; --red-dark: #a92424;
  --radius: 18px; --radius-lg: 24px;
  --shadow: 0 8px 28px rgba(60, 35, 10, 0.22);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --paper: #fdf3c9; --paper-line: rgba(120, 90, 30, 0.22); --paper-ink: #2b2118;
}

/* ---------- Teman (varm = standard) ---------- */
body, body[data-theme="varm"] {
  --bg1: var(--varm-1); --bg2: var(--varm-2); --bg3: var(--varm-3);
  --glow: rgba(255, 251, 242, 0.55);
  --ink: #3d2c1e; --ink-soft: rgba(61, 44, 30, 0.72); --card: rgba(255, 255, 255, 0.82);
  --accent: #b06a2c; --on-dark: #fff8ef;
}
body[data-theme="mork"] {
  --bg1: var(--mork-1); --bg2: var(--mork-2); --bg3: var(--mork-3);
  --glow: rgba(255, 255, 255, 0.07);
  --ink: #f2ede4; --ink-soft: rgba(242, 237, 228, 0.72); --card: rgba(255, 255, 255, 0.09);
  --accent: #e8b26a; --on-dark: #f2ede4;
}
body[data-theme="bla"] {
  --bg1: var(--bla-1); --bg2: var(--bla-2); --bg3: var(--bla-3);
  --glow: rgba(255, 255, 255, 0.5);
  --ink: #1e3a56; --ink-soft: rgba(30, 58, 86, 0.72); --card: rgba(255, 255, 255, 0.82);
  --accent: #2f6db3; --on-dark: #f4f9ff;
}
body[data-theme="ljus"] {
  --bg1: var(--ljus-1); --bg2: var(--ljus-2); --ljus-3: var(--ljus-3);
  --bg3: var(--ljus-3);
  --glow: rgba(255, 255, 255, 0.65);
  --ink: #3a352b; --ink-soft: rgba(58, 53, 43, 0.72); --card: rgba(255, 255, 255, 0.9);
  --accent: #8a6d3b; --on-dark: #fffdf7;
}
body[data-theme="gron"] {
  --bg1: var(--gron-1); --bg2: var(--gron-2); --bg3: var(--gron-3);
  --glow: rgba(252, 255, 252, 0.45);
  --ink: #24402a; --ink-soft: rgba(36, 64, 42, 0.72); --card: rgba(255, 255, 255, 0.82);
  --accent: #2e7d32; --on-dark: #f2f8f1;
}
body[data-theme="lila"] {
  --bg1: var(--lila-1); --bg2: var(--lila-2); --bg3: var(--lila-3);
  --glow: rgba(255, 252, 255, 0.45);
  --ink: #3d2c5c; --ink-soft: rgba(61, 44, 92, 0.72); --card: rgba(255, 255, 255, 0.82);
  --accent: #6a4bb3; --on-dark: #f7f2ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh; min-height: 100dvh;
}
.screen {
  max-width: 560px; margin: 0 auto; padding: 28px 24px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  min-height: 100vh; min-height: 100dvh;
}
.screen[hidden] { display: none !important; }
.brand-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; }
.brand { font-size: 32px; font-weight: 900; letter-spacing: 4px; }
.brand-heart { font-size: 34px; color: #e2574c; }
.brand-sub { font-size: 17px; color: var(--ink-soft); margin-bottom: 8px; }
.lbl { align-self: flex-start; font-size: 17px; color: var(--ink-soft); margin-top: 8px; }
.field {
  width: 100%; font-size: 20px; padding: 15px 16px; color: var(--ink);
  border: 2px solid rgba(128, 110, 90, 0.35); border-radius: 14px; background: var(--card);
}
.field:focus { outline: 3px solid var(--accent); border-color: var(--accent); }
.error { color: var(--red); font-size: 17px; min-height: 24px; }
.btn-primary {
  width: 100%; min-height: 60px; font-size: 22px; font-weight: 800;
  border: none; border-radius: 16px; background: var(--green); color: #fff; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.btn-primary:active { background: var(--green-dark); }
.photo {
  width: 140px; height: 140px; border-radius: 50%;
  background: var(--card); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; font-weight: 800; margin: 10px 0 2px;
  box-shadow: var(--shadow); border: 3px solid rgba(255, 255, 255, 0.6);
}
.pname { font-size: 36px; font-weight: 800; text-align: center; }
.status { font-size: 19px; color: var(--ink-soft); min-height: 28px; text-align: center; }
.btn-ring {
  width: 100%; min-height: 88px; font-size: 32px; font-weight: 900;
  border: none; border-radius: 22px; background: var(--green); color: #fff; cursor: pointer;
  margin-top: 10px; box-shadow: var(--shadow);
}
.btn-ring:active { background: var(--green-dark); }
.btn-secondary {
  width: 100%; min-height: 60px; font-size: 20px; font-weight: 700;
  border-radius: 16px; border: 2px solid rgba(128, 110, 90, 0.4); background: var(--card); color: var(--ink); cursor: pointer;
}
/* AnhÃ¶riga-admin (1.9.0): lÃ¤gg-till-knapp, koppla-bort-knapp per kort,
 * dialogrubriker och engÃ¥ngslÃ¤nk-box. Samma varma formsprÃ¥k, smÃ¥ ytor sÃ¥
 * korten fÃ¶rblir kompakta och list-scrollen (1.6.3) bevaras. */
.add-btn {
  align-self: flex-start; min-height: 52px; padding: 8px 20px; font-size: 18px; font-weight: 800;
  border-radius: 14px; border: 2px solid var(--green, #2e7d32); background: var(--card); color: var(--ink); cursor: pointer;
  margin-bottom: 6px;
}
.unlink-btn {
  align-self: flex-end; background: none; border: 1px solid var(--red); color: var(--red);
  border-radius: 10px; padding: 6px 14px; min-height: 40px; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 6px;
}
/* 1.9.1 inline-KOPPLA fÃ¶r okopplad medlem: samma kompakta formsprÃ¥k, grÃ¶n. */
.link-btn {
  align-self: flex-end; background: none; border: 1px solid var(--green, #2e7d32); color: var(--green, #2e7d32);
  border-radius: 10px; padding: 6px 14px; min-height: 40px; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 6px;
}
/* 1.14.10 RADERA ANHÖRIG: samma kompakta formspråk som unlink-btn (kontot
 * raderas, inte bara relationen) — ingen ny färgpalett tillagd. */
.delete-btn {
  align-self: flex-end; background: none; border: 1px solid var(--red); color: var(--red);
  border-radius: 10px; padding: 6px 14px; min-height: 40px; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 6px;
}
/* 1.11.2 LÃ¤gg-till-dialog kompakt (endast denna dialog): hela lÃ¤ge A ska
 * rymmas pÃ¥ 600px-hÃ¶jd utan scroll. Globala formulÃ¤rstorlekar orÃ¶rda. */
#anhorig-add .dlg { gap: 4px; padding: 12px 18px; }
#anhorig-add .dlg-h { margin: 4px 0 2px; }
#anhorig-add .lbl { margin-top: 4px; }
#anhorig-add .field { padding: 9px 14px; font-size: 18px; }
#anhorig-add .cap-radio { padding: 5px 4px; }
#anhorig-add .cap-check { padding: 4px; }
#anhorig-add .dlg-row .btn-primary,
#anhorig-add .dlg-row .btn-secondary,
#anhorig-add .dlg-row .btn-avbryt { min-height: 46px; }
/* Tom felrad tar ingen plats (24px-reserv enbart vid felmeddelande). */
#anhorig-add .error:empty { display: none; }
/* BAKGRUND V1: kompakta thumbnail-rutnÃ¤t i Brukare-fliken (samma
 * markeringsprÃ¥k som teman: accent-ram = vald). Liten text under bild. */
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 8px; }
.bg-opt {
  border: 2px solid transparent; border-radius: 12px; background: none; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-weight: 600; color: inherit;
}
.bg-opt img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; display: block; background: rgba(128, 110, 90, 0.15); }
.bg-opt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-opt[aria-pressed="true"] { border-color: var(--accent); }
.dlg-h { font-size: 17px; margin: 10px 0 4px; }
.dlg-h:first-of-type { margin-top: 2px; }
.okbox {
  background: rgba(46, 125, 50, 0.1); border: 2px solid var(--green, #2e7d32);
  border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-size: 16px;
}
#add-existing-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.linklike {
  background: none; border: none; color: var(--ink-soft); font-size: 17px;
  padding: 14px; min-height: 48px; cursor: pointer; text-decoration: underline;
}
/* I18N 2c: pre-login sprÃ¥kvÃ¤xlare (Svenska | English | à¹„à¸—à¸¢). */
.lang-switch {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; flex-wrap: wrap; margin: 6px 0 2px;
}
.lang-label { font-size: 15px; color: var(--ink-soft); margin-right: 2px; }
.lang-btn {
  min-height: 48px; padding: 8px 16px; font-size: 17px; font-weight: 700;
  border-radius: 14px; border: 2px solid rgba(128, 110, 90, 0.4);
  background: var(--card); color: var(--ink); cursor: pointer;
}
.lang-btn.active, .lang-btn[aria-pressed="true"] {
  border-color: var(--green, #2e7d32);
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.25);
}
#ver {
  position: fixed;
  left: 50%;
  top: 5px;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 90;
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.2;
  padding: 2px 8px;
  pointer-events: none;
  opacity: 0.82;
  white-space: nowrap;
}
#login-as {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  z-index: 90;
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  padding: 2px 12px;
  border-radius: 12px;
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- Samtalsvy (Bild 2 + fÃ¤rdigt bakgrundsfacit) ---------- */
/* Bakgrunden Ã¤r DESIGNFACIT (O:\bilder\bakgrunder): faktisk bildfil,
 * aldrig egen CSS-gradient, aldrig stretchad X/Y (cover + center).
 * Gradienten pÃ¥ body ligger kvar som fallback under bilden. */
.screen-call { padding: 0 18px 10px; max-width: none; gap: 0; }
body[data-theme="varm"] .screen-call { background-image: url("./backgrounds/warm/mtold_bg_warm_clean_1920x1080.png"); }
body[data-theme="mork"] .screen-call { background-image: url("./backgrounds/dark/mtold_bg_dark_clean_1920x1080.png"); }
body[data-theme="bla"] .screen-call { background-image: url("./backgrounds/blue/mtold_bg_blue_clean_1920x1080.png"); }
body[data-theme="ljus"] .screen-call { background-image: url("./backgrounds/light/mtold_bg_light_clean_1920x1080.png"); }
body[data-theme="gron"] .screen-call { background-image: url("./backgrounds/green/mtold_bg_green_clean_1920x1080.png"); }
body[data-theme="lila"] .screen-call { background-image: url("./backgrounds/purple/mtold_bg_purple_clean_1920x1080.png"); }
.screen-call {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* 1.6.8 CLEAN THEMES
   Every theme uses the verified text-free Warm CLEAN artwork as its spatial base.
   Theme identity comes from a translucent color wash, so no embedded branding,
   quotes, hearts or edge artifacts can reappear at another viewport size.
   1.6.13 LIVE-SYNC: call view uses per-theme CLEAN artwork (same verified
   text-free spatial base per theme) so saved theme is visible in call view
   and live-updates via body[data-theme] without call restart. Wash kept. */
.screen-call::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
body[data-theme="varm"] .screen-call::before { background: rgba(255, 224, 154, 0.02); }
body[data-theme="mork"] .screen-call::before { background: rgba(55, 58, 70, 0.28); }
body[data-theme="bla"] .screen-call::before { background: rgba(92, 166, 220, 0.24); }
body[data-theme="ljus"] .screen-call::before { background: rgba(255, 255, 255, 0.28); }
body[data-theme="gron"] .screen-call::before { background: rgba(96, 170, 105, 0.24); }
body[data-theme="lila"] .screen-call::before { background: rgba(166, 126, 201, 0.22); }

/* Keep actual UI above the decorative wash. */
.screen-call > * {
  position: relative;
  z-index: 1;
}

/* HTML-logotyp dÃ¶ljs i samtalsvyn: bilden har inbakad logotyp/slogan.
 * Klocka/datum behÃ¥lls uppe hÃ¶ger (ingen motsvarighet i bilden). */
.screen-call .brand-mini { visibility: hidden; }
/* Slim topprad: endast klocka/datum uppe hÃ¶ger (sekundÃ¤rt). */
/* 1.6.2: branding/header-zon med riktig HTML (clean bakgrund har ingen
 * inbakad text). Hela huvudgruppen flyttas ned som EN ENHET via denna
 * zon â€” intern 1.6.1-geometri orÃ¶rd. */
.call-top {
  width: 100%; max-width: 1760px; display: flex; justify-content: space-between; align-items: flex-start;
  padding: 8px 10px 4px; min-height: 44px; box-sizing: border-box;
}
/* VÃ¤nster branding: Ã¥teranvÃ¤nder login-formsprÃ¥ket (.brand-row etc.)
 * med samtalsanpassad storlek. Riktiga element â€” aldrig inbakade. */
.call-brand .brand-row { margin: 0; gap: 8px; }
.call-brand .brand-heart { font-size: 27px; }
.call-brand .brand { font-size: 27px; letter-spacing: 3px; }
.call-brand .brand-sub { font-size: 14px; margin: 2px 0 0 34px; }
/* HÃ¶ger branding: citat + diskret hjÃ¤rta + klocka/datum (sekundÃ¤rt). */
.call-brand-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.brand-quote {
  font-size: 18px; line-height: 1.25; font-weight: 500; font-style: italic;
  color: var(--ink); opacity: 0.85; text-align: right;
  white-space: pre-line; /* I18N 2c: \n i brand.quote bryts som tidigare <br> */
  text-shadow: 0 1px 3px rgba(60, 30, 0, 0.2), 0 0 24px var(--glow);
}
.brand-heartline { font-size: 18px; color: var(--ink-soft); line-height: 1; }
.call-top .call-clock { font-size: 16px; }
.call-top #call-date { font-size: 11px; }
/* Klocka/datum pÃ¥ en rad i headern (sparar hÃ¶jd â€” funktioner fÃ¶rst). */
.call-top .call-datetime { flex-direction: row; align-items: baseline; gap: 8px; }
.call-datetime { display: flex; flex-direction: column; align-items: flex-end; gap: 0; }
.call-clock { font-size: 19px; font-weight: 700; opacity: 0.85; }
#call-date { font-size: 12px; font-weight: 400; opacity: 0.7; }
.call-grid {
  width: 100%; max-width: 1760px; flex: 1 1 auto; min-height: 0;
  max-height: calc(100dvh - 118px);
  display: flex; gap: 28px; align-items: stretch; justify-content: center;
  /* 1.6.2: headerzonen ovan ger luften â€” hÃ¤r endast liten andning. */
  padding-top: clamp(4px, 1dvh, 8px); box-sizing: border-box;
}
/* VÃ¤nster: smal verktygspanel + citat under (citat konkurrerar aldrig). */
/* Facit v3-ordning: verktyg(1) | video(2) | notes(3) | citat(4, lÃ¤ngst hÃ¶ger).
 * Endast presentation â€” samma DOM, samma funktioner/state/data. */
.call-tools {
  order: 1;
  flex: 0 0 118px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--card); border-radius: var(--radius-lg);
  padding: 12px 8px; max-height: 100%; overflow-y: auto;
  box-shadow: var(--shadow);
  margin-top: clamp(40px, 9dvh, 130px); margin-bottom: 8px;
}
.tool-btn {
  background: none; border: none; cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100%; padding: 5px 2px; font-size: 13px; font-weight: 600;
}
.tool-btn .ic {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--green); color: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 90ms ease-out, box-shadow 90ms ease-out, background-color 90ms ease-out;
}
.tool-btn:active .ic { transform: translateY(2px); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.tool-btn .ic svg { width: 56%; height: 56%; display: block; }
.tool-btn[aria-pressed="false"] .ic { background: rgba(120, 120, 128, 0.9); }
.tool-btn .lb { line-height: 1.2; text-align: center; }
.tools-div { width: 60%; border-top: 1px solid rgba(128, 110, 90, 0.35); margin: 4px 0; }
.tools-status {
  margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 13px; font-weight: 600; color: var(--ink); text-align: center;
  background: rgba(128, 110, 90, 0.12); border-radius: 12px; padding: 8px 6px; width: 100%;
}
.tools-status .dot { width: 10px; height: 10px; border-radius: 50%; background: #43d17c; box-shadow: 0 0 8px #43d17c; }
#call-timer { font-size: 12px; font-weight: 400; opacity: 0.8; }
/* VÃ¤nster citatkolumn: varm detalj, sekundÃ¤r till videon. */
/* Facit v3: citatet ligger lÃ¤ngst till hÃ¶ger som lugn dekor â€” det fÃ¥r
 * aldrig trÃ¤nga sig mellan verktyg och video eller nudda videoramen. */
.quote-col {
  order: 4;
  flex: 0 1 200px; display: flex; flex-direction: column; justify-content: center; gap: 10px;
  padding: 0 6px;
}
.quote-text {
  font-size: 24px; line-height: 1.4; font-weight: 500; font-style: italic;
  color: var(--ink); opacity: 0.8; white-space: pre-line; max-width: 220px;
  text-shadow: 0 1px 3px rgba(60, 30, 0, 0.2), 0 0 24px var(--glow);
}
.quote-heart { font-size: 28px; color: var(--ink-soft); }
/* Mitten: STOR huvudvideo (facit ~900Ã—900 @1080), contain, ingen crop. */
/* Facit v3: stabil Standard-storlek â€” Ã¤ndras ALDRIG vid notes PÃ…/AV.
 * Endast placeringen Ã¤ndras (centrering styrs av .notes-off-regeln). */
.video-col { order: 2; flex: 0 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.video-frame {
  position: relative;
  height: min(900px, calc(100dvh - 130px));
  aspect-ratio: 1 / 1;
  max-width: 100%;
  border-radius: 26px;
  overflow: hidden;
  background: #1c1512;
  /* Facit v3 TYDLIGT LYFT: tunn varm premiumram + mjukt djup + tydlig men
   * elegant skugga + subtil varm ljuseffekt. Taktilt, lugnt, premium â€”
   * INTE neon/cyber, INTE platt CSS-box. Slutresultatet Ã¤r det som rÃ¤knas. */
  border: 6px solid #fdf1da;
  box-shadow:
    0 0 0 1px rgba(146, 106, 58, 0.55),
    0 2px 6px rgba(255, 250, 238, 0.70),
    0 24px 60px rgba(60, 35, 10, 0.38),
    0 8px 22px rgba(60, 35, 10, 0.28),
    0 0 46px rgba(255, 236, 200, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
/* Brukarens namn: centrerat i videons Ã¶vre omrÃ¥de (facit),
 * tydligt och elegant. Vit + skugga fungerar pÃ¥ alla teman. */
.peer-chip {
  position: absolute; top: 22px; left: 0; right: 0; z-index: 3;
  text-align: center; font-size: 26px; font-weight: 700; letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.96); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
/* 1.6.10: litet LiveKit-anslutningshjÃ¤rta DIREKT efter deltagarens namn
 * i videokortets namnrad. Representerar MOTPARTEN/Brukaren (remote
 * participant), inte egen dator. Enkel CSS-puls ("hjÃ¤rtslag"), aldrig
 * blink. FÃ¤rgen visar state Ã¤ven vid prefers-reduced-motion. */
.quality-heart {
  display: inline-block;
  font-size: 0.8em; line-height: 1; margin-left: 10px; vertical-align: baseline;
  color: #9aa0a6;
  animation: none;
}
.quality-heart[data-q="good"] {
  color: #35c26e; text-shadow: 0 0 10px rgba(53, 194, 110, 0.65);
  animation: quality-beat 3.2s ease-in-out infinite;
}
.quality-heart[data-q="poor"] {
  color: #e6b93d; text-shadow: 0 0 10px rgba(230, 185, 61, 0.65);
  animation: quality-beat 2.2s ease-in-out infinite;
}
.quality-heart[data-q="bad"] {
  color: #e05252; text-shadow: 0 0 12px rgba(224, 82, 82, 0.8);
  animation: quality-beat 1.5s ease-in-out infinite;
}
.quality-heart[hidden] { display: none; }
/* 1.6.11: lugnt hjÃ¤rtslag â€” mjuk fade + litet hjÃ¤rtslag (max ~9 %),
 * kort vila, upprepning. Opacity 0.55â€“1.0, fÃ¶rsvinner aldrig helt.
 * Varmt/lugnt/mjukt â€” aldrig hÃ¥rd blinkning, aldrig alarm. */
@keyframes quality-beat {
  0% { transform: scale(1); opacity: 0.72; filter: brightness(1); }
  18% { transform: scale(1); opacity: 1; filter: brightness(1.15); }
  34% { transform: scale(1.09); opacity: 1; filter: brightness(1.22); }
  52% { transform: scale(1); opacity: 0.85; filter: brightness(1.05); }
  68% { transform: scale(1); opacity: 0.62; filter: brightness(0.98); }
  82% { transform: scale(1); opacity: 0.55; filter: brightness(0.96); }
  100% { transform: scale(1); opacity: 0.72; filter: brightness(1); }
}
@media (prefers-reduced-motion: reduce) {
  .quality-heart { animation: none; }
}
#remoteVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #1c1512; }
.status-overlay {
  position: absolute; top: 66px; left: 50%; transform: translateX(-50%);
  color: #fff; background: rgba(0, 0, 0, 0.55);
  padding: 8px 16px; border-radius: 12px; max-width: 90%;
  font-size: 17px; min-height: 0;
}
.status-overlay:empty { display: none; }
.selfview {
  position: absolute; top: 10px; right: 10px;
  width: clamp(110px, 24%, 150px); aspect-ratio: 3 / 4;
  border-radius: 14px; overflow: hidden; background: #212121;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}
.selfview[hidden] { display: none; }
#localVideo { width: 100%; height: 100%; object-fit: cover; background: #212121; }
.selfview-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 13px; font-weight: 700; color: #fff; text-align: center;
  background: rgba(0, 0, 0, 0.5); padding: 2px 4px;
}
.selfview-off {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 700; background: #212121;
}
.selfview-off[hidden] { display: none; }
/* AVSLUTA: rÃ¶d glass-overlay centrerad i videons nederkant (facit).
 * Alltid tillgÃ¤nglig. Funktionalitet ofÃ¶rÃ¤ndrad (samma id/handler). */
.btn-hangup-overlay {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 26px; z-index: 4;
  display: flex; align-items: center; gap: 12px;
  min-width: 210px; min-height: 68px; padding: 14px 34px;
  border: none; border-radius: 22px; cursor: pointer;
  background: rgba(211, 47, 47, 0.94); color: #fff;
  font-size: 24px; font-weight: 800; letter-spacing: 0.5px;
  box-shadow: 0 4px 22px rgba(150, 20, 20, 0.5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: transform 90ms ease-out, box-shadow 90ms ease-out;
}
.btn-hangup-overlay:active {
  transform: translateX(-50%) translateY(2px);
  box-shadow: 0 1px 8px rgba(150, 20, 20, 0.5);
}
.btn-hangup-overlay .ic { width: 34px; height: 34px; display: flex; }
.btn-hangup-overlay .ic svg { width: 100%; height: 100%; display: block; transform: rotate(135deg); }
.btn-hangup-overlay .lb { line-height: 1; }
/* HÃ¶ger: anteckningspapper (AH-privat, syns aldrig fÃ¶r Brukaren).
 * StrÃ¤cks med videohÃ¶jd: del av samma huvudkomposition.
 * Facit v3: blocket flyttat tydligt Ã¥t hÃ¶ger med ordentligt andrum mot
 * videon â€” det fÃ¥r aldrig kÃ¤nnas fastklistrat pÃ¥ videoramen. */
.notes-col { order: 3; flex: 0 1 340px; display: flex; align-items: stretch; min-height: 0; position: relative; margin-left: 20px; }
/* Facit v3 Notes AV: samma Standard-videostorlek, samma proportioner,
 * samma frame, samma lyft â€” endast horisontellt balanserat centrerad.
 * Ingen tredje layout, ingen fÃ¶rstoring. JS sÃ¤tter body.notes-off nÃ¤r
 * Anteckningar Ã¤r AV (se applyCallDecor). */
body.notes-off:not([data-layout="large"]) .call-grid { justify-content: center; }
body.notes-off:not([data-layout="large"]) #notes-col { display: none !important; }
@media (min-width: 921px) {
  /* LÃ¥st UX-regel (1.6.1): panelen pinned vÃ¤nster, videon centreras i
   * Ã¥terstÃ¥ende yta (inte gruppcentrering). Samma storlek â€” endast X. */
  body.notes-off:not([data-layout="large"]) .video-col { flex: 1 1 auto; }
}
/* Dekorativ blyertspenna bredvid blocket: ingen knapp, ingen funktion.
 * Klick gÃ¥r igenom (pointer-events:none), tÃ¤cker aldrig text/knappar. */
/* 1.6.8: pennan ska lÃ¤sas som en riktig penna som hÃ¶r till blocket â€”
 * diagonalt vilande mot blockets Ã¶vre hÃ¶gra hÃ¶rn, inte som en vertikal
 * markÃ¶r/scrollbar lÃ¤ngs kanten. Endast presentation; samma SVG. */
.pencil-deco {
  position: absolute; left: auto; right: 4px; top: 18px; width: 62px; height: auto;
  transform: rotate(24deg); transform-origin: 50% 20%;
  filter: drop-shadow(0 6px 10px rgba(60, 30, 0, 0.45));
  pointer-events: none; z-index: 1;
}
.notes-paper {
  position: relative; isolation: isolate;
  width: 100%; height: 100%; min-height: 0; border-radius: 12px; padding: 14px 14px 16px;
  background: var(--paper); color: var(--paper-ink);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
/* 3D-block: underliggande pappersark (hÃ¶ger/botten) + tunna synliga
 * papperskanter + mjuk bordsskugga. KÃ¤nns ~4â€“6 mm upphÃ¶jt, aldrig
 * kitsch. Samma block, samma funktioner â€” endast djup. */
.notes-paper::before, .notes-paper::after {
  content: ""; position: absolute; inset: 0; border-radius: 10px; z-index: -1;
}
.notes-paper::before {
  transform: rotate(0.7deg) translate(4px, 5px);
  background: #f4e7bd;
  box-shadow: 0 12px 26px rgba(60, 35, 10, 0.28);
}
.notes-paper::after {
  transform: rotate(-0.6deg) translate(-3px, 9px);
  background: #eddcab;
  box-shadow: 0 16px 30px rgba(60, 35, 10, 0.24);
}
/* Tunna papperskanter lÃ¤ngs hÃ¶ger/nederkant (fysiska ark i blocket). */
.notes-paper {
  box-shadow: var(--shadow),
    2px 0 0 #efe0b8, 4px 0 0 #e9d5a4,
    0 2px 0 #efe0b8, 0 4px 0 #e9d5a4,
    2px 2px 0 #e9d5a4,
    0 20px 36px rgba(60, 35, 10, 0.3);
}
.notes-head { display: flex; justify-content: space-between; align-items: center; font-size: 19px; font-weight: 800; margin-bottom: 4px; }
/* Datumrad i blocket (facit): diskret, hÃ¶gerstÃ¤lld. SÃ¤tts per samtal. */
.notes-date { text-align: right; font-size: 13px; color: var(--paper-ink); opacity: 0.7; margin: 0 0 4px; }
.notes-date:empty { display: none; }
.icon-btn { background: none; border: none; font-size: 20px; cursor: pointer; padding: 6px; color: inherit; }
/* Tydliga focus-states (tangentbord). :active fÃ¶rstÃ¶r aldrig focus. */
.tool-btn:focus-visible, .notes-btn:focus-visible, .btn-hangup-overlay:focus-visible,
.tsw:focus-visible, .btn-primary:focus-visible, .btn-secondary:focus-visible,
.btn-ring:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
/* Reducerad rÃ¶relse: ingen onÃ¶dig animation, funktion alltid intakt. */
@media (prefers-reduced-motion: reduce) {
  .notes-btn, .tool-btn .ic, .btn-hangup-overlay { transition: none; }
  .notes-btn:active { transform: none; }
  .tool-btn:active .ic { transform: none; }
  .btn-hangup-overlay:active { transform: translateX(-50%); }
}
#notes-text {
  width: 100%; flex: 1; resize: none; min-height: 170px;
  font-size: 17px; line-height: 28px; color: var(--paper-ink);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, var(--paper-line) 27px, var(--paper-line) 28px);
  border: 0; outline: none; font-family: inherit; padding: 2px 58px 0 4px;
}
/* Tre anteckningsfunktioner: NY / SPARA / SKRIV UT.
 * LÃ¤tt upphÃ¶jda fysiska premiumknappar: subtil hÃ¶jd, mjuk skugga,
 * highlight upptill, mÃ¶rkare kegg nedtill. Sjunker 2 px vid tryck. */
.notes-actions { display: flex; gap: 8px; margin-top: 10px; }
.notes-btn {
  flex: 1; min-height: 46px; font-size: 16px; font-weight: 700;
  border-radius: 10px; border: 1px solid rgba(120, 90, 30, 0.22);
  background: rgba(255, 255, 255, 0.55);
  color: var(--paper-ink); cursor: pointer;
  box-shadow: 0 2px 0 rgba(120, 90, 30, 0.35), 0 5px 12px rgba(60, 35, 10, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 90ms ease-out, box-shadow 90ms ease-out, background-color 90ms ease-out;
}
.notes-btn:hover { background: rgba(255, 255, 255, 0.75); }
.notes-btn svg { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; }
.notes-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 rgba(120, 90, 30, 0.3), 0 1px 3px rgba(60, 35, 10, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
/* Utskrift: ren anteckning, aldrig GUI-skÃ¤rmen. */
#print-sheet { display: none; }
@media print {
  body { background: #fff !important; }
  body * { visibility: hidden; }
  #print-sheet, #print-sheet * { visibility: visible; }
  #print-sheet {
    display: block; position: absolute; inset: 0; padding: 28px; color: #000;
  }
  #print-sheet h1 { font-size: 22px; margin: 0 0 8px; }
  #print-sheet p { font-size: 15px; }
  #print-sheet pre { white-space: pre-wrap; font-size: 15px; font-family: inherit; }
}
/* Utskrift: inloggningsuppgifter fÃ¶r Ã¤ldre â€” stor tydlig text, EXAKT 1 sida.
 * Syskon dÃ¶ljs med display:none (visibility lÃ¤mnar layout och gav 2 sidor). */
#cred-print-sheet { display: none; }
@media print {
  body.printing-creds > :not(#cred-print-sheet) { display: none !important; }
  body.printing-creds #cred-print-sheet {
    display: block; position: static; padding: 0; color: #000;
  }
  #cred-print-sheet h1, #cred-print-sheet h1 * { visibility: visible; }
  #cred-print-sheet p, #cred-print-sheet p * { visibility: visible; }
  #cred-print-sheet h1 { font-size: 40px; margin: 0 0 16px; }
  #cred-print-sheet p { font-size: 24px; line-height: 1.7; white-space: pre-wrap; font-family: inherit; margin: 0; }
}
/* Inloggningsuppgifter i dialogen: tydligt lÃ¤sbara, ingen tekniktext. */
.cred-sheet {
  background: rgba(46, 125, 50, 0.08); border: 2px solid var(--green, #2e7d32);
  border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: 19px;
}
.cred-brand { font-size: 26px; font-weight: 900; margin-bottom: 6px; }
.cred-line { margin: 4px 0; overflow-wrap: anywhere; }
/* Liten SPARA-dialog */
.dlg-backdrop {
  position: fixed; inset: 0; background: rgba(20, 12, 6, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.dlg-backdrop[hidden] { display: none; }
.dlg { width: min(440px, 100%); background: var(--card); color: var(--ink); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
/* 1.11.1 LÃ¤gg-till-dialog: bredare + lÃ¤gre pÃ¥ desktop (tvÃ¥ kolumner) sÃ¥
 * hela dialogen rymms utan scroll. ALDRIG horisontell scroll hÃ¤rifrÃ¥n. */
.dlg-wide { width: min(720px, 100%); }
.add-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; min-height: 0; }
.add-cols > div { min-width: 0; }
/* hidden-attributet fÃ¶rlorar mot display:grid (author slÃ¥r UA) â€” explicit. */
#add-cols[hidden], #add-result-box[hidden] { display: none; }
@media (max-width: 640px) {
  /* Mobil: en kolumn; scroll i dialogen accepteras endast hÃ¤r. */
  .add-cols { grid-template-columns: 1fr; }
  .dlg-wide { max-height: calc(100dvh - 40px); overflow-y: auto; overflow-x: hidden; }
}
.dlg-title { font-size: 22px; font-weight: 800; }
.dlg-row { display: flex; gap: 10px; }
.dlg-row .btn-primary, .dlg-row .btn-secondary, .dlg-row .btn-avbryt { min-height: 54px; font-size: 19px; flex: 1 1 0; min-width: 0; }

/* ---------- InstÃ¤llningar-panel (Bild 1) ---------- */
/* 1.6.3: fasta kontroller (header/flikar/footer) ligger still; endast
 * verkligt lÃ¥nga dynamiska listor scrollar internt (.settings-list).
 * DÃ¥lig disposition-scroll = fel; list-scroll vid behov = tillÃ¥tet. */
.screen-settings { max-width: 760px; justify-content: flex-start; padding-top: 24px; max-height: 100dvh; }
.panel {
  width: 100%; background: rgba(255, 255, 255, 0.94); color: #2c2620;
  border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column; max-height: calc(100dvh - 48px);
}
body[data-theme="mork"] .panel { background: rgba(30, 33, 39, 0.96); color: #f2ede4; }
.panel-head {
  display: flex; justify-content: space-between; align-items: center; flex: none;
  font-size: 20px; font-weight: 800; padding: 12px 14px 8px;
}
.panel-head .icon-btn { color: inherit; }
/* PrimÃ¤r stÃ¤ngning: SPARA / STÃ„NG nere till hÃ¶ger. GUI-instÃ¤llningar
 * sparas redan omedelbart vid Ã¤ndring â€” knappen bekrÃ¤ftar + returnerar
 * korrekt (samma returvÃ¤g som X, aldrig home under ACTIVE). */
.panel-foot { padding: 8px 14px 14px; display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex: none; }
.panel-foot .btn-primary { width: auto; min-width: 220px; min-height: 52px; font-size: 20px; }
/* 1.6.8: fast transaktionell footer â€” RÃ–D AVBRYT + GRÃ–N SPARA OCH STÃ„NG.
 * Samma varma formsprÃ¥k, stora klickytor. */
.btn-avbryt {
  min-width: 160px; min-height: 52px; font-size: 20px; font-weight: 800;
  border: none; border-radius: 16px; background: var(--red); color: #fff; cursor: pointer;
  box-shadow: var(--shadow-sm); padding: 0 28px;
}
.btn-avbryt:active { background: var(--red-dark); }
.foot-msg { flex: 1 1 auto; font-size: 15px; color: var(--ink-soft); text-align: left; }
.foot-msg:empty { display: none; }
.tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 2px solid rgba(128, 110, 90, 0.25); flex: none; }
.tab {
  background: none; border: none; cursor: pointer; font-size: 17px; font-weight: 600;
  color: inherit; opacity: 0.65; padding: 10px 14px; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab[aria-selected="true"] { opacity: 1; border-bottom-color: var(--accent); }
/* 1.13.0: hidden-attributet fÃ¶rlorar mot author-display (samma bugklass som
 * #add-cols) â€” explicit sÃ¥ flikrad/innehÃ¥ll/footer verkligen dÃ¶ljs i menyn. */
.tabs[hidden], .tab-body[hidden], .panel-foot[hidden] { display: none; }
/* 1.13.0 footer med tre knappar (SPARA + AVBRYT + SPARA OCH STÃ„NG). */
#settings-foot { flex-wrap: wrap; }
/* SPARA ska alltid vara tydligt synlig som den primara spar-knappen:
 * gron bakgrund + vit text. Samma storlek/placering som tidigare.
 * (Tidigare vit/transparent -> uppfattades felaktigt som SPARA OCH STANG.) */
#settings-foot .btn-secondary {
  width: auto; min-width: 150px; min-height: 52px; font-size: 20px;
  border: 2px solid var(--green-dark); background: var(--green); color: #fff;
  box-shadow: var(--shadow-sm);
}
#settings-foot .btn-secondary:hover { background: var(--green-dark); }
#settings-foot .btn-secondary:active { background: #0f3f14; }
#settings-foot .btn-secondary:disabled { opacity: 0.45; cursor: default; }
/* 1.10.1: innehÃ¥llsdelen scrollar vertikalt nÃ¤r fliksinnehÃ¥ll (t.ex.
 * Brukare: namn/skÃ¤rmvila/sprÃ¥k/bakgrund) Ã¶verstiger visningsytan.
 * Header/flikar/footer Ã¤r flex:none och ligger still. Ingen horisontell
 * scroll. Inre .settings-list behÃ¥ller egen intern scroll. */
.tab-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
/* Flexkedjan mÃ¥ste begrÃ¤nsa hÃ¶jd i varje led â€” annars vÃ¤xer sektionen
 * med innehÃ¥llet i stÃ¤llet fÃ¶r att listan scrollar internt. */
.tabpane { min-height: 0; }
.tabpane:not([hidden]) { display: flex; flex-direction: column; }
/* Endast verkligt lÃ¥nga dynamiska listor scrollar â€” internt avgrÃ¤nsat. */
.settings-list { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
/* AVSLUTA i InstÃ¤llningar: endast under aktivt samtal (hidden annars).
 * Samma end-call-handler som vanliga AVSLUTA â€” ingen duplicerad logik. */
.btn-hangup-settings {
  display: block; width: calc(100% - 36px); margin: 0 18px 4px;
  min-height: 62px; font-size: 20px; font-weight: 800; letter-spacing: 0.5px;
  border: none; border-radius: 14px; background: var(--red); color: #fff; cursor: pointer;
  box-shadow: 0 2px 12px rgba(150, 20, 20, 0.4);
}
.btn-hangup-settings[hidden] { display: none; }
.tab-body h3 { font-size: 17px; margin: 8px 0 4px; }
.tab-body h3:first-child { margin-top: 0; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tsw {
  border: 2px solid transparent; border-radius: 14px; background: none; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: inherit;
}
.tsw .sw { height: 52px; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.tsw .sw {
  background-image:
    linear-gradient(var(--theme-wash), var(--theme-wash)),
    url("./backgrounds/warm/mtold_bg_warm_clean_1920x1080.png");
  background-size: cover;
  background-position: center;
}
.tsw[data-t="varm"] { --theme-wash: rgba(246, 194, 102, 0.12); }
.tsw[data-t="mork"] { --theme-wash: rgba(31, 35, 44, 0.64); }
.tsw[data-t="bla"]  { --theme-wash: rgba(64, 145, 214, 0.54); }
.tsw[data-t="ljus"] { --theme-wash: rgba(255, 255, 255, 0.72); }
.tsw[data-t="gron"] { --theme-wash: rgba(72, 151, 91, 0.54); }
.tsw[data-t="lila"] { --theme-wash: rgba(143, 94, 190, 0.54); }
.tsw[aria-pressed="true"] { border-color: var(--accent); }
.tsw[aria-pressed="true"] .sw { box-shadow: inset 0 0 0 2px var(--accent); }
.swatches { display: flex; gap: 10px; }
.swatches .sw {
  width: 40px; height: 40px; border-radius: 12px; cursor: pointer;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.swatches .sw[aria-pressed="true"] { border-color: var(--accent); }
#settings-about, #settings-caps, #settings-people { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
/* 1.6.3: GUI-layout som tvÃ¥ kort sida vid sida (en enda instÃ¤llning,
 * endast hÃ¤r under Utseende). */
#appear-layout { display: flex; flex-wrap: wrap; gap: 8px; }
#appear-layout .cap-guilabel { flex: 1 1 100%; }
#appear-layout .cap-radio {
  flex: 1 1 220px; border: 2px solid rgba(128, 110, 90, 0.3); border-radius: 12px;
  padding: 10px 12px; align-items: center;
}
.person-row {
  background: var(--card); border: 2px solid rgba(128, 110, 90, 0.3); border-radius: 14px;
  padding: 12px 14px; font-size: 19px; font-weight: 700; color: var(--ink);
}
body[data-theme="mork"] .person-row { border-color: rgba(255, 255, 255, 0.2); }
.person-sub { font-size: 16px; font-weight: 400; color: var(--ink-soft); }
.cap-check {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 400; padding: 6px 4px; cursor: pointer;
}
.cap-check input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--green); flex: none; }
/* 1.6.3: kompakt AnhÃ¶rig-kort â€” namn, funktioner horisontellt, SPARA hÃ¶ger.
 * Samma PATCH-logik, samma state; endast mÃ¶blering. */
.cap-card { padding: 12px 14px; }
.cap-name { font-size: 20px; font-weight: 700; }
.cap-grid { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 4px 0 2px; }
.cap-msg { min-height: 22px; font-size: 14px; color: var(--ink-soft); margin-top: 2px; }
.cap-guilabel { font-weight: 700; font-size: 17px; margin: 6px 0 2px; }
.cap-radio { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; font-weight: 400; cursor: pointer; }
.cap-radio input[type="radio"] { width: 24px; height: 24px; accent-color: var(--green); flex: none; margin-top: 2px; }
/* SkÃ¤rmvila: kompakta tidsrader i samma kortsprÃ¥k (ingen layoutpÃ¥verkan). */
.sleep-row { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 400; padding: 6px 4px; cursor: pointer; }
.sleep-row input[type="time"] { font-size: 18px; font-weight: 600; color: var(--ink); background: var(--card, #fff); border: 2px solid rgba(128, 110, 90, 0.35); border-radius: 10px; padding: 6px 10px; min-height: 44px; }
.sleep-row input[type="time"]:disabled { opacity: 0.45; }

/* ---------- Layout 4: stor video / minimal (valbar per AH) ---------- */
/* LÃ…ST UX-regel (1.6.1): kontrollpanelen ALLTID VÃ„NSTER â€” Ã¤ven Stor bild.
 * Samma DOM-ordning som Standard (verktyg 1 | video 2 | notes 3 | citat 4)
 * sÃ¥ muskelminnet bevaras. Stor video maximeras, anteckningar Ã¤r Ã¶verlÃ¤gg.
 * Samma funktioner/state/data â€” endast presentation skiljer.
 * Large-panelen Ã¤r kompakt (facit slim): fÃ¥r aldrig scrolla i normal
 * desktopviewport â€” innehÃ¥llet dimensioneras att rymmas. */
body[data-layout="large"] .quote-col { display: none; }
body[data-layout="large"] .call-grid { justify-content: center; }
body[data-layout="large"] .call-tools { order: 1; }
body[data-layout="large"] .call-tools {
  flex-basis: 92px; padding: 10px 6px; gap: 5px;
  margin-top: clamp(16px, 6dvh, 90px); margin-bottom: 8px;
}
body[data-layout="large"] .tool-btn { font-size: 11px; gap: 3px; padding: 3px 2px; }
body[data-layout="large"] .tool-btn .ic { width: 38px; height: 38px; }
body[data-layout="large"] .tools-status { font-size: 11px; padding: 6px 4px; gap: 2px; }
body[data-layout="large"] #call-timer { font-size: 11px; }
body[data-layout="large"] .video-frame { height: min(960px, calc(100dvh - 122px)); }
body[data-layout="large"] #notes-col { display: none; }
body[data-layout="large"].notes-open #notes-col {
  display: flex; position: fixed; right: 18px; top: 50%; transform: translateY(-50%);
  z-index: 60; width: min(340px, 92vw); height: min(640px, calc(100dvh - 140px));
  flex: none;
}
/* LÃ…ST UX-regel (1.6.1): Stor bild + Anteckningar Ã¶ppnas temporÃ¤rt som
 * Ã¶verlÃ¤gg och stÃ¤ngs med tydlig STÃ„NG-knapp tillbaka till samma stora
 * video. Samma befintliga notes-funktionalitet â€” ingen serverlagring. */
.notes-overlay-close {
  display: none; position: absolute; top: -52px; right: 0; z-index: 61;
  min-height: 44px; padding: 10px 22px; font-size: 17px; font-weight: 800;
  border-radius: 12px; border: 1px solid rgba(120, 90, 30, 0.35); cursor: pointer;
  background: rgba(255, 255, 255, 0.92); color: var(--paper-ink, #2b2118);
  box-shadow: 0 4px 14px rgba(60, 35, 10, 0.3);
}
body[data-layout="large"].notes-open .notes-overlay-close { display: block; }

/* ---------- Responsivt ---------- */
@media (max-width: 1500px) {
  .call-grid { gap: 22px; }
  .quote-col { flex-basis: 160px; }
  .quote-text { font-size: 22px; }
  .notes-col { flex-basis: 272px; margin-left: 12px; }
  .call-tools { flex-basis: 104px; padding: 10px 6px; gap: 6px; }
  .tool-btn { gap: 2px; padding: 3px 2px; font-size: 11px; }
  .tool-btn .ic { width: 44px; height: 44px; }
  .tools-div { margin: 2px 0; }
  .tools-status { font-size: 11px; padding: 6px 4px; gap: 2px; }
  #call-timer { font-size: 11px; }
}
/* 1.6.3 viewport-fit: panelinnehÃ¥llet Ã¤r fast ~700px men krymper
 * gridhÃ¶jden med viewporten â€” utan detta fÃ¥r panelen egen scrollbar och
 * status klipps vid kort viewport. Kompaktering i steg, aldrig redesign:
 * stora klickytor och samma ordning/position behÃ¥lls. */
@media (max-height: 850px) {
  .call-tools { flex-basis: 104px; padding: 10px 6px; gap: 5px; margin-top: 24px; }
  .tool-btn { font-size: 12px; gap: 3px; padding: 4px 2px; }
  .tool-btn .ic { width: 46px; height: 46px; }
  .tools-status { font-size: 12px; padding: 6px 4px; }
  #call-timer { font-size: 11px; }
}
@media (max-height: 700px) {
  .call-tools { flex-basis: 96px; padding: 8px 4px; gap: 4px; margin-top: 12px; margin-bottom: 4px; }
  .tool-btn { font-size: 11px; gap: 2px; padding: 3px 2px; }
  .tool-btn .ic { width: 38px; height: 38px; }
  .tools-div { margin: 2px 0; }
  .tools-status { font-size: 11px; padding: 5px 4px; gap: 2px; }
  #call-timer { font-size: 10px; }
}
@media (max-height: 700px) {
  .call-top { padding: 6px 10px 4px; }
  .call-brand .brand-heart { font-size: 24px; }
  .call-brand .brand { font-size: 24px; }
  .call-brand .brand-sub { font-size: 13px; margin-left: 32px; }
  .brand-quote { font-size: 16px; }
  .brand-heartline { display: none; }
}
/* Smal fallback (mobil): staplat, verktygspanel horisontell Ã¶verst.
 * Desktopkraven 1366/1920 pÃ¥verkas inte. */
@media (max-width: 920px) {
  .brand-quote, .brand-heartline { display: none; }
  .call-brand .brand { font-size: 24px; }
  .call-brand .brand-heart { font-size: 24px; }
  .call-brand .brand-sub { font-size: 13px; margin-left: 32px; }
  .call-grid { flex-direction: column; align-items: center; overflow-y: auto; }
  .call-tools {
    flex: none; order: 0; width: 100%; max-width: 560px;
    flex-direction: row; flex-wrap: wrap; justify-content: center;
    max-height: none; padding: 10px; margin-top: 0; margin-bottom: 0;
  }
  .tool-btn { width: 76px; }
  .tools-div { display: none; }
  .tools-status { margin-top: 0; width: auto; flex-direction: row; padding: 8px 12px; }
  .quote-col { flex: none; order: 3; max-width: 420px; text-align: center; }
  .quote-text { max-width: none; }
  .video-col { order: 1; width: 100%; }
  .notes-col { flex: none; order: 2; width: min(420px, 100%); }
  .video-frame { height: min(60dvh, 520px); }
  body[data-layout="large"] .video-frame { height: min(70dvh, 560px); }
  .btn-hangup-overlay { min-width: 200px; min-height: 64px; font-size: 20px; bottom: 16px; }
}
@media (max-width: 600px) {
  .tool-btn { width: 68px; font-size: 11px; }
  .tool-btn .ic { width: 48px; height: 48px; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .peer-chip { font-size: 22px; top: 14px; }
}
@media (min-width: 700px) {
  .pname { font-size: 40px; }
  .photo { width: 170px; height: 170px; font-size: 80px; }
}
