/* ============================================================
   Převodník HP-GL -> DXF — UI theme
   Design system adopted from QB45_Prevod/Template/asistent.html
   ============================================================ */

/* ============================================================
   1) TOKENY / PROMĚNNÉ — světlý a tmavý motiv
   ============================================================ */
:root {
  --bg: #eef1f7;
  --bg-grad-a: rgba(99, 102, 241, 0.1);
  --bg-grad-b: rgba(20, 184, 166, 0.09);
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --text: #0d1526;
  --text-soft: #4a5872;
  --muted: #7c8aa5;
  --border: #dfe5ef;
  --border-strong: #c9d3e3;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --accent-2: #0d9488;
  --pos: #0f9d58;
  --neg: #dc2626;
  --warn: #d97706;
  --shadow-sm:
    0 1px 2px rgba(13, 21, 38, 0.06), 0 1px 1px rgba(13, 21, 38, 0.04);
  --shadow-md: 0 6px 22px -8px rgba(13, 21, 38, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(13, 21, 38, 0.35);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --h-top: 60px;
  --h-foot: 30px;
  --w-left: 292px;
}

[data-theme="dark"] {
  --bg: #080b14;
  --bg-grad-a: rgba(99, 102, 241, 0.16);
  --bg-grad-b: rgba(20, 184, 166, 0.1);
  --surface: #10151f;
  --surface-2: #151b28;
  --surface-3: #1c2434;
  --text: #eaf0fb;
  --text-soft: #aebbd2;
  --muted: #74849f;
  --border: #232d3f;
  --border-strong: #31405a;
  --accent: #7c8cff;
  --accent-soft: rgba(124, 140, 255, 0.14);
  --accent-2: #2dd4bf;
  --pos: #34d399;
  --neg: #f87171;
  --warn: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 26px -10px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, 0.85);
}

/* ============================================================
   2) ZÁKLAD
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font:
    400 14px/1.5 "Inter",
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 12% -8%, var(--bg-grad-a), transparent 60%),
    radial-gradient(760px 480px at 105% 110%, var(--bg-grad-b), transparent 60%);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.015em;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 9px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-track {
  background: transparent;
}

#app {
  display: block;
  position: relative;
  z-index: 1;
}

/* ============================================================
   3) TOP LIŠTA
   ============================================================ */
.topbar {
  position: relative;
  /*z-index: 40;*/
  height: var(--h-top);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

@supports (backdrop-filter: blur(14px)) {
  .topbar {
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: blur(14px);
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 6px;
  min-width: 0;
}

.brand__mark {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 5px;
  display: grid;
  place-items: center;
  overflow: hidden;
  /*background: linear-gradient(145deg, var(--accent), var(--accent-2));*/
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}

.brand__mark img {
  width: 80%;
  height: 80%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.brand__txt {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}
.brand__name {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.06em;
}
.brand__sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.vr {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex: none;
}

.spacer {
  flex: 1 1 auto;
}

/* --- tlačítka --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 29px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: 0.16s ease;
}

.btn:not(:disabled):hover {
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}
.btn:not(:disabled):active {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn svg {
  width: 15px;
  height: 15px;
}

.btn--icon {
  width: 34px;
  padding: 0;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 85%, transparent);
}
.btn--primary:not(:disabled):hover {
  filter: brightness(1.07);
  color: #fff;
}

.btn.is-on {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  color: var(--accent);
}

/* --- přepínač Dark / Light --- */
.seg {
  display: flex;
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.seg__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: 0.18s ease;
}

.seg__btn svg {
  width: 14px;
  height: 14px;
}
.seg__btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   4) ROZVRŽENÍ — levý panel + plátno
   ============================================================ */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  height: calc(100vh - var(--h-top) - var(--h-foot));
  grid-template-columns: var(--w-left) minmax(0, 1fr);
}

.layout.no-left {
  --w-left: 0px;
}

/* Admin module has no left panel; use a single column so the body fills the width
   (avoiding the body being auto-placed into the zero-width first grid column). */
.layout.admin-only,
.layout.single-column {
  grid-template-columns: minmax(0, 1fr);
}

.panel,
.canvas {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.panel__in {
  width: var(--w-left);
  min-width: 280px;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}
.no-left .panel__in {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
}

.p-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 10px;
  flex: none;
}
.p-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}
.p-body {
  overflow-y: auto;
  padding: 0 12px 14px;
  flex: 1 1 auto;
}

