:root {
  color-scheme: dark;
  --shop-bg: #0d1522;
  --shop-panel: #141f30;
  --shop-raised: #19273a;
  --shop-border: #304156;
  --shop-text: #f1f5fa;
  --shop-muted: #a8bacd;
  --shop-accent: #ff8a15;
  --shop-on-accent: #211508;
  --forma-paper: var(--shop-bg);
  --forma-ink: var(--shop-text);
  --forma-teal: var(--shop-accent);
  --forma-deep: var(--shop-accent);
  --forma-tint: #293142;
  --forma-line: var(--shop-border);
  --ink: var(--shop-text);
  --muted: var(--shop-muted);
  --paper: var(--shop-panel);
  --border: var(--shop-border);
  --accent: var(--shop-accent);
  --navy: var(--shop-bg);
  color: var(--shop-text);
  background: var(--shop-bg);
}

body, body.selection-workspace { background: var(--shop-bg); color: var(--shop-text); }
.app-header, .app-nav { background: var(--shop-bg); border-color: var(--shop-border); color: var(--shop-text); }
.workshop-mark { color: var(--shop-accent); font-size: 2rem; line-height: 1; }
.boot { background: var(--shop-bg); color: var(--shop-text); }
.boot .workshop-mark { display: inline-block; font-size: 3rem; }

button, .project-card-menu > summary, .viewtools > summary,
body.selection-workspace .app-header button,
body.selection-workspace #mobile-toolbar button,
body.selection-workspace .context-group button,
body.selection-workspace #mobile-sheet-toggle,
body.selection-workspace .viewtools button {
  color: var(--shop-text);
  background: var(--shop-panel);
  border-color: var(--shop-border);
}
button:hover, body.selection-workspace #mobile-toolbar button:hover { background: var(--shop-raised); }
button.primary, #projects-screen .primary,
body.selection-workspace #header-export, body.selection-workspace #add-first-part {
  color: var(--shop-on-accent);
  background: var(--shop-accent);
  border-color: var(--shop-accent);
}
#projects-screen .primary:hover, button.primary:hover { background: #ffab57; border-color: #ffab57; }
button:focus-visible, summary:focus-visible, [role=separator]:focus-visible { outline: 2px solid var(--shop-accent); outline-offset: -2px; }
input:not([type=color]):not([type=file]), select, textarea,
body.selection-workspace #mobile-sheet input:not([type=color]),
body.selection-workspace #mobile-sheet select {
  color: var(--shop-text);
  background: var(--shop-bg);
  border-color: var(--shop-border);
}
.fields input { background: var(--shop-bg) !important; }
.control-label, .fields label, .check-label, .color-label, .muted,
body.selection-workspace #selection-help, body.selection-workspace #mobile-sheet .section-label { color: var(--shop-muted); }
.empty-state, .settings-card, .module-card, dialog,
:is(#projects-screen,#library-screen) .project-card-menu .card-actions,
body.selection-workspace.mobile-nav-open #workspace-project-actions,
body.selection-workspace.edge-task-open #cad-edge-dialog {
  color: var(--shop-text);
  background: var(--shop-panel);
  border-color: var(--shop-border);
}
body.selection-workspace #cad-edge-form>.actions { background: var(--shop-panel); box-shadow: none; }
body.selection-workspace #cad-edge-submit,
body.selection-workspace #cad-edge-preview { background: var(--shop-accent); border-color: var(--shop-accent); color: var(--shop-on-accent); }
:is(#project-list,#library-list) { gap: 8px; }
:is(#projects-screen,#library-screen) .project-card,
:is(#projects-screen,#library-screen) .project-card:first-child {
  background: var(--shop-panel);
  border: 1px solid var(--shop-border);
  border-radius: 10px;
}
:is(#projects-screen,#library-screen) .card-open img, :is(#projects-screen,#library-screen) .card-placeholder { background: #fff; color: #50415f; }
:is(#projects-screen,#library-screen) .card-open { padding-left: 8px; }
#projects-screen .project-tools button { color: var(--shop-text); }
#projects-screen .project-tools button:hover, :is(#projects-screen,#library-screen) .card-open:hover { background: var(--shop-raised); }
:is(#projects-screen,#library-screen) .card-open strong { color: var(--shop-text); }
:is(#projects-screen,#library-screen) .card-chevron { color: var(--shop-accent); }

#workshop-view-mode { display: none; }
body.selection-workspace #workshop-view-mode { display: flex; gap: 2px; }
body.selection-workspace #workshop-view-mode button { min-width: 34px; padding: 4px 6px; }
body.selection-workspace #workshop-view-mode button[aria-pressed=true] {
  color: var(--shop-on-accent);
  background: var(--shop-accent);
}
body.selection-workspace #project-title,
body.selection-workspace #selection-status { color: var(--shop-text); }
body.selection-workspace .project-status small { color: var(--shop-muted); }
body.selection-workspace #workspace-back, body.selection-workspace #mobile-menu { color: var(--shop-text); background: var(--shop-panel); border-color: var(--shop-border); }
body.selection-workspace .app-header { background: var(--shop-bg); border-color: var(--shop-border); }

#workspace-views {
  grid-column: 1;
  grid-row: 1;
  flex: 1 1 0;
  position: relative;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  min-width: 0;
  min-height: 130px;
  isolation: isolate;
}
#workspace-views[data-mode=split] { grid-template-rows: minmax(0, var(--plan-share, 50%)) 14px minmax(0, 1fr); }
body.selection-workspace #workspace-views #viewport,
#plan-view {
  grid-row: 1;
  grid-column: 1;
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--shop-bg);
}
body.selection-workspace #workspace-views[data-mode=split] #viewport { grid-row: 3; }
#plan-view[hidden], #workspace-views #viewport[hidden], #view-divider[hidden] { display: none !important; }
#plan-view canvas { position: absolute; inset: 0; display: block; }
#plan-view .viewport-label, #editor-underlay { position: absolute; top: 8px; z-index: 2; }
#plan-view .viewport-label { left: 56px; padding: 6px 8px; color: var(--shop-muted); background: var(--shop-panel); border-radius: 6px; font-size: .8rem; }
#editor-underlay { right: 8px; min-height: 38px; padding: 5px 10px; }
#view-divider {
  grid-row: 2;
  z-index: 4;
  display: grid;
  place-items: center;
  background: var(--shop-panel);
  border-block: 1px solid var(--shop-border);
  cursor: row-resize;
  touch-action: none;
}
#view-divider::before {
  content: '';
  width: 32px;
  height: 4px;
  background: var(--shop-muted);
  border-radius: 4px;
}
body.selection-workspace #viewport-status { background: var(--shop-panel); color: var(--shop-text); border-color: var(--shop-border); }

