/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--bg-input);
  font-size: 12.5px; font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; }

.btn-primary { background: var(--accent); color: var(--accent-text); box-shadow: 0 2px 10px rgba(47, 107, 255, .3); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); border-color: var(--line-strong); }

.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* Momentary success state — used instead of a popup after copying. */
.btn.is-done { color: var(--success); border-color: var(--success); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: var(--r-sm); }
.icon-btn.is-on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.icon-btn svg { transition: transform var(--dur) var(--ease); }

/* Theme + lock icon swapping */
[data-theme="dark"] #btn-theme .i-moon, [data-theme="light"] #btn-theme .i-sun { display: none; }
#btn-lock-ratio .i-unlock { display: none; }
#btn-lock-ratio[aria-pressed="false"] .i-lock { display: none; }
#btn-lock-ratio[aria-pressed="false"] .i-unlock { display: block; }
#btn-lock-ratio[aria-pressed="true"] { color: var(--accent); border-color: var(--line-strong); }

:where(button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.count-pill {
  min-width: 20px; height: 18px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--accent-soft); color: var(--accent);
  font-size: 10.5px; font-weight: 650;
}

/* ── Collapsed asset rail ──────────────────────────────────────────────── */

.asset-rail { display: none; }

body.assets-collapsed .asset-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0 var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line-soft);
}

.rail-btn {
  position: relative;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.rail-btn svg { width: 18px; height: 18px; }
.rail-btn:hover { background: var(--bg-hover); color: var(--text); }

/* Upload is the primary action, so it keeps the accent even at rest. */
.rail-btn[data-rail="upload"] { color: var(--accent); }
.rail-btn[data-rail="upload"]:hover { background: var(--accent-soft); }

/* ── Tooltip ───────────────────────────────────────────────────────────── */

/* A single shared node, positioned by js/ui.js. Fixed so it can escape the
   panels' overflow clipping; pointer-events off so it never blocks a click. */
.tooltip {
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  max-width: 260px;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 11.5px; font-weight: 500;
  line-height: 1.45;
  /* Wraps rather than truncating — a clipped hint about clipped text is useless. */
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms var(--ease), transform 120ms var(--ease);
}
/* Flipped below its trigger, so it should rise into place from the other side. */
.tooltip.is-below { transform: translateY(-4px); }
.tooltip.is-visible { opacity: 1; transform: translateY(0); }

/* ── Dropzone ──────────────────────────────────────────────────────────── */

.dropzone {
  display: grid; justify-items: center; gap: 2px;
  padding: var(--sp-5) var(--sp-4);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--bg-sunken);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-over { border-style: solid; }
.dz-icon { width: 30px !important; height: 30px !important; color: var(--accent); margin-bottom: var(--sp-2); stroke-width: 1.4 !important; }
.dz-title { font-size: 13.5px; font-weight: 600; }
.dz-sub { font-size: 11.5px; color: var(--text-2); }
.dz-link { font-size: 11.5px; color: var(--accent); font-weight: 550; }
.dz-note { font-size: 10.5px; color: var(--text-3); margin-top: var(--sp-2); }

/* ── Search ────────────────────────────────────────────────────────────── */

.search-row { display: flex; gap: var(--sp-2); margin: var(--sp-4) 0 var(--sp-3); }

.search-field {
  position: relative; flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center;
}
.search-field svg { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search-field input {
  width: 100%; height: 34px;
  padding: 0 10px 0 32px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text); font-size: 12.5px;
}
.search-field input::placeholder { color: var(--text-3); }
.search-field input:focus { outline: none; border-color: var(--accent); }
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── Folder chips ──────────────────────────────────────────────────────── */

.folder-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: var(--sp-3); }
.folder-bar:empty { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 25px; padding: 0 9px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text-2);
  font-size: 11.5px; font-weight: 500;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chip:hover { background: var(--bg-hover); color: var(--text); }
.chip.is-active { background: var(--accent); border-color: transparent; color: var(--accent-text); }
.chip .chip-x { opacity: .55; font-size: 13px; line-height: 1; }
.chip .chip-x:hover { opacity: 1; }

/* ── Asset grid ────────────────────────────────────────────────────────── */

