/* =====================================================================
   Woodchips Online — styles.css
   Palette: clean monochrome + one bright green CTA accent
   Fonts: Outfit (UI) · DM Mono (numbers)
   Layout: 2-column workspace on the app page
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=DM+Mono:ital,wght@0,400;0,500;1,400&display=swap');

* {
  box-sizing: border-box;
}

/* =====================================================================
   Panel-highlight animation (JS-triggered)
   ===================================================================== */
@keyframes highlight-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
  50%  { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.08); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
.panel-highlight { animation: highlight-pulse 1.8s ease-out; }

/* =====================================================================
   Design tokens
   ===================================================================== */
:root {
  color-scheme: light;

  /* Surfaces */
  --bg:          #f5f5f4;
  --surface:     #ffffff;
  --surface-2:   #fafaf9;

  /* Borders — light, unobtrusive */
  --border:      #e4e4e2;
  --border-2:    #d0d0ce;

  /* Text */
  --text:        #111111;
  --text-2:      #5c5c5c;
  --text-3:      #a0a0a0;

  /* Primary — teal/turquoise from the logo cuts */
  --green:        #1BB8AF;
  --green-dark:   #148F88;
  --green-subtle: #E6F7F6;
  --green-border: #80D8D4;

  /* Forest green — from the logo chevron, used for success/good states */
  --forest:        #2EA358;
  --forest-dark:   #237940;
  --forest-subtle: #E8F5EE;
  --forest-border: #86D4A4;

  /* Nav / dark surfaces — deep teal from logo shadows */
  --nav-bg:        #146660;

  /* Amber — secondary accent, section highlights, supportive UI */
  --amber:        #C96A2A;
  --amber-dark:   #A8541E;
  --amber-subtle: #FEF3E8;
  --amber-border: #F5C49A;
  --amber-text:   #92400E;

  /* State */
  --danger:          #dc2626;
  --danger-subtle:   #fef2f2;
  --danger-border:   #fecaca;
  --warning:         #d97706;
  --warning-subtle:  #fffbeb;
  --warning-border:  #fde68a;
  --success:         #2EA358;
  --success-subtle:  #E8F5EE;
  --success-border:  #86D4A4;

  /* Shadows — very subtle */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow:    0 2px 4px rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 8px rgba(0,0,0,0.08), 0 16px 32px rgba(0,0,0,0.10);

  /* Typography */
  --font:      'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'Cascadia Code', Menlo, monospace;

  /* Radii — kept tight */
  --r-xs: 2px;
  --r-sm: 3px;
  --r:    4px;
  --r-lg: 6px;
  --r-xl: 8px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur:  120ms;
  --dur-m: 200ms;

  /* Toolbar height — used to size workspace */
  --toolbar-h: 70px;
}

/* =====================================================================
   Base
   ===================================================================== */
body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font);
  font-weight: 600;
  margin: 0 0 8px;
  line-height: 1.25;
  color: var(--text);
}

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--green); }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 1px 5px;
  border-radius: var(--r-xs);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--green);
}

/* =====================================================================
   Site navigation (guide/content pages)
   ===================================================================== */
.site-nav {
  background: var(--nav-bg);
  position: relative;
  z-index: 50;
}

.site-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: 52px;
}

.site-nav__brand {
  font-family: var(--font);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.site-nav__brand:hover { opacity: 0.75; }

.site-nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--r);
  cursor: pointer;
  padding: 8px 10px;
  width: 40px;
  height: 40px;
}
.site-nav__toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.15s ease;
  pointer-events: none;
}
.site-nav__toggle[aria-expanded="true"] span:first-child { transform: translateY(7px) rotate(45deg); }
.site-nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.site-nav__toggle[aria-expanded="true"] span:last-child  { transform: translateY(-7px) rotate(-45deg); }

