/* ==========================================================================
   SwissTile PRO — D.R. · Swiss Precision Instrument
   Design System: Swiss Quiet Instrument (Dark / Sunlight Light + Print PDF)
   100% Static Offline CSS · Zero External Dependencies
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg: #0f1217;
  --card: #171b22;
  --elevated: #1e232c;
  --border: #2a3140;
  --border-strong: #384154;
  --text: #f4f5f7;
  --muted: #8b919c;
  --accent: #dc2626;
  --accent-hover: #ef4444;
  --accent-soft: #2a1518;
  --accent-border: rgba(220, 38, 38, 0.45);
  --safe: #3dd68c;
  --safe-soft: rgba(61, 214, 140, 0.12);
  --safe-border: rgba(61, 214, 140, 0.38);
  --cad-bg: #0b0e13;
  --cad-grid: #19202b;
  --cad-piece: #1d232e;
  --cad-piece-alt: #222936;
  --cad-piece-stroke: #3c4659;
  --cad-wall: #d6dae2;
  --cad-dim: #9aa3b2;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.42);
  --focus-ring: 0 0 0 2px rgba(220, 38, 38, 0.55);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f6f5f2;
  --card: #ffffff;
  --elevated: #f3f1ec;
  --border: #e2e0d8;
  --border-strong: #c8c5ba;
  --text: #111318;
  --muted: #5c6370;
  --accent: #dc2626;
  --accent-hover: #b91c1c;
  --accent-soft: #fde8e8;
  --accent-border: rgba(220, 38, 38, 0.38);
  --safe: #15803d;
  --safe-soft: rgba(21, 128, 61, 0.10);
  --safe-border: rgba(21, 128, 61, 0.35);
  --cad-bg: #faf9f6;
  --cad-grid: #ebe9e2;
  --cad-piece: #ffffff;
  --cad-piece-alt: #f4f2ec;
  --cad-piece-stroke: #9ca3af;
  --cad-wall: #1f242d;
  --cad-dim: #4b5563;
  --shadow-sm: 0 2px 6px rgba(17, 19, 24, 0.05);
  --shadow-md: 0 10px 26px rgba(17, 19, 24, 0.10);
  --focus-ring: 0 0 0 2px rgba(220, 38, 38, 0.4);
  color-scheme: light;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
  font-feature-settings: "tnum" 1, "cv05" 1;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

.num, input[type="number"], .metric-val, .dim-pill, .table-nums td {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  transition: opacity 0.38s ease, visibility 0.38s ease;
}

.splash-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.dr-shield {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--card), var(--elevated));
  border: 1.5px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.dr-shield::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--accent);
}

.dr-monogram {
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: 0.06em;
  color: var(--text);
}

.dr-monogram span { color: var(--accent); }

.splash-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0;
}

.splash-sub {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 0;
}

.splash-bar {
  width: 148px;
  height: 3px;
  border-radius: 99px;
  background: var(--elevated);
  overflow: hidden;
}

.splash-bar-fill {
  width: 45%;
  height: 100%;
  background: var(--accent);
  animation: swissLoad 0.85s ease-in-out infinite alternate;
}

@keyframes swissLoad {
  from { transform: translateX(-20%); width: 35%; }
  to { transform: translateX(175%); width: 55%; }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 120;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--elevated);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.brand-badge::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 3px;
  background: var(--accent);
}

.brand-badge strong {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1;
}

.brand-badge small {
  font-size: 0.54rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-top: 2px;
}

.brand-text { min-width: 0; }

.brand-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  white-space: nowrap;
}

.pro-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  border-radius: 5px;
  background: var(--accent);
  color: #ffffff;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin: 1px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 12px calc(86px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 1040px) {
  .app-shell {
    grid-template-columns: minmax(410px, 470px) minmax(0, 1fr);
    align-items: start;
    padding: 16px 18px 40px;
    gap: 18px;
  }
  .cad-column {
    position: sticky;
    top: 74px;
  }
}

.controls-column, .cad-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-title {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.seg-group {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  background: var(--elevated);
  padding: 5px;
  border-radius: 11px;
  border: 1px solid var(--border);
}

.seg-group.seg-2 { grid-template-columns: repeat(2, 1fr); grid-auto-flow: row; }
.seg-group.seg-3 { grid-template-columns: repeat(3, 1fr); grid-auto-flow: row; }

.seg-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.seg-btn:hover { color: var(--text); }

.seg-btn.is-active {
  background: var(--card);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.seg-btn.is-active.accent-active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: var(--accent);
}

.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease;
}

.btn:active { transform: translateY(1px); }

.btn:focus-visible, .seg-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-compact {
  min-height: 38px;
  padding: 6px 11px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-icon {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
}

.btn-ghost-danger {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (min-width: 520px) {
  .field-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field.span-2 { grid-column: span 2; }

.field label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input, select.input, textarea.input {
  width: 100%;
  min-height: 46px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  transition: border-color 0.15s ease;
}

.input-wrap .input { padding-right: 42px; }

.input-unit {
  position: absolute;
  right: 11px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  min-height: 36px;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.chip.is-active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.slider-box {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
}

.slider-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 6px;
  cursor: pointer;
}

.variant-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 600px) {
  .variant-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.variant-card {
  background: var(--elevated);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  padding: 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.variant-card.is-selected {
  border-color: var(--text);
  background: var(--card);
}

.variant-card.is-warn.is-selected { border-color: var(--accent); }
.variant-card.is-safe.is-selected { border-color: var(--safe); }

.variant-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.variant-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-pill.ok {
  background: var(--safe-soft);
  color: var(--safe);
  border: 1px solid var(--safe-border);
}

.status-pill.warn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.variant-cuts {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.8rem;
  color: var(--muted);
}

.variant-cuts strong { color: var(--text); }
.variant-cuts .bad-val { color: var(--accent); font-weight: 700; }
.variant-cuts .good-val { color: var(--safe); font-weight: 700; }

.cad-card { padding: 12px; }

.cad-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.cad-viewport {
  position: relative;
  width: 100%;
  min-height: 300px;
  height: clamp(310px, 48vh, 540px);
  background: var(--cad-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
@media (max-width: 768px) {
  .cad-viewport {
    min-height: 265px;
    height: clamp(280px, 80vw, 350px);
  }
}

.cad-viewport svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cad-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.76rem;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
}

.alert-banner {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  line-height: 1.4;
}

.alert-banner.warn {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--text);
}

.alert-banner.ok {
  background: var(--safe-soft);
  border: 1px solid var(--safe-border);
  color: var(--text);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.kpi-box {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 3px;
}

.kpi-value {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text);
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(8, 10, 14, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-backdrop[hidden] { display: none !important; }

.modal-panel {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-md);
}

.mobile-dock {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 110;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (min-width: 1040px) {
  .mobile-dock { display: none; }
}

.print-sheet { display: none; }


/* v2 Additions: 60+ Large Digits Mode (A+), CAD Quick-Edit, Gray 90° Diagonal, Live X/Y Nudge */
.cad-dim-pill rect { transition: stroke-width 0.15s ease, filter 0.15s ease; }
.cad-dim-pill:hover rect { stroke: var(--accent); filter: brightness(1.08); }
.diag-ref-input { font-variant-numeric: tabular-nums; font-weight: 700; }
.diag-ref-input::placeholder { color: var(--muted); opacity: 0.92; font-weight: 700; font-variant-numeric: tabular-nums; }
.diag-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.diag-badge-ref { color: var(--muted); background: var(--elevated); border: 1px solid var(--border); border-radius: 5px; padding: 2px 7px; font-weight: 600; }
.diag-badge-dev { border-radius: 5px; padding: 2px 7px; font-weight: 800; }
.diag-badge-dev.ok { color: var(--safe); background: var(--safe-soft); border: 1px solid var(--safe-border); }
.diag-badge-dev.warn { color: #ffffff; background: var(--accent); border: 1px solid var(--accent); }

.cad-quick-edit { display: flex; align-items: center; gap: 8px; background: var(--elevated); border: 2px solid var(--accent); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; box-shadow: var(--shadow-sm); }
.cad-quick-edit[hidden] { display: none !important; }
.cad-quick-edit-label { font-weight: 800; font-size: 0.92rem; color: var(--text); white-space: nowrap; }
.cad-quick-edit input { flex: 1; min-width: 90px; font-size: 1.25rem !important; font-weight: 800; font-variant-numeric: tabular-nums; padding: 8px 10px; text-align: center; background: var(--card); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px; }

.cad-nudge-panel { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-top: 8px; display: grid; gap: 8px; }
.nudge-axis-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.nudge-axis-title { font-size: 0.82rem; font-weight: 800; min-width: 72px; font-variant-numeric: tabular-nums; }
.nudge-axis-row input[type="range"] { flex: 1; min-width: 110px; accent-color: var(--accent); height: 28px; }
.nudge-btns { display: flex; flex-wrap: wrap; gap: 5px; width: 100%; }
.nudge-btn { flex: 1 1 auto; min-height: 38px; padding: 6px 8px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--elevated); color: var(--text); font-weight: 700; font-size: 0.84rem; font-variant-numeric: tabular-nums; cursor: pointer; }
.nudge-btn:hover, .nudge-btn.primary-nudge { border-color: var(--accent); }
.nudge-btn.primary-nudge { background: var(--accent-soft); color: var(--text); }