.asset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }

.asset-card {
  position: relative;
  display: grid; gap: 2px;
  padding: var(--sp-3);
  border-radius: var(--r-lg);
  border: 1.5px solid var(--line);
  background: var(--bg-raised);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.asset-card:hover { border-color: var(--line-strong); background: var(--bg-hover); }
.asset-card.is-selected { border-color: var(--accent); background: var(--accent-soft); }

.asset-thumb {
  aspect-ratio: 1;
  display: grid; place-items: center;
  margin-bottom: var(--sp-2);
  color: var(--text);
  overflow: hidden;
}
.asset-thumb svg { width: 78%; height: 78%; }
.asset-card.is-selected .asset-thumb { color: var(--accent); }

.asset-name {
  font-size: 11.5px; font-weight: 550;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.asset-meta { font-size: 10.5px; color: var(--text-3); }

.asset-more {
  position: absolute; right: 6px; bottom: 6px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-3);
  cursor: pointer; opacity: 0;
  transition: opacity var(--dur) var(--ease), background var(--dur) var(--ease);
}
.asset-card:hover .asset-more, .asset-more:focus-visible { opacity: 1; }
.asset-more:hover { background: var(--bg-active); color: var(--text); }
.asset-more svg { width: 14px; height: 14px; stroke-width: 2.4; }

.asset-badge {
  position: absolute; top: 6px; right: 6px;
  font-size: 9px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3);
  background: var(--bg-input);
  border-radius: var(--r-sm);
  padding: 2px 5px;
}

.empty-note { padding: var(--sp-5) 0; text-align: center; color: var(--text-3); font-size: 12px; }

/* ── Tabs ──────────────────────────────────────────────────────────────── */

.tab-bar { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab {
  flex: 1 1 0; position: relative;
  padding: 13px var(--sp-3);
  border: 0; background: none;
  font-size: 12.5px; font-weight: 550;
  color: var(--text-2); cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); font-weight: 600; }
.tab.is-active::after {
  content: ""; position: absolute; inset: auto 0 -1px; height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0;
}

.tab-bar.sub {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  padding: 3px; gap: 3px;
  margin-bottom: var(--sp-3);
}
.tab-bar.sub .tab {
  padding: 6px; border-radius: var(--r-sm);
  font-size: 12px;
}
.tab-bar.sub .tab.is-active { background: var(--bg-active); color: var(--text); }
.tab-bar.sub .tab.is-active::after { display: none; }

/* ── Cards ─────────────────────────────────────────────────────────────── */

.card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  overflow: hidden;
}
.card-head {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  background: none; border: 0; cursor: pointer;
}
.card-head h3 { font-size: 12.5px; font-weight: 650; }
.card-head .chev { color: var(--text-3); }
.card.is-collapsed .card-head .chev { transform: rotate(180deg); }
.card.is-collapsed .card-body { display: none; }

.card-body { padding: 0 var(--sp-4) var(--sp-4); display: grid; gap: var(--sp-3); }
.card-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-1); }
.card-actions .btn { flex: 1 1 0; }

/* ── Fields ────────────────────────────────────────────────────────────── */

.field { display: grid; gap: var(--sp-2); }
.field > label { font-size: 11.5px; font-weight: 550; color: var(--text-2); }

.field.row {
  grid-template-columns: 92px minmax(0, 1fr) 62px;
  align-items: center; gap: var(--sp-2);
}
.field.row > label { margin: 0; }

/* Colour rows trade the slider column for a wide hex field. */
.field.row[data-control="color"],
.field.row[data-control="background"] { grid-template-columns: 92px 42px minmax(0, 1fr); }

.field-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-1); }
.field-actions .btn { flex: 1 1 0; }

/* Number / hex inputs */
.num, .hex, .size-row input[type="number"] {
  height: 30px; width: 100%;
  padding: 0 8px;
  text-align: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  font-size: 11.5px; font-weight: 550;
  font-variant-numeric: tabular-nums;
}
.hex { text-align: left; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; }
.num:focus, .hex:focus, .size-row input:focus { outline: none; border-color: var(--accent); }
.size-row input[type="number"]::-webkit-outer-spin-button,
.size-row input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.size-row input[type="number"] { -moz-appearance: textfield; }

