/* Gemeinsame Grundlage für Studio und Admin */
:root {
  --bg: #f2f3f5;
  --panel: #ffffff;
  --sunken: #f7f8fa;
  --line: #e3e5ea;
  --line-strong: #cdd1d8;
  --text: #16171b;
  --muted: #687080;
  --accent: #e2337e;
  --accent-ink: #ffffff;
  --accent-text: #b81c62;
  --accent-soft: #fce8f1;
  --good: #138a55;
  --good-soft: #e3f4ec;
  --ok: #a86a08;
  --ok-soft: #fbf1dd;
  --low: #c93636;
  --low-soft: #fbe6e6;
  --radius-sm: 6px;
  --radius: 10px;
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13px/1.45 var(--font); color: var(--text); background: var(--bg); font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[hidden] { display: none !important; }
a { color: var(--accent-text); }
h1, h2, h3 { margin: 0; font-weight: 600; }

.btn {
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--panel); cursor: pointer; font-weight: 500; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--sunken); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--low); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; height: 40px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; flex: none;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; font-size: 16px;
}
.icon-btn:hover:not(:disabled) { background: var(--sunken); color: var(--text); }
.icon-btn.is-on { color: var(--accent-text); background: var(--accent-soft); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.sm { width: 26px; height: 26px; }
.ico { width: 18px; height: 18px; }
.icon-btn.sm .ico { width: 15px; height: 15px; }
.icon-row { display: flex; align-items: center; gap: 2px; }
.icon-row.wrap { flex-wrap: wrap; }
.icon-row .sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.field input:not([type=checkbox]):not([type=radio]):not([type=range]), .field select, textarea, .input {
  width: 100%; height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line-strong);
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); }
.field input:focus, .field select:focus, textarea:focus, .input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field-input { position: relative; display: flex; }
.field-input input { padding-right: 32px !important; }
.field-input .unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; pointer-events: none; }
.field input[type=color] { padding: 3px; height: 34px; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline select { width: auto; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.grid-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-fields.three { grid-template-columns: repeat(3, 1fr); }
.grid-fields.four { grid-template-columns: repeat(4, 1fr); }

.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--panel); }
.segmented button { border: 0; background: none; padding: 6px 12px; cursor: pointer; color: var(--muted); }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.is-on { color: var(--text); background: var(--sunken); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0; }
.chip {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: 99px; padding: 5px 12px; cursor: pointer; font-size: 12px;
}
.chip:hover { border-color: var(--accent); }
.chip-check {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--line-strong);
  border-radius: 99px; cursor: pointer; background: var(--panel);
}
.chip-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chip-check input { accent-color: var(--accent); margin: 0; }
.swatch { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); flex: none; display: inline-block; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.is-good { background: var(--good-soft); color: var(--good); }
.badge.is-ok { background: var(--ok-soft); color: var(--ok); }
.badge.is-low { background: var(--low-soft); color: var(--low); }
.badge.is-muted { background: var(--sunken); color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 12px; font-weight: 500; color: var(--muted); }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table input, .table select { height: 32px; }