/* rukojeť pro rychlé obnovení levého panelu */
.edge {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: 16px;
  height: 74px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: none;
  place-items: center;
  color: var(--muted);
  transition: 0.18s ease;
}
.edge:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.edge--l {
  left: 0;
  border-left: 0;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.layout.no-left .edge--l {
  display: grid;
}

/* ============================================================
   5) LEVÝ PANEL — KROKY VRTÁNÍ
   ============================================================ */
.grp-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 4px 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.grp-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  transition: 0.15s ease;
}
.step__ico {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--muted);
}
.step__ico svg {
  width: 14px;
  height: 14px;
}
.step__body {
  min-width: 0;
  flex: 1;
}
.step__name {
  display: block;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--text-soft);
}
.step__sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.step.is-running {
  background: var(--accent-soft);
}
.step.is-running .step__ico {
  background: var(--accent);
  color: #fff;
}
.step.is-running .step__name {
  color: var(--text);
}
.step.is-done .step__ico {
  background: color-mix(in srgb, var(--pos) 16%, transparent);
  color: var(--pos);
}
.step.is-done .step__name {
  color: var(--text-soft);
}
.step.is-error .step__ico {
  background: color-mix(in srgb, var(--neg) 16%, transparent);
  color: var(--neg);
}

.drill-actions {
  padding: 12px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.drill-actions .btn {
  width: 100%;
  height: 38px;
}
.drill-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
}
.drill-meta b {
  color: var(--text-soft);
  font-weight: 650;
}

/* progress bar */
.progress-track {
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}

/* ============================================================
   6) PROSTŘEDÍ — PLÁTNO / VÝSLEDKY
   ============================================================ */
.canvas {
  background: transparent;
}

.c-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
}
.c-bar h1 {
  font-size: 16.5px;
}
.c-bar h1:focus,
.c-bar h1:focus-visible {
  outline: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  background: var(--surface-3);
  color: var(--text-soft);
}
.chip svg {
  width: 12px;
  height: 12px;
}
.chip--pos {
  background: color-mix(in srgb, var(--pos) 14%, transparent);
  color: var(--pos);
}

.c-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px 26px;
}

/* --- box --- */
.box {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  /*padding: 14px 16px 16px;*/
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s ease;
}
.box:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.box__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  /*margin-bottom: 12px;*/
  flex: none;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.box__title {
  font-size: 13.5px;
  font-weight: 640;
}
.box__ico {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  background: var(--surface-3);
  color: var(--text-soft);
}
.box__ico.is-accent {
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #fff;
}
.box__ico.is-warn {
  background: linear-gradient(145deg, var(--warn), var(--neg));
  color: #fff;
}
.box__ico.is-pos {
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: #fff;
}
.box__tools {
  margin-left: auto;
  display: flex;
  gap: 4px;
  align-items: center;
  opacity: 0.65;
  transition: 0.2s;
}
.box:hover .box__tools {
  opacity: 1;
}
.ico-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.ico-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}
.ico-btn svg {
  width: 14px;
  height: 14px;
}
.box__foot {
  /*margin-top: 12px;*/
  /*padding-top: 10px;*/
  padding: 8px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: none;
}

/* --- mřížka prohlížečů + orientace --- */
.vector-viewers {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.vector-viewers.stacked {
  grid-template-columns: 1fr;
}

.viewer-canvas {
  position: relative;
  height: 500px;
  flex: none;
  /*border-radius: var(--r-md);*/
  overflow: hidden;
  background: #0d1117;
  /*border: 1px solid var(--border);*/
}
.vector-viewers.stacked .viewer-canvas {
  height: 500px;
}

.viewer-filename {
  font-size: 11.5px;
  color: var(--muted);
  font-family: Consolas, "Cascadia Mono", monospace;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-box.maximized {
  position: fixed;
  /* Offset by the fixed environment banner when body.has-env-banner is present. */
  inset: var(--env-banner-h, 0px) 0 0 0;
  z-index: 900;
  margin: 0;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}
.viewer-box.maximized .viewer-canvas {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

/* ============================================================
   7) SEGMENTOVANÝ PŘEPÍNAČ REŽIMU ZOBRAZENÍ
   ============================================================ */
.segmented-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.segmented-btn {
  padding: 0.35rem 0.8rem;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 550;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}
.segmented-btn:hover {
  color: var(--text);
  background: var(--surface-3);
}
.segmented-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}
.segmented-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ============================================================
   8) TOASTY + STAVOVÝ PÁSEK
   ============================================================ */
.toasts {
  position: fixed;
  right: 16px;
  bottom: calc(var(--h-foot) + 14px);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 250px;
  max-width: 380px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  animation: slide 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.toast svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex: none;
}
.toast--ok svg,
.toast--pos svg {
  color: var(--pos);
}
.toast--error svg,
.toast--neg svg {
  color: var(--neg);
}
@keyframes slide {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--h-foot);
  padding: 0 14px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(8px);
  position: relative;
  /*z-index: 40;*/
}
.statusbar .ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.statusbar .led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pos) 20%, transparent);
}
.statusbar b {
  color: var(--text-soft);
  font-weight: 650;
}

