/* Modelltár – közös stílus. Rajzlap-hangulat: hideg papírszürke, grafit tinta, kobalt kiemelés,
   sarokjelek (illesztőjelek) a lapokon. */

:root {
  --page: #e7eae8;
  --paper: #dde2df;
  --sheet: #f6f7f5;
  --ink: #1b201e;
  --graphite: #59625e;
  --rule: #c6ccc9;
  --rule-soft: #dfe3e1;
  --cobalt: #2441c6;
  --cobalt-soft: #e3e8fb;
  --poche: #2e3431;
  --alert: #a3401c;
  --panel-w: clamp(360px, 27vw, 420px);
  /* Képernyőszélek: a telefon kivágása / kerekítése (safe-area) és a böngésző rálógó felülete (iPad Safari
     felső sávja, Android címsor) — a --vv-* értékeket a common.js trackViewport() méri a visualViewport-ból. */
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --el: env(safe-area-inset-left, 0px); --er: env(safe-area-inset-right, 0px);
  --et: max(var(--sat), var(--vv-top, 0px)); --eb: max(var(--sab), var(--vv-bottom, 0px));
  --app-h: 100dvh; /* a ténylegesen látható magasság (JS felülírja) */
  --dock-space: 74px; /* az alsó sáv helye (16 + 50 px) + 8 px rés: a jobb oldali panel és a bal sáv e fölött ér véget */
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--page); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.muted { color: var(--graphite); }
output, .num, .readout, .facts dd { font-variant-numeric: tabular-nums; }

/* ---------- illesztőjelek: a rajzlap sarkai ---------- */
.marks, .card .thumb::after {
  --t: 12px; --w: 1.5px; --c: var(--ink);
  background-image:
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c));
  background-size:
    var(--t) var(--w), var(--w) var(--t), var(--t) var(--w), var(--w) var(--t),
    var(--t) var(--w), var(--w) var(--t), var(--t) var(--w), var(--w) var(--t);
  background-position:
    left top, left top, right top, right top,
    left bottom, left bottom, right bottom, right bottom;
  background-repeat: no-repeat;
}

/* ---------- gombok, mezők ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px; border: 1px solid var(--rule); border-radius: 6px; background: transparent;
  font-weight: 550; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #000; }
.btn.danger { background: var(--alert); border-color: var(--alert); color: #fff; }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { border-color: var(--rule); }
.danger-text { color: var(--alert); }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn {
  width: 26px; height: 26px; display: inline-grid; place-items: center; padding: 0;
  border: 1px solid transparent; border-radius: 5px; background: none; cursor: pointer; font-size: 15px; line-height: 1;
  color: var(--graphite);
}
.icon-btn:hover:not(:disabled) { border-color: var(--rule); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }

input[type=text], input[type=search], input[type=date], select {
  width: 100%; padding: 6px 9px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; min-height: 32px;
}
input[type=text]:focus, input[type=search]:focus, input[type=date]:focus, select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 2px var(--cobalt-soft); }
input[type=range] { width: 100%; accent-color: var(--cobalt); margin: 4px 0 0; }
input[type=color] { width: 34px; height: 28px; padding: 2px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; cursor: pointer; }

.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 11px; font-size: 12.5px; font-weight: 550; cursor: pointer; color: var(--graphite); }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed=true] { background: var(--ink); color: #fff; }
.seg.small button { padding: 4px 8px; font-size: 12px; }

.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 30px; height: 17px; border-radius: 9px; background: var(--rule); position: relative; margin: 0; cursor: pointer; flex: none; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--cobalt); }
.switch input:checked::after { transform: translateX(13px); }
.switch input:disabled, .switch input:disabled + span { opacity: .5; cursor: default; }
.switch:has(> input:disabled) { cursor: default; }
.switch.small { font-size: 12.5px; color: var(--graphite); }

/* ---------- galéria ---------- */
.gallery .g-head, .gallery .g-main { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.g-head { display: flex; align-items: center; justify-content: space-between; padding-top: 30px !important; padding-bottom: 22px !important; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; color: var(--ink); }
.brand h1 { font-size: 26px; font-weight: 650; letter-spacing: -.01em; }
.env-tag { font-size: 12px; color: var(--graphite); border: 1px solid var(--rule); border-radius: 20px; padding: 3px 10px; }

.drop {
  position: relative; display: grid; grid-template-columns: 1fr; gap: 18px;
  padding: 44px 48px; background-color: var(--sheet); border: 1px solid var(--rule-soft);
  transition: background-color .15s, border-color .15s;
}
.drop h2 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.drop p { color: var(--graphite); max-width: 60ch; margin-top: 6px; }
.drop-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.drop.over { background-color: var(--cobalt-soft); border-color: var(--cobalt); }
.drop.busy .drop-actions { opacity: .4; pointer-events: none; }
.upload { border-top: 1px solid var(--rule); padding-top: 16px; }
.upload-name { font-weight: 600; margin-bottom: 8px; }
.upload-info { font-size: 12.5px; color: var(--graphite); margin-top: 8px; overflow-wrap: anywhere; }
.upload.error .upload-info { color: var(--alert); font-weight: 550; }
.bar { height: 3px; background: var(--rule-soft); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--cobalt); transition: width .2s; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 40px 0 16px; }
.list-head h2 { font-size: 17px; font-weight: 650; }
.list-head input { max-width: 260px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 22px; padding-bottom: 60px; }
.empty { color: var(--graphite); padding: 20px 0 60px; }