.checker {
  background-color: #fff;
  background-image: linear-gradient(45deg, #eceef1 25%, transparent 25%), linear-gradient(-45deg, #eceef1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eceef1 75%), linear-gradient(-45deg, transparent 75%, #eceef1 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border-radius: var(--radius-sm); display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line);
}

/* Dialoge */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(22,23,27,.45); padding: 24px; }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--panel); border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.25);
}
.modal.is-wide { width: min(900px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 8px 22px; }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 6px 22px 22px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.lead { margin: 0 0 14px; color: var(--muted); }
.progress { display: flex; align-items: center; gap: 12px; padding: 18px 0; }
.progress-line { color: var(--muted); margin: 0; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.code { max-height: 300px; overflow: auto; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; font-size: 11px; line-height: 1.5; margin: 0; }
.error { color: var(--low); }
.success { color: var(--good); }
.warnings { margin: 0; padding: 10px 12px 10px 28px; border-radius: var(--radius-sm); background: var(--ok-soft); color: var(--ok); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; z-index: 60;
  padding: 9px 16px; border-radius: 8px; background: var(--text); color: #fff;
  transition: opacity .2s, transform .2s; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Foto ausrichten */
.calibrate { display: flex; flex-direction: column; gap: 12px; }

.badge.is-info { background: #e7f0fb; color: #1d5fa8; }
.muted { color: var(--muted); }

/* KPIs & Diagramm */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi-value { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.kpi-sub { color: var(--muted); font-size: 12px; }
.chart { position: relative; padding-left: 64px; }
.chart-svg { width: 100%; height: 180px; display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-axis { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-bar { fill: var(--accent); }
.chart-hit { fill: transparent; cursor: default; }
.chart-hit:hover { fill: rgba(22,23,27,.04); }
.chart-y { position: absolute; left: 0; top: 0; height: 180px; width: 58px; color: var(--muted); font-size: 11px; }
.chart-y span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; }
.chart-x { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: -18px; }
.chart-tip {
  position: absolute; top: 0; transform: translateX(-50%); background: var(--text); color: #fff; border-radius: 8px;
  padding: 6px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 1px; pointer-events: none; white-space: nowrap; margin-left: 32px;
}
.chart-tip .muted { color: #c9ccd3; }
.meter { height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 120px 1fr; gap: 12px; font-size: 12px; }
.timeline time { color: var(--muted); }
.line-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.line-item img, .line-item .ph { width: 56px; height: 70px; object-fit: cover; border-radius: 6px; background: var(--sunken); border: 1px solid var(--line); }
.design-tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.design-tile .img { aspect-ratio: 4 / 5; background: var(--sunken) center/cover no-repeat; }
.design-tile .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.design-tile .row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.design-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tabs a { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line-strong); text-decoration: none; color: var(--text); background: var(--panel); font-size: 12px; }
.filter-tabs a[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.filter-tabs .n { color: var(--muted); margin-left: 4px; }

/* Dashboards */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.is-active { background: var(--text); color: #fff; }
.chg { font-size: 12px; font-weight: 600; }
.chg.is-up { color: var(--good); }
.chg.is-down { color: #c2410c; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.share-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 4px; }
.share-label { font-weight: 600; }
.share-val em { font-style: normal; color: var(--muted); margin-left: 8px; font-size: 12px; }
.share-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 18px; }
.news-card { display: flex; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.news-card .news-img { width: 34%; min-height: 140px; flex: none; background: var(--sunken) center / cover no-repeat; }
.news-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.news-body h3 { margin: 0; font-size: 15px; }
.news-body p { margin: 0; color: var(--muted); font-size: 13px; }
.news-tag { align-self: flex-start; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; background: var(--sunken); color: var(--muted); }
.tone-promo .news-tag, .tone-season .news-tag { background: #fde7f1; color: var(--accent); }
.tone-product .news-tag { background: #e6f4ea; color: #1e7a3c; }
.tone-important { border-color: #f5c08a; }
.tone-important .news-tag { background: #fff1e0; color: #b45309; }
.news-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.news-edit { padding: 16px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.news-edit-head { display: flex; align-items: center; gap: 8px; }
.top-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.top-list li { display: flex; align-items: center; gap: 12px; }
.top-list .rank { width: 22px; height: 22px; border-radius: 50%; background: var(--sunken); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.top-list .grow { flex: 1; min-width: 0; }
.thumb { width: 48px; height: 60px; border-radius: 6px; background: var(--sunken) center / cover no-repeat; border: 1px solid var(--line); flex: none; }
.thumb.sm { width: 36px; height: 44px; }
.chip-mini { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--sunken); }
.chip-mini svg { width: 13px; height: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.me { display: flex; align-items: center; gap: 6px; padding: 10px 6px 4px; border-top: 1px solid var(--line); }
.me-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: var(--text); }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text strong, .me-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: 11px; }
.me-btn { gap: 8px; padding-left: 6px; }
@media (max-width: 640px) { .news-card .news-img { display: none; } .grid-2 { grid-template-columns: 1fr; } }

/* Marken-Profil & Onboarding */
.chip-pick { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.chip-pick.is-active { background: var(--text); border-color: var(--text); color: #fff; }
.links-editor { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; align-items: center; }
.look-editor { display: grid; grid-template-columns: 1fr 160px; gap: 20px; align-items: start; }
.look-controls { display: flex; flex-direction: column; gap: 12px; }
.look-preview { border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; position: relative; overflow: hidden; width: 160px; }
.look-preview[data-surface="paper"]::after, .look-preview[data-surface="concrete"]::after, .look-preview[data-surface="linen"]::after { content: ''; position: absolute; inset: 0; opacity: .22; mix-blend-mode: multiply;
  background-image: radial-gradient(rgba(0,0,0,.35) 0.6px, transparent 0.8px); background-size: 3px 3px; }
.look-preview[data-surface="concrete"]::after { opacity: .35; background-size: 5px 5px; }
.look-preview[data-surface="linen"]::after { background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px); }
.look-shirt { width: 62%; aspect-ratio: 1 / 1.1; background: #2a2a2a; clip-path: polygon(30% 0, 70% 0, 100% 18%, 88% 34%, 80% 28%, 80% 100%, 20% 100%, 20% 28%, 12% 34%, 0 18%); position: relative; z-index: 1; }
.look-preview[data-shadow="soft"] .look-shirt { filter: drop-shadow(0 10px 10px rgba(0,0,0,.28)); }
.look-preview[data-shadow="hard"] .look-shirt { filter: drop-shadow(5px 7px 1px rgba(0,0,0,.35)); }
.guide { display: flex; flex-direction: column; gap: 10px; }
.guide-head { display: flex; align-items: center; gap: 8px; }
.guide p { margin: 0; }
.guide ul { margin: 4px 0 0; padding-left: 18px; }
.link-meta { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.nudge-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; background: #fff7fb; border-color: #f7c6dc; margin-bottom: 16px; }
.nudge-card p { margin: 4px 0 0; }
.onboard-layer { position: fixed; inset: 0; z-index: 60; background: rgba(22,23,27,.55); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.onboard-card { width: min(680px, 100%); background: var(--panel); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.3); padding: 28px; display: flex; flex-direction: column; gap: 18px; max-height: calc(100vh - 32px); overflow-y: auto; }
.onboard-head { display: flex; gap: 14px; align-items: flex-start; }
.onboard-head .logo { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.onboard-head h1 { margin: 2px 0 4px; font-size: 22px; }
.onboard-head small { color: var(--muted); }
.onboard-head p { margin: 0; }
.onboard-progress { display: flex; gap: 6px; }
.onboard-progress span { flex: 1; height: 4px; border-radius: 2px; background: var(--sunken); }
.onboard-progress span.is-on { background: var(--accent); }
.onboard-body { display: flex; flex-direction: column; gap: 14px; }
.onboard-actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) { .look-editor { grid-template-columns: 1fr; } .link-row { grid-template-columns: 1fr auto; } .link-row select { grid-column: 1 / -1; } }
.swatches { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.swatches .swatch { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); cursor: pointer; padding: 0; position: relative; overflow: hidden; box-shadow: none; }
.swatches .swatch.is-active { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatches .swatch.custom { background: conic-gradient(#f66, #fd6, #6f9, #6cf, #c6f, #f66); }
.swatches .swatch.custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