.site-nav__menu {
  display: flex;
  align-items: stretch;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav__menu a {
  display: block;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--r);
  transition: background var(--dur), color var(--dur);
}
.site-nav__menu a:hover { background: rgba(255,255,255,0.1); color: #fff; }

.site-nav__cta {
  background: #fff;
  color: var(--text) !important;
  font-weight: 700 !important;
  margin-left: 4px;
}
.site-nav__cta:hover { background: rgba(255,255,255,0.88) !important; }

.site-nav__item { position: relative; list-style: none; display: flex; align-items: center; }
.site-nav__link {
  display: block;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--r);
  transition: background var(--dur), color var(--dur);
  white-space: nowrap;
}
.site-nav__link:hover { background: rgba(255,255,255,0.1); color: #fff; }

.site-nav__group-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--r);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur), color var(--dur);
}
.site-nav__group-btn:hover,
.site-nav__group-btn[aria-expanded="true"] { background: rgba(255,255,255,0.1); color: #fff; }

.site-nav__chevron {
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255,255,255,0.6);
  margin-top: 1px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.site-nav__group-btn[aria-expanded="true"] .site-nav__chevron { transform: rotate(180deg); }

.site-nav__dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: 6px;
  z-index: 200;
  list-style: none;
  margin: 0;
}
.site-nav__has-dropdown:hover > .site-nav__dropdown,
.site-nav__has-dropdown:focus-within > .site-nav__dropdown { display: block; }
.site-nav__dropdown li { list-style: none; }
.site-nav__dropdown a {
  display: block;
  padding: 8px 12px;
  color: var(--text) !important;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--r);
  transition: background var(--dur);
  background: none !important;
}
.site-nav__dropdown a:hover { background: var(--bg) !important; }

@media (max-width: 640px) {
  .site-nav__toggle { display: flex; }
  .site-nav__menu {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--nav-bg);
    padding: 8px 16px 16px;
    gap: 2px;
    border-top: 1px solid rgba(255,255,255,0.1);
    box-shadow: var(--shadow-lg);
  }
  .site-nav__menu--open { display: flex; }
  .site-nav__menu a { padding: 10px 12px; }
  .site-nav__cta { margin-left: 0; margin-top: 8px; text-align: center; }
  .site-nav__item { display: block; }
  .site-nav__group-btn { width: 100%; justify-content: space-between; padding: 10px 12px; }
  .site-nav__has-dropdown:hover > .site-nav__dropdown { display: none; }
  .site-nav__has-dropdown.site-nav__open > .site-nav__dropdown {
    display: block;
    position: static;
    background: rgba(255,255,255,0.08);
    border: none;
    box-shadow: none;
    border-radius: var(--r);
    min-width: 0;
    padding: 4px 0;
    margin: 2px 0 4px;
  }
  .site-nav__has-dropdown.site-nav__open > .site-nav__dropdown a {
    color: rgba(255,255,255,0.85) !important;
    padding: 8px 20px;
    font-size: 0.85rem;
  }
  .site-nav__has-dropdown.site-nav__open > .site-nav__dropdown a:hover {
    background: rgba(255,255,255,0.08) !important;
    color: #fff !important;
  }
  .site-nav__link { padding: 10px 12px; width: 100%; display: block; }
}

/* =====================================================================
   Breadcrumb
   ===================================================================== */
.breadcrumb { margin-bottom: 10px; }
.breadcrumb ol {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  list-style: none;
  margin: 0; padding: 0;
  font-size: 0.8rem;
}
.breadcrumb li { display: flex; align-items: center; }
.breadcrumb li + li::before { content: '/'; margin: 0 6px; opacity: 0.35; color: #fff; }
.breadcrumb a { color: rgba(255,255,255,0.7); text-decoration: none; }
.breadcrumb a:hover { color: #fff; text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: rgba(255,255,255,0.45); }

/* =====================================================================
   Utility shell — app toolbar (full-width, flat)
   ===================================================================== */
.utility-shell {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.utility-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--toolbar-h);
  padding: 0 16px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  max-width: none;
  position: relative;
}

/* Logo in the toolbar (index.html puts it here) */
.utility-bar-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 8px;
}
.site-logo {
  height: 56px;
  width: auto;
  display: block;
}

.site-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
  line-height: 1;
}

.utility-bar-main {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
  flex: 1;
}