/* ============================================================
   9) MODÁLY / FORMULÁŘE
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: 92%;
  max-width: 860px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal.modal-wide {
  max-width: 1100px;
}
.modal-header {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 650;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 1.2rem;
}
.modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}
.modal-body {
  padding: 1.2rem 1.4rem;
}
.modal-footer {
  padding: 0.9rem 1.4rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  flex: none;
}
.modal-footer__start {
  margin-right: auto;
}

/* --- konsolidovaný dialog "Nastavení" (taby + pevná patička) --- */
.modal.settings-dialog {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 88vh;
  max-width: 860px;
  padding: 0;
}
.settings-dialog .modal-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.settings-tabs {
  flex: none;
  width: 210px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0.8rem;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.settings-tab {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 550;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}
.settings-tab:hover {
  background: var(--surface-3);
  color: var(--text);
}
.settings-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}
.settings-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.settings-pane {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding: 1.2rem 1.4rem;
}
.input-color {
  width: 60px;
  height: 32px;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
}
@media (max-width: 700px) {
  .settings-dialog .modal-body {
    flex-direction: column;
  }
  .settings-tabs {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

.settings-section {
  margin-bottom: 1.2rem;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.section-title {
  font-size: 0.92rem;
  font-weight: 650;
  margin-bottom: 0.8rem;
  color: var(--accent);
}

.tool-table {
  width: 100%;
  border-collapse: collapse;
}
.tool-table th,
.tool-table td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.tool-table th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 650;
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 0.88rem;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-number {
  width: 100px;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}
.field-row label {
  min-width: 170px;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-soft);
}
.checkbox-wrapper input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.file-input {
  display: none;
}

/* messages */
.alert {
  padding: 0.6rem 0.9rem;
  border-radius: var(--r-sm);
  margin-bottom: 1rem;
  font-size: 0.85rem;
}
.alert-danger {
  background: color-mix(in srgb, var(--neg) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--neg) 40%, transparent);
  color: var(--neg);
}
.validation-message {
  color: var(--neg);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* ============================================================
   10) RESPONZIVITA
   ============================================================ */
@media (max-width: 1240px) {
  .vector-viewers {
    grid-template-columns: 1fr;
  }
  .vector-viewers .viewer-canvas {
    height: 440px;
  }
}

@media (max-width: 900px) {
  .hide-sm {
    display: none !important;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .panel--left {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(320px, 90vw);
    z-index: 50;
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%);
    transition: transform 0.3s ease;
  }
  .layout.show-left .panel--left {
    transform: none;
  }
  .layout .panel__in {
    width: min(320px, 90vw);
  }
}

/* ============================================================
   11) BLAZOR CHROME
   ============================================================ */
#blazor-error-ui {
  background: var(--neg);
  color: #fff;
  bottom: 0;
  left: 0;
  width: 100%;
  position: fixed;
  display: none;
  padding: 0.65rem 1.25rem;
  z-index: 2000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.4);
}
#blazor-error-ui .reload {
  color: #fff;
}
#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.55rem;
}

.loading-progress {
  position: relative;
  display: block;
  width: 8rem;
  height: 8rem;
  margin: 0 auto;
}
.loading-progress circle {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 0.6rem;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}
.loading-progress circle:last-child {
  stroke: var(--accent);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.05s ease-in-out;
}

/* Boot/auth splash shared by index.html and AuthSplash.razor so the swap
   between the static loader and the Blazor-driven authorizing state is invisible. */
.auth-splash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1rem;
}

.auth-splash .loading-progress {
  margin: 0;
}

.auth-splash__ring circle:last-child {
  stroke-dasharray: 60%, 500%;
  animation: auth-spin 900ms linear infinite;
}

@keyframes auth-spin {
  from {
    transform: rotate(-90deg);
  }
  to {
    transform: rotate(270deg);
  }
}

/* ============================================================
   12) PŘIHLÁŠENÍ / OBNOVA HESLA
   ============================================================ */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-body {
  width: 100%;
  max-width: 400px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  animation: auth-card-in 160ms ease-out both;
}

@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .auth-splash__ring circle:last-child {
    animation: none;
  }
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 700;
}

.auth-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.8rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.auth-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
}

.auth-submit {
  width: 100%;
  height: 38px;
  margin-top: 0.4rem;
}

.auth-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.88rem;
  color: var(--accent);
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
}