.swatch {
  position: relative; width: 100%; height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  overflow: hidden;
  display: block;
}
.field.row .swatch { width: 42px; justify-self: start; }
.swatch input[type="color"] {
  position: absolute; inset: -6px;
  width: calc(100% + 12px); height: calc(100% + 12px);
  border: 0; padding: 0; background: none; cursor: pointer;
}
.swatch input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.swatch input[type="color"]::-webkit-color-swatch { border: 0; }

/* Range */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 18px;
  background: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: var(--r-full);
  background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--track) var(--fill, 50%));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: var(--r-full); background: var(--track); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: var(--r-full); background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; margin-top: -4.5px;
  border-radius: 50%; background: #fff;
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease);
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent); box-shadow: var(--shadow-sm);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }

/* Segmented control */
.segmented {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px; padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
}
.segmented button {
  display: grid; justify-items: center; gap: 4px;
  padding: 7px 2px;
  border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-2);
  font-size: 10px; font-weight: 550;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.segmented button svg { width: 15px; height: 15px; }
.segmented button:hover { color: var(--text); background: var(--bg-hover); }
.segmented button.is-active { background: var(--accent); color: var(--accent-text); }

/* Select */
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap select {
  appearance: none; -webkit-appearance: none;
  height: 32px; padding: 0 30px 0 11px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
}
.select-wrap svg { position: absolute; right: 9px; color: var(--text-3); pointer-events: none; }
.select-wrap select:focus { outline: none; border-color: var(--accent); }
.select-wrap.sm select { height: 30px; padding: 0 26px 0 9px; font-size: 11.5px; }
.select-wrap.sm svg { right: 7px; width: 14px; height: 14px; }

.size-row { display: grid; grid-template-columns: 1fr auto 1fr 74px 34px; align-items: center; gap: 6px; }
.times { color: var(--text-3); font-size: 12px; text-align: center; }

/* Zoom group */
.zoom-group {
  display: flex; align-items: center; gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-input);
}
.zoom-group .icon-btn { border: 0; background: none; }
.zoom-value {
  min-width: 54px; padding: 0 6px;
  border: 0; background: none;
  font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text); cursor: pointer;
}

/* Toolbar toggle */
.toolbar-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.toolbar-toggle:hover { background: var(--bg-hover); color: var(--text); }
.toolbar-toggle[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* Switch */
.switch-row { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch {
  position: relative; width: 34px; height: 19px; flex: none;
  border-radius: var(--r-full);
  background: var(--track);
  transition: background var(--dur) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease);
}
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(15px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row:hover span:last-child { color: var(--text); }

/* ── Code block ────────────────────────────────────────────────────────── */

.code-block {
  margin: 0;
  max-height: 260px; overflow: auto;
  padding: var(--sp-3);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  font-family: var(--font-mono);
  font-size: 10.5px; line-height: 1.65;
  white-space: pre;
  tab-size: 2;
  color: var(--text-2);
}
.code-block .t { color: var(--code-tag); }
.code-block .a { color: var(--code-attr); }
.code-block .v { color: var(--code-val); }
.code-block .p { color: var(--code-punct); }
.code-block .c { color: var(--text-3); font-style: italic; }

.download-pane { display: grid; gap: var(--sp-2); }

.dl-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-3);
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.dl-option:hover { border-color: var(--accent); background: var(--accent-soft); }

.dl-icon {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text-2);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.dl-icon svg { width: 18px; height: 18px; }
.dl-option:hover .dl-icon { color: var(--accent); border-color: transparent; background: var(--bg-panel); }

.dl-text { display: grid; gap: 2px; min-width: 0; }
.dl-name { font-size: 12.5px; font-weight: 600; }
.dl-desc { font-size: 11px; color: var(--text-3); }

.dl-action {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 10px; flex: none;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text-2);
  font-size: 11.5px; font-weight: 550;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.dl-action svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dl-option:hover .dl-action { background: var(--accent); color: var(--accent-text); border-color: transparent; }

/* The row is narrow in the side panel — drop the pill's label there and keep
   just the download glyph. */
.panel-right .dl-action span:last-child { display: none; }
.panel-right .dl-action { padding: 0 7px; }

/* ── Pattern cards ─────────────────────────────────────────────────────── */

.pattern-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-panel);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.pattern-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.pattern-preview {
  aspect-ratio: 4 / 3;
  border: 0; padding: 0; margin: 0;
  background: var(--bg-sunken);
  cursor: pointer;
  overflow: hidden; position: relative;
}
.pattern-preview svg { width: 100%; height: 100%; display: block; }