.utility-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 13px;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
}
.utility-btn:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
.utility-btn[aria-expanded="true"] {
  background: var(--nav-bg);
  color: #ffffff;
  border-color: var(--nav-bg);
}
.utility-link { cursor: pointer; }

/* Hamburger — desktop: hidden. Mobile: toggles the nav dropdown */
.utility-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--r);
  cursor: pointer;
  padding: 7px 9px;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}
.utility-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.15s ease;
  pointer-events: none;
}
/* Animate to × when open */
.utility-hamburger[aria-expanded="true"] span:first-child { transform: translateY(7px) rotate(45deg); }
.utility-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.utility-hamburger[aria-expanded="true"] span:last-child  { transform: translateY(-7px) rotate(-45deg); }

/* Dark toolbar variant */
.utility-shell--dark .utility-hamburger { border-color: rgba(255, 255, 255, 0.3); }
.utility-shell--dark .utility-hamburger span { background: #ffffff; }

/* Units toggle — always amber; hover darkens */
.units-toggle-btn {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--amber) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}
.units-toggle-btn:hover {
  background: var(--amber-dark) !important;
  color: #ffffff !important;
}
.units-toggle-btn[aria-pressed="true"] {
  background: var(--amber) !important;
  color: #ffffff !important;
}
.utility-tray {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  gap: 0;
}

/* ── Dark teal variant — app page toolbar ── */
.utility-shell--dark {
  background: var(--nav-bg);
  border-bottom: none;
}
.utility-shell--dark .utility-bar {
  border-bottom: none;
}
.utility-shell--dark .site-name {
  color: #ffffff;
}
.utility-shell--dark .utility-btn {
  color: rgba(255, 255, 255, 0.78);
}
.utility-shell--dark .utility-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: transparent;
}
.utility-shell--dark .utility-btn[aria-expanded="true"] {
  background: #ffffff;
  color: var(--nav-bg);
  border-color: transparent;
}
.utility-shell--dark .plan-badge {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
}
.utility-shell--dark .utility-tray {
  background: var(--surface);
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid var(--border);
}

.utility-panel {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 24px;
  animation: trayReveal 0.18s var(--ease) both;
}

@keyframes trayReveal {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =====================================================================
   App shell
   ===================================================================== */

/* Default: guide/content page layout — centred max-width container */
.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* Workspace variant (app page only) — full-bleed, no padding */
.app-shell--workspace {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Section headings — larger on content pages, compact in workspace sidebar */
.app-shell:not(.app-shell--workspace) .section-heading h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--nav-bg);
}

/* Links on guide/content pages */
.app-shell:not(.app-shell--workspace) a {
  color: var(--green-dark);
}
.app-shell:not(.app-shell--workspace) a:hover {
  color: var(--nav-bg);
}

/* Buttons styled as <a> — must come after the link rule above to win the
   specificity battle (both are 0,2,1 but later declarations win) */
