/* Extrusion Designer: the Quiver Design Works "Trail & Workshop" look
   (quiverdesignworks-site src/styles/global.css), dark by default like the
   other builders. */
:root {
  color-scheme: dark;
  --bg: #15130f;
  --surface: #1d1a15;
  --surface-2: #27231c;
  --text: #efe9dc;
  --muted: #a89f8e;
  --line: #342f27;
  --accent: #e0a93b;
  --accent-strong: #f0bb4e;
  --accent-contrast: #1a1408;
  --accent-soft: rgb(224 169 59 / .14);
  --ok: #8fc98a;
  --warn: #e7c35c;
  --bad: #f08a6e;
  --font-sans: 'Barlow', system-ui, sans-serif;
  --font-display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --r: 8px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--font-sans); font-size: 16px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); }
h1, h2 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .03em; margin: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.05rem; color: var(--accent); margin-bottom: 8px; }
button, .button, input, select { font: inherit; color: inherit; }
button, .button {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
button:hover, .button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); font-weight: 600; }
input, select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; width: 100%; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input.bad { border-color: var(--bad); }
label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
label > input, label > select, label > .stepper { margin-top: 4px; color: var(--text); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); margin-bottom: 6px; }
label.check input { width: auto; }
label.small { font-size: .85rem; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px 4px; margin: 0 0 10px; }
legend { color: var(--muted); font-size: .9rem; padding: 0 4px; }
.hint { color: var(--muted); font-size: .85rem; margin: -4px 0 10px; }
.badge { font-size: .7rem; vertical-align: middle; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 8px; margin-left: 6px; letter-spacing: .05em; }

.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; color: var(--muted); text-decoration: none; }
.top-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.layout { flex: 1; display: grid; grid-template-columns: var(--panel-w, 320px) 6px 1fr; min-height: 0; }
.panel { padding: 16px; overflow-y: auto; max-height: calc(100vh - 110px); }
.panel section, .panel details { margin-bottom: 18px; }
.panel details summary { cursor: pointer; color: var(--accent); font-family: var(--font-display); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stepper { display: flex; gap: 4px; }
.stepper input { text-align: center; }
.stepper button { padding: 6px 12px; }
.shelf-heights label { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; }
.status { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--surface); }
.status.ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.status.bad { border-color: var(--bad); }
.status strong { display: block; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .03em; }
.status .ok-text { color: var(--ok); }
.status .bad-text { color: var(--bad); }

