/* ============================================================================
   Layher VDS Configurator — Styles
   ========================================================================== */
:root {
  --bg:         #f6f3eb;
  --paper:      #fbf9f3;
  --panel:     #ffffff;
  --ink:        #2d3142;
  --ink-soft:   #5b6072;
  --muted:      #8b8a82;
  --line:       #e6dfcd;
  --line-soft:  #efeadc;
  --accent:     #009fc2;   /* VDS Gevelonderhoud brand blue */
  --accent-dark: #007a99;
  --accent-2:   #c0392b;
  --teal:       #1f7a7a;
  --good:       #4a7c59;
  --warn:       #c38a00;
  --error:      #c0392b;
  --shadow:     0 1px 2px rgba(45,49,66,0.04), 0 4px 16px rgba(45,49,66,0.06);
}

[x-cloak] { display: none !important; }

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

button {
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 120ms ease;
}
button:hover { background: var(--paper); border-color: #d4cbb1; }
button.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: var(--paper);
  color: var(--muted);
}
button:disabled:hover { background: var(--paper); border-color: var(--line); }
button.mini-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary {
  background: var(--ink); color: #fff; border-color: var(--ink);
  font-weight: 600; padding: 7px 14px;
}
.btn-primary:hover { background: #1b1f30; color: #fff; }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
}

/* ================= TOPBAR ================= */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 10px 18px;
  box-shadow: 0 1px 0 rgba(45,49,66,0.03);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px;
  background: var(--accent);
  color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 18px;
  font-family: 'Fraunces', serif;
  box-shadow: 0 1px 2px rgba(217,122,58,0.4);
}
.brand-logo {
  height: 38px;
  width: auto;
  display: block;
  object-fit: contain;
}
.brand-title { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.preset-group { display: flex; align-items: center; gap: 4px; padding-right: 12px; border-right: 1px solid var(--line); }
.preset-group button { padding: 5px 9px; font-size: 12px; }
.preset-label { font-size: 12px; color: var(--muted); margin-right: 4px; }

.preset-select {
  font-family: inherit;
  font-size: 12px;
  padding: 5px 24px 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235b6072' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  min-width: 230px;
}
.preset-select:hover { border-color: var(--accent); }
.preset-select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.preset-select optgroup { font-size: 11px; color: var(--muted); }
.preset-select option { color: var(--ink); padding: 2px 0; }

.error-banner {
  background: #fef2ee;
  color: var(--error);
  padding: 10px 18px;
  border-bottom: 1px solid #f5d6cd;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
}

/* ================= GRID ================= */
.grid {
  display: grid;
  grid-template-columns: 280px 1fr 380px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.left, .right {
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 16px;
}
.right {
  border-right: none;
  border-left: 1px solid var(--line);
  padding: 0;
  display: flex; flex-direction: column;
}
.center {
  display: flex; flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  min-width: 0;
  position: relative;   /* anker voor floating trap-paneel */
}

/* ================= FLOATING TRAP PANEL ================= */
.trap-fab {
  position: absolute;
  left: 16px; bottom: 64px;
  z-index: 20;
  background: rgba(255,255,255,0.94);
  border: 1px solid #d7d2c4;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  padding: 8px 10px;
  width: 190px;
  font-size: 12px;
  backdrop-filter: blur(4px);
}
.trap-fab-active { border-color: #d97a3a; box-shadow: 0 4px 18px rgba(217,122,58,0.35); }
.trap-fab-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.trap-fab-title { font-weight: 700; color: #2d3142; }
.trap-fab-count {
  background: #d97a3a; color: #fff; font-weight: 700;
  min-width: 20px; text-align: center; border-radius: 10px; padding: 1px 7px;
}
.trap-fab-btn {
  display: block; width: 100%; margin-top: 5px;
  padding: 6px 8px; border: 1px solid #cfc9ba; border-radius: 6px;
  background: #f4f1e9; color: #2d3142; cursor: pointer; font-size: 12px;
  transition: background 0.12s, border-color 0.12s;
}
.trap-fab-btn:hover { background: #ece7d8; }
.trap-fab-btn.on { background: #d97a3a; color: #fff; border-color: #b9621f; }
.trap-fab-actions { display: flex; gap: 5px; }
.trap-fab-actions .trap-fab-btn { font-size: 11px; padding: 5px 4px; }
.trap-fab-hint { margin: 6px 0 0; color: #7a3e0d; line-height: 1.35; font-size: 11px; }

/* ================= PANELS / CONTROLS ================= */
.panel { margin-bottom: 18px; }
.panel h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 14px 0 8px;
  font-weight: 600;
}
.panel h3:first-child { margin-top: 0; }

.info-i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  margin-left: 5px;
  cursor: help;
  transition: all 120ms ease;
  letter-spacing: 0;
  text-transform: none;
  font-family: 'Inter', sans-serif;
  vertical-align: middle;
}
.info-i:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.15);
}

input[type="range"]:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
input[type="range"]:disabled::-webkit-slider-thumb { background: var(--muted); }

.seg-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 8px;
}
.seg-control button { padding: 7px 4px; font-size: 12px; }
.seg-control.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg-control.seg-4 { grid-template-columns: repeat(4, 1fr); }
.seg-control.seg-6 { grid-template-columns: repeat(6, 1fr); }

.hint {
  font-size: 11.5px;
  color: var(--muted);
  margin: 4px 0 12px;
  line-height: 1.5;
}
.hint strong { color: var(--ink); font-weight: 600; }

.slider-row {
  display: grid;
  grid-template-columns: 80px 1fr 70px;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}
.slider-row label {
  font-size: 12px; color: var(--ink-soft);
}
.slider-row span {
  font-size: 12px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--ink);
  text-align: right;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 18px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  background: var(--line);
  height: 3px;
  border-radius: 2px;
}
input[type="range"]::-moz-range-track {
  background: var(--line);
  height: 3px;
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  margin-top: -5.5px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
}

.check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-soft);
}

.segment-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 120ms ease;
}
.segment-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217,122,58,0.1);
}
.segment-card-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
}
.segment-card-head .x {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 2px 6px;
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
}
.segment-card-head .x:hover { background: #fde8e3; color: var(--error); }

.corner-row {
  display: flex; align-items: center; gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.corner-row-lbl {
  font-size: 11px;
  color: var(--muted);
  margin-right: 2px;
}
.corner-row button {
  padding: 3px 7px;
  font-size: 11px;
}

.btn-add {
  display: block;
  width: 100%;
  padding: 9px;
  background: var(--paper);
  border: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 12.5px;
  border-radius: 6px;
  margin-top: 4px;
}
.btn-add:hover {
  background: #fff;
  border-color: var(--accent);
  color: var(--accent);
}

/* ================= CENTER ================= */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  gap: 16px;
  flex-wrap: wrap;
}
.tool-group { display: flex; align-items: center; gap: 4px; }
.tool-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-right: 4px;
}
.tool-group button { padding: 6px 10px; font-size: 12px; }

.opening-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fef8ea;
  border-bottom: 1px solid #ecdfb8;
  padding: 6px 16px;
  font-size: 12px;
  color: var(--ink-soft);
}
.opening-picker button { padding: 4px 9px; font-size: 11.5px; }
.opening-picker input[type="range"] { flex: 1; max-width: 220px; }

.canvas-wrap {
  flex: 1;
  overflow: auto;
  background:
    radial-gradient(ellipse at center, rgba(255,255,255,0.5) 0%, transparent 70%),
    var(--bg);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.canvas {
  width: 100%;
  height: 100%;
  max-height: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.canvas-wrap-3d {
  padding: 0;
  position: relative;
  overflow: hidden;
}
.scaffold-canvas-3d {
  width: 100%;
  height: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: grab;
}
.scaffold-canvas-3d:active { cursor: grabbing; }

.canvas-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(45, 49, 66, 0.85);
  color: #fff;
  font-size: 11.5px;
  padding: 6px 12px;
  border-radius: 14px;
  pointer-events: none;
  z-index: 5;
  font-family: 'Inter', sans-serif;
}
.canvas-hint kbd {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  padding: 1px 6px;
  margin: 0 2px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
}

.status-bar {
  display: flex;
  gap: 24px;
  padding: 10px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-soft);
  font-family: 'IBM Plex Mono', monospace;
}
.status-bar strong {
  color: var(--ink);
  font-weight: 600;
}

/* ================= RIGHT PANEL ================= */
.right-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.right-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 8px;
  font-size: 12.5px;
  color: var(--muted);
  border-radius: 0;
  border-bottom: 2px solid transparent;
  position: relative;
}
.right-tabs button.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  background: var(--panel);
  font-weight: 600;
}
.right-tabs .badge {
  background: var(--accent-2);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
  font-weight: 600;
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* BOM */
.bom-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}
.cat-pill {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 4px 9px;
  border-radius: 12px;
  font-size: 11.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 100ms ease;
  font-family: inherit;
}
.cat-pill:hover {
  background: #fff;
  border-color: var(--accent);
  color: var(--accent);
}
.cat-pill strong { color: var(--ink); }
.cat-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(217,122,58,0.3);
}
.cat-pill.active strong { color: #fff; }
.cat-pill.clear-filter {
  background: transparent;
  border-color: var(--accent-2);
  color: var(--accent-2);
}
.cat-pill.clear-filter:hover {
  background: #fef2ee;
}

.filter-status {
  background: #fef8ea;
  border: 1px solid #ecdfb8;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 10px;
  color: #6b5400;
}
.filter-status strong { color: var(--accent); }

.bom-table tr.in-filter {
  background: rgba(217,122,58,0.04);
}
.bom-table .grand-row td {
  color: var(--muted);
  font-weight: 400;
  border-top: 1px dashed var(--line);
  padding-top: 6px;
  font-size: 11.5px;
}

.bom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.bom-table th {
  text-align: left;
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
}
.bom-table td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.bom-table td.num, .bom-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bom-table td.mono, .bom-table .mono {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.bom-table .part-name { font-weight: 500; line-height: 1.3; }
.bom-table .part-meta {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: capitalize;
  margin-top: 2px;
}
.bom-table tfoot td {
  font-weight: 600;
  border-top: 2px solid var(--ink);
  border-bottom: none;
  padding-top: 10px;
}
.bom-table .strong { font-weight: 700; color: var(--ink); }

/* Summary */
.summary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  margin: 0 0 18px;
}
.summary dt {
  font-size: 11.5px;
  color: var(--muted);
}
.summary dd {
  margin: 0;
  font-size: 12.5px;
  text-align: right;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--ink);
}
.summary dd strong { color: var(--accent); }

h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 14px 0 8px;
  font-weight: 600;
}

.seg-fields {
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--paper);
  border-radius: 6px;
}
.seg-fields > strong {
  font-size: 12px;
  display: block;
  margin-bottom: 5px;
}
.field-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
}
.chip.off {
  background: #f5e3df;
  color: var(--error);
  border-color: #e9c8c0;
  text-decoration: line-through;
}

/* Warnings */
.empty {
  text-align: center;
  color: var(--good);
  font-size: 13px;
  margin: 30px 0;
}
.warnings {
  list-style: none;
  padding: 0;
  margin: 0;
}
.warnings li {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.4;
}
.warnings li.warn {
  background: #fff8e6;
  border: 1px solid #f0e0a8;
  color: #6b5400;
}
.warnings li.error {
  background: #fce9e4;
  border: 1px solid #f3c4b7;
  color: #7a1f10;
}
.warning-header { display: flex; align-items: flex-start; gap: 8px; }
.warning-text { flex: 1; font-weight: 500; }
.warnings .lvl { font-size: 14px; flex-shrink: 0; }
.warning-why {
  margin: 6px 0 0 22px;
  font-size: 11.5px;
  font-style: italic;
  opacity: 0.85;
  line-height: 1.45;
}
.warning-link {
  margin: 8px 0 0 22px;
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.warning-link:hover { color: var(--accent-2); background: transparent; }

/* ==== Manual / Handleiding tab ==== */
.manual-tab { padding: 12px 14px; }
.manual-intro {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.manual-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--panel);
  overflow: hidden;
  transition: box-shadow 120ms ease;
}
.manual-section:hover {
  box-shadow: 0 1px 4px rgba(45,49,66,0.06);
}
.manual-section > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  cursor: pointer;
  background: var(--panel);
  transition: background 100ms ease;
}
.manual-section > header:hover {
  background: var(--paper);
}
.manual-section h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}
.manual-chevron {
  font-size: 14px;
  color: var(--muted);
  transition: transform 200ms ease;
  display: inline-block;
}
.manual-chevron.open {
  transform: rotate(90deg);
  color: var(--accent);
}
.manual-body {
  padding: 4px 14px 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  border-top: 1px solid var(--line-soft);
}
.manual-body p {
  margin: 8px 0;
}
.manual-body ul {
  margin: 8px 0;
  padding-left: 20px;
}
.manual-body li { margin-bottom: 3px; }
.manual-body strong { color: var(--ink); }
.manual-body code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  background: var(--paper);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent-2);
}
.manual-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.manual-body a:hover { color: var(--accent-2); }
.manual-source {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}
.manual-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 11.5px;
}
.manual-table th {
  text-align: left;
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.manual-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-soft);
}
.manual-table td:first-child {
  font-weight: 600;
  color: var(--accent);
  font-family: 'IBM Plex Mono', monospace;
}

/* ================= SCROLLBARS ================= */
.left::-webkit-scrollbar, .right::-webkit-scrollbar, .tab-content::-webkit-scrollbar, .canvas-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.left::-webkit-scrollbar-thumb, .right::-webkit-scrollbar-thumb, .tab-content::-webkit-scrollbar-thumb, .canvas-wrap::-webkit-scrollbar-thumb {
  background: #d8d2bd;
  border-radius: 4px;
}
.left::-webkit-scrollbar-thumb:hover, .right::-webkit-scrollbar-thumb:hover { background: #c0b89c; }

/* ================= ZOOM CONTROLS ================= */
.canvas-wrap { position: relative; }
.zoom-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  box-shadow: var(--shadow);
  z-index: 5;
}
.zoom-controls button {
  width: 30px; height: 30px;
  padding: 0;
  font-size: 16px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--ink);
  border-radius: 4px;
}
.zoom-controls button:hover { background: var(--paper); }
.zoom-level {
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--muted);
  text-align: center;
  padding-top: 2px;
  border-top: 1px solid var(--line-soft);
}

.pan-hint {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(45,49,66,0.7);
  color: #fff;
  font-size: 10.5px;
  padding: 4px 10px;
  border-radius: 12px;
  z-index: 4;
  font-family: 'Inter', sans-serif;
  pointer-events: none;
  opacity: 0.8;
  transition: opacity 300ms ease;
}
.canvas-wrap:hover .pan-hint { opacity: 0.4; }
.canvas-wrap:hover:not(:focus-within) .pan-hint:hover { opacity: 1; }

/* ================= POPOVER ================= */
.popover {
  position: fixed;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(45,49,66,0.25);
  min-width: 180px;
  max-width: 280px;
  border: 1px solid #1b1f30;
  animation: popoverIn 120ms ease-out;
}
@keyframes popoverIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.popover-title {
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  color: var(--accent);
}
.popover-detail {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  line-height: 1.5;
  color: #d8d3c8;
}
.popover-detail li {
  padding: 1px 0;
}
.popover-photo {
  display: block;
  width: 100%;
  max-width: 240px;
  max-height: 180px;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
  margin: 6px 0;
}
.popover-article {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 10px;
  color: #b8b3a8;
}

/* ================= DELETE CONFIRM MODAL ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(45,49,66,0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: backdropIn 140ms ease-out;
}
@keyframes backdropIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--panel);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(45,49,66,0.3);
  animation: modalIn 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.modal-icon {
  font-size: 36px;
  color: var(--accent-2);
  margin-bottom: 8px;
}
.modal-text {
  font-size: 15px;
  line-height: 1.4;
  margin-bottom: 18px;
  color: var(--ink);
  font-weight: 500;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.btn-danger {
  background: var(--accent-2);
  color: #fff;
  border-color: var(--accent-2);
  font-weight: 600;
  padding: 8px 18px;
}
.btn-danger:hover {
  background: #9d2e22;
  border-color: #9d2e22;
  color: #fff;
}

/* ================= CLEAR BUTTON ================= */
.undo-group {
  display: flex;
  gap: 2px;
  padding-right: 10px;
  border-right: 1px solid var(--line);
}
.btn-icon {
  padding: 6px 9px;
  font-size: 15px;
  line-height: 1;
  border: 1px solid var(--line);
  background: var(--panel);
}
.btn-icon:hover:not(:disabled) {
  background: var(--paper);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-clear {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  font-size: 12px;
  padding: 6px 10px;
}
.btn-clear:hover {
  background: #fef2ee;
  color: var(--accent-2);
  border-color: #f3c4b7;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1200px) {
  .grid { grid-template-columns: 260px 1fr 340px; }
}
@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; grid-template-rows: auto 50vh auto; }
  .left, .right { max-height: 35vh; }
  .right { border-left: none; border-top: 1px solid var(--line); }
  .left { border-right: none; border-bottom: 1px solid var(--line); }
}