.app-shell:not(.app-shell--workspace) a.primary-btn         { color: #ffffff; }
.app-shell:not(.app-shell--workspace) a.primary-btn:hover   { color: #ffffff; }
.app-shell:not(.app-shell--workspace) a.secondary-btn       { color: var(--text); }
.app-shell:not(.app-shell--workspace) a.primary-outline-btn { color: var(--text); }
.app-shell:not(.app-shell--workspace) a.ghost-btn           { color: var(--text-2); }

/* Panels — extra bottom spacing on content pages, with teal left accent */
.app-shell:not(.app-shell--workspace) .panel {
  margin-bottom: 20px;
  border-left: 3px solid var(--green);
}

/* Hero: used on guide/content pages, hidden on app page */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}
.hero-top-left { min-width: 0; }
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.site-logo-hero {
  width: 220px;
  max-width: 100%;
  height: auto;
  display: block;
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.hero-title {
  margin: 0 0 10px;
  max-width: 20ch;
  font-size: clamp(1.9rem, 3.8vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.hero-copy { max-width: 68ch; color: var(--text-2); font-size: 1rem; }
.hero-copy-wide { grid-column: 1 / -1; max-width: none; margin-top: -2px; }
.hero-note {
  padding: 18px 20px;
  background: linear-gradient(135deg, #146660 0%, #1a9690 100%);
  color: #fff;
  border-radius: var(--r-xl);
  display: grid;
  gap: 8px;
}
.hero-note strong {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.42);
}
.hero-note span { color: rgba(255,255,255,0.86); font-size: 0.9rem; line-height: 1.45; }

/* =====================================================================
   Workspace — input-first layout
   Default: full-width input column, results hidden.
   After optimiser runs: two-column, results slide in from the right.
   Uses CSS :has() to watch #results-content losing its .hidden class.
   ===================================================================== */

.workspace {
  display: grid;
  grid-template-columns: 1fr;   /* single column until results exist */
  min-height: calc(100vh - var(--toolbar-h));
  background: var(--surface);
}

/* ── Input column ── */
.workspace-left {
  background: var(--surface);
  border-right: none;
  overflow-y: auto;
  position: sticky;
  top: var(--toolbar-h);
  height: calc(100vh - var(--toolbar-h));
}

/* Panels: flat sections separated by dividers */
.workspace-left .panel {
  background: transparent;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  margin-bottom: 0;
  padding: 16px 20px;
}
.workspace-left .panel:last-of-type { border-bottom: none; }

/* ── Results column — hidden until optimiser runs ── */
.workspace-right {
  display: none;
  background: var(--bg);
  padding: 20px 24px;
  overflow-y: auto;
}

.workspace-right .cut-list-export-host {
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 20px 24px;
  box-shadow: none;
  margin-bottom: 0;
  min-height: 300px;
}

/* ── Solo mode: constrain width and centre the input column ── */
.workspace:not(:has(#results-content:not(.hidden))) {
  grid-template-columns: minmax(auto, 1154px);
  justify-content: center;
  background: var(--bg);
}

/* ── Results exist: switch to two-column, reveal results panel ── */
.workspace:has(#results-content:not(.hidden)) {
  grid-template-columns: clamp(340px, 40vw, 780px) 1fr;
  background: var(--bg);
}

.workspace:has(#results-content:not(.hidden)) .workspace-left {
  border-right: 1px solid var(--border);
}

.workspace:has(#results-content:not(.hidden)) .workspace-right {
  display: block;
  animation: resultsReveal 0.45s var(--ease) both;
}

@keyframes resultsReveal {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* =====================================================================
   Content pages: app-shell is a max-width centered container
   ===================================================================== */
.app-shell-content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* =====================================================================
   Panels (content/guide pages)
   ===================================================================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px 24px;
  box-shadow: none;
  margin-bottom: 14px;
}

.section-heading {
  margin-bottom: 16px;
}
.section-heading h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.section-heading p {
  font-size: 0.875rem;
  color: var(--text-2);
  margin: 0;
  line-height: 1.5;
}

/* Overrides for panel children that set max-width */
.panel .hero-copy,
.panel .summary-list,
.panel .hero-links {
  max-width: none;
}

/* =====================================================================
   Mode switch
   ===================================================================== */
.section-actions { margin-bottom: 14px; }

.mode-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
}
.mode-btn {
  background: transparent;
  color: var(--text-2);
  border-radius: var(--r);
  padding: 6px 16px;
  font-family: var(--font);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--dur) var(--ease);
  border: 1px solid transparent;
  cursor: pointer;
}
.mode-btn.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.mode-btn:hover:not(.is-active) { color: var(--text); }

/* =====================================================================
   Form inputs
   ===================================================================== */
label { display: grid; gap: 5px; font-size: 0.9rem; }
label > span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="number"],
input[type="email"],
select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--dur), box-shadow var(--dur);
  outline: none;
}
input[type="number"] {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: -0.01em;
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(27, 184, 175, 0.15);
}
input:hover:not(:focus),
select:hover:not(:focus) { border-color: var(--border-2); }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--green); }

.inline-controls,
.form-grid,
.results-columns,
.actions-panel { display: grid; gap: 10px; }
.inline-controls {
  margin-top: 12px;
  grid-template-columns: minmax(200px, 260px) auto auto auto;
  align-items: end;
}
.form-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.sheet-custom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 200px)) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