body.selection-workspace .viewtools .view-options { background: var(--shop-panel); border-color: var(--shop-border); }

#workshop-left-tools {
  position: absolute;
  z-index: 8;
  top: 8px;
  bottom: 48px;
  left: 0;
  max-height: max-content;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 56px;
  padding: 5px;
  overflow: auto;
  background: var(--shop-panel);
  border: 1px solid var(--shop-border);
  border-radius: 0 12px 12px 0;
}
#workshop-left-tools[hidden] { display: none; }
#workshop-left-tools button { flex: 0 0 39px; padding: 0; min-height: 39px; color: var(--shop-text); background: var(--shop-bg); font-size: 1.05rem; }
#workshop-left-tools #workshop-add {
  flex-basis: 44px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1px;
  font-size: .65rem;
}
#workshop-add span { font-size: 1.15rem; line-height: 1; }
#workshop-left-tools .workshop-side-task {
  flex-basis: 46px;
  font-size: .65rem;
  line-height: 1.25;
}
#workshop-left-actions {
  position: absolute;
  z-index: 12;
  top: 8px;
  left: env(safe-area-inset-left, 0px);
  display: flex;
  align-items: center;
  gap: 6px;
}
#workshop-left-actions.rail-open { left: max(56px, env(safe-area-inset-left, 0px)); }
body.selection-workspace #workshop-left-actions .viewtools { position: relative; inset: auto; z-index: 12; }
body.selection-workspace #workshop-left-actions .view-options {
  top: calc(100% + 6px);
  bottom: auto;
  min-width: 224px;
  max-height: calc(100dvh - 250px);
  overflow-y: auto;
  padding: 8px;
  gap: 6px;
  border-radius: 14px;
  box-shadow: 0 14px 32px #030712cc;
}
.view-group-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--shop-muted);
  padding: 2px 2px 0;
}
.view-camera-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
.view-camera-grid .view-span-2 { grid-column: 1 / -1; }
body.selection-workspace .viewtools .view-options button {
  min-height: 40px;
  padding: 6px 10px;
  font-size: .82rem;
  justify-content: flex-start;
  text-align: left;
  border-radius: 10px;
}
body.selection-workspace .viewtools .view-options button[aria-pressed="true"] {
  color: var(--shop-on-accent);
  background: var(--shop-accent);
  border-color: var(--shop-accent);
  font-weight: 700;
}
#workspace-views[data-mode=2d] :is(#workshop-left-actions .viewtools, #viewport-move) { display: none; }
#workshop-left-toggle {
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 1.25rem;
  border-radius: 0 12px 12px 0;
  color: var(--shop-text);
}
#workshop-bottom-toggle { display: none; }
body.selection-workspace { --workshop-toggle-width: 82px; }
body.selection-workspace:not(.edge-task-open) #workshop-bottom-toggle {
  position: fixed;
  z-index: 36;
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--workspace-safe) + 8px);
  display: grid;
  place-items: center;
  min-height: 44px;
  min-width: 78px;
  padding: 4px 8px;
  font-size: .78rem;
  white-space: nowrap;
  background: var(--shop-panel);
  border-color: var(--shop-border);
}
body.selection-workspace.workshop-bottom-open:not(.edge-task-open) #workshop-bottom-toggle {
  bottom: calc(var(--workspace-safe) + (var(--workspace-nav) - 44px) / 2);
  width: var(--workshop-toggle-width);
  height: 44px;
}
body.selection-workspace.workshop-bottom-open:not(.edge-task-open) #mobile-toolbar {
  padding-right: calc(max(12px, env(safe-area-inset-right, 0px)) + var(--workshop-toggle-width) + 6px);
}
body.selection-workspace:not(.edge-task-open):not(.workshop-bottom-open) #editor-screen { padding-bottom: 0; }
body.selection-workspace:not(.workshop-bottom-open) #mobile-toolbar,
body.selection-workspace:not(.workshop-bottom-open) #context-actions { display: none; }
body.selection-workspace[data-selection-mode=none]:not(.edge-task-open):not(.workshop-bottom-open) #context-actions {
  display: flex;
  bottom: calc(var(--workspace-safe) + 57px);
  left: 50%;
  right: auto;
  width: min(320px, calc(100% - 92px));
  height: auto;
  transform: translateX(-50%);
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}
body.selection-workspace #context-actions, body.selection-workspace #mobile-toolbar { color: var(--shop-text); background: var(--shop-bg); border-color: var(--shop-border); }
body.selection-workspace #context-transform-size,
body.selection-workspace #mobile-toolbar button.active { color: var(--shop-on-accent); background: var(--shop-accent); border-color: var(--shop-accent); }
body.selection-workspace #mobile-toolbar button { gap: 4px; padding-inline: 3px; }
body.selection-workspace #mobile-toolbar button>span { font-size: 1.15rem; }
body.selection-workspace #mobile-sheet,
body.selection-workspace #mobile-sheet-toggle,
body.selection-workspace #transform-tools,
body.selection-workspace .numeric-details,
body.selection-workspace .pick-modes button,
body.selection-workspace #property-tabs button,
body.selection-workspace #edit-task-back,
body.selection-workspace .object,
body.selection-workspace .edge-picker,
body.selection-workspace .mesh-notice,
body.selection-workspace #workspace-project-actions button,
body.selection-workspace #context-body-more {
  color: var(--shop-text);
  background: var(--shop-panel);
  border-color: var(--shop-border);
}
body.selection-workspace .object.active,
body.selection-workspace .pick-modes button.active,
body.selection-workspace #transform-tools button[aria-pressed=true] {
  color: var(--shop-on-accent);
  background: var(--shop-accent);
  border-color: var(--shop-accent);
}
body.selection-workspace #transform-tools button { color: var(--shop-text); border-color: var(--shop-border); }
body.selection-workspace .numeric-details > summary { color: var(--shop-text); }
body.selection-workspace #mobile-sheet-toggle .sheet-chevron { color: var(--shop-muted); }
body.selection-workspace #selection-strip #selection-status { min-width: 0; }
body.selection-workspace #selection-strip :is(#context-body-shape, #context-body-more) {
  flex: 0 0 auto;
  width: auto;
  min-height: 44px;
  padding: 4px 8px;
  border: 1px solid var(--shop-border);
  background: var(--shop-panel);
  color: var(--shop-text);
  box-shadow: none;
  font-size: .78rem;
}
body.selection-workspace #selection-strip :is(#context-body-shape, #context-body-more):hover {
  border-color: var(--shop-accent);
}

