/* ============================================================
   Components — panel content: profiles, materials, properties,
   cut list, templates, toasts, modal, selection readout.
   ============================================================ */

/* ---------- Section block inside panels ---------- */
.block { margin-bottom: var(--s-5); }
.block-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); margin-bottom: var(--s-3);
}
.block-title .count {
  background: var(--surface-3); color: var(--ink-2);
  padding: 1px 7px; border-radius: 99px; font-size: 10px;
}

/* ---------- Profile / template tile grid ---------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-2);
}
.tile {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 10px 8px 8px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: all var(--t-fast);
  position: relative;
}
.tile:hover { border-color: var(--accent); background: var(--surface); transform: translateY(-1px); box-shadow: var(--sh-1); }
.tile.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.tile .thumb {
  width: 100%; height: 48px;
  display: grid; place-items: center;
}
.tile .thumb svg { max-width: 100%; max-height: 100%; }
.tile .tname { font-size: 11px; font-weight: 600; text-align: center; color: var(--ink-2); line-height: 1.2; }
.tile .tdim { font-size: 10px; color: var(--ink-3); font-family: var(--mono); }

.template-grid .tile .thumb { height: 70px; }

/* ---------- Material list ---------- */
.mat-list { display: flex; flex-direction: column; gap: 6px; }
.mat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: all var(--t-fast);
}
.mat-row:hover { border-color: var(--line-strong); background: var(--surface); }
.mat-row.on { border-color: var(--accent); background: var(--accent-soft); }
.mat-swatch {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: inset 0 0 8px rgba(255,255,255,0.3);
}
.mat-info { flex: 1; min-width: 0; }
.mat-info .mn { font-size: var(--fs-sm); font-weight: 600; }
.mat-info .mr { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.mat-add {
  border: 1.5px dashed var(--line-strong);
  background: transparent; color: var(--ink-3);
  border-radius: var(--r-sm); height: 38px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: var(--fs-sm); font-weight: 560;
  transition: all var(--t-fast);
}
.mat-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- Properties readout ---------- */
.prop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2) var(--s-3); }
.prop-grid.full { grid-template-columns: 1fr; }

.readout {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-bottom: var(--s-3);
}
.readout-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s-3);
}
.readout-head .tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 2px 8px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
}
.metric { display: flex; flex-direction: column; gap: 1px; }
.metric .ml { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.metric .mv { font-size: var(--fs-lg); font-weight: 650; font-family: var(--mono); color: var(--ink); }
.metric .mv small { font-size: 11px; color: var(--ink-3); font-weight: 500; }

.empty-state {
  text-align: center; padding: var(--s-6) var(--s-3); color: var(--ink-3);
}
.empty-state svg { width: 38px; height: 38px; opacity: 0.4; margin-bottom: var(--s-3); }
.empty-state p { font-size: var(--fs-sm); line-height: 1.5; }

/* ---------- Cut list ---------- */
.cut-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.cut-table th {
  text-align: left; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-3); font-weight: 700;
  padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--surface);
}
.cut-table td {
  padding: 7px 8px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); color: var(--ink-2);
}
.cut-table td.name { font-family: var(--font); color: var(--ink); font-weight: 560; }
.cut-table tr:hover td { background: var(--surface-2); }
.cut-table tr.glass td.name::before { content: "▢ "; color: var(--glass-tint); }
.cut-table tr.frame td.name::before { content: "▬ "; color: var(--frame-tone); }

.cut-summary {
  display: flex; gap: var(--s-3); flex-wrap: wrap;
  padding: var(--s-3); margin-top: var(--s-3);
  background: var(--surface-2); border-radius: var(--r-md); border: 1px solid var(--line);
}
.cut-summary .cs { flex: 1; min-width: 90px; }
.cut-summary .cs .l { font-size: 10px; color: var(--ink-3); text-transform: uppercase; }
.cut-summary .cs .v { font-size: var(--fs-md); font-weight: 650; font-family: var(--mono); }

/* ---------- Division mini-controls ---------- */
.div-controls {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2);
  margin-top: var(--s-3);
}
.div-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--surface-2);
  color: var(--ink-2); font-size: var(--fs-sm); font-weight: 560;
  transition: all var(--t-fast);
}
.div-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.div-btn svg { width: 26px; height: 26px; stroke-width: 1.6; }
.div-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.stepper button { width: 30px; height: 32px; border: none; background: var(--surface-2); color: var(--ink-2); font-size: 16px; }
.stepper button:hover { background: var(--surface-3); color: var(--ink); }
.stepper .val { min-width: 36px; text-align: center; font-family: var(--mono); font-size: var(--fs-sm); }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; bottom: calc(var(--statusbar-h) + 16px); left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 200;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: var(--r-pill);
  background: var(--ink); color: #fff;
  font-size: var(--fs-sm); font-weight: 560;
  box-shadow: var(--sh-3);
  animation: pop-in var(--t-med) var(--ease);
}
.toast svg { width: 17px; height: 17px; }
.toast.ok    { background: var(--ok); }
.toast.warn  { background: var(--warn); }
.toast.error { background: var(--danger); }

/* ---------- Modal ---------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(15, 22, 40, 0.5);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  animation: fade-in var(--t-fast);
}
.modal {
  width: min(520px, 92vw);
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-pop);
  border: 1px solid var(--line);
  animation: pop-in var(--t-med) var(--ease);
  overflow: hidden;
}
.modal-head { padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: var(--fs-xl); }
.modal-body { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.modal-foot { padding: var(--s-4) var(--s-5); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: var(--s-2); }

/* ---------- Selection label on canvas (HTML overlay) ---------- */
.sel-flag {
  position: absolute; transform: translate(-50%, -130%);
  background: var(--ink); color: #fff;
  padding: 5px 10px; border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-family: var(--mono); font-weight: 600;
  white-space: nowrap; box-shadow: var(--sh-2);
  pointer-events: none; z-index: 10;
}
.sel-flag::after {
  content: ""; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--ink);
}

/* ---------- Views dropdown ---------- */
.menu {
  position: absolute; min-width: 190px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-3);
  padding: 6px; z-index: 60;
  animation: pop-in var(--t-fast) var(--ease);
}
.menu button {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: none; background: transparent;
  border-radius: var(--r-sm); color: var(--ink); font-size: var(--fs-sm);
  text-align: left;
}
.menu button:hover { background: var(--surface-2); }
.menu button.on { color: var(--accent); background: var(--accent-soft); }
.menu button svg { width: 17px; height: 17px; color: var(--ink-3); }
.menu button.on svg { color: var(--accent); }
.menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu .shortcut { margin-left: auto; }