/* =====================================================================
   Buttons
   ===================================================================== */
button {
  appearance: none;
  border: none;
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  line-height: 1;
}

a.primary-btn,
a.secondary-btn,
a.primary-outline-btn,
a.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--r-sm);
  transition: all var(--dur) var(--ease);
}

/* Most buttons: dark teal */
.primary-btn {
  background: var(--nav-bg);
  color: #fff;
  font-weight: 600;
  border: 1px solid var(--nav-bg);
}
.primary-btn:hover { background: #0f524d; border-color: #0f524d; }
.primary-btn:active { background: var(--nav-bg); }

.secondary-btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-2);
  font-weight: 500;
}
.secondary-btn:hover { background: #ececea; border-color: var(--border-2); }

.primary-outline-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-2);
  font-weight: 500;
}
.primary-outline-btn:hover { background: var(--bg); }

.ghost-btn {
  background: var(--bg);
  color: var(--text-2);
  border: 1px solid var(--border-2);
}
.ghost-btn:hover { background: #e8e8e6; color: var(--text); border-color: #b8b8b6; }

button:disabled { opacity: 0.38; cursor: not-allowed; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* THE main CTA — vibrant teal, dark text for contrast */
#optimise-btn {
  background: var(--green);
  color: #0d3d3a;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 11px 20px;
  border: none;
  border-radius: var(--r-sm);
  letter-spacing: 0.005em;
  width: 100%;
  transition: background var(--dur) var(--ease);
}
#optimise-btn:hover:not(:disabled) { background: var(--green-dark); color: #fff; }
#optimise-btn:active:not(:disabled) { background: #0f7A74; color: #fff; }

/* Stale state — settings changed since last run */
#optimise-btn[data-stale="true"] {
  background: var(--warning);
}
#optimise-btn[data-stale="true"]:hover { background: #b45309; }

/* =====================================================================
   Actions panel (optimise row)
   ===================================================================== */
.actions-panel {
  grid-template-columns: 1fr;
  align-items: start;
}
.status-message {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--text-3);
}

/* =====================================================================
   Plan badge
   ===================================================================== */
.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border-2);
  white-space: nowrap;
}

/* =====================================================================
   Tables
   ===================================================================== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--bg);
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.875rem;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }
td input[type="text"],
td input[type="number"] { padding: 5px 8px; font-size: 0.875rem; }

/* Remove button column — only in the workspace cut list tables */
.workspace-left td:last-child { width: 80px; }
.checkbox-cell { text-align: center; }

/* Guide page tables — let content drive column widths naturally */
.app-shell:not(.app-shell--workspace) table {
  table-layout: auto;
}
.app-shell:not(.app-shell--workspace) td,
.app-shell:not(.app-shell--workspace) th {
  width: auto;
  white-space: normal;
}
/* Numeric / short-content columns: prevent them expanding too wide */
.app-shell:not(.app-shell--workspace) th:where([data-col="qty"], [data-col="length"], [data-col="mm"]),
.app-shell:not(.app-shell--workspace) td:where([data-col="qty"], [data-col="length"], [data-col="mm"]) {
  width: 1%;
  white-space: nowrap;
}

/* Workspace step headings — amber left border ties sections together */
.workspace-left .section-heading h2 {
  padding-left: 10px;
  border-left: 3px solid var(--amber);
}

/* =====================================================================
   Workspace intro — welcome panel above step 1
   ===================================================================== */
.workspace-intro {
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.workspace-intro h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.workspace-intro p {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 12px;
}

.intro-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.intro-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--green-subtle);
  color: var(--nav-bg);
  border: 1px solid var(--green-border);
  white-space: nowrap;
}
.results-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.9rem;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-lg);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.summary-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  background: var(--surface);
}
.summary-card .value {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.03em;
}

.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.results-columns {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 20px;
}

/* =====================================================================
   Cut plan cards
   ===================================================================== */
.cut-plan-list { display: grid; gap: 10px; }
.plan-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  background: var(--surface);
}
.plan-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.plan-header h3,
.plan-header h4 { font-size: 0.9rem; font-weight: 600; letter-spacing: -0.01em; }