body.workspace-photo { background: var(--shop-bg); color: var(--shop-text); }
body.workspace-photo :is(.photo-heading h1, .photo-task h2, .photo-outline-tools-heading strong) { color: var(--shop-text); }
body.workspace-photo .photo-stage { background: #141220; border-color: var(--shop-border); }
body.workspace-photo :is(.photo-steps, .photo-flow-footer, #photo-outline-tools, .photo-outline-tools-heading,
  #photo-auto-panel, #photo-calibration-controls, #photo-model-summary) {
  color: var(--shop-text);
  background: var(--shop-panel);
  border-color: var(--shop-border);
}
body.workspace-photo :is(.photo-task p, .photo-flow-footer small, .photo-hint, .photo-dimension-grid label,
  .photo-hole-row label, .photo-notes, .photo-steps button) { color: var(--shop-muted); }
body.workspace-photo .photo-dimension-grid input {
  color: var(--shop-text);
  background: var(--shop-bg) !important;
  border-color: var(--shop-border) !important;
}
body.workspace-photo .photo-flow-footer #photo-next:not(:disabled),
body.workspace-photo .photo-steps button.active {
  color: var(--shop-on-accent);
  background: var(--shop-accent);
  border-color: var(--shop-accent);
}

@media (max-width: 600px) {
  body.selection-workspace .app-header { gap: 5px; padding-inline: 6px; }
  body.selection-workspace #workspace-back { width: 38px; min-width: 38px; font-size: 0; padding: 0; }
  body.selection-workspace #workspace-back::before { content: '‹'; font-size: 1.45rem; }
  body.selection-workspace #mobile-menu { width: 34px; min-width: 34px; }
  body.selection-workspace .header-actions { gap: 4px; }
  body.selection-workspace .header-actions #header-export { padding-inline: 6px; }
  body.selection-workspace #mobile-toolbar button { flex-direction: column; gap: 2px; font-size: .72rem; }
}

body.selection-workspace.mobile-sheet-open #mobile-sheet,
body.selection-workspace #context-actions .context-group button:not(.primary),
body.selection-workspace #viewport-history button,
body.selection-workspace #viewport-status,
body.selection-workspace .viewtools button,
body.selection-workspace #selection-choice {
  background: var(--shop-panel);
  color: var(--shop-text);
  border-color: var(--shop-border);
}
body.selection-workspace #context-actions .context-group button {
  flex: 1 1 0;
  min-width: 64px;
  padding: 8px 6px;
}
body.selection-workspace.mobile-sheet-open[data-selection-mode="none"] #context-actions {
  display: none;
}
body.selection-workspace #context-actions #context-transform-size {
  background: var(--shop-accent);
  color: var(--shop-on-accent);
  border-color: var(--shop-accent);
}
body.selection-workspace #mobile-sheet .section-label,
body.selection-workspace #mesh-selection p,
body.selection-workspace #selection-status { color: var(--shop-muted); }