.threshold-advice-box { background: var(--accent-soft); border: 1.5px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: 0.88rem; }
.threshold-advice-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.btn-large-ui { font-weight: 900 !important; letter-spacing: -0.02em; min-width: 44px; }
.btn-large-ui.active { background: var(--accent) !important; color: #ffffff !important; border-color: var(--accent) !important; }
body.large-ui { font-size: 18px; }
body.large-ui input[type="number"], body.large-ui input[type="text"], body.large-ui select { font-size: 1.22rem !important; font-weight: 800 !important; min-height: 48px !important; padding: 9px 12px !important; font-variant-numeric: tabular-nums; }
body.large-ui .field-label, body.large-ui label { font-size: 0.98rem !important; font-weight: 700 !important; }
body.large-ui .btn, body.large-ui .seg-btn, body.large-ui .nudge-btn { font-size: 1rem !important; min-height: 46px !important; padding: 9px 12px !important; }
body.large-ui .kpi-val, body.large-ui .quote-total-val { font-size: 1.48rem !important; font-variant-numeric: tabular-nums; }
body.large-ui .variant-card { padding: 12px !important; font-size: 1rem !important; }
body.large-ui .cad-quick-edit input { font-size: 1.5rem !important; min-height: 54px !important; }


/* === Contrast Framed Cards, Collapsible Headers & Laser Room Guide === */
:root .card, [data-theme="dark"] .card { background: rgba(15, 20, 28, 0.95); border: 1.5px solid #64748b; border-radius: 14px; overflow: hidden; }
[data-theme="light"] .card { background: #f8fafc; border: 2px solid #334155; border-radius: 14px; overflow: hidden; }
:root .card > .card-header, [data-theme="dark"] .card > .card-header,
:root .cad-card > .cad-toolbar, [data-theme="dark"] .cad-card > .cad-toolbar { background: #1e293b; color: #f8fafc; border-bottom: 1.5px solid #64748b; }
[data-theme="light"] .card > .card-header, [data-theme="light"] .cad-card > .cad-toolbar { background: #e2e8f0; color: #0f172a; border-bottom: 2px solid #334155; }
.card > .card-header { margin: -14px -14px 14px -14px; padding: 11px 14px; }
.cad-card > .cad-toolbar { margin: -12px -12px 12px -12px; padding: 11px 14px; }
:root .card > .card-header .card-title, [data-theme="dark"] .card > .card-header .card-title,
:root .cad-card > .cad-toolbar .card-title, [data-theme="dark"] .cad-card > .cad-toolbar .card-title { color: #f8fafc; }
[data-theme="light"] .card > .card-header .card-title, [data-theme="light"] .cad-card > .cad-toolbar .card-title { color: #0f172a; }
[data-theme="light"] .card > .card-header .step-dot { background: #f8fafc; border-color: #334155; color: #0f172a; }
:root .card > .card-header .step-dot, [data-theme="dark"] .card > .card-header .step-dot { background: #0f172a; border-color: #94a3b8; color: #f8fafc; }
.sec-collapsible-header { cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.sec-collapse-chevron { margin-left: auto; padding-left: 8px; font-size: 0.95rem; font-weight: 900; line-height: 1; flex-shrink: 0; pointer-events: none; }
.card:not(.cad-card).is-collapsed > .card-header { margin-bottom: -14px; border-bottom-color: transparent; }
.card:not(.cad-card).is-collapsed > :not(.card-header),
#controlsColumn .card:not(.cad-card).is-collapsed > :not(.card-header),
#controlsColumn #sec2RoomCard.is-collapsed > :not(.card-header) { display: none !important; }
#p2CheckBadge ~ .diag-meta-row { display: none !important; }
.rm-poly { fill: var(--card); stroke: none; }
.rm-seg { stroke: #64748b; stroke-width: 3; stroke-linecap: round; }
.rm-diag { stroke-dasharray: 7 5; }
.rm-diag-opt { stroke-dasharray: 4 5; opacity: 0.75; }
@keyframes rmLaserPulse { 0%, 100% { stroke-width: 5.2; opacity: 1; } 50% { stroke-width: 8.2; opacity: 0.76; } }
.rm-seg.is-active { stroke: #dc2626 !important; stroke-dasharray: none !important; opacity: 1 !important; marker-start: url(#rmArrRed); marker-end: url(#rmArrRed); animation: rmLaserPulse 1s ease-in-out infinite; }
.rm-lbl { cursor: pointer; }
.rm-lbl rect { fill: #0f172a; stroke: #94a3b8; stroke-width: 1.5; }
.rm-lbl text { fill: #ffffff; font-size: 12px; font-weight: 800; text-anchor: middle; }
.rm-lbl.is-active rect { fill: #dc2626; stroke: #ffffff; stroke-width: 2; }
.mobile-dock .btn { font-size: 0.76rem; line-height: 1.15; padding: 6px; white-space: normal; text-align: center; }

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  html, body { background: #ffffff !important; color: #111318 !important; font-size: 10.5pt; }
  .topbar, .controls-column, .mobile-dock, .modal-backdrop, .splash-screen, .no-print, .cad-column { display: none !important; }
  .app-shell { display: block !important; padding: 0 !important; margin: 0 !important; }
  .print-sheet { display: block !important; color: #111318 !important; }
  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #dc2626;
    padding-bottom: 10px;
    margin-bottom: 14px;
  }
  .print-logo { max-height: 52px; max-width: 160px; object-fit: contain; }
  .print-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
  .print-box { border: 1px solid #d1d5db; border-radius: 6px; padding: 9px 11px; break-inside: avoid; }
  .print-box h3 { margin: 0 0 6px; font-size: 9.5pt; text-transform: uppercase; letter-spacing: 0.06em; color: #374151; }
  .print-cad-wrap { border: 1px solid #d1d5db; border-radius: 6px; padding: 8px; margin: 10px 0; background: #ffffff !important; break-inside: avoid; }
  .print-cad-wrap svg { width: 100%; max-height: 95mm; height: auto; }
  .print-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; margin-top: 8px; }
  .print-table th, .print-table td { border-bottom: 1px solid #e5e7eb; padding: 6px 8px; text-align: left; }
  .print-table th { background: #f3f4f6; font-weight: 700; }
  .print-table td.num, .print-table th.num { text-align: right; }
  .print-footer { margin-top: 16px; padding-top: 8px; border-top: 1px solid #e5e7eb; font-size: 8pt; color: #6b7280; display: flex; justify-content: space-between; }
}

/* === SwissTile PRO — Section 2 Clean Architecture (Zero Overlap) === */
#sec2RoomCard {
  display: block !important;
  visibility: visible !important;
}
#sec2RoomCard > .card-header {
  display: flex !important;
  visibility: visible !important;
}
#geomSwitch .seg-btn {
  white-space: normal;
  line-height: 1.22;
  padding: 8px 6px;
  height: auto;
  min-height: 40px;
  text-align: center;
}
#sec2-rect-box,
#sec2-laser-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}
#sec2-rect-box.sec2-pane-hidden,
#sec2-laser-box.sec2-pane-hidden,
#sec2-rect-box[hidden],
#sec2-laser-box[hidden] {
  display: none !important;
}
#sec2-rect-box .field,
#sec2-laser-box .field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sec2-field-lbl {
  display: flex;
  align-items: flex-end;
  min-height: 2.45em;
  line-height: 1.2;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 5px;
  word-break: break-word;
}
.sec2-full-span {
  grid-column: 1 / -1;
  margin-top: 2px;
}
#sec2-svg-guide {
  width: 100%;
  margin-top: 12px;
  padding: 10px 10px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--elevated, rgba(148, 163, 184, 0.06));
  box-sizing: border-box;
}
.sec2-svg-caption {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.3;
}
#sec2GuideSvg {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  margin: 0 auto;
  overflow: visible;
  user-select: none;
}
.sec2-room-poly { fill: rgba(59, 130, 246, 0.06); stroke: none; }
.sec2-seg {
  stroke: var(--text, #cbd5e1);
  stroke-width: 2.2px;
  stroke-linecap: round;
  opacity: 0.72;
  transition: stroke 0.15s ease, stroke-width 0.15s ease, opacity 0.15s ease;
}
.sec2-rect-axis { stroke: #64748b; stroke-width: 1.8px; stroke-dasharray: 5 4; opacity: 0.85; }
.sec2-diag-main { stroke: #64748b; stroke-width: 1.8px; stroke-dasharray: 6 4; }
.sec2-diag-opt  { stroke: #94a3b8; stroke-width: 1.5px; stroke-dasharray: 3 4; opacity: 0.6; }
.sec2-seg.is-active-measure {
  stroke: #dc2626 !important;
  stroke-width: 3.8px !important;
  stroke-dasharray: none !important;
  opacity: 1 !important;
  marker-start: url(#sec2ArrStart);
  marker-end: url(#sec2ArrEnd);
}
.sec2-door-gap-line { stroke: #f59e0b; stroke-width: 4.5px; stroke-linecap: round; }
.sec2-door-arc { fill: rgba(245, 158, 11, 0.12); stroke: #f59e0b; stroke-width: 1.4px; stroke-dasharray: 3 2; }
.sec2-corners circle { fill: var(--card, #1e293b); stroke: var(--text, #e2e8f0); stroke-width: 2px; }
.sec2-corners text { fill: var(--text, #e2e8f0); font-size: 11.5px; font-weight: 800; font-family: system-ui, -apple-system, sans-serif; }
.sec2-badge { cursor: pointer; }
.sec2-badge rect { fill: var(--card, #0f172a); stroke: var(--border, #475569); stroke-width: 1.3px; }
.sec2-badge text { fill: var(--text, #f8fafc); font-size: 10.5px; font-weight: 800; font-family: system-ui, -apple-system, sans-serif; }
.sec2-badge.is-active-measure rect { fill: #dc2626 !important; stroke: #991b1b !important; }
.sec2-badge.is-active-measure text { fill: #ffffff !important; }
.sec2-orient-pill { fill: rgba(15, 23, 42, 0.86); stroke: #475569; stroke-width: 1.2px; }
.sec2-orient-door { fill: rgba(245, 158, 11, 0.16); stroke: #d97706; stroke-width: 1.5px; }
.sec2-orient-ceiling, .sec2-orient-floor { fill: rgba(59, 130, 246, 0.15); stroke: #3b82f6; stroke-width: 1.4px; }
.sec2-orient-txt { fill: var(--text, #f8fafc); font-size: 11px; font-weight: 800; letter-spacing: 0.02em; font-family: system-ui, -apple-system, sans-serif; }
.sec2-orient-door-txt { fill: #d97706; }
[data-theme="dark"] .sec2-orient-door-txt, :root:not([data-theme="light"]) .sec2-orient-door-txt { fill: #fbbf24; }

/* === SWISSTILE PRO: CLEAN UI & RULER-STRAIGHT ALIGNMENT === */
body {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.topbar {
  position: relative !important;
  top: auto !important;
  z-index: 40;
  padding: max(6px, env(safe-area-inset-top)) 12px 6px !important;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
  min-height: 38px;
}

.brand.brand-compact {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  min-width: 0;
  flex-shrink: 1;
}

.brand-dr-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.2;
  flex-shrink: 0;
}

.brand-dot {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.brand.brand-compact .brand-title {
  font-size: 0.95rem !important;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-quick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.topbar-quick > .btn {
  min-height: 34px !important;
  height: 34px;
  padding: 0 9px !important;
  font-size: 0.78rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.topbar-quick > .btn-icon {
  width: 34px;
  padding: 0 !important;
}

.topbar-opts-chev {
  font-size: 0.66rem;
  opacity: 0.85;
}

.topbar-drawer[hidden] {
  display: none !important;
}

.topbar-drawer {
  max-width: 1440px;
  margin: 8px auto 2px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.topbar-drawer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

@media (min-width: 720px) {
  .topbar-drawer-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.topbar-drawer-grid > .btn,
.topbar-drawer-grid > .topbar-lang-select {
  width: 100% !important;
  min-height: 38px !important;
  height: 38px;
  padding: 4px 10px !important;
  font-size: 0.8rem !important;
  justify-content: center;
  box-sizing: border-box;
}

/* Global Dimension Input Alignment Across All 2/3/4-Col Grids */
.field-grid,
#sec2-rect-box {
  align-items: end !important;
}

.field-grid > .field,
#sec2-rect-box > .field {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  min-width: 0;
}

.field-grid > .field[hidden],
.field-grid[hidden] {
  display: none !important;
}

#sec2-laser-box > .field:nth-child(-n+4) {
  align-self: end !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
}

#sec2-laser-box > .field:nth-child(5),
#sec2-laser-box > .field:nth-child(6) {
  align-self: start !important;
}

#sec2-laser-box .diag-meta-row:empty {
  display: none;
}

.field .input,
.field select.input,
.field .input-wrap .input {
  min-height: 42px;
  height: 42px;
  box-sizing: border-box;
}

body.large-ui .field .input,
body.large-ui .field select.input,
body.large-ui .field .input-wrap .input {
  min-height: 48px;
  height: 48px;
}

#openingsList [style*="grid-template-columns"] {
  align-items: end !important;
}

/* Section 3 Symmetric Layout */
.sec3-main-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.sec3-span-full {
  grid-column: 1 / -1 !important;
  width: 100%;
}

#lblUnitL,
#lblUnitW {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.sec3-dir-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--elevated);
  min-height: 46px;
  box-sizing: border-box;
}

.sec3-rotate-btn {
  flex: 0 0 auto;
  min-height: 34px !important;
  height: 34px;
  padding: 0 12px !important;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.sec3-dir-badge {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 34px;
  padding: 4px 10px;
  border-radius: 7px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
}

#unitPresetsRow,
#jointPresetsRow,
.sec3-preset-grid {
  grid-column: 1 / -1 !important;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px !important;
  width: 100% !important;
  margin-top: 0 !important;
}

#jointFieldWrap #jointPresetsRow {
  margin-top: 8px !important;
}

#unitPresetsRow > button,
#unitPresetsRow > .chip,
#jointPresetsRow > button,
#jointPresetsRow > .chip {
  width: 100% !important;
  min-height: 38px !important;
  height: 100%;
  margin: 0 !important;
  padding: 6px 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  font-size: 0.78rem !important;
  font-weight: 700;
  line-height: 1.15;
  box-sizing: border-box;
}

#jointFieldWrap {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.sec3-subhead-lbl {
  font-size: 0.82rem !important;
  font-weight: 800 !important;
  color: var(--text) !important;
}

#jointZeroNote {
  display: none !important;
}

.sec3-pattern-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  width: 100%;
}

.sec3-pattern-row > #btnKaro45Quick {
  min-height: 42px;
  height: 42px;
  padding: 0 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

body.large-ui .sec3-pattern-row > #btnKaro45Quick {
  min-height: 48px;
  height: 48px;
}

.sec3-safety-wrap {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.sec3-safety-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Slim Equal-Height Bottom Dock */
.mobile-dock {
  padding: 6px 10px max(6px, env(safe-area-inset-bottom)) !important;
  gap: 6px !important;
  align-items: stretch !important;
}

.mobile-dock button {
  min-height: 38px !important;
  height: 38px !important;
  padding: 4px 6px !important;
  font-size: 0.78rem !important;
  font-weight: 700;
  line-height: 1.15 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}


/* Live 2-line edge cuts legend under CAD viewport */
.cad-cuts-summary {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  background: var(--elevated);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
  line-height: 1.28;
  font-variant-numeric: tabular-nums;
}
.cad-cuts-line {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.cad-cut-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 5px;
  padding: 4px 7px;
  border-radius: 7px;
  background: var(--card);
  border: 1px solid var(--border);
  min-width: 0;
  overflow: visible;
  white-space: normal;
}
.cad-cut-item.is-warn {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.09);
}
.cad-cut-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex: 0 0 7px;
  background: #16a34a;
}
.cad-cut-item.is-warn .cad-cut-dot {
  background: #ef4444;
}
.cad-cut-lbl {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.73rem;
  white-space: normal;
}
.cad-cut-val {
  margin-left: auto;
  color: var(--text);
  font-weight: 800;
  font-size: 0.74rem;
  white-space: normal;
  word-break: break-word;
  text-align: right;
  line-height: 1.22;
}
.cad-cut-item.is-warn .cad-cut-val {
  color: #ef4444;
}
@media (max-width: 480px) {
  .cad-cuts-summary { padding: 6px 7px; font-size: 0.71rem; }
  .cad-cuts-line { gap: 4px; }
  .cad-cut-item { padding: 3px 5px; gap: 3px 4px; }
  .cad-cut-lbl { font-size: 0.69rem; }
  .cad-cut-val { font-size: 0.70rem; }
}

/* Section 6 manual piece reserve stepper */
.reserve-stepper {
  display: flex;
  align-items: stretch;
  gap: 5px;
  width: 100%;
}
.reserve-step-btn {
  flex: 0 0 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0 !important;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  user-select: none;
}
.reserve-step-inp {
  flex: 1 1 auto;
  min-width: 54px;
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.reserve-step-inp::-webkit-outer-spin-button,
.reserve-step-inp::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
body.large-ui .reserve-step-btn {
  flex: 0 0 48px;
  min-width: 48px;
  min-height: 48px;
}

/* === v4 Hybryda H1 Splash + Animated Green Laser + 0%-100% Spark Bar === */
.splash-screen {
  background: radial-gradient(circle at 50% 38%, #161e2c 0%, #0d121b 56%, #070a10 100%) !important;
  color: #f8fafc !important;
  gap: 14px;
  overflow: hidden;
}

.splash-bg-pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(148, 163, 184, 0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(148, 163, 184, 0.07) 1px, transparent 1px),
    repeating-linear-gradient(90deg, transparent 0px, transparent 29px, rgba(217, 152, 85, 0.055) 29px, rgba(217, 152, 85, 0.055) 30px),
    radial-gradient(circle at 50% 42%, rgba(16, 185, 129, 0.10) 0%, transparent 55%);
  background-size: 56px 56px, 56px 56px, 30px 100%, 100% 100%;
  -webkit-mask-image: radial-gradient(ellipse at 50% 46%, rgba(0, 0, 0, 0.95) 18%, rgba(0, 0, 0, 0.32) 70%, transparent 100%);
  mask-image: radial-gradient(ellipse at 50% 46%, rgba(0, 0, 0, 0.95) 18%, rgba(0, 0, 0, 0.32) 70%, transparent 100%);
}

.splash-h1-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.65)) drop-shadow(0 0 18px rgba(16, 185, 129, 0.18));
}

.splash-h1-svg {
  display: block;
  width: 142px;
  height: 142px;
}

.h1-laser-scan {
  stroke-dasharray: 34 210;
  stroke-dashoffset: 244;
  animation: h1LaserSweep 1.05s linear infinite;
}

.h1-laser-halo {
  animation: h1LaserGlow 0.9s ease-in-out infinite alternate;
}

.h1-reticle-bloom {
  transform-origin: 130px 154px;
  animation: h1ReticlePulse 0.75s ease-in-out infinite alternate;
}

@keyframes h1LaserSweep {
  0% { stroke-dashoffset: 244; opacity: 0.35; }
  20% { opacity: 1; }
  85% { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0.35; }
}

@keyframes h1LaserGlow {
  0% { stroke-opacity: 0.28; }
  100% { stroke-opacity: 0.52; }
}

@keyframes h1ReticlePulse {
  0% { transform: scale(0.86); opacity: 0.20; }
  100% { transform: scale(1.18); opacity: 0.44; }
}

.splash-screen .splash-title {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.48rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #f8fafc !important;
  margin: 2px 0 0;
}

.splash-screen .splash-pro-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%) !important;
  color: #ffffff !important;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.45);
}

.splash-screen .splash-sub {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: #94a3b8 !important;
  margin: -4px 0 4px;
}

.splash-loader {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 224px;
}

.splash-screen .splash-bar {
  position: relative;
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(71, 85, 105, 0.55);
  overflow: visible;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.75);
}

.splash-screen .splash-bar-fill {
  position: relative;
  width: 0%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #059669 0%, #10b981 62%, #34d399 88%, #86efac 100%);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.85), 0 0 22px rgba(16, 185, 129, 0.42);
  animation: none;
  transition: width 0.045s linear;
}

.splash-bar-sheen-clip {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  overflow: hidden;
  pointer-events: none;
}

.splash-bar-sheen {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 64px;
  background: linear-gradient(90deg, transparent 0%, rgba(134, 239, 172, 0.55) 42%, rgba(255, 255, 255, 0.96) 52%, transparent 100%);
  animation: splashLaserSheen 0.62s linear infinite;
}

.splash-bar-spark {
  position: absolute;
  right: -4px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: #ffffff;
  box-shadow: 0 0 5px 2px #ffffff, 0 0 11px 4px #86efac, 0 0 20px 7px #10b981;
  animation: splashSparkFlicker 0.18s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes splashLaserSheen {
  0% { left: -68px; }
  100% { left: 100%; }
}

@keyframes splashSparkFlicker {
  0% { transform: translateY(-50%) scale(0.88); opacity: 0.92; }
  100% { transform: translateY(-50%) scale(1.22); opacity: 1; }
}

.splash-pct-row {
  display: flex;
  justify-content: center;
  width: 100%;
}

.splash-pct {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #86efac;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.55);
}

/* ==========================================================================
   SWISSTILE PRO v5 — DIRECTIONAL PATTERN TOGGLE (SECTION 3)
   ========================================================================== */
.st-dir-pattern-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border, rgba(148, 163, 184, 0.32));
}
.st-dir-pattern-wrap[hidden] { display: none !important; }
.st-dir-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
@media (max-width: 520px) {
  .st-dir-seg { grid-template-columns: 1fr; }
}
.st-dir-btn {
  appearance: none;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--border-strong, #475569);
  background: var(--bg-input, rgba(15, 23, 42, 0.06));
  color: inherit;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  touch-action: manipulation;
}
.st-dir-btn.active, .st-dir-btn[aria-pressed="true"] {
  background: #dc2626;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.32);
}
.st-dir-hint {
  margin-top: 5px;
  font-size: 0.76rem;
  opacity: 0.84;
}
.large-ui .st-dir-btn {
  font-size: 1.04rem;
  padding: 13px 14px;
}

/* ==========================================================================
   D.R. HYBRID H1 + GREEN LASER (#10b981) — HEADER 38PX & SPLASH 132PX (1:1)
   ========================================================================== */
.st-hdr-h1-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.32);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.st-hdr-h1-icon canvas {
  width: 38px;
  height: 38px;
  display: block;
}
.st-h1-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #05080f;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  user-select: none;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.st-h1-splash.is-hiding {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#splashSceneCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}
.st-h1-centerpiece {
  position: relative;
  z-index: 4;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 26px 14px;
  text-align: center;
}
.st-h1-hero-mount {
  width: 132px;
  height: 132px;
  border-radius: 31px;
  position: relative;
  margin-bottom: 22px;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.9),
    0 0 38px rgba(16, 185, 129, 0.34);
  animation: stH1FloatIcon 4s ease-in-out infinite;
}
@keyframes stH1FloatIcon {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}
#splashHeroIconCanvas {
  width: 132px;
  height: 132px;
  display: block;
  border-radius: 31px;
}
.st-h1-specular-sweep {
  position: absolute;
  inset: 0;
  border-radius: 31px;
  overflow: hidden;
  pointer-events: none;
}
.st-h1-specular-sweep::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -140%;
  width: 65%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.06) 30%,
    rgba(255, 255, 255, 0.42) 50%,
    rgba(255, 255, 255, 0.06) 70%,
    transparent 100%
  );
  transform: rotate(24deg);
  animation: stH1IconGloss 2.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes stH1IconGloss {
  0% { left: -140%; }
  65%, 100% { left: 165%; }
}
.st-h1-glass-plate {
  width: 100%;
  max-width: 300px;
  background: linear-gradient(180deg, rgba(12, 18, 30, 0.82) 0%, rgba(7, 10, 18, 0.92) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 20px;
  padding: 16px 18px 15px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.st-h1-wordmark-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
}
.st-h1-wordmark {
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #ffffff;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.7));
}
.st-h1-pro-tag {
  background: linear-gradient(135deg, #ef4444 0%, #991b1b 100%);
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(254, 202, 202, 0.5);
  box-shadow: 0 3px 12px rgba(220, 38, 38, 0.5);
}
.st-h1-ch-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: #94a3b8;
  margin-bottom: 18px;
}
.st-h1-ch-flag {
  width: 12px;
  height: 12px;
  border-radius: 2.5px;
  background: #dc2626;
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.st-h1-ch-flag::before,
.st-h1-ch-flag::after {
  content: "";
  position: absolute;
  background: #ffffff;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.st-h1-ch-flag::before { width: 7px; height: 2px; }
.st-h1-ch-flag::after { width: 2px; height: 7px; }
.st-h1-progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.st-h1-track {
  position: relative;
  width: 100%;
  height: 11px;
  background: #060911;
  border-radius: 999px;
  border: 1px solid #334155;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.95);
}
.st-h1-track-clip {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.st-h1-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #065f46 0%, #10b981 55%, #34d399 85%, #ffffff 100%);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.85);
  position: relative;
  overflow: hidden;
}
.st-h1-fill::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -65%;
  width: 55%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.22) 25%,
    rgba(255, 255, 255, 0.98) 50%,
    rgba(255, 255, 255, 0.22) 75%,
    transparent 100%
  );
  transform: skewX(-24deg);
  animation: stH1BarFlash 0.85s linear infinite;
}
@keyframes stH1BarFlash {
  0% { left: -65%; }
  100% { left: 130%; }
}
.st-h1-spark {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #a7f3d0 38%, rgba(16, 185, 129, 0.75) 68%, transparent 100%);
  box-shadow: 0 0 16px 5px rgba(16, 185, 129, 0.9);
  pointer-events: none;
}
.st-h1-pct-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 800;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}
.st-h1-footer-engraving {
  position: relative;
  z-index: 4;
  padding: 0 20px calc(16px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.26em;
  color: rgba(203, 213, 225, 0.62);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}
@media print {
  .st-h1-splash { display: none !important; }
}


/* === SwissTile PRO v3: Fullscreen 24-Lang Selector + QR Referral + Print QR === */
.sr-u-lang-ov {
  --srl-ink: #0f1217; --srl-panel: #171b22; --srl-line: #2a3140;
  --srl-fg: #f4f5f7; --srl-muted: #8b919c; --srl-copper: #dc2626; --srl-copper-dim: #2a1518;
  position: fixed !important; inset: 0 !important; z-index: 9999 !important;
  display: flex !important; flex-direction: column !important;
  width: 100% !important; height: 100vh !important; height: 100dvh !important;
  overflow: hidden !important; background: var(--srl-ink) !important; color: var(--srl-fg) !important;
}
.sr-u-lang-ov.sr-u-hidden { display: none !important; }
html[data-theme="light"] .sr-u-lang-ov {
  --srl-ink: #f6f5f2; --srl-panel: #ffffff; --srl-line: #e2e0d8;
  --srl-fg: #111318; --srl-muted: #5c6370; --srl-copper: #dc2626; --srl-copper-dim: #fde8e8;
}
.sr-u-lang-top { max-width: 48rem; width: 100%; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 8px; flex-shrink: 0; }
.sr-u-lang-iso { font-size: 10px; font-weight: 700; letter-spacing: 0.18em; color: var(--srl-copper) !important; text-transform: uppercase; }
.sr-u-lang-title { margin: 2px 0 0; font-size: 1.25rem; font-weight: 600; color: var(--srl-fg) !important; }
.sr-u-lang-scroll {
  max-width: 48rem; width: 100%; margin: 0 auto; flex: 1 1 0%; min-height: 0 !important;
  overflow-y: auto !important; overflow-x: hidden !important; -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important; overscroll-behavior: contain !important; padding: 10px 16px 16px;
}
.sr-u-lang-item {
  display: flex !important; flex-shrink: 0 !important; height: 58px !important; width: 100% !important;
  align-items: center !important; gap: 12px !important; border-radius: 12px !important;
  border: 1px solid var(--srl-line) !important; background: var(--srl-panel) !important;
  color: var(--srl-fg) !important; padding: 0 12px !important; margin-bottom: 8px !important;
  text-align: left !important; cursor: pointer !important; box-sizing: border-box !important;
}
.sr-u-lang-item.on { border-color: var(--srl-copper) !important; background: var(--srl-copper-dim) !important; }
.sr-u-lang-flag { font-size: 20px; line-height: 1; flex-shrink: 0; }
.sr-u-lang-code {
  display: flex !important; height: 32px !important; width: 48px !important; flex-shrink: 0 !important;
  align-items: center !important; justify-content: center !important; border-radius: 6px !important;
  border: 1px solid var(--srl-line) !important; font-size: 12px !important; font-weight: 700 !important;
}
.sr-u-lang-item.on .sr-u-lang-code { background: var(--srl-copper) !important; border-color: var(--srl-copper) !important; color: #fff !important; }
.sr-u-lang-name { display: block; font-size: 14px; font-weight: 600; color: var(--srl-fg) !important; }
.sr-u-lang-sub { display: block; font-size: 12px; color: var(--srl-muted) !important; }
.sr-u-lang-chk { color: var(--srl-copper) !important; font-weight: 800; font-size: 15px; flex-shrink: 0; }
.sr-u-lang-bot {
  max-width: 48rem; width: 100%; margin: 0 auto; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0; border-top: 1px solid var(--srl-line); background: var(--srl-ink);
}
.sr-u-lang-close {
  height: 48px !important; width: 100% !important; border-radius: 12px !important;
  border: 1px solid var(--srl-line) !important; background: var(--srl-panel) !important;
  color: var(--srl-fg) !important; font-size: 0.875rem !important; font-weight: 600 !important; cursor: pointer !important;
}
.st-qr-card-white {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #ffffff; color: #0f172a; border-radius: 14px; padding: 14px; margin: 10px auto; max-width: 236px;
}
@media print {
  .print-footer { align-items: center !important; }
}
