/* Palette Studio – Oberfläche des Generators */

/* Schriften der Oberfläche – aus static/fonts statt von Google (DSGVO, CSP font-src 'self') */
@font-face { font-family: "Switzer"; src: url("../fonts/sans-serif/Switzer/Switzer-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("../fonts/sans-serif/Switzer/Switzer-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("../fonts/sans-serif/Switzer/Switzer-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("../fonts/sans-serif/Switzer/Switzer-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/monospace/JetBrains Mono/JetBrainsMono-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/monospace/JetBrains Mono/JetBrainsMono-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --ui-bg: #f3f3f1;
  --ui-surface: #ffffff;
  --ui-surface-2: #f7f7f5;
  --ui-border: #e4e3de;
  --ui-border-strong: #d2d1cb;
  --ui-text: #1b1b1f;
  --ui-muted: #6b6a72;
  --ui-accent: #1b1b1f;
  --ui-focus: #2563eb;
  --topbar-h: 60px;
  --font: "Switzer", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ui-text);
  background: var(--ui-bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 2px; }
.icon { display: block; flex-shrink: 0; }
i[data-icon], span[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
.muted { color: var(--ui-muted); font-weight: 400; }

kbd {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--ui-border-strong);
  background: var(--ui-surface);
  color: var(--ui-muted);
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px 0 20px;
  background: rgb(255 255 255 / 0.88);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--ui-border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.brand-mark { display: grid; grid-template-columns: repeat(3, 7px); gap: 2px; }
.brand-mark i { height: 22px; border-radius: 3px; background: #ccc; transition: background-color 0.4s ease; }
.mini {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  background: var(--ui-surface);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
}
.topbar.show-mini .mini { opacity: 1; pointer-events: auto; transform: none; }
.mini i { width: 20px; height: 20px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.1); transition: background-color 0.4s ease; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.logout-form { display: contents; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  transition: background-color 0.15s, opacity 0.15s;
}
.icon-btn:hover { background: rgb(0 0 0 / 0.06); }
.icon-btn:disabled { opacity: 0.3; cursor: default; background: transparent; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-surface);
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--ui-surface-2); border-color: var(--ui-border-strong); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ui-accent); border-color: var(--ui-accent); color: #fff; }
.btn-primary:hover { background: #34343b; border-color: #34343b; }
.btn-primary kbd { background: transparent; color: rgb(255 255 255 / 0.75); border-color: rgb(255 255 255 / 0.3); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ui-muted); }
.btn-ghost:hover { background: var(--ui-surface-2); color: var(--ui-text); }
#generateBtn { margin-left: 6px; }

/* ---------- Palette ---------- */
.palette {
  display: flex;
  height: clamp(300px, 50vh, 540px);
  background: var(--ui-surface);
}
.swatch {
  --c: #cccccc;
  --on: #ffffff;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 10px 26px;
  background: var(--c);
  color: var(--on);
  transition: background-color 0.45s ease, color 0.3s ease;
  animation: swatch-in 0.35s ease;
}
@keyframes swatch-in { from { opacity: 0; transform: scaleX(0.9); } }
.swatch-tools {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.tool {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  opacity: 0;
  transition: opacity 0.15s, background-color 0.15s, transform 0.1s;
}
.tool:hover { background: color-mix(in srgb, currentColor 15%, transparent); }
.tool:active { transform: scale(0.94); }
.tool:disabled { cursor: not-allowed; }
.tool:disabled:hover { background: transparent; }
.swatch:hover .tool,
.swatch:focus-within .tool,
.swatch.is-locked .tool-lock,
.tool:focus-visible { opacity: 1; }
.swatch:hover .tool:disabled { opacity: 0.35; }
.tool:focus-visible { outline-color: currentColor; }
.tool-picker { cursor: pointer; }
.tool-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.swatch.is-locked .tool-lock { background: color-mix(in srgb, currentColor 16%, transparent); }

.swatch-info { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.swatch-hex {
  width: 100%;
  max-width: 170px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: center;
  text-transform: uppercase;
  font-weight: 700;
  font-size: clamp(18px, 1.9vw, 27px);
  letter-spacing: 0.02em;
  cursor: text;
}
.swatch-hex:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.swatch-hex:focus { outline: 2px solid currentColor; outline-offset: 0; background: color-mix(in srgb, currentColor 10%, transparent); }
.swatch-name { font-size: 12.5px; font-weight: 500; text-align: center; min-height: 1.3em; }
.swatch-roles { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 22px; margin-top: 6px; }
.role-chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 16%, transparent);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.swatch-adjust {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 9px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 16%, transparent);
  color: inherit;
  font-size: 11.5px;
  font-weight: 600;
}
.swatch-adjust:hover { background: color-mix(in srgb, currentColor 24%, transparent); }
.swatch-adjust i { width: 12px; height: 12px; border-radius: 4px; box-shadow: 0 0 0 1.5px currentColor; }
.add-col {
  flex: 0 0 56px;
  display: grid;
  place-items: center;
  border: 0;
  background: var(--ui-surface);
  color: var(--ui-muted);
  transition: background-color 0.15s, color 0.15s;
}
.add-col:hover { background: var(--ui-surface-2); color: var(--ui-text); }

/* ---------- Controls ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 36px;
  padding: 10px 20px 12px;
  background: var(--ui-surface);
  border-top: 1px solid var(--ui-border);
  border-bottom: 1px solid var(--ui-border);
}
.field-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
/* Gruppen Farben · Stil · Schrift: kleine Überschrift, darunter die Regler in einer Zeile */
.ctrl-group { display: grid; gap: 6px; min-width: 0; }
.ctrl-title {
  margin: 0;
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ctrl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-height: 36px; }
.ctrl-row .field-inline,
.ctrl-row .fp-label { color: var(--ui-muted); font-weight: 500; }
.ctrl-row select { color: var(--ui-text); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
select {
  height: 34px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  background: var(--ui-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6a72' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  appearance: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
select:hover { border-color: var(--ui-border-strong); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ui-accent); }
.harmony-used { font-size: 12.5px; color: var(--ui-muted); margin-left: -4px; }
/* Checkbox als Schalter in Reglerhöhe */
.toggle {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  background: var(--ui-surface);
  white-space: nowrap;
}
.toggle:hover { border-color: var(--ui-border-strong); }
.toggle:has(input:checked) { border-color: var(--ui-text); background: var(--ui-surface-2); }

/* ---------- Schriftauswahl ---------- */
.font-pickers { gap: 8px 14px; }
.font-picker { display: inline-flex; align-items: center; gap: 8px; }
.fp-label { font-size: 13px; font-weight: 600; }
.fp-button {
  height: 34px;
  max-width: 190px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  background: var(--ui-surface);
  color: var(--ui-muted);
}
.fp-button:hover { border-color: var(--ui-border-strong); }
.fp-button[aria-expanded="true"] { border-color: var(--ui-text); }
.fp-name { overflow: hidden; color: var(--ui-text); font-size: 15px; white-space: nowrap; text-overflow: ellipsis; }

.font-popover {
  position: absolute;
  z-index: 60;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  background: var(--ui-surface);
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / 0.35), 0 2px 6px rgb(0 0 0 / 0.06);
  overflow: hidden;
}
.fp-search {
  flex: none;
  margin: 10px 10px 4px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  background: var(--ui-surface-2);
  outline: none;
}
.fp-search:focus { border-color: var(--ui-text); background: var(--ui-surface); }
.fp-list { flex: 1; min-height: 0; overflow: auto; padding: 4px 6px 8px; }
.fp-group-title {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  padding: 10px 8px 4px;
  background: var(--ui-surface);
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.fp-group-title span { font-weight: 500; letter-spacing: 0; }
.fp-item {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}
.fp-item:hover { background: var(--ui-surface-2); }
.fp-item.is-active { background: var(--ui-bg); box-shadow: inset 3px 0 0 var(--ui-text); }
.fp-item-name { overflow: hidden; font-size: 19px; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.fp-item-meta { flex: none; color: var(--ui-muted); font-size: 11.5px; }
.fp-empty { margin: 12px 10px; color: var(--ui-muted); }
.fp-note { flex: none; margin: 0; padding: 8px 12px; border-top: 1px solid var(--ui-border); color: var(--ui-muted); font-size: 11.5px; }
.fp-note code { font-family: var(--mono); font-size: 11px; }

/* ---------- Workspace ---------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  align-items: start;
}
.panel {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
  height: calc(100vh - var(--topbar-h) - 40px);
  height: calc(100dvh - var(--topbar-h) - 40px);
  display: flex;
  flex-direction: column;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  overflow: hidden;
}
.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--ui-border); }
.tab {
  flex: 1 0 auto;
  padding: 0 7px;
  white-space: nowrap;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ui-muted);
  font-size: 12.5px;
  font-weight: 600;
}
.tab:hover { color: var(--ui-text); background: var(--ui-surface-2); }
.tab.is-active { color: var(--ui-text); background: var(--ui-bg); }
.tab-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 14px; overflow: auto; }
.tab-panel--export { overflow: hidden; }
.panel-intro { margin: 0; color: var(--ui-muted); font-size: 13px; }

.seg { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--ui-bg); }
.seg button {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ui-muted);
  font-size: 12.5px;
  font-weight: 600;
}
.seg button:hover { color: var(--ui-text); }
.seg button.is-active { background: var(--ui-surface); color: var(--ui-text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 0 0 1px rgb(0 0 0 / 0.04); }
.seg-icons button { flex: none; width: 36px; padding: 0; }
.export-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }

.code {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  border-radius: 12px;
  background: #121216;
  color: #e4e4ea;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  tab-size: 2;
}
.code code { font-family: inherit; }
.tk-c { color: #7d7d8c; font-style: italic; }
.tk-p { color: #9cc4ff; }
.tk-k { color: #d7a6ff; }
.tk-s { color: #a7e3b4; }
.tk-v { color: #ffd98e; white-space: nowrap; }
.tk-v i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: -1px;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.25);
}
.export-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.export-actions #starterKit { grid-column: 1 / -1; }

/* Rollen */
.roles { display: grid; gap: 8px; }
.role-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
}
.role-swatch { width: 42px; height: 42px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08); }
.role-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.role-hint { font-size: 12px; color: var(--ui-muted); }
.role-tag { padding: 1px 7px; border-radius: 999px; background: var(--ui-bg); color: var(--ui-muted); font-size: 11px; font-weight: 600; }
.role-tag.is-derived { background: #fef3c7; color: #92400e; }
.role-row select { max-width: 160px; }
.role-adopt {
  margin-top: 6px;
  padding: 3px 10px;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  background: var(--ui-surface);
  font-size: 12px;
  font-weight: 600;
}
.role-adopt:hover { background: var(--ui-surface-2); border-color: var(--ui-border-strong); }
#resetRoles { align-self: flex-start; }

/* Kontrast */
.contrast { display: grid; }
.c-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--ui-border);
}
.c-row:last-child { border-bottom: 0; }
.c-sample {
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08);
  font-weight: 700;
  font-size: 15px;
}
.c-label { font-size: 13px; font-weight: 500; }
.c-ratio { font-family: var(--mono); font-size: 12px; color: var(--ui-muted); }
.c-badge { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.c-pass { background: #dcfce7; color: #166534; }
.c-warn { background: #fef3c7; color: #92400e; }
.c-fail { background: #fee2e2; color: #991b1b; }
.legend { margin: 4px 0 0; font-size: 12px; color: var(--ui-muted); }
.audit { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--ui-border); border-radius: 12px; background: var(--ui-surface-2); }
.audit-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.audit-head p { margin: 2px 0 0; color: var(--ui-muted); font-size: 12px; }
.audit-result { display: grid; gap: 6px; font-size: 13px; }
.audit-line { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.audit-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.audit-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 8px; background: var(--ui-surface); font-size: 12px; }
.audit-list code { overflow: hidden; font-family: var(--mono); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.adjusted { padding: 10px 12px; border-radius: 12px; background: #fef3c7; color: #78350f; font-size: 12.5px; }
.adjusted ul { margin: 6px 0 0; padding-left: 18px; }
.adjusted code { font-family: var(--mono); font-size: 11.5px; }
.chip-swatch { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 3px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15); }

/* ---------- Vorschau ---------- */
.preview {
  min-width: 0;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  overflow: hidden;
}
.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 18px;
  border-bottom: 1px solid var(--ui-border);
}
.preview-bar h2 { margin: 0; font-size: 14px; }
.demo-frame[data-viewport="tablet"] { --frame-w: 820px; }
.demo-frame[data-viewport="mobile"] { --frame-w: 390px; }
.c-ui { display: block; width: 26px; height: 18px; border-radius: 5px; }
.copy-buffer { position: fixed; opacity: 0; pointer-events: none; }
.preview-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }

/* Stil-Tab */
.style-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.style-preset {
  display: grid; gap: 2px; padding: 10px 12px; text-align: left;
  border: 1px solid var(--ui-border); border-radius: 10px; background: var(--ui-surface); color: var(--ui-text); cursor: pointer;
}
.style-preset:hover { border-color: var(--ui-border-strong); }
.style-preset.is-active { border-color: var(--ui-accent); box-shadow: inset 0 0 0 1px var(--ui-accent); }
.style-preset strong { font-size: 13.5px; }
.style-preset span { color: var(--ui-muted); font-size: 12px; line-height: 1.35; }
.style-controls { display: grid; gap: 10px; padding-top: 4px; border-top: 1px solid var(--ui-border); }
.style-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.style-row .seg { grid-column: 2 / -1; }
.style-row .seg button { padding: 0 6px; font-size: 12px; }
.style-name { font-size: 12.5px; font-weight: 600; color: var(--ui-muted); }
.style-row input[type="range"] { width: 100%; accent-color: var(--ui-accent); }
/* Gespeichert-Tab */
.save-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.save-form .comp-name:first-child { grid-column: 1 / -1; }
.save-form .comp-name input { font-family: inherit; }
.save-form .btn { height: 38px; }
.saved-note { margin: 0; padding: 10px 12px; border-radius: 9px; background: #fff4e5; color: #6b3d00; font-size: 12.5px; }
.saved-list { display: grid; gap: 8px; }
/* Projekt = aufklappbar (details), darin die Varianten */
.saved-project { border: 1px solid var(--ui-border); border-radius: 10px; background: var(--ui-surface); }
.saved-project-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  list-style: none;
  cursor: pointer;
}
.saved-project-head::-webkit-details-marker { display: none; }
.saved-project-head::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ui-muted);
  border-bottom: 2px solid var(--ui-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.saved-project[open] > .saved-project-head::before { transform: rotate(45deg); }
.saved-project-head:hover { background: var(--ui-surface-2); }
.saved-project-name { flex: 1; min-width: 0; overflow: hidden; font-size: 13.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.saved-count { flex: none; color: var(--ui-muted); font-size: 11.5px; }
.saved-variants { display: grid; gap: 6px; padding: 2px 8px 8px; }
.saved-empty { margin: 0; color: var(--ui-muted); font-size: 13px; }
.saved-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; border: 1px solid var(--ui-border); border-radius: 10px; background: var(--ui-surface); overflow: hidden; }
.saved-item:hover { border-color: var(--ui-border-strong); }
.saved-item.is-active { border-color: var(--ui-accent); box-shadow: inset 0 0 0 1px var(--ui-accent); }
.saved-load { display: grid; gap: 6px; padding: 9px 10px 9px 12px; border: 0; background: none; color: var(--ui-text); text-align: left; cursor: pointer; }
.saved-load:focus-visible, .saved-del:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: -2px; }
.saved-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.saved-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-date { flex: none; font-size: 11.5px; color: var(--ui-muted); }
.saved-colors { display: flex; height: 22px; border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08); }
.saved-colors i { flex: 1; }
.saved-del { width: 36px; border: 0; border-left: 1px solid var(--ui-border); background: none; color: var(--ui-muted); font-size: 18px; cursor: pointer; }
.saved-del:hover { background: #fdecec; color: #b42318; }

/* Komponente-Tab */
.comp-view { display: grid; gap: 10px; }
.comp-title { font-size: 15px; }
.comp-name { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.comp-name input {
  height: 38px; padding: 0 12px; border: 1px solid var(--ui-border-strong); border-radius: 9px;
  background: var(--ui-surface); color: var(--ui-text); font-family: var(--mono); font-size: 13.5px;
}
.comp-name input:focus { outline: 2px solid var(--ui-focus); outline-offset: 1px; }
.comp-name input.is-invalid { border-color: #c0392b; outline-color: #c0392b; }
.comp-hint { margin: -4px 0 0; font-size: 12px; color: var(--ui-muted); }
.comp-name:has(.is-invalid) + .comp-hint { color: #b42318; }
.comp-code-head { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 13px; }
.comp-code-head .check { margin-left: auto; }
.comp-code-head .btn { height: 32px; padding: 0 12px; font-size: 12.5px; }
.comp-code-head strong + .btn { margin-left: auto; }
.code.comp-code { flex: none; max-height: 320px; white-space: pre; }
.link-btn { padding: 0; border: 0; background: none; color: var(--ui-text); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* Skalen-Tab */
.scale-sec { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--ui-border); }
.scale-title { margin: 0; font-size: 14px; }
.style-row input[type="range"]:disabled { opacity: 0.4; }
.viz { display: grid; gap: 4px; padding: 10px; border-radius: 10px; background: var(--ui-surface-2); overflow: hidden; }
.viz-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 54px; gap: 8px; align-items: center; min-height: 18px; }
.viz-row code, .viz-tile code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; color: var(--ui-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viz-val { font-size: 11.5px; text-align: right; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.viz-bar { display: block; height: 10px; max-width: 100%; border-radius: 3px; background: var(--ui-accent); }
.viz-font { align-items: baseline; }
.viz-sample { line-height: 1.1; white-space: nowrap; overflow: hidden; color: var(--ui-text); }
.viz-font.is-base code, .viz-font.is-base .viz-val { color: var(--ui-text); font-weight: 700; }
.viz-radius { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
.viz-tile { display: grid; justify-items: center; gap: 4px; }
.viz-shape { width: 52px; height: 52px; border: 2px solid var(--ui-accent); background: var(--ui-surface); }
.viz-tile small { font-size: 11px; color: var(--ui-muted); }
.viz-scale { display: grid; gap: 4px; }
.viz-scale-name { font-size: 11.5px; font-weight: 600; color: var(--ui-muted); text-transform: capitalize; }
.viz-strip { display: flex; gap: 2px; }
.viz-chip { flex: 1; min-width: 0; height: 30px; display: grid; place-items: center; border-radius: 4px; font-size: 9.5px; font-weight: 600; overflow: hidden; }
.viz-chip.is-base { outline: 2px solid var(--ui-text); outline-offset: 1px; position: relative; z-index: 1; }
.viz-note { margin: 4px 0 0; font-size: 11.5px; color: var(--ui-muted); }
.style-row output { min-width: 42px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ui-muted); }
.stage {
  padding: 16px;
  background: var(--ui-bg) radial-gradient(#d6d5cf 1px, transparent 1px) 0 0 / 16px 16px;
}
.demo-frame {
  --frame-w: 100%;
  width: min(var(--frame-w), 100%);
  margin: 0 auto;
  container-type: inline-size;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.06), 0 24px 60px -30px rgb(0 0 0 / 0.4);
  transition: width 0.35s ease;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: #1b1b1f;
  color: #fff;
  font-weight: 500;
  box-shadow: 0 12px 32px -12px rgb(0 0 0 / 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (hover: none) {
  .tool { opacity: 1; }
  .swatch .tool:disabled { opacity: 0.35; }
}

@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; height: auto; }
  .tab-panel--export { overflow: visible; }
  .code { flex: none; max-height: 460px; }
}

@media (max-width: 760px) {
  #viewportSeg { display: none; }
  .workspace { padding: 12px; gap: 12px; }
  .stage { padding: 0; }
  .demo-frame { border-radius: 0; box-shadow: none; }
  .controls { padding: 12px 16px; }
  .fp-button { max-width: 150px; }
}

@media (max-width: 720px) {
  .palette { flex-direction: column; height: auto; }
  .swatch {
    flex: none;
    flex-direction: row;
    height: 80px;
    padding: 0 8px 0 16px;
    animation: none;
  }
  .swatch-info { order: -1; flex: 1; min-width: 0; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
  .swatch-hex { flex: 0 0 calc(100% + 6px); max-width: none; margin-left: -6px; text-align: left; font-size: 20px; }
  .swatch-name { text-align: left; min-height: 0; }
  .swatch-roles { justify-content: flex-start; min-height: 0; margin-top: 0; }
  .role-chip { padding: 2px 7px; font-size: 10px; }
  .swatch-adjust { margin-top: 0; padding: 2px 7px; font-size: 10.5px; }
  .swatch-tools { flex: none; flex-direction: row; gap: 0; }
  .tool { width: 40px; height: 40px; opacity: 1; }
  .swatch .tool:disabled { opacity: 0.35; }
  .swatch-adjust {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 9px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 16%, transparent);
  color: inherit;
  font-size: 11.5px;
  font-weight: 600;
}
.swatch-adjust:hover { background: color-mix(in srgb, currentColor 24%, transparent); }
.swatch-adjust i { width: 12px; height: 12px; border-radius: 4px; box-shadow: 0 0 0 1.5px currentColor; }
.add-col { flex: none; height: 52px; }
}

@media (max-width: 560px) {
  .topbar { gap: 10px; padding: 0 10px 0 14px; }
  .brand-name, .btn-primary kbd, .mini { display: none; }
  .harmony-used { display: none; }
  .ctrl-group:last-child { width: 100%; }
  .font-pickers { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 8px; }
  .font-picker { min-width: 0; flex-direction: column; align-items: stretch; gap: 4px; }
  .fp-button { max-width: none; justify-content: space-between; }
}