/* =====================================================================
   Badges
   ===================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-good { background: var(--success-subtle); color: var(--success); border: 1px solid var(--success-border); }
.badge-warn { background: var(--warning-subtle); color: var(--warning); border: 1px solid var(--warning-border); }

/* =====================================================================
   Bar diagram (linear stock visualizer)
   ===================================================================== */
.bar-diagram {
  display: flex;
  width: 100%;
  min-height: 36px;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--border);
  margin-bottom: 10px;
}
.segment {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 10px;
  padding: 3px 5px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  border-right: 1px solid rgba(255,255,255,0.4);
  text-align: center;
}
.segment.cut    { background: #804000; color: #ffffff; }
.segment.kerf   { background: #1a0d00; color: #ffffff; }
.segment.offcut { background: #ffcc99; color: #804000; }

/* =====================================================================
   Meta list
   ===================================================================== */
.meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}
.meta-item {
  padding: 8px 10px;
  border-radius: var(--r);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.875rem;
}

/* =====================================================================
   Sheet goods visualizer
   ===================================================================== */
.sheet-layout { display: grid; gap: 12px; }
.sheet-layout-canvas {
  position: relative;
  width: 100%;
  max-width: 100%;
  border: 1px solid #804000;
  background: #ffcc99;
  overflow: hidden;
}
.sheet-piece {
  position: absolute;
  border: 1px solid rgba(26, 13, 0, 0.25);
  background: #804000;
  color: #fff;
  padding: 3px;
  overflow: hidden;
}
.sheet-piece span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 1.2;
}
.sheet-placement-list { margin: 0; }
.summary-list, .offcuts-list { margin: 0; padding-left: 18px; }

/* =====================================================================
   Export panel
   ===================================================================== */
.export-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--bg);
}
.export-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.export-panel-actions { display: flex; gap: 6px; }
.export-textarea {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.export-textarea:focus { border-color: var(--text); }
.pdf-preview { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 16px; }
.pdf-preview h4 { margin: 14px 0 6px; }
.pdf-preview table { margin-top: 10px; }
.pdf-preview ul { margin: 6px 0 0; padding-left: 16px; }

/* =====================================================================
   Stock / materials
   ===================================================================== */
.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.stock-option {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  background: var(--surface-2);
  transition: border-color var(--dur);
}
.stock-option:hover { border-color: var(--border-2); }
.stock-option > label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 0.875rem;
}
.stock-header { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.stock-header input[type="text"] { font-weight: 600; }
.material-remove-btn { padding-inline: 10px; }
.stock-option strong { display: block; color: var(--text); }
.stock-length-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 4px;
  margin-bottom: 8px;
}
.stock-length-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--r-xs);
  background: var(--bg);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  transition: all var(--dur);
}
.stock-length-checks label:hover { background: #ececea; }
.stock-length-checks label:has(input:checked) { background: var(--green-subtle); border-color: var(--green-border); color: var(--green-dark); }
.stock-inline-add { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.stock-inline-add input { font-size: 0.75rem; }

/* ── Material price inputs ── */
.stock-prices { margin-bottom: 8px; }
.stock-prices-label { margin: 0 0 6px !important; }

.stock-prices-grid {
  display: grid;
  grid-template-columns: repeat(2, auto 1fr);
  column-gap: 10px;
  row-gap: 5px;
  align-items: center;
}
/* Dissolve the row wrapper so label + input are direct grid children */
.stock-price-row {
  display: contents;
}
.stock-price-row > span {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-2);
  white-space: nowrap;
}
.price-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}
.price-currency {
  padding: 0 5px;
  font-size: 0.78rem;
  color: var(--text-3);
  background: var(--bg);
  border-right: 1px solid var(--border);
  line-height: 1;
  align-self: stretch;
  display: flex;
  align-items: center;
  font-family: var(--font);
  flex-shrink: 0;
}
.price-input-wrap input {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 5px 6px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  width: 100%;
  background: transparent;
}
.cost-subtotal {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--nav-bg);
  margin-left: 6px;
  font-family: var(--font-mono);
}

/* =====================================================================
   Pricing / plan
   ===================================================================== */