.pattern-info { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3); border-top: 1px solid var(--line-soft); }
.pattern-info .pi-text { min-width: 0; flex: 1 1 auto; }
.pattern-info h4 { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pattern-info p { font-size: 11px; color: var(--text-3); }

/* ── Empty state ───────────────────────────────────────────────────────── */

.empty-state {
  max-width: 420px; margin: 8vh auto 0;
  text-align: center; display: grid; justify-items: center; gap: var(--sp-2);
}
.empty-state svg { width: 40px !important; height: 40px !important; color: var(--text-3); margin-bottom: var(--sp-2); }
.empty-state h3 { font-size: 15px; font-weight: 650; }
.empty-state p { color: var(--text-2); }
.empty-state .btn { margin-top: var(--sp-3); }

/* ── Menus ─────────────────────────────────────────────────────────────── */

.menu-root { position: fixed; inset: 0; z-index: 60; }
.menu {
  position: absolute;
  min-width: 190px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg);
  animation: pop var(--dur) var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

.menu button {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 7px 9px;
  border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-2);
  font-size: 12.5px; text-align: left; cursor: pointer;
}
.menu button:hover { background: var(--bg-hover); color: var(--text); }
.menu button.danger { color: var(--danger); }
.menu button.danger:hover { background: var(--danger-soft); }
.menu button:disabled { opacity: .4; cursor: not-allowed; }
.menu button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 0; }
.menu .menu-label { padding: 6px 9px 4px; font-size: 10px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }

/* ── Modal ─────────────────────────────────────────────────────────────── */

.modal-root { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: var(--sp-4); }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 7, 13, .6); backdrop-filter: blur(3px); animation: fade var(--dur) var(--ease); }
@keyframes fade { from { opacity: 0; } }

.modal {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 2 * var(--sp-4));
  display: flex; flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  background: var(--bg-panel);
  box-shadow: var(--shadow-lg);
  animation: rise 180ms var(--ease);
  overflow: hidden;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal.wide { width: min(760px, 100%); }

.modal-head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.modal-head h3 { font-size: 15px; font-weight: 650; }
.modal-head p { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.modal-head .icon-btn { margin-left: auto; border: 0; background: none; }
.modal-body { padding: 0 var(--sp-5); overflow-y: auto; display: grid; gap: var(--sp-3); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5) var(--sp-5); }

.modal .field-label { font-size: 11.5px; font-weight: 550; color: var(--text-2); display: block; margin-bottom: 6px; }
.modal input[type="text"], .modal textarea, .modal select {
  width: 100%; padding: 9px 11px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text); font-size: 13px; font-family: inherit;
}
.modal textarea { min-height: 110px; resize: vertical; font-family: var(--font-mono); font-size: 11px; }
.modal input:focus, .modal textarea:focus, .modal select:focus { outline: none; border-color: var(--accent); }

.export-preview {
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--bg-sunken);
}
.export-preview svg { width: 100%; height: 100%; display: block; }

/* ── Toasts ────────────────────────────────────────────────────────────── */

.toast-stack {
  position: fixed; right: var(--sp-5); bottom: var(--sp-5);
  z-index: 90;
  display: flex; flex-direction: column; gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  min-width: 220px; max-width: 380px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  pointer-events: auto;
  animation: slide-in 200ms var(--ease);
}
.toast.is-out { animation: slide-out 160ms var(--ease) forwards; }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } }
@keyframes slide-out { to { opacity: 0; transform: translateX(16px); } }
.toast .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: none; }
.toast.error .dot { background: var(--danger); }
.toast.warn .dot { background: var(--warn); }
.toast.info .dot { background: var(--accent); }