.stage { display: flex; flex-direction: column; min-width: 0; }
.viewer { position: relative; height: var(--viewer-h, 52vh); min-height: 200px; flex: none; background: radial-gradient(ellipse at 50% 40%, #241f18, var(--bg)); }
.viewer canvas { display: block; width: 100%; height: 100%; }
.viewer-tools { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.viewer-tools button { padding: 4px 10px; font-size: .85rem; background: rgb(29 26 21 / .85); }
.viewer-tools label { background: rgb(29 26 21 / .85); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
.viewer-hint { position: absolute; bottom: 8px; right: 12px; margin: 0; font-size: .8rem; color: var(--muted); pointer-events: none; }

.tabs { display: flex; gap: 2px; padding: 8px 16px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; background: transparent; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); border-color: var(--line); color: var(--text); }
.tab-body { padding: 16px; overflow: auto; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

table.data { border-collapse: collapse; width: 100%; font-size: .92rem; margin-bottom: 16px; }
table.data th, table.data td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 500; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tfoot td { font-weight: 600; }
.mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent); font-weight: 600; font-size: .85rem; }
.tbd { color: var(--warn); }
.issues { list-style: none; padding: 0; margin: 0; }
.issues li { padding: 8px 10px; border-left: 3px solid var(--line); margin-bottom: 6px; background: var(--surface); border-radius: 0 6px 6px 0; cursor: pointer; }
.issues li.error { border-color: var(--bad); }
.issues li.warn { border-color: var(--warn); }
.issues li.info { border-color: var(--line); color: var(--muted); }
.issues li .more { color: var(--muted); font-size: .85rem; }
.sticks { display: grid; gap: 6px; margin-bottom: 16px; }
.stick { display: flex; height: 28px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 6px, var(--surface-2) 6px, var(--surface-2) 12px); }
.stick span { display: grid; place-items: center; background: #8c96a0; color: #111; font-size: .78rem; font-weight: 600; border-right: 2px solid var(--bg); overflow: hidden; white-space: nowrap; }
.paper { background: #fff; border-radius: 4px; overflow: auto; }
.paper svg { display: block; width: 100%; height: auto; min-width: 800px; }
textarea.paste { width: 100%; min-height: 140px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; padding: 8px; }
ol.steps { padding-left: 20px; }
ol.steps li { margin-bottom: 6px; }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--accent-contrast); padding: 8px 16px; border-radius: 6px; font-weight: 600; z-index: 10; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  .viewer { height: 46vh; }
  .top-actions { margin-left: 0; }
}

@media print {
  body * { visibility: hidden; }
  .paper, .paper * { visibility: visible; }
  .paper { position: fixed; inset: 0; border-radius: 0; overflow: visible; }
  .paper svg { width: 100%; height: auto; min-width: 0; }
  @page { size: 17in 11in; margin: 0.25in; }
}
.top-actions label.button { margin: 0; color: var(--text); font-size: inherit; }
.viewer-tools button[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.viewer-tools .explode-amount { display: flex; align-items: center; gap: 6px; color: var(--text); }
.viewer-tools .explode-amount input { width: 110px; margin: 0; padding: 0; accent-color: var(--accent); }

/* Resizable layout and floating windows (layout.js) */
.split { background: var(--line); position: relative; z-index: 2; touch-action: none; }
.split::after { content: ''; position: absolute; background: var(--muted); border-radius: 2px; opacity: .5; }
.split:hover, .split:focus-visible, .split.dragging { background: var(--accent); outline: none; }
.split-v { cursor: col-resize; }
.split-v::after { width: 2px; height: 28px; left: 2px; top: 50%; margin-top: -14px; }
.split-h { cursor: row-resize; height: 6px; flex: none; }
.split-h::after { height: 2px; width: 28px; top: 2px; left: 50%; margin-left: -14px; }
.dock { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dock .tab-body { flex: 1; }
.stage.viewer-out .split-h, .stage.dock-out .split-h { display: none; }
.stage.dock-out .viewer { flex: 1; height: auto; }
.floating { position: fixed !important; z-index: 20; resize: both; overflow: hidden; border: 1px solid var(--accent); border-radius: 8px; box-shadow: 0 18px 48px -12px rgb(0 0 0 / .7); background: var(--surface); display: flex; flex-direction: column; min-width: 320px; min-height: 220px; }
.floating.viewer { height: auto; }
.floating .float-bar { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); cursor: move; user-select: none; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em; font-size: .85rem; color: var(--muted); flex: none; touch-action: none; }
.floating .float-bar button { margin-left: auto; padding: 2px 10px; font-size: .8rem; }
.floating.viewer canvas { flex: 1; min-height: 0; height: auto; width: 100%; }
.floating.viewer .viewer-tools { top: 44px; }
.floating .tab-body { overflow: auto; }
.float-bar { display: none; }
.floating > .float-bar { display: flex; }
.float-toggle { margin-left: auto; }
.tabs .float-toggle { border: 1px solid var(--line); border-radius: 6px; color: var(--muted); align-self: center; padding: 3px 10px; font-size: .85rem; }
.floating .float-toggle { display: none; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .split, .float-toggle { display: none !important; }
}

/* Parts library (library.js) */
.dropzone { display: grid; gap: 4px; place-items: center; text-align: center; padding: 22px; border: 2px dashed var(--line); border-radius: 8px; cursor: pointer; color: var(--muted); margin: 0 0 16px; }
.dropzone strong { color: var(--text); font-size: 1rem; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.lib-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 14px; background: var(--surface); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; }
.lib-pdf { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.bad-text { color: var(--bad); }

/* Risers (sidebar) */
.risers .riser { margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; align-items: end; }
.riser .remove { margin-bottom: 10px; justify-self: start; color: var(--muted); }
#add-riser { width: 100%; justify-content: center; }