.pricing-panel .section-heading { margin-bottom: 12px; }
.plan-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.pricing-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.billing-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pricing-card {
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 16px 18px;
  background: var(--surface-2);
  transition: border-color var(--dur-m);
}
.pricing-card:hover { border-color: var(--border-2); }
.pricing-card.is-active { border-color: var(--green); background: var(--green-subtle); }
.pricing-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.pricing-price {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.project-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.auth-summary { display: grid; gap: 6px; align-content: start; }
.auth-summary .plan-badge { width: fit-content; }

/* =====================================================================
   Plan comparison table
   ===================================================================== */
.plan-compare { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; }
.plan-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font);
  font-size: 0.875rem;
  min-width: 340px;
}
.plan-table thead th {
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.plan-table thead th:first-child { text-align: left; }
.plan-col-free { background: var(--bg); width: 22%; }
.plan-col-pro  { background: var(--nav-bg); color: #fff; width: 22%; }
.plan-table tbody td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.plan-table tbody td:not(:first-child) { text-align: center; font-weight: 500; }
.plan-group td {
  background: var(--bg);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 7px 14px 5px;
  border-bottom: none;
}
.plan-yes { color: var(--forest); font-size: 1.1rem; font-weight: 700; }
.plan-limit { color: var(--text-3); font-size: 0.82rem; }
.plan-feature { color: var(--forest); font-weight: 600; }
.plan-no { color: var(--border-2); }
.plan-no::before { content: '—'; }
.plan-cta-row td { padding: 14px; border-bottom: none; }
.plan-cta-row a {
  display: inline-block;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  text-align: center;
  width: 100%;
  transition: all var(--dur);
}
.plan-cta-free { background: var(--bg); color: var(--text); border: 1px solid var(--border-2); }
.plan-cta-pro  { background: var(--green); color: #0d3d3a; border: 1px solid var(--green); font-weight: 700; }
.plan-cta-free:hover { background: #ececea; }
.plan-cta-pro:hover  { background: var(--green-dark); color: #fff; border-color: var(--green-dark); }

/* =====================================================================
   Error box
   ===================================================================== */
.error-box {
  padding: 10px 14px;
  border-radius: var(--r);
  background: var(--danger-subtle);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  font-size: 0.875rem;
}

/* =====================================================================
   Learn more (guide pages)
   ===================================================================== */
.learn-more-panel { padding: 0; overflow: hidden; }
.learn-more-summary {
  display: grid;
  gap: 5px;
  padding: 18px 22px;
  cursor: pointer;
  list-style: none;
}
.learn-more-summary::-webkit-details-marker { display: none; }
.learn-more-heading { display: inline-flex; align-items: center; gap: 10px; }
.learn-more-title { font-size: 1.1rem; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.learn-more-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-3);
  transition: transform 0.2s var(--ease);
}
.learn-more-panel[open] .learn-more-icon { transform: rotate(180deg); }
.learn-more-copy { color: var(--text-2); font-size: 0.875rem; }
.learn-more-content { padding: 0 22px 20px; }

/* =====================================================================
   Resource cards (guide pages)
   ===================================================================== */
.resource-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.resource-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  transition: border-color var(--dur-m), background var(--dur-m);
}
.resource-card:hover { border-color: var(--border-2); background: var(--bg); }
.resource-card strong { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.resource-card span { color: var(--text-2); font-size: 0.83rem; }

/* =====================================================================
   Content figures (guide pages)
   ===================================================================== */
.content-figure { margin: 20px auto; max-width: 720px; text-align: center; }
.content-figure img { display: block; width: 100%; height: auto; border-radius: var(--r-lg); border: 1px solid var(--border); }
.content-figure figcaption { margin-top: 6px; font-size: 0.82rem; color: var(--text-3); }
.figure-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 20px 0; }
.figure-pair .content-figure { max-width: none; margin: 0; }
.figure-pair .content-figure img { width: 100%; height: auto; }
@media (max-width: 580px) {
  .figure-pair { grid-template-columns: 1fr; }
}

/* =====================================================================
   Modal
   ===================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
  animation: overlayIn 0.15s var(--ease) both;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: min(520px, 100%);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 24px 28px;
  animation: cardIn 0.18s var(--ease) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-card h3 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* =====================================================================
   Footer (content pages)
   ===================================================================== */
.site-footer {
  margin-top: 32px;
  padding: 18px 0 8px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.85rem;
}
.site-footer a { color: var(--green-dark); text-decoration: underline; transition: color var(--dur); }
.site-footer a:hover { color: var(--nav-bg); }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 0; }

/* App page footer (inside workspace) */
.workspace-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.8rem;
  background: var(--surface);
}
.workspace-footer a { color: var(--text-3); text-decoration: none; }
.workspace-footer a:hover { color: var(--text-2); text-decoration: underline; }
.workspace-footer-links { display: flex; gap: 12px; margin-top: 2px; }

/* =====================================================================
   Utility
   ===================================================================== */
.hidden { display: none !important; }

.hint {
  font-size: 0.8rem;
  color: var(--text-3);
  margin: 6px 0 0;
  line-height: 1.5;
}

/* Guide page hero on smaller screens */
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy-wide { grid-column: auto; }
  .hero-note { grid-column: auto; }
}