.alert-ok {
  background: color-mix(in srgb, var(--pos) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--pos) 40%, transparent);
  color: var(--pos);
}

/* ============================================================
   13) ADMINISTRACE — SPRÁVA UŽIVATELŮ
   ============================================================ */
.admin-panel {
  padding: 1.2rem 1.4rem;
  max-width: 900px;
}

.admin-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.admin-table td,
.admin-table th {
  padding: 0.6rem 0.9rem;
}

.admin-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.modal.admin-modal {
  max-width: 480px;
}

/* ============================================================
   ENVIRONMENT BANNER (Development / NAS test deployments)
   ============================================================ */
body.has-env-banner {
  --env-banner-h: 30px;
}
/* Consumed by .viewer-box.maximized so fixed overlays clear the banner. */

.env-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  height: var(--env-banner-h, 30px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  background: var(--neg, #dc2626);
  color: #fff;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  pointer-events: none;
}

body.has-env-banner .topbar {
  margin-top: var(--env-banner-h);
}

body.has-env-banner .layout {
  height: calc(100vh - var(--h-top) - var(--h-foot) - var(--env-banner-h));
}

body.has-env-banner .auth-shell,
body.has-env-banner .auth-splash {
  margin-top: var(--env-banner-h);
  min-height: calc(100vh - var(--env-banner-h));
}

/* ============================================================
   PROJEKTY — seznam, karty, dialog a kontext aktivního projektu
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  white-space: nowrap;
}

.btn--danger {
  background: var(--neg);
  border-color: var(--neg);
  color: #fff;
}
.btn--danger:not(:disabled):hover {
  filter: brightness(1.08);
  color: #fff;
}

.projects-page {
  max-width: 960px;
  margin: 0 auto;
}

.projects-message {
  margin: 0;
  color: var(--muted);
}

.search {
  position: relative;
  flex: 1 1 180px;
  min-width: 180px;
  max-width: 320px;
}
.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 30px;
  padding: 0 12px 0 32px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.search input::placeholder {
  color: var(--muted);
}
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.proj-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.proj {
  position: relative;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}
.proj:hover,
.proj:focus-visible {
  border-color: var(--border-strong);
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
  outline: none;
}
.proj__body {
  min-width: 0;
}
.proj__thumb {
  width: 190px;
  height: 118px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  overflow: hidden;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  background:
    repeating-linear-gradient(0deg, transparent 0 19px, rgba(120, 150, 220, 0.07) 19px 20px),
    repeating-linear-gradient(90deg, transparent 0 19px, rgba(120, 150, 220, 0.07) 19px 20px),
    var(--surface-3);
}
.proj__thumb span {
  font-size: 10.5px;
  line-height: 1.45;
}
.proj__badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
  backdrop-filter: blur(3px);
}
.proj__name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
}
.proj__name .t {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj__desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-soft);
}
.proj__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.m-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}
.m-item svg {
  flex: none;
  color: var(--muted);
}
.proj__actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-2px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}
.proj:hover .proj__actions,
.proj:focus-within .proj__actions {
  opacity: 1;
  transform: none;
}

.tag {
  flex-shrink: 0;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3);
}
.tag--ok {
  color: var(--pos);
  border-color: currentColor;
  background: transparent;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 24px;
  text-align: center;
  color: var(--text-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
}
.empty svg {
  color: var(--muted);
}
.empty h3 {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--text);
}
.empty p {
  max-width: 420px;
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

/* Aktivní projekt v c-bar conversion stránky */
.proj-ctx {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  max-width: 360px;
  padding: 4px 14px 4px 2px;
  border-right: 1px solid var(--border);
}
.proj-ctx__name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.proj-ctx__name:hover {
  color: var(--accent);
}
.proj-ctx__name:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.proj-ctx__name .nm {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-ctx__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-ctx__meta .dot {
  width: 3px;
  height: 3px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
}

.status-proj {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.project-dialog {
  max-width: 460px;
}
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-soft);
}
.field label b {
  color: var(--neg);
}
.field textarea.form-control {
  min-height: 70px;
  resize: vertical;
}
.hint {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
}
.hint svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--accent);
}
.confirm-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-soft);
}
.confirm-text b {
  color: var(--text);
}

@media (max-width: 640px) {
  .proj {
    grid-template-columns: 1fr;
  }
  .proj__thumb {
    width: 100%;
    height: 150px;
  }
  .proj__actions {
    position: static;
    opacity: 1;
    transform: none;
    margin-top: 12px;
    justify-content: flex-end;
  }
  .proj-ctx {
    max-width: 100%;
    border-right: 0;
    padding-right: 2px;
  }
  .proj-ctx__meta {
    display: none;
  }
}