body.selection-workspace #workshop-left-tools #viewport-move {
  min-height: 44px;
  padding: 3px;
  font-size: .65rem;
  color: var(--shop-text);
  background: var(--shop-panel);
  border-color: var(--shop-border);
}
body.selection-workspace #viewport-move[aria-pressed=true] {
  color: var(--shop-on-accent);
  background: var(--shop-accent);
  border-color: var(--shop-accent);
}
#viewport-move-hint {
  position: absolute;
  z-index: 7;
  inset: auto 112px 12px 64px;
  max-width: max-content;
  margin: 0;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--shop-panel);
  color: var(--shop-text);
  pointer-events: none;
  font-size: .8rem;
}
#viewport.moving-part canvas { cursor: grab; }
#viewport.moving-part canvas:active { cursor: grabbing; }
body.edge-task-open #viewport-move { display: none; }

/* 2.40 (telefon): úpravy dílu v levé liště, kostka pohledu nad tlačítkem Nástroje */
#workshop-left-tools .rail-sep { flex: 0 0 auto; width: 100%; margin: 2px 0; border: 0; border-top: 1px solid var(--shop-border); }
#workshop-left-tools .rail-body-task[hidden] { display: none; }
#workshop-left-tools .rail-body-task { font-size: .62rem; }
#workshop-left-toggle.has-tasks { border-color: #2dd4bf; box-shadow: 0 0 0 2px #2dd4bf55; }
html:not(.pc) body.selection-workspace:not(.workshop-bottom-open):not(.edge-task-open) #view-cube-wrap { bottom: calc(var(--workspace-safe, 0px) + 64px); }
/* Lišta 3D šipek: na telefonu výsuvná zleva dole */
#gizmo-bar-toggle { display: none; }
html:not(.pc) body.selection-workspace #gizmo-bar-toggle {
  position: absolute; left: 0; bottom: 10px; z-index: 11; display: grid; place-items: center;
  min-height: 44px; min-width: 52px; padding: 4px 10px; border-radius: 0 12px 12px 0;
  background: var(--shop-panel, #0d1726); border: 1px solid #2d435e; border-left: 0; font-size: .9rem;
}
html:not(.pc) body.selection-workspace #gizmo-bar[hidden] ~ #gizmo-bar-toggle { display: none; }
html:not(.pc) body.selection-workspace #gizmo-bar { transition: transform .2s ease, opacity .2s ease; }
html:not(.pc) body.selection-workspace:not(.gizmo-bar-open) #gizmo-bar { transform: translateX(calc(-100% - 12px)); opacity: 0; pointer-events: none; }
html:not(.pc) body.selection-workspace.gizmo-bar-open #gizmo-bar { left: 52px; max-width: calc(100% - 140px); }
html:not(.pc) body.selection-workspace.gizmo-bar-open #gizmo-bar-toggle { min-width: 44px; }