/* =====================================================================
   Workspace responsive
   ===================================================================== */
@media (max-width: 960px) {
  /* On narrow screens: always single-column stack regardless of results state */
  .workspace,
  .workspace:has(#results-content:not(.hidden)) {
    grid-template-columns: 1fr;
    min-height: auto;
    background: var(--surface);
  }
  .workspace-left {
    position: static;
    height: auto;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .workspace-left .panel { padding: 14px 16px; }
  /* Always show results column on mobile — stacks below inputs */
  .workspace-right,
  .workspace:has(#results-content:not(.hidden)) .workspace-right {
    display: block;
    animation: none;
    padding: 16px;
    background: var(--bg);
  }
  .inline-controls { grid-template-columns: 1fr 1fr; }
  .sheet-custom-grid { grid-template-columns: 1fr 1fr; }
  .sheet-custom-grid > button { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  /* Show hamburger, push brand to fill available width */
  .utility-hamburger { display: flex; }
  .utility-bar-brand  { flex: 1; }

  /* Hide the inline nav buttons */
  .utility-bar-main {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 6px 12px 12px;
    gap: 2px;
    z-index: 201;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  }

  /* Dark toolbar dropdown */
  .utility-shell--dark .utility-bar-main {
    background: var(--nav-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* Open state */
  .utility-bar-main--open {
    display: flex;
    animation: trayReveal 0.18s var(--ease) both;
  }

  .utility-bar-main .utility-btn {
    justify-content: flex-start;
    padding: 10px 12px;
    font-size: 0.9rem;
    border-radius: var(--r);
    width: 100%;
    text-align: left;
  }

  /* User Guide link — add a visible separator at the bottom */
  .utility-bar-main .utility-link {
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 12px;
  }
  .utility-shell--dark .utility-bar-main .utility-link {
    border-top-color: rgba(255, 255, 255, 0.12);
  }

  .inline-controls { grid-template-columns: 1fr; }
  .modal-card { padding: 18px 20px; }
}

/* =====================================================================
   Print / PDF export
   ===================================================================== */
@media print {
  body.pdf-export-mode .app-shell > *:not(.cut-list-export-host),
  body.pdf-export-mode .utility-shell,
  body.pdf-export-mode .workspace-left { display: none !important; }
  body.pdf-export-mode .workspace { display: block; }
  body.pdf-export-mode .workspace-right { padding: 0; background: #fff; }
  body.pdf-export-mode .cut-list-export-host {
    display: block !important;
    max-width: none; margin: 0; padding: 0;
    border: none; border-radius: 0; box-shadow: none;
  }
  body.pdf-export-mode .export-panel {
    border: none; box-shadow: none; padding: 0; margin: 0; background: #fff;
  }
  body.pdf-export-mode .export-panel-actions,
  body.pdf-export-mode #export-help { display: none !important; }
  body.pdf-export-mode .pdf-preview { border: none; padding: 0; }
}