/* ==========================================================================
   Pintaz Draf Studio - studio.css
   The drafting table skin. Loads AFTER base.css and reuses its tokens
   (--bg, --bg-card, --ink, --muted, --line, --brand, --shadow-card).
   Every class here is prefixed .st- so nothing collides with the landing
   pages. The one exception is the print block at the bottom, which styles
   the .draf-* sheet DOM that export-pdf.js builds.
   ========================================================================== */

.st-body {
  --st-top-h: 56px;
  --st-left-w: 300px;
  --st-rail-w: 132px;
  --st-radius: 12px;
  --st-radius-lg: 20px;
  --st-brand-soft: rgba(242, 116, 39, 0.16);
  --st-hover: rgba(28, 25, 19, 0.055);

  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.st-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.st-noscript {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Shared controls
   -------------------------------------------------------------------------- */

.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--st-radius);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.st-btn--ghost {
  background-color: var(--bg-card);
  border-color: var(--line);
  color: var(--ink);
}

.st-btn--ghost:hover {
  border-color: #D8D1C0;
  background-color: #FFFFFF;
  transform: translateY(-1px);
}

.st-btn--brand {
  background-color: var(--brand);
  color: #FFFFFF;
  box-shadow: 0 8px 18px -12px rgba(242, 116, 39, 0.9);
}

.st-btn--brand:hover {
  background-color: #E4661B;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -14px rgba(242, 116, 39, 0.95);
}

.st-btn--brand:active,
.st-btn--ghost:active { transform: translateY(0); }

.st-btn--block { width: 100%; }

.st-btn--sm {
  height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: 9px;
}

.st-btn--danger:hover {
  color: #A9432A;
  border-color: rgba(169, 67, 42, 0.4);
  background-color: rgba(169, 67, 42, 0.06);
}

.st-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.st-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.st-iconbtn:hover { background-color: var(--st-hover); color: var(--ink); }

.st-iconbtn:disabled {
  opacity: 0.32;
  cursor: default;
  background-color: transparent;
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.st-top {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: var(--st-top-h);
  padding-inline: 12px;
  border-bottom: 1px solid var(--line);
  background-color: rgba(250, 248, 242, 0.9);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  z-index: 40;
}

.st-top__group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.st-top__group--right { justify-self: end; }

.st-logo { display: inline-flex; align-items: center; flex: none; }
.st-logo img { height: 22px; width: auto; }

.st-name {
  min-width: 0;
  width: clamp(90px, 16vw, 210px);
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background-color: transparent;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
}

.st-name:hover { background-color: var(--st-hover); }

.st-name:focus {
  outline: none;
  background-color: #FFFFFF;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--st-brand-soft);
}

.st-history { display: flex; align-items: center; gap: 2px; }

/* View switcher (role=tablist) */
.st-views {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background-color: rgba(28, 25, 19, 0.055);
}

.st-view-tab {
  height: 30px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.st-view-tab:hover { color: var(--ink); }

.st-view-tab.is-active {
  background-color: var(--bg-card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(28, 25, 19, 0.16);
}

/* Export menu */
.st-menu { position: relative; }

.st-menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 250px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background-color: var(--bg-card);
  box-shadow: var(--shadow-card);
  z-index: 50;
}

.st-menu__list[hidden] { display: none; }

.st-menu__item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.st-menu__item:hover { background-color: var(--st-hover); }

.st-menu__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.st-menu__note {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Shell grid
   -------------------------------------------------------------------------- */

.st-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--st-left-w) minmax(0, 1fr) var(--st-rail-w);
}

/* --------------------------------------------------------------------------
   Left panel
   -------------------------------------------------------------------------- */

.st-left {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background-color: var(--bg-card);
}

.st-left__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.st-block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.st-block__title,
.st-sub,
.st-rail__title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.st-count { font-size: 12px; color: var(--muted); }

.st-textarea {
  display: block;
  width: 100%;
  min-height: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--st-radius);
  background-color: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.st-textarea::placeholder { color: #A8A093; }

.st-textarea:focus {
  outline: none;
  background-color: #FFFFFF;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--st-brand-soft);
}

#st-generate {
  margin-top: 10px;
  height: 42px;
  font-size: 15px;
}

.st-hint,
.st-foot-note {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.st-foot-note { margin-top: 0; }

/* Rooms */
.st-rooms {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.st-room {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--st-radius);
  background-color: var(--bg);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.st-room.is-selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--st-brand-soft);
  background-color: #FFFFFF;
}

.st-room__top,
.st-room__bottom {
  display: flex;
  align-items: center;
  gap: 6px;
}

.st-room__label {
  flex: 1 1 auto;
  min-width: 0;
  height: 26px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background-color: transparent;
  font-size: 13.5px;
  font-weight: 600;
}

.st-room__label:hover { background-color: #FFFFFF; }

.st-room__label:focus {
  outline: none;
  background-color: #FFFFFF;
  border-color: var(--brand);
}

.st-room__remove {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.st-room__remove:hover {
  color: #A9432A;
  background-color: rgba(169, 67, 42, 0.08);
}

.st-room__type {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #FFFFFF;
  font-size: 12.5px;
  cursor: pointer;
}

.st-room__type:focus { outline: none; border-color: var(--brand); }

.st-stepper {
  flex: none;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #FFFFFF;
}

.st-stepper__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.st-stepper__btn:hover { background-color: var(--st-hover); color: var(--ink); }

.st-room__area {
  width: 32px;
  border: 0;
  background-color: transparent;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  -moz-appearance: textfield;
  appearance: textfield;
}

.st-room__area:focus { outline: none; }

.st-room__area::-webkit-outer-spin-button,
.st-room__area::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.st-stepper__unit {
  padding-right: 2px;
  font-size: 11px;
  color: var(--muted);
}

/* Lot + style */
.st-fields { display: flex; gap: 8px; }

.st-field { flex: 1 1 0; min-width: 0; }

.st-field__label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
}

.st-field__input {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--st-radius);
  background-color: var(--bg);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.st-field__input:focus-within {
  background-color: #FFFFFF;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--st-brand-soft);
}

.st-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background-color: transparent;
  font-size: 14px;
  font-weight: 600;
}

.st-input:focus { outline: none; }

.st-field__unit { font-size: 12px; color: var(--muted); }

.st-sub { display: block; margin: 18px 0 8px; }

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

.st-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--bg);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.st-swatch__chip {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1px solid rgba(28, 25, 19, 0.14);
}

.st-swatch--timber .st-swatch__chip { background-image: linear-gradient(135deg, #E8DCC8, #B08954); }
.st-swatch--white .st-swatch__chip { background-image: linear-gradient(135deg, #F4F2EC, #C9C4B6); }
.st-swatch--frame .st-swatch__chip { background-image: linear-gradient(135deg, #3A3630, #1C1913); }
.st-swatch--brick .st-swatch__chip { background-image: linear-gradient(135deg, #D9A184, #C4693B); }

.st-swatch:hover { border-color: #D8D1C0; background-color: #FFFFFF; }

.st-swatch.is-active {
  border-color: var(--brand);
  background-color: #FFFFFF;
  box-shadow: 0 0 0 2px var(--st-brand-soft);
}

/* --------------------------------------------------------------------------
   Canvas - the drafting surface
   -------------------------------------------------------------------------- */

.st-canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(28, 25, 19, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 25, 19, 0.045) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px;
}

.st-stage { position: absolute; inset: 0; }

.st-view {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.st-view[hidden] { display: none; }

.st-view:focus-visible { outline: 2px solid var(--brand); outline-offset: -4px; }

.st-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  touch-action: none;
}

#elev-svg { transform-origin: center center; }

.st-three {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
}

.st-three canvas { display: block; width: 100%; height: 100%; }

/* three-view.js drops this in when WebGL is unavailable, in place of a canvas. */
.draf-3d-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 34ch;
  margin: 0 auto;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.st-render {
  max-width: 100%;
  max-height: 100%;
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  transform-origin: center center;
}

/* Elevation side toggle */
.st-elev-switch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background-color: rgba(255, 254, 249, 0.94);
  box-shadow: 0 8px 20px -16px rgba(28, 25, 19, 0.6);
  z-index: 11;
}

.st-elev-btn {
  height: 28px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.st-elev-btn.is-active {
  background-color: var(--ink);
  color: var(--accent-ink);
  font-weight: 600;
}

/* Zoom controls */
.st-zoom {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background-color: rgba(255, 254, 249, 0.94);
  box-shadow: var(--shadow-card);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 12;
}

.st-zoom[hidden] { display: none; }

.st-zoom.is-idle { opacity: 0.55; }

.st-zoom__btn { width: 32px; height: 32px; }

.st-zoom__btn--fit {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Empty state */
.st-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-image: linear-gradient(rgba(250, 248, 242, 0.7), rgba(250, 248, 242, 0.94));
  z-index: 14;
}

.st-empty[hidden] { display: none; }

.st-empty__card {
  max-width: 560px;
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: var(--st-radius-lg);
  background-color: var(--bg-card);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.st-empty__eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
}

.st-empty__title {
  margin-top: 10px;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.st-empty__sub {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.st-empty__label {
  margin-top: 24px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.st-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.st-chip {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background-color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, color 150ms ease;
}

.st-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Variant rail
   -------------------------------------------------------------------------- */

.st-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 14px 12px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background-color: var(--bg-card);
}

.st-rail__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.st-variant {
  display: block;
  width: 100%;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: var(--bg);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.st-variant__svg {
  display: block;
  width: 100%;
  height: 76px;
  border-radius: 8px;
  background-color: #FFFFFF;
  pointer-events: none;
}

.st-variant__label {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.st-variant:hover { border-color: #D8D1C0; transform: translateY(-1px); }

.st-variant.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--st-brand-soft);
}

.st-variant.is-active .st-variant__label { color: var(--brand); }

.st-rail__hint {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Scrim, drawer, toast
   -------------------------------------------------------------------------- */

.st-scrim {
  position: fixed;
  inset: 0;
  background-color: rgba(28, 25, 19, 0.34);
  z-index: 70;
}

.st-scrim[hidden] { display: none; }

.st-drawer {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 80;
}

.st-drawer[hidden] { display: none; }

.st-drawer__panel {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(400px, 92vw);
  height: 100%;
  padding: 18px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background-color: var(--bg-card);
  box-shadow: -24px 0 60px -30px rgba(28, 25, 19, 0.55);
  animation: st-slide-in 240ms var(--ease-carousel);
}

@keyframes st-slide-in {
  from { transform: translateX(28px); opacity: 0.5; }
  to { transform: translateX(0); opacity: 1; }
}

.st-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.st-drawer__title { font-size: 17px; }

.st-drawer__note,
.st-drawer__empty {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.st-drawer__empty[hidden] { display: none; }

.st-projects {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.st-project {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: var(--bg);
}

.st-project.is-current {
  border-color: var(--brand);
  background-color: #FFFFFF;
}

.st-project__name {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.st-project__meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.st-project__actions { display: flex; gap: 6px; }

.st-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  max-width: min(90vw, 460px);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background-color: var(--ink);
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 18px 40px -18px rgba(28, 25, 19, 0.7);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  z-index: 90;
}

.st-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.st-toast[hidden] { display: none; }

/* Hidden until a narrow viewport needs it */
.st-panel-toggle { display: none; }

/* --------------------------------------------------------------------------
   Responsive - under 900px the panel slides over and the rail lies flat
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .st-body { --st-top-h: 52px; }

  .st-panel-toggle { display: inline-flex; }
  .st-logo,
  .st-history { display: none; }

  .st-top { grid-template-columns: auto 1fr auto; gap: 8px; padding-inline: 8px; }
  .st-views { justify-self: center; }
  .st-view-tab { padding: 0 11px; font-size: 12.5px; }

  .st-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "rail"
      "canvas";
  }

  .st-left {
    position: fixed;
    top: var(--st-top-h);
    bottom: 0;
    left: 0;
    width: min(320px, 88vw);
    z-index: 75;
    transform: translateX(-102%);
    transition: transform 260ms var(--ease-carousel);
  }

  .st-panel-open .st-left {
    transform: translateX(0);
    box-shadow: 24px 0 60px -30px rgba(28, 25, 19, 0.55);
  }

  .st-rail {
    grid-area: rail;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .st-rail__title,
  .st-rail__hint { display: none; }

  .st-rail.is-empty { display: none; }

  .st-rail__list { flex-direction: row; }

  .st-variant { flex: none; width: 104px; }
  .st-variant__svg { height: 52px; }

  .st-canvas { grid-area: canvas; }

  .st-empty__card { padding: 24px 20px; }
  .st-zoom { right: 12px; bottom: 12px; }
}

@media (max-width: 600px) {
  .st-name { display: none; }
  .st-view-tab { padding: 0 9px; font-size: 12px; }
  .st-btn { padding: 0 11px; font-size: 13px; }
  .st-menu__list { width: min(280px, 92vw); }

  /* A phone cannot hold four full tab labels plus both right-hand buttons -
     the strip used to run under Export and swallow the Elevations tab. Shorten
     the two longest labels and drop the Export chevron so all four stay
     clickable. The real text stays in the DOM for assistive tech. */
  .st-top { gap: 6px; padding-inline: 6px; }
  .st-view-tab { padding: 0 8px; font-size: 0; }
  .st-view-tab::after {
    content: attr(data-short);
    font-size: 12px;
    letter-spacing: 0;
  }
  #st-export-btn svg { display: none; }
  #st-export-btn,
  #st-studio-btn { padding: 0 9px; }
  #st-studio-btn { font-size: 0; }
  #st-studio-btn::after { content: attr(data-short); font-size: 13px; }
}

/* --------------------------------------------------------------------------
   Print sheets
   --------------------------------------------------------------------------
   export-pdf.js builds a hidden print-only tree and calls window.print().
   Expected DOM (either the class or the data attribute works):

   <div class="draf-print">                     root, screen-hidden
     <section class="draf-sheet">               one A3 landscape page
       <div class="draf-sheet__body"> svg </div> the drawing, scaled to fit
       <div class="draf-sheet__title-block">
         <div class="draf-tb__cell draf-tb__brand">PINTAZ DRAF</div>
         <div class="draf-tb__cell">
           <span class="draf-tb__label">Project</span>
           <span class="draf-tb__value">...</span>
         </div>
         ... date, scale, sheet no
       </div>
     </section>
   </div>
   -------------------------------------------------------------------------- */

.draf-print,
#draf-print-root { display: none; }

@media print {
  @page {
    size: A3 landscape;
    margin: 12mm;
  }

  html,
  body.st-body {
    height: auto;
    overflow: visible;
    background-color: #FFFFFF;
    font-size: 11pt;
  }

  /* App chrome never prints. */
  .skip-link,
  .st-top,
  .st-shell,
  .st-left,
  .st-rail,
  .st-canvas,
  .st-zoom,
  .st-empty,
  .st-elev-switch,
  .st-toast,
  .st-drawer,
  .st-scrim,
  .st-noscript { display: none !important; }

  .draf-print,
  #draf-print-root {
    display: block !important;
    color: #1C1913;
    font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .draf-sheet,
  [data-print-sheet] {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 180mm;
    page-break-after: always;
    break-after: page;
  }

  .draf-sheet:last-child,
  [data-print-sheet]:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .draf-sheet__body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6mm;
    border: 0.4mm solid #1C1913;
  }

  .draf-sheet__body > svg,
  .draf-sheet__body > canvas,
  .draf-sheet__body > img {
    max-width: 100%;
    max-height: 100%;
    height: auto;
  }

  /* Title block - brand cell first, then label/value cells. */
  .draf-sheet__title-block,
  .draf-titleblock {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1.4fr 2fr 1fr 1fr 1fr;
    margin-top: 4mm;
    border: 0.4mm solid #1C1913;
    font-size: 9pt;
  }

  .draf-tb__cell,
  .draf-sheet__title-block > div,
  .draf-titleblock > div {
    padding: 2.5mm 3mm;
    border-right: 0.25mm solid #1C1913;
  }

  .draf-tb__cell:last-child,
  .draf-sheet__title-block > div:last-child,
  .draf-titleblock > div:last-child { border-right: 0; }

  .draf-tb__label {
    display: block;
    font-size: 7pt;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #6B6456;
  }

  .draf-tb__value {
    display: block;
    margin-top: 0.6mm;
    font-size: 10pt;
    font-weight: 600;
  }

  .draf-tb__brand {
    display: flex;
    align-items: center;
    font-size: 13pt;
    font-weight: 700;
    letter-spacing: 0.05em;
  }

  .draf-sheet__note {
    margin-top: 2mm;
    font-size: 8pt;
    color: #6B6456;
  }
}
