/* HiddenPrints – Gridfinity Organizer page styles.
   Loaded before css/tabs.css, so the shared header, popup and scrollbar rules there win. */

:root {
  --bg: #0a0a0a;
  --panel: #111111;
  --panel2: #1a1a1a;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --muted: #757575;
  --accent: #e8132a;
  --accent-bg: #201113;
  --accent-line: #5c121a;
  --accent2: #6fa8ff;
  --warn: #f0a020;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Karla', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px; line-height: 1.4;
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
  font-variant-numeric: tabular-nums;
}
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- header ---------- */
header {
  height: 52px; flex-shrink: 0; position: relative;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--border); z-index: 30;
}
.logo {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px; color: var(--accent);
  font-size: 17px; font-weight: 800; letter-spacing: 0.1px; white-space: nowrap;
}
.logo svg { flex-shrink: 0; }  .header-actions { display: flex; gap: 8px; margin-left: auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s;
}
.btn:hover { border-color: #3d414a; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.btn-primary:hover { background: #f22a3f; border-color: #f22a3f; }
.btn-danger:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 6px 10px; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------- layout ---------- */
.main { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.left-panel, .right-panel {
  width: 292px; flex-shrink: 0; background: var(--panel); overflow-y: auto;
  display: flex; flex-direction: column;
}
.left-panel { border-right: 1px solid var(--border); }
.right-panel { border-left: 1px solid var(--border); width: 280px; }
.panel-section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.section-title { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.section-title .count { letter-spacing: 0; text-transform: none; }
.section-title .count { font-weight: 500; color: var(--muted); font-size: 11px; }
.hint { font-size: 11px; color: var(--muted); line-height: 1.5; }

.prop-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.prop-row:last-child { margin-bottom: 0; }
.prop-label { color: var(--muted); font-size: 12px; }
.prop-label b { color: var(--text); font-weight: 700; }
.input-unit { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.prop-input {
  width: 92px; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 6px 8px; border-radius: 4px; font-family: inherit; font-size: 12px; text-align: right; outline: none;
  -moz-appearance: textfield; appearance: textfield;
}
.prop-input:focus { border-color: var(--accent); }
.prop-input::-webkit-outer-spin-button, .prop-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 5px; background: var(--bg); }
.stepper button {
  width: 28px; height: 28px; background: none; border: none; color: var(--text);
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.stepper button:hover:not(:disabled) { color: var(--accent); }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper span { min-width: 30px; white-space: nowrap; padding: 0 2px; text-align: center; font-weight: 700; font-size: 13px; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; cursor: pointer; user-select: none; }
.toggle-row:last-child { margin-bottom: 0; }
.toggle-row .prop-label { color: var(--text); }
.toggle-row small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 1px; }
.switch { position: relative; width: 34px; height: 19px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background .15s; }
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  border-radius: 50%; background: #cfd0d4; transition: transform .15s, background .15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(15px); background: #ffffff; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-row { display: flex; gap: 6px; margin-top: 10px; }
.btn-row .btn { flex: 1; }

.color-row { display: flex; align-items: center; gap: 8px; }
.color-swatch { width: 26px; height: 26px; border-radius: 5px; border: 1px solid var(--border); padding: 0; cursor: pointer; background: none; overflow: hidden; }
.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch { border: none; }
.color-swatch::-moz-color-swatch { border: none; }

/* bins list */
.objects-list { flex: 1; min-height: 120px; padding: 6px 8px 12px; }
.obj-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px;
  cursor: pointer; border: 1px solid transparent;
}
.obj-item:hover { background: var(--panel2); }
.obj-item.selected { background: var(--accent-bg); border-color: rgba(232,19,42,0.45); }
.obj-icon { width: 22px; height: 22px; flex-shrink: 0; }
.obj-name { flex: 1; font-weight: 700; font-size: 12px; }
.obj-name small { display: block; color: var(--muted); font-weight: 400; font-size: 10.5px; }
.obj-del {
  opacity: 0; background: none; border: none; color: var(--muted); font-size: 16px; line-height: 1;
  cursor: pointer; width: 24px; height: 24px; border-radius: 4px;
}
.obj-item:hover .obj-del, .obj-item.selected .obj-del { opacity: 1; }
.obj-del:hover { color: var(--accent); }
.empty-list { padding: 18px 10px; color: var(--muted); font-size: 11.5px; line-height: 1.55; text-align: center; }

/* ---------- viewport ---------- */
.viewport-wrap { flex: 1; position: relative; min-width: 0; background: var(--bg); overflow: hidden; }
#viewport, #layout { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#layout { cursor: crosshair; }
.viewport-overlay { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; pointer-events: none; z-index: 3; }
.chip {
  background: rgba(26,27,31,0.88); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 10px; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.chip.warn { border-color: rgba(240,160,32,.6); color: #f5c26b; }
.vp-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; z-index: 3; }
.vp-actions .btn { background: rgba(26,27,31,0.88); }
.vp-actions .btn-primary { background: var(--accent); }
.grid-toggle {
  position: absolute; bottom: 12px; left: 12px; z-index: 3; display: flex; padding: 3px;
  background: rgba(26,27,31,0.92); border: 1px solid var(--border); border-radius: 999px;
}
.grid-toggle button {
  background: none; border: none; color: var(--muted); font-weight: 700; font-size: 12px;
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
}
.grid-toggle button.active { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.vp-hint {
  position: absolute; bottom: 14px; right: 14px; z-index: 3; pointer-events: none;
  font-size: 11px; color: var(--muted); text-align: right; max-width: 60%;
}

/* ---------- right panel ---------- */
.no-selection { padding: 22px 16px; color: var(--muted); font-size: 12px; line-height: 1.55; border-bottom: 1px solid var(--border); }
.no-selection b { color: var(--text); }
.bin-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.bin-head .big { font-size: 22px; font-weight: 800; }
.bin-head .mm { color: var(--muted); font-size: 11px; }
.info-block { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.info-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 3px 0; }
.info-row span:first-child { color: var(--muted); }
.info-row span:last-child { font-weight: 700; text-align: right; }
.warn-box {
  font-size: 11px; line-height: 1.5; color: #e0e0e0; border: 1px solid var(--accent-line);
  background: var(--accent-bg); border-radius: 5px; padding: 8px 10px; margin-top: 10px;
}

/* ---------- status bar ---------- */
.statusbar {
  height: 26px; flex-shrink: 0; display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--panel); border-top: 1px solid var(--border); font-size: 11px; color: var(--muted);
}
.statusbar .dot { color: var(--accent); }
#statusMsg { color: var(--text); }

/* ---------- export modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.62); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  width: 460px; max-width: 100%; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px;
}
.modal h2 { font-size: 17px; font-weight: 800; margin-bottom: 14px; }
.export-warning p { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.modal-row { margin-bottom: 14px; }
.modal-row.hidden { display: none; }
.modal-label { font-size: 12px; font-weight: 700; margin-bottom: 7px; }
.format-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.format-btn {
  flex: 1; min-width: 80px; text-align: center; padding: 9px 8px; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; font-weight: 700; font-size: 12px; background: var(--bg); user-select: none;
}
.format-btn:hover { border-color: #3d414a; }
.format-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.format-btn.disabled { opacity: .35; pointer-events: none; }
.format-btn small { display: block; font-weight: 400; font-size: 10px; color: var(--muted); margin-top: 2px; }
.bed-custom { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.bed-custom .bed-lbl { min-width: 46px; }
.bed-custom input { width: 76px; text-align: center; }
.bed-hint, .format-note { font-size: 10.5px; color: var(--muted); line-height: 1.5; margin-top: 6px; }
#exportFilename { width: 100%; text-align: left; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.modal-actions .btn { flex: 1; padding: 10px; }
.support-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.support-row:empty { display: none; }
.credit { font-size: 10.5px; color: var(--muted); margin-top: 14px; line-height: 1.5; }

/* ---------- tool cutouts ---------- */
.modal.modal-wide { width: 720px; }
details.tips { border: 1px solid rgba(232,19,42,0.45); background: var(--accent-bg); border-radius: 6px; padding: 10px 12px; margin-bottom: 16px; }
details.tips summary { font-weight: 800; font-size: 13px; color: var(--accent); cursor: pointer; list-style-position: inside; }
details.tips ul { margin: 8px 0 2px 18px; }
details.tips li { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-bottom: 5px; }
details.tips li b { color: var(--text); font-weight: 700; }
.photo-btn { width: 100%; padding: 11px; font-size: 13px; }
.brush-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.brush-modes { flex: 0 0 auto; }
.brush-modes .format-btn { min-width: 0; padding: 7px 12px; }
.brush-size { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); flex: 1; min-width: 160px; }
.brush-size input { flex: 1; width: auto; }
.brush-size b { color: var(--text); min-width: 38px; }
.stage-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 4px; background: rgba(26,27,31,0.9); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.stage-zoom span { min-width: 42px; text-align: center; font-size: 11px; font-weight: 700; }
.stage-zoom .btn { padding: 4px 8px; }
.found-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.found-item.off .found-size, .found-item.off .found-name { opacity: .45; }
.found-check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.found-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.found-num { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.found-item.off .found-num { background: #3a3d44; }
.found-name { flex: 1; min-width: 0; width: auto; text-align: left; }
.found-size { color: var(--muted); font-size: 11px; white-space: nowrap; min-width: 92px; text-align: right; }
.tool-stage { position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-top: 10px; }
#toolStage { display: block; width: 100%; height: min(52vh, 460px); touch-action: none; }
input[type=range] { accent-color: var(--accent); width: 170px; }
.tool-list { margin: 6px 0 2px; }
.tool-item { display: flex; align-items: center; gap: 6px; padding: 6px 6px; border-radius: 5px; border: 1px solid transparent; cursor: pointer; }
.tool-item:hover { background: var(--panel2); }
.tool-item.selected { border-color: rgba(232,19,42,0.45); background: var(--accent-bg); }
.tool-item .tname { flex: 1; font-size: 12px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-item .tname small { display: block; font-weight: 400; color: var(--muted); font-size: 10.5px; }
.icon-btn { width: 26px; height: 26px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; font-size: 13px; line-height: 1; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.on { border-color: var(--accent); color: var(--accent); }
.level-toggle { display: flex; padding: 3px; background: rgba(17,17,17,0.92); border: 1px solid var(--border); border-radius: 999px; }
.level-toggle button { background: none; border: none; color: var(--muted); font-weight: 700; font-size: 11.5px; padding: 6px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.level-toggle [data-level-add], .level-toggle [data-level-del] { font-size: 15px; padding: 3px 11px; color: var(--text); }
.level-toggle [data-level-del] { border-left: 1px solid var(--border); border-radius: 0 999px 999px 0; margin-left: 2px; }
.level-toggle [data-level-del] + [data-level-add] { border-radius: 999px; }
.level-toggle button.active { background: var(--accent-bg); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.grid-toggle button:disabled { opacity: .35; cursor: default; }

.rot-ctl { display: flex; align-items: center; gap: 4px; }
.rot-ctl .prop-input { width: 70px; text-align: center; }
.steps { margin: 0 0 0 20px; }
.steps li { font-size: 12.5px; line-height: 1.5; margin-bottom: 8px; padding-left: 2px; }
.steps li b { color: var(--text); }
.key { display: inline-block; min-width: 20px; padding: 0 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--bg); font-weight: 800; font-size: 11.5px; text-align: center; }
.cut-box { margin: -4px 0 12px; }
.cut-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.cut-row b { color: var(--text); font-weight: 700; }
.shape-btns { display: grid; grid-template-columns: repeat(4, 1fr); }
.shape-btns .format-btn { min-width: 0; padding: 7px 2px; font-size: 11px; }
.shape-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.shape-row .prop-input { width: 74px; text-align: center; }
.tname-text { cursor: text; border-bottom: 1px dashed transparent; }
.tname-text:hover { border-bottom-color: var(--muted); }
.tname-input { width: 100%; text-align: left; padding: 3px 6px; font-weight: 700; }
.gap-inline { position: absolute; z-index: 6; width: 68px; height: 26px; text-align: center; font-weight: 800; border-color: var(--accent); }
.type-btns { display: grid; grid-template-columns: 1fr 1fr; flex: 0 0 auto; width: 190px; }
/* Inside: label on its own line, then the three buttons across the whole panel; equal widths, but "Compartments" never narrower than its text */
#bpTypeBox { flex-direction: column; align-items: stretch; gap: 6px; }
#bpTypeBox .type-btns { grid-template-columns: repeat(3, minmax(max-content, 1fr)); width: 100%; }
#bpTypeBox .type-btns .format-btn { padding: 7px 10px; font-size: 12px; white-space: nowrap; }
/* socket drive size: three small buttons */
.drive-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 150px; flex: 0 0 auto; }
.drive-btns .format-btn { min-width: 0; padding: 6px 4px; font-size: 12px; }
.type-btns .format-btn { min-width: 0; padding: 6px 4px; font-size: 11px; }
.tr-texts { width: 100% !important; text-align: left; font-family: inherit; resize: vertical; line-height: 1.5; margin-top: 4px; }
.notch-box { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.label-box { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.label-input { width: 100%; text-align: left; margin-bottom: 6px; }
.chips { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 3px; }
.chip-btn { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: 3px 7px; font-size: 11px; font-weight: 700; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- touch devices ---------- */
@media (hover: none) { .obj-del { opacity: 1; } }

/* ---------- phones and narrow windows ---------- */
@media (max-width: 900px) {
  body { height: auto; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; overflow-y: auto; }
  header {
    padding: 0 12px; padding-top: env(safe-area-inset-top, 0px);
    height: calc(52px + env(safe-area-inset-top, 0px)); gap: 8px; position: sticky; top: 0;
  }
  .logo { position: static; transform: none; font-size: 16px; overflow: hidden; }
  .brand { font-size: 11px; }
  .logo { font-size: 15px; }
  .header-actions .btn { padding: 7px 10px; }
  .header-actions .btn { padding: 7px 12px; }
  .main { flex-direction: column; overflow: visible; flex: none; }
  .viewport-wrap {
    order: -1; flex: none; height: 50vh; height: 50svh; min-height: 280px;
    position: sticky; top: calc(52px + env(safe-area-inset-top, 0px)); z-index: 20;
    border-bottom: 1px solid var(--border);
  }
  .left-panel, .right-panel { width: 100%; border: none; overflow: visible; flex-shrink: 0; }
  .main.has-sel .right-panel { order: 0; border-top: none; border-bottom: 1px solid var(--border); }
  .main.has-sel .left-panel { order: 1; }
  .brush-size { flex: 1 1 100%; }
  .lv-word { display: none; }
  .level-toggle button { padding: 6px 11px; }
  .right-panel { border-top: 1px solid var(--border); }
  .right-panel .print-block { margin-top: 0 !important; }
  .objects-list { flex: none; }
  .viewport-overlay { top: 8px; left: 8px; right: 8px; flex-wrap: wrap; }
  .vp-actions { top: auto; bottom: 54px; right: 8px; }
  .vp-hint { display: none; }
  .grid-toggle { bottom: 8px; left: 8px; }
  .statusbar { height: auto; flex-wrap: wrap; padding: 6px 12px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); gap: 4px 16px; }
  .modal-overlay { align-items: flex-start; overflow-y: auto; padding: 12px; }
  .modal { padding: 18px; }
  /* 16px stops iPhones zooming the page when a field is tapped */
  .prop-input { font-size: 16px; }
  .prop-input { width: 110px; }
  #toolStage { height: 46vh; }
  .paper-btns { display: grid; grid-template-columns: 1fr 1fr; }
  .grid-toggle button { padding: 7px 12px; }
}
@media (max-width: 440px) { .logo-long { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