.card { display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--rule-soft); }
.card .thumb { display: block; aspect-ratio: 4 / 3; background: var(--paper); overflow: hidden; position: relative; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .thumb::after { content: ""; position: absolute; inset: 8px; pointer-events: none; --c: rgba(27,32,30,.55); --t: 10px; --w: 1px; }
.card .thumb:hover::after { --c: var(--cobalt); --w: 2px; }
.thumb-empty { width: 100%; height: 100%; display: grid; place-items: center; color: var(--graphite); }
.thumb-empty svg { width: 46%; }
.card-body { padding: 12px 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card h3 { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.facts { font-size: 12.5px; color: var(--graphite); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.badge { font-size: 11.5px; padding: 1px 7px; border: 1px solid var(--rule); border-radius: 4px; color: var(--graphite); }
.badge.accent { border-color: var(--cobalt); color: var(--cobalt); }
.card-actions { display: flex; gap: 4px; margin-top: auto; padding-top: 10px; flex-wrap: wrap; }

/* ---------- párbeszéd, értesítés ---------- */
.dlg { border: 0; border-radius: 10px; padding: 0; width: min(560px, calc(100vw - 32px)); color: var(--ink); box-shadow: 0 20px 60px rgba(27, 32, 30, .25); }
.dlg::backdrop { background: rgba(27, 32, 30, .35); }
.dlg form { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.dlg h2 { font-size: 17px; font-weight: 650; overflow-wrap: anywhere; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.share { display: flex; flex-direction: column; gap: 14px; }
.share-new { display: flex; gap: 8px; }
.share-nickrow { display: flex; flex-direction: column; gap: 5px; margin-top: -6px; }
.share-nickhint { font-size: 12px; }
.share-nick { font-size: 12px; color: var(--cobalt); font-weight: 600; }
.share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; max-height: 50vh; overflow: auto; }
.share-list li { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--rule-soft); }
.share-meta { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.share-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.share-row input { flex: 1 1 220px; font-size: 12.5px; }

.toasts { position: fixed; left: 50%; bottom: calc(84px + var(--eb, 0px)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 6px; font-size: 13px; transition: opacity .4s, transform .4s; max-width: 80vw; }
.toast.error { background: var(--alert); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- nézegető ---------- */
body.viewer { overflow: hidden; background: #e3e7e5; font-size: 13px; overscroll-behavior: none; position: fixed; inset: 0; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; outline: none; }
#c.flying, #c.measuring { cursor: crosshair; }
:root { --pal-text: #8c9390; --pal-hover: #4c5450; --pal-line: #e1e4e2; }

.v-top { position: fixed; top: calc(14px + var(--et)); left: calc(16px + var(--el)); display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - var(--panel-w) - 100px); z-index: 5; }
.panel-closed .v-top, .read-only .v-top { max-width: calc(100vw - 90px); }
.help-btn { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; background: #fff; color: var(--pal-hover); font: 700 14px/1 var(--font); cursor: pointer; box-shadow: 0 3px 14px rgba(27, 32, 30, .08); }
.help-btn:hover, .help-btn[aria-expanded=true] { color: var(--ink); }
.help-pop { position: fixed; z-index: 9; top: calc(54px + var(--et)); left: calc(16px + var(--el)); width: min(340px, calc(100vw - 32px)); padding: 14px 16px 16px; background: #fff; border-radius: 16px; box-shadow: 0 0 12px rgba(0, 0, 0, .18); }
.help-pop h3 { font-size: 13px; font-weight: 650; }
.back { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px 6px 8px; border-radius: 999px; text-decoration: none; background: #fff; color: var(--pal-hover); font-weight: 600; box-shadow: 0 3px 14px rgba(27, 32, 30, .08); }
.back svg { width: 16px; height: 16px; flex: none; }
.back { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.back h1 { display: block; flex: 0 1 auto; color: var(--ink); min-width: 0; max-width: 100%; }
.read-only .back { padding-left: 14px; pointer-events: none; cursor: default; }
.back:hover { color: var(--ink); }
.v-top h1 { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state, .status { font-size: 12px; color: var(--graphite); white-space: nowrap; }
.status { padding: 3px 10px; background: #fff; border-radius: 999px; box-shadow: 0 3px 14px rgba(27, 32, 30, .08); }

/* fehér paletták: lekerekített végek, szürke szöveg, a kiválasztott fekete */
.pal { display: flex; align-items: center; gap: 2px; background: #fff; border-radius: 999px; padding: 4px 8px; box-shadow: 0 4px 22px rgba(27, 32, 30, .10), 0 0 0 1px rgba(27, 32, 30, .04); }
.pal button { border: 0; background: none; color: var(--pal-text); font: 550 13px/1 var(--font); padding: 9px 11px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: color .12s; }
.pal button:hover { color: var(--pal-hover); }
.pal button[aria-pressed=true] { color: var(--ink); font-weight: 700; }
.pal .grp { display: flex; align-items: center; }
.pal .sep { display: block; width: 1px; height: 18px; background: var(--pal-line); margin: 0 6px; flex: none; }
.pal.col { flex-direction: column; align-items: stretch; border-radius: 22px; padding: 8px 4px; gap: 0; }
.pal.col button { padding: 8px 14px; text-align: left; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.pal.col .sep { width: auto; height: 1px; margin: 5px 10px; }

/* alsó sáv: iránytű + paletta, együtt középen */
/* alsó sáv: mindig vízszintesen középen; az iránytű a sáv bal oldalán, a sáv középvonalához igazítva (nem tolja el a sávot) */
.bottom-bar { position: fixed; bottom: calc(16px + var(--eb)); left: 50%; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; max-width: calc(100vw - 160px); }
.dock { position: relative; min-width: 0; overflow-x: auto; scrollbar-width: none; }
/* alsó sáv: asztali gépen feliratok, telefonon (720 px alatt) minimalista vonalikonok */
.pal.icons button svg { display: none; }
/* ikonos mód: telefonon (720 px alatt), és ha szűk ablakban a feliratos sáv nem férne ki (.fit-icons, a main.js méri) */
.pal.icons.fit-icons { gap: 2px; padding: 5px 7px; }
.pal.icons.fit-icons button { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; transition: color .12s, background-color .15s; }
.pal.icons.fit-icons button .txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pal.icons.fit-icons button svg { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pal.icons.fit-icons button svg .fill { fill: currentColor; stroke: none; }
.pal.icons.fit-icons button svg .fill.soft { opacity: .28; }
.pal.icons.fit-icons button[aria-pressed=true] { color: var(--ink); background: #eef0ef; }
.pal.icons.fit-icons .sep { height: 22px; margin: 0 5px; }
@media (max-width: 720px) {
  .pal.icons { gap: 2px; padding: 5px 7px; }
  .pal.icons button { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; transition: color .12s, background-color .15s; }
  .pal.icons button .txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .pal.icons button svg { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .pal.icons button svg .fill { fill: currentColor; stroke: none; }
  .pal.icons button svg .fill.soft { opacity: .28; }
  .pal.icons button[aria-pressed=true] { color: var(--ink); background: #eef0ef; }
  .pal.icons .sep { height: 22px; margin: 0 5px; }
}

/* bal oldali paletták: egyforma szélesek */
.rail { position: fixed; left: calc(16px + var(--el)); top: calc(64px + var(--et)); bottom: calc(var(--dock-space) + var(--eb)); width: 148px; display: flex; flex-direction: column; z-index: 4; pointer-events: none; padding-bottom: 4px; }
/* az összes nézet egyetlen mezőben, ha nem fér ki, a mező belül görgethető */
.rail > .pal { flex: 0 1 auto; min-height: 0; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(27, 32, 30, .28) transparent; pointer-events: auto; align-self: stretch; box-shadow: 0 0 12px rgba(0, 0, 0, .18); -webkit-overflow-scrolling: touch; }
.rail > .pal::-webkit-scrollbar { width: 4px; }
.rail > .pal::-webkit-scrollbar-thumb { background: rgba(27, 32, 30, .28); border-radius: 4px; }
.rail .pal.col button { max-width: none; flex: none; }

/* iránytű */
.compass { position: absolute; right: calc(100% + 12px); top: 50%; margin-top: -25px; flex: none; width: 50px; height: 50px; pointer-events: none; border-radius: 50%; box-shadow: 0 4px 22px rgba(27, 32, 30, .10), 0 0 0 1px rgba(27, 32, 30, .04); }
.compass svg { width: 100%; height: 100%; display: block; }

/* jobb oldali panel: bezárva fekete kör, kinyitva kicsúszik */
.panel {
  position: fixed; top: calc(12px + var(--et)); right: calc(12px + var(--er)); width: var(--panel-w); height: calc(100vh - 12px - var(--dock-space)); height: calc(var(--app-h) - 12px - var(--dock-space) - var(--sat) - var(--sab)); z-index: 6;
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 12px rgba(0, 0, 0, .18);
  transition: width .42s cubic-bezier(.2, .8, .2, 1), height .42s cubic-bezier(.2, .8, .2, 1), border-radius .42s, background-color .3s;
}
/* zárva is világos (fehér kör), mint nyitott állapotban és mint az alsó sáv */
.panel-closed .panel { width: 44px; height: 44px; border-radius: 22px; background: #fff; box-shadow: 0 0 12px rgba(0, 0, 0, .18); }
.panel-body { position: absolute; top: 0; right: 0; bottom: 0; width: var(--panel-w); display: flex; flex-direction: column; transition: opacity .25s .18s; }
.panel-closed .panel-body { opacity: 0; visibility: hidden; transition: opacity .12s, visibility 0s .12s; }
.panel-toggle { position: absolute; top: 3px; right: 3px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; z-index: 2; color: var(--pal-hover); transition: color .3s, background-color .2s; }
.panel-toggle:hover { background: #f1f3f2; }
.panel-toggle svg { width: 18px; height: 18px; overflow: visible; display: block; }
/* mindhárom vonal az ikon középvonalán van, és a pontos középpont (10,10) körül mozog:
   zárva hamburger (fel/le tolva), nyitva pontosan középre álló X */
.panel-toggle path { stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; transform-box: view-box; transform-origin: 10px 10px; transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .2s; }
.panel-toggle .l1 { transform: translateY(-4px); }
.panel-toggle .l3 { transform: translateY(4px); }
.panel-toggle[aria-expanded=true] .l1 { transform: rotate(45deg) scaleX(.92); }
.panel-toggle[aria-expanded=true] .l2 { opacity: 0; transform: scaleX(.2); }
.panel-toggle[aria-expanded=true] .l3 { transform: rotate(-45deg) scaleX(.92); }
.panel-head { display: flex; align-items: center; gap: 2px; height: 44px; padding: 0 48px 0 18px; flex: none; }
.panel-title { flex: 1; font-size: 13px; font-weight: 650; color: var(--ink); }
.panel-head .hist { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); }
.panel-head .hist svg { width: 18px; height: 18px; }
.panel-head .hist:disabled { color: var(--pal-line); cursor: default; background: none; }
.tabs { display: flex; border-bottom: 1px solid var(--pal-line); padding: 0 8px; flex: none; min-height: 40px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 1 1 auto; border: 0; background: none; padding: 13px 3px 11px; white-space: nowrap; font-weight: 600; font-size: 12px; color: var(--pal-text); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--pal-hover); }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--ink); }
.pane { padding: 16px 16px 24px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.pane h3 { font-size: 13px; font-weight: 650; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field .label, .label { font-size: 12px; font-weight: 550; color: var(--graphite); display: flex; justify-content: space-between; gap: 8px; }
.field output { color: var(--ink); }
.field > .seg { align-self: flex-start; }
.hint { font-size: 12px; color: var(--graphite); }
.small { font-size: 12px; }
.readout { font-size: 12.5px; color: var(--ink); background: #f1f3f2; padding: 7px 10px; border-radius: 8px; }
.readout a { color: var(--cobalt); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fill-row { justify-content: flex-start; margin-top: -4px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline { display: flex; gap: 6px; }
.help dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 12px; }
.help dt { color: var(--graphite); }
.help dd { margin: 0; }
.btn.icon-text { gap: 7px; padding: 6px 12px 6px 8px; }
.btn.icon-text svg { width: 22px; height: 22px; }
.link-btn { border: 0; background: none; color: #fff; text-decoration: underline; cursor: pointer; font: inherit; padding: 0 4px; }

/* nézetkártyák: lekerekített gomb + reset nyíl, alatta kis szöveg */
.vgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; align-items: start; }
.vcard { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.vpill { display: flex; align-items: center; min-width: 0; padding: 2px; background: #fff; border: 1px solid var(--rule); border-radius: 999px; }
.vcard.on .vpill { border-color: var(--ink); }
.vgo { flex: 1; min-width: 0; border: 0; background: none; padding: 7px 4px 7px 12px; border-radius: 999px; text-align: left; font: 650 11.5px/1.2 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vgo:hover { color: var(--cobalt); }
.vreset { flex: none; width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--graphite); cursor: pointer; }
.vreset svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.vreset:hover:not(:disabled) { background: #f1f3f2; color: var(--ink); }
.vreset:disabled { opacity: .3; cursor: default; }
.vcap { display: flex; align-items: center; gap: 6px; padding: 0 10px; min-height: 18px; font-size: 11.5px; color: var(--pal-text); }
.vcap .custom { color: var(--cobalt); font-weight: 600; }
.vtools { margin-left: auto; display: flex; align-items: center; }
.vtool { border: 0; background: none; padding: 0 4px; min-width: 18px; height: 18px; font: 600 12px/1 var(--font); color: var(--graphite); cursor: pointer; border-radius: 4px; }
.vtool.txt { margin-left: auto; padding: 0; text-decoration: underline; font-weight: 500; font-size: 11.5px; }
.vtool:hover:not(:disabled) { color: var(--ink); }
.vtool:disabled { opacity: .3; cursor: default; }
.vpill input[type=text].vname { flex: 1; width: auto; min-width: 0; min-height: 28px; padding: 3px 4px 3px 12px; border: 0; border-radius: 999px; background: transparent; font: 650 12px/1.2 var(--font); }
.vpill input[type=text].vname:focus { border: 0; box-shadow: none; }
.vadd { height: 32px; border: 1px dashed var(--rule); border-radius: 999px; background: none; color: var(--graphite); font: 400 20px/1 var(--font); cursor: pointer; }
.vadd:hover { border-color: var(--ink); color: var(--ink); }
.vcard .combo-sel { margin-top: 2px; }
.part-name { flex: 1; font-size: 12.5px; }
.align-btn svg { width: 16px; height: 16px; display: block; }

.place-results { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.place-results button { border: 0; border-bottom: 1px solid var(--rule-soft); background: #fff; text-align: left; padding: 7px 10px; font-size: 12px; cursor: pointer; }
.place-results button:hover { background: var(--cobalt-soft); }
.place-results p { padding: 7px 10px; }

.cfg-box { border-top: 1px solid var(--pal-line); padding-top: 14px; display: flex; flex-direction: column; gap: 9px; }
.tables-info, .doc-list { display: flex; flex-direction: column; gap: 6px; }
.sheet-row { display: grid; grid-template-columns: 1fr 140px; gap: 8px; align-items: center; font-size: 12.5px; }
.sheet-row select { min-height: 28px; padding: 3px 6px; }
.doc-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; font-size: 12.5px; }
.doc-row a { color: var(--ink); overflow-wrap: anywhere; }
.missing { border-top: 1px solid var(--pal-line); padding-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.missing h3 { color: var(--alert); }
.missing ul { margin: 0; padding-left: 18px; font-size: 12px; max-height: 160px; overflow: auto; }

/* metszet panel */
.plane-list { display: flex; flex-direction: column; gap: 10px; }
.plane { border: 1px solid var(--rule); border-left: 3px solid var(--cobalt); border-radius: 8px; padding: 8px 10px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.plane-head { display: flex; align-items: center; gap: 6px; }
.plane-kind { font-weight: 600; flex: 1; font-size: 12.5px; }
.plane .num { width: 74px; min-height: 28px; padding: 3px 7px; text-align: right; }
.num.small { width: 52px !important; }
.unit { color: var(--graphite); font-size: 12px; }
.plane-dir { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.plane-dir .seg { flex: 1 1 100%; display: flex; }
.plane-dir .seg button { padding: 4px 4px; flex: 1; min-width: 0; font-size: 11.5px; }
.plane-dir .num.small { width: 46px !important; min-height: 26px; }
.add-planes { display: flex; flex-direction: column; gap: 6px; }
.save-preset { display: flex; flex-direction: column; gap: 7px; border-top: 1px solid var(--pal-line); padding-top: 14px; }
.preset-list { display: flex; flex-direction: column; gap: 2px; }
.preset { display: flex; align-items: center; gap: 4px; border-radius: 6px; }
.preset.on { background: #f1f3f2; }
.preset-name { flex: 1; text-align: left; border: 0; background: none; padding: 6px 8px; cursor: pointer; font-weight: 550; border-radius: 6px; color: var(--graphite); }
.preset-name:hover { color: var(--ink); }
.preset.on .preset-name { color: var(--ink); font-weight: 700; }
.preset-tools { display: flex; align-items: center; gap: 2px; }
.preset .dirty { color: var(--cobalt); font-weight: 500; font-size: 11.5px; }
.levels { border-top: 1px solid var(--pal-line); padding-top: 12px; }
.levels summary { font-weight: 650; cursor: pointer; }
.levels[open] { display: flex; flex-direction: column; gap: 10px; }
.level-rows { display: flex; flex-direction: column; gap: 6px; }
.level-row { display: flex; align-items: center; gap: 6px; }
.level-row .num { width: 72px; flex: none; text-align: right; }
#sun-time, #sun-manual { display: flex; flex-direction: column; gap: 16px; }

/* súgósáv (séta, mérés) */
.hint-bar { position: fixed; bottom: calc(80px + var(--eb)); width: max-content; left: 50%; transform: translateX(-50%); background: rgba(27, 32, 30, .85); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; z-index: 5; max-width: calc(100vw - 24px); }
.hint-bar span { opacity: .85; margin: 0 4px; }
kbd { font: 600 11px var(--font); border: 1px solid rgba(255, 255, 255, .4); border-radius: 3px; padding: 1px 5px; }

/* mérés: SVG vonalak a 3D kép fölött, feliratok */
.measure-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.m-line .halo { stroke: #fff; stroke-width: 5; stroke-linecap: round; opacity: .9; }
.m-line .ink { stroke: var(--cobalt); stroke-width: 2; stroke-linecap: round; }
.m-line.preview .ink { stroke-dasharray: 6 5; }
.m-line .end { fill: var(--cobalt); stroke: #fff; stroke-width: 1.5; }
.m-snap { fill: rgba(36, 65, 198, .12); stroke: var(--cobalt); stroke-width: 2; }
.labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.measure-label { position: absolute; left: 0; top: 0; background: var(--cobalt); color: #fff; font: 650 12px var(--font); font-variant-numeric: tabular-nums; padding: 3px 8px; border-radius: 999px; white-space: nowrap; pointer-events: auto; box-shadow: 0 2px 8px rgba(36, 65, 198, .3); }

/* dokumentumok ablak: táblázatoknál a tartalomhoz igazodik, rajzoknál/képeknél nagy */
.docs-dlg { border: 0; padding: 0; border-radius: 16px; width: fit-content; min-width: min(600px, calc(100vw - 32px)); max-width: min(1100px, calc(100vw - 32px)); max-height: calc(var(--app-h, 100vh) - 48px - var(--sat, 0px) - var(--sab, 0px)); color: var(--ink); box-shadow: 0 24px 70px rgba(27, 32, 30, .3); display: none; }
.docs-dlg.wide { width: min(1320px, calc(100vw - 32px)); max-width: none; height: min(900px, calc(var(--app-h, 100vh) - 32px - var(--sat, 0px) - var(--sab, 0px))); }
.docs-dlg[open] { display: flex; flex-direction: column; }
.docs-dlg::backdrop { background: rgba(27, 32, 30, .4); }
.docs-head { display: flex; align-items: center; gap: 20px; padding: 10px 14px 0 22px; border-bottom: 1px solid var(--pal-line); flex: none; }
.docs-head h2 { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30%; padding-bottom: 12px; }
.docs-tabs { display: flex; gap: 4px; flex: 1; }
.docs-tabs button { border: 0; background: none; padding: 10px 12px 12px; color: var(--pal-text); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.docs-tabs button:hover { color: var(--pal-hover); }
.docs-tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--ink); }
.docs-head .close { font-size: 22px; margin-bottom: 10px; }
.docs-body { flex: 1; overflow: auto; min-height: 0; display: flex; flex-direction: column; }
.tables-pane { padding: 22px 24px 26px; display: flex; flex-direction: column; gap: 28px; }

/* táblázat: a cím a táblázat része */
.table-scroll { overflow: auto; }
table.data { border-collapse: collapse; width: auto; min-width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data caption { caption-side: top; text-align: left; padding: 0 2px 14px; }
table.data caption .cap-title { display: block; font-size: 19px; font-weight: 650; letter-spacing: -.01em; color: var(--ink); }
table.data caption .cap-sub { display: block; font-size: 13px; color: var(--graphite); margin-top: 3px; }
table.data th { text-align: left; font-weight: 650; font-size: 12px; color: var(--graphite); padding: 9px 14px; border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--ink); white-space: nowrap; }
table.data td { padding: 8px 14px; border-bottom: 1px solid var(--rule-soft); white-space: nowrap; }
table.data .num { text-align: right; }
table.data tbody tr:hover td { background: #f6f7f6; }
table.data.no-head tbody tr:first-child > * { border-top: 1.5px solid var(--ink); }
table.data tr.group th { border-top: 0; border-bottom: 1px solid var(--rule); padding: 22px 14px 7px; font-size: 13px; font-weight: 650; color: var(--ink); }
table.data tbody tr.group:first-child th { padding-top: 10px; }
table.data tr.subtotal td { font-weight: 650; border-top: 1px solid var(--graphite); border-bottom: 0; }
table.data tr.grand td, table.data tfoot td { font-weight: 700; border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }
table.data tbody tr.subtotal + tr.grand td { border-top-width: 1.5px; }
table.data tbody tr.subtotal + tr.grand > td { padding-top: 12px; }

/* rajzok, látványtervek: rács */
.docs-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; padding: 24px; align-content: start; }
.doc-card { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 9px; color: var(--ink); }
.doc-thumb { aspect-ratio: 4 / 3; border: 1px solid var(--pal-line); border-radius: 10px; background: #fff; display: grid; place-items: center; overflow: hidden; padding: 10px; transition: border-color .15s, box-shadow .15s; }
.doc-thumb canvas, .doc-thumb img { max-width: 100%; max-height: 100%; display: block; }
/* sorban töltődő előnézetek: várakozik / most töltődik */
.doc-thumb.waiting::after { content: "Várakozik…"; font-size: 12px; color: var(--pal-text); }
.doc-thumb.broken::after { content: "Nem tölthető be"; font-size: 12px; color: var(--alert); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.doc-thumb img.pdf-thumb { object-fit: contain; border-radius: 0; }
.doc-card:hover .doc-thumb, .doc-card:focus-visible .doc-thumb { border-color: var(--ink); box-shadow: 0 6px 18px rgba(27, 32, 30, .08); }
.doc-name { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }

/* rajzok, látványtervek: részletes nézet */
.doc-detail { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px 1fr; }
.doc-side { border-right: 1px solid var(--pal-line); padding: 16px 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.back-link { border: 0; background: none; text-align: left; color: var(--graphite); font-weight: 600; cursor: pointer; padding: 4px 8px; }
.back-link:hover { color: var(--ink); }
.doc-side nav { display: flex; flex-direction: column; gap: 1px; overflow: auto; }
.doc-side nav button { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 8px; color: var(--pal-text); font-weight: 550; cursor: pointer; overflow-wrap: anywhere; }
.doc-side nav button:hover { color: var(--pal-hover); }
.doc-side nav button[aria-pressed=true] { color: var(--ink); font-weight: 700; background: #f3f4f3; }
.doc-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.doc-main > header { display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px 22px; border-bottom: 1px solid var(--pal-line); }
.doc-main h3 { font-size: 14px; font-weight: 650; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-bar { display: flex; align-items: center; gap: 10px; }
.zoom-ctl, .pager { display: flex; align-items: center; gap: 2px; }
.zoom-val, .pager span { font-size: 12px; color: var(--graphite); min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.doc-stage { flex: 1; min-height: 0; overflow: auto; background: #fff; cursor: grab; display: flex; padding: 28px; }
.doc-stage.dragging { cursor: grabbing; }
.doc-page { margin: auto; flex: none; position: relative; box-shadow: 0 0 0 1px var(--pal-line), 0 10px 30px rgba(27, 32, 30, .07); background: #fff; user-select: none; }
.doc-page canvas, .doc-page img { width: 100%; height: 100%; display: block; }

.loading { position: fixed; inset: 0; display: grid; place-items: center; background: #e3e7e5; z-index: 20; }
.loading-card { width: min(400px, calc(100vw - 48px)); display: flex; flex-direction: column; gap: 10px; padding: 26px 26px 22px; background: #fff; }
#loading-title { font-weight: 650; font-size: 15px; }
#loading-info { font-size: 12.5px; min-height: 18px; overflow-wrap: anywhere; }
.loading.error #loading-title { color: var(--alert); }

.read-only .owner-only { display: none !important; }

/* ---------- keskeny képernyő ---------- */
@media (max-width: 720px) {
  :root { --panel-w: calc(100vw - 16px - var(--el) - var(--er)); --dock-space: 64px; }
  .gallery .g-head, .gallery .g-main { padding: 0 16px; }
  .drop { padding: 28px 22px; }
  .list-head { flex-direction: column; align-items: stretch; }
  .list-head input { max-width: none; }
  /* telefonon: a panel az iránytű fölött ér véget (az iránytű a sáv fölött ül), sosem lóg rá az alsó sávra */
  .panel { top: calc(8px + var(--et)); right: calc(8px + var(--er)); height: calc(var(--app-h) - 8px - var(--dock-space) - 54px - var(--sat) - var(--sab)); }
  .v-top { max-width: calc(100vw - 80px); }
  /* telefonon is egy sor: az ikonok elférnek, a sáv középen marad */
  .bottom-bar { bottom: calc(8px + var(--eb)); max-width: calc(100vw - 16px - var(--el) - var(--er)); }
  .dock { overflow: visible; }
  .pal button { padding: 8px 8px; font-size: 12px; }
  .rail { top: calc(58px + var(--et)); left: calc(8px + var(--el)); bottom: calc(var(--dock-space) + 58px + var(--eb)); width: 118px; }
  body { --rail-l: 8px; --rail-w: 118px; }
  .pal.col button { padding: 6px 10px; font-size: 12px; }
  /* telefonon a sáv kitölti a szélességet: az iránytű közvetlenül fölötte, a bal szélén */
  .compass { left: 0; right: auto; top: auto; margin-top: 0; bottom: calc(100% + 8px); width: 46px; height: 46px; }
  .hint-bar { bottom: calc(var(--dock-space) + 56px + var(--eb)); border-radius: 12px; }
  .doc-detail { grid-template-columns: 1fr; }
  .doc-side { display: none; }
}

/* nagyon keskeny telefon (pl. 320–360 px): a két sor így is kiférjen */
@media (max-width: 420px) {
  .pal.icons { padding: 4px 5px; }
  .pal.icons button { width: 34px; height: 34px; }
}
@media (max-width: 370px) {
  .pal.icons { padding: 4px 3px; gap: 1px; }
  .pal.icons button { width: 32px; height: 32px; }
  .pal.icons button svg { width: 19px; height: 19px; }
  .pal.icons .sep { margin: 0 3px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* csúszka melletti beírható érték */
input.range-val { flex: none; width: 66px; min-height: 26px; padding: 2px 6px; margin-left: auto; text-align: right; font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums; border: 1px solid transparent; border-radius: 6px; background: #f3f5f4; color: var(--ink); }
input.range-val:hover { border-color: var(--rule); }
input.range-val:focus { outline: none; border-color: var(--cobalt); background: #fff; box-shadow: none; }
.field.range .label { display: flex; align-items: center; gap: 8px; }

/* robbantott nézet */
.explode-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--pal-line); display: flex; flex-direction: column; gap: 10px; }
.explode-box .hint { margin: 0; }
body.exploded #measure-btn { opacity: .35; pointer-events: none; }

/* fóliák */
.layer-body { display: flex; flex-direction: column; gap: 12px; }
.layer-body .readout { margin: 0; }
.layer-groups { display: flex; flex-direction: column; gap: 8px; }
.layer-group { border: 1px solid var(--pal-line); border-radius: 10px; background: #fff; overflow: hidden; }
.layer-group.off .group-name { color: var(--pal-text); }
.group-head { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; }
.group-head input.group-name { flex: 1; min-width: 0; min-height: 28px; padding: 3px 6px; border-color: transparent; font-weight: 600; background: transparent; }
.group-head input.group-name:hover { border-color: var(--rule); }
.group-head input.group-name:focus { background: #fff; }
.group-count { font-size: 12px; color: var(--graphite); font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }
.group-head .chevron { width: 28px; height: 28px; font-size: 17px; line-height: 1; transition: transform .2s; }
.group-head .chevron.open { transform: rotate(90deg); }
.layer-group .check { display: flex; align-items: center; gap: 8px; min-width: 0; cursor: pointer; }
.layer-group input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ink); flex: none; margin: 0; }
.group-layers { border-top: 1px solid var(--pal-line); padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 2px; background: #fafbfa; }
.layer-row { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.layer-row .check { flex: 1; }
.layer-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-row select { width: 112px; flex: none; min-height: 26px; padding: 2px 4px; font-size: 12px; }
.group-layers .link-btn { align-self: flex-start; margin-top: 6px; }
.group-head .group-name.fixed { flex: 1; min-width: 0; padding: 3px 6px; font-weight: 700; }
.layer-row .icon-btn { flex: none; }
.group-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--pal-line); }
.group-foot select { flex: 1; min-width: 0; min-height: 28px; padding: 2px 6px; font-size: 12px; }
.group-foot .link-btn { margin-top: 0; flex: none; }
.link-btn.danger { color: var(--alert); }

/* ---------- fiók (bk3d.hu): felhasználói sáv, tárhely, űrlapok ---------- */
input[type=password], input[type=number] {
  width: 100%; padding: 6px 9px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; min-height: 32px;
}
input[type=password]:focus, input[type=number]:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 2px var(--cobalt-soft); }
input:disabled { background: var(--rule-soft); color: var(--graphite); }
.user-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.user-name { font-weight: 600; font-size: 13px; margin: 0 4px 0 6px; }
.quota { min-width: 150px; font-size: 12px; color: var(--graphite); font-variant-numeric: tabular-nums; }
.quota .bar { margin-top: 4px; }
.quota.full .bar span { background: var(--alert); }
.form-grid { display: flex; flex-direction: column; gap: 12px; }
.form-grid .field > span:first-child { font-size: 12px; font-weight: 550; color: var(--graphite); }
.form-error { color: var(--alert); font-size: 12.5px; font-weight: 550; min-height: 1em; }
@media (max-width: 720px) {
  .g-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .user-box { justify-content: flex-start; }
  .quota { flex-basis: 100%; }
}

/* ---------- feltöltő képernyő (dokumentumok, táblázatok): középen, elhomályosított háttér ---------- */
.up-screen { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: calc(16px + var(--et, 0px)) 16px calc(16px + var(--eb, 0px));
  background: rgba(231, 234, 232, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .2s; }
.up-screen.in { opacity: 1; }
.up-card { width: min(420px, 100%); background: #fff; border-radius: 16px; padding: 22px 24px 20px;
  box-shadow: 0 24px 60px rgba(27, 32, 30, .18), 0 0 0 1px rgba(27, 32, 30, .04); transform: translateY(8px); transition: transform .2s; }
.up-screen.in .up-card { transform: none; }
.up-card h2 { font-size: 16px; font-weight: 650; margin-bottom: 14px; }
.up-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 8px; }
.up-bar { height: 4px; border-radius: 2px; }
.up-bar span { border-radius: 2px; }
.up-bar.busy span { width: 35% !important; animation: up-slide 1.1s ease-in-out infinite; }
@keyframes up-slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.up-info { font-size: 12.5px; color: var(--graphite); margin-top: 8px; min-height: 1.2em; font-variant-numeric: tabular-nums; }
.up-card.failed .up-name { color: var(--alert); }
.up-errors { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--ink); max-height: 30vh; overflow: auto; }
.up-errors li + li { margin-top: 4px; }
.up-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.up-actions:has(> [hidden]:only-child) { display: none; }
@media (prefers-reduced-motion: reduce) { .up-bar.busy span { animation: none; width: 100% !important; opacity: .5; } }

/* ---------- dokumentum-nézegető: lapozó nyilak a kép két oldalán ---------- */
.doc-stage-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.doc-stage-wrap > .doc-stage { flex: 1; }
.doc-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .92); color: var(--pal-hover); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 4px 18px rgba(27, 32, 30, .14), 0 0 0 1px rgba(27, 32, 30, .05); transition: color .12s, background-color .12s; }
.doc-nav:hover { color: var(--ink); background: #fff; }
.doc-nav svg { width: 20px; height: 20px; }
.doc-nav.prev { left: 14px; }
.doc-nav.next { right: 14px; }
.doc-count { font-size: 12px; color: var(--graphite); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 720px) { .doc-nav { width: 38px; height: 38px; } .doc-nav.prev { left: 8px; } .doc-nav.next { right: 8px; } }

/* ---------- kis feltöltő ablak: ejtőmező + Hozzáadás gomb ---------- */
.pick-card { width: min(460px, 100%); }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.pick-head h2 { margin: 0; }
.pick-zone { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 30px 20px 26px;
  border: 1.5px dashed var(--rule); border-radius: 12px; background: var(--sheet); transition: border-color .15s, background-color .15s; }
.pick-zone.over { border-color: var(--cobalt); background: var(--cobalt-soft); }
.pick-zone:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.pick-ico { width: 34px; height: 34px; color: var(--graphite); margin-bottom: 2px; }
.pick-ico svg { width: 100%; height: 100%; display: block; }
.pick-zone.over .pick-ico { color: var(--cobalt); }
.pick-title { font-weight: 600; font-size: 14px; max-width: 30ch; }
.pick-hint { font-size: 12.5px; color: var(--graphite); }
.pick-or { font-size: 12px; color: var(--pal-text); margin: 4px 0 2px; }
.pick-msg { color: var(--alert); font-size: 12.5px; margin-top: 10px; min-height: 0; }
.pick-msg:empty { display: none; }

/* ---------- telefonos séta: botkormány bal alul, fel / le gombok jobb alul ---------- */
/* széles képernyőn a botkormány a bal alsó sarokban, a fel / le nyilak jobb oldalt egy sorban az alsó menüvel */
.joy { position: fixed; z-index: 7; bottom: calc(16px + var(--eb)); touch-action: none; user-select: none; -webkit-user-select: none; }
.joy-move { left: calc(16px + var(--el)); }
.joy-lift { right: calc(16px + var(--er)); display: flex; flex-direction: row; gap: 10px; }
body.joy-on .rail { bottom: calc(142px + var(--eb)); } /* a lista a botkormány fölött ér véget */
@media (min-width: 721px) { body.joy-on .bottom-bar { max-width: calc(100vw - 420px); } } /* a sáv ne ütközzön a botkormánnyal és a nyilakkal */
.joy-base { width: 118px; height: 118px; border-radius: 50%; display: grid; place-items: center; touch-action: none;
  background: rgba(255, 255, 255, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 22px rgba(27, 32, 30, .12), inset 0 0 0 1px rgba(27, 32, 30, .08); }
.joy-knob { width: 50px; height: 50px; border-radius: 50%; background: #fff; box-shadow: 0 3px 12px rgba(27, 32, 30, .22); transition: transform .12s; pointer-events: none; }
.joy-base.on .joy-knob { transition: none; background: var(--ink); }
.joy-ud { width: 50px; height: 50px; border-radius: 50%; border: 0; background: #fff; color: var(--pal-hover); display: grid; place-items: center; touch-action: none;
  box-shadow: 0 4px 22px rgba(27, 32, 30, .12), 0 0 0 1px rgba(27, 32, 30, .05); }
.joy-ud svg { width: 22px; height: 22px; }
.joy-ud.on { background: var(--ink); color: #fff; }
/* telefon: az alsó menü teljes szélességű, ezért a botkormány és a nyilak (egy sorban, jobb oldalt) fölötte ülnek */
@media (max-width: 720px) {
  .joy { bottom: calc(var(--dock-space) + 66px + var(--eb)); }
  .joy-move { left: calc(8px + var(--el)); }
  .joy-lift { right: calc(8px + var(--er)); }
  body.joy-on .rail { bottom: calc(var(--dock-space) + 200px + var(--eb)); }
}
/* fekvő telefon: a botkormány fölött a lista használhatatlanul alacsony lenne */
@media (max-height: 520px) { body.joy-on .rail { display: none; } }

/* nézethez mentett fóliakombináció */
.combo-sel { min-height: 26px !important; padding: 2px 6px !important; font-size: 12px; color: var(--graphite); }
.preset { flex-wrap: wrap; }
.preset .combo-sel { flex: 1 1 100%; margin: 0 4px 6px 8px; width: auto; }

/* Fájlok kezelése: lista az ejtőmező alatt */
.pick-card.with-list { width: min(560px, 100%); max-height: calc(var(--app-h, 100dvh) - 32px - var(--et, 0px) - var(--eb, 0px)); display: flex; flex-direction: column; }
.pick-card.with-list .pick-zone { padding: 20px 16px 18px; flex: none; }
.pick-extra { margin-top: 14px; min-height: 0; overflow: auto; flex: 1 1 auto; }
.doc-list-head { font-size: 12px; font-weight: 600; color: var(--graphite); margin-bottom: 6px; }
.pick-extra .doc-row { padding: 6px 0; border-top: 1px solid var(--pal-line); }
.doc-del.armed { background: var(--alert); color: #fff; border-color: var(--alert); }
.orient-angle { align-items: center; }
.orient-angle .num { width: 70px; flex: none; text-align: right; }
#plan-orient { flex-wrap: wrap; }

/* alacsony ablak (pl. fekvő telefon): a bal sáv görgethető, a panel a sáv fölött ér véget */
@media (max-height: 520px) {
  .rail { top: calc(56px + var(--et)); }
  .pal.col button { padding: 6px 12px; }
}

/* hat fül: keskeny panelen kisebb betű, hogy görgetés nélkül elférjenek */
@media (max-width: 420px) { .tabs { padding: 0 4px; } .tabs button { font-size: 11.5px; padding-left: 2px; padding-right: 2px; } }

/* dokumentumok ablak: egy állandó méret minden fülön (nem ugrál), betöltés alatt töltő-képernyő */
.docs-dlg, .docs-dlg.wide { width: min(1100px, calc(100vw - 32px)); min-width: 0; max-width: none;
  height: min(780px, calc(var(--app-h, 100vh) - 48px - var(--sat, 0px) - var(--sab, 0px))); max-height: none; }
.docs-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.docs-busy { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(255, 255, 255, .86); color: var(--graphite); font-size: 13px; font-weight: 550; }
@media (max-width: 720px) { .docs-dlg, .docs-dlg.wide { width: calc(100vw - 16px); height: calc(var(--app-h, 100vh) - 16px - var(--sat, 0px) - var(--sab, 0px)); } }

/* rajz / kép fejléce: bal oldalt a név, középen a lapozó nyilak, jobbra a nagyítás */
.doc-main > header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; }
.doc-main > header .doc-bar { justify-self: end; }
.doc-pager { display: flex; align-items: center; gap: 6px; }
.doc-pager .doc-nav { position: static; transform: none; width: 34px; height: 34px; box-shadow: 0 0 0 1px var(--pal-line); }
.doc-pager .doc-nav svg { width: 17px; height: 17px; }
.doc-pager .doc-count { min-width: 44px; text-align: center; }
@media (max-width: 720px) {
  .doc-main > header { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; padding-left: 14px; }
  .doc-main > header .doc-bar { grid-column: 1 / -1; justify-self: stretch; flex-wrap: wrap; }
}

/* robbantási keret kijelölése */
.frame-overlay { position: fixed; inset: 0; z-index: 12; cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; background: rgba(27, 32, 30, .06); }
.frame-overlay[hidden] { display: none; }
.frame-rect { position: absolute; border: 2px dashed #d9480f; background: rgba(217, 72, 15, .10); pointer-events: none; }
.frame-msg { position: absolute; left: 50%; top: calc(72px + var(--et)); transform: translateX(-50%); margin: 0; padding: 8px 14px; border-radius: 999px; background: var(--ink); color: #fff; font: 550 13px/1.3 var(--font); pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
.field.range.is-off{opacity:.5}
