/* VanityOnTour Teststudio – Anwendungsoberfläche */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--background); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: var(--brand-text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Grundlayout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: var(--sidebar); color: var(--sidebar-text); position: fixed; inset: 0 auto 0 0; overflow-y: auto; padding: 28px 16px 20px; display: flex; flex-direction: column; z-index: 30; }
.brand { color: #fff; text-decoration: none; display: block; padding: 0 10px 24px; border-bottom: 1px solid #ffffff14; margin-bottom: 18px; }
.brand strong { display: block; font-size: 21px; letter-spacing: -.6px; font-weight: 750; }
.brand strong span { color: #f58a55; }
.brand small { display: block; font-size: 10px; letter-spacing: 3.4px; color: var(--sidebar-muted); margin-top: 4px; font-weight: 600; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; color: var(--sidebar-muted); padding: 0 12px; margin: 18px 0 8px; text-transform: uppercase; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; border-radius: 7px; color: var(--sidebar-text); text-decoration: none; font-size: 14px; }
.side-nav a:hover { background: #ffffff0d; color: #fff; }
.side-nav a.active { background: #ed6b2c24; color: var(--sidebar-active); }
.side-nav .sub { padding-left: 20px; font-size: 13px; min-height: 34px; }
.side-nav .count { margin-left: auto; font-size: 12px; color: var(--sidebar-muted); }
.side-nav .dot { width: 7px; height: 7px; border-radius: 50%; background: #c89a5e; margin-left: auto; flex: none; }
.side-nav .dot.done { background: #6fae94; }
.side-foot { margin-top: auto; padding: 24px 12px 0; font-size: 12px; color: var(--sidebar-muted); }
.shell { margin-left: 248px; width: calc(100% - 248px); min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { min-height: 74px; border-bottom: 1px solid var(--border); background: #ffffffd9; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 36px; position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px); }
.crumbs { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); min-width: 0; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--border-strong); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.save-status { font-size: 13px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.save-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.save-status[data-state="dirty"]::before, .save-status[data-state="saving"]::before { background: var(--warning); }
.save-status[data-state="error"]::before, .save-status[data-state="conflict"]::before { background: var(--danger); }
.save-status[data-state="error"], .save-status[data-state="conflict"] { color: var(--danger); font-weight: 600; }
.user-chip { font-size: 13px; color: var(--muted); }
.icon-btn.menu-toggle { display: none; }
main { width: 100%; max-width: 1500px; margin: 0 auto; padding: 28px 36px 48px; flex: 1; }
.site-foot { padding: 16px 36px 24px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; }

/* Typografie und Seitenkopf */
h1 { font-size: 30px; letter-spacing: -.8px; line-height: 1.15; margin: 6px 0 6px; font-weight: 700; }
h2 { font-size: 20px; letter-spacing: -.3px; margin: 0 0 4px; font-weight: 650; }
h3 { font-size: 16px; margin: 0 0 4px; font-weight: 650; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.6px; color: var(--muted); text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 4px 0 24px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mono { font-family: var(--mono); font-size: .9em; }

/* Bedienelemente */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control-height); padding: 9px 16px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #9aa5a0; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.danger { color: var(--danger); border-color: #e3b5b7; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 36px; padding: 6px 11px; font-size: 13px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.icon-btn { min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=url], input[type=password], input[type=email], select, textarea {
  width: 100%; min-height: var(--control-height); border: 1px solid var(--border-strong); border-radius: var(--radius-input); background: var(--surface); padding: 9px 12px; font-size: 15px; line-height: 1.45;
}
textarea { min-height: 88px; resize: vertical; }
textarea.short { min-height: 64px; }
input:disabled, select:disabled, textarea:disabled { background: #f1f2f0; color: #6a757b; }
.check { display: inline-flex; align-items: center; gap: 9px; min-height: 40px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.field-error { color: var(--danger); font-size: 13px; font-weight: 600; }
.field-issues { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.field-issues li { color: var(--warning); font-size: 13px; display: flex; gap: 6px; }
.field-issues li::before { content: "!"; font-weight: 800; }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.card-head { padding: 22px 25px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.card-head > div { flex: 1; min-width: 200px; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.card-body { padding: 22px 25px; }
.card-foot { padding: 14px 25px; border-top: 1px solid var(--border); background: var(--surface-muted); border-radius: 0 0 var(--radius-card) var(--radius-card); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
.stack { display: grid; gap: 20px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; padding: 3px 8px; border-radius: 5px; background: #eef0ed; color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.brand { background: var(--brand-soft); color: var(--brand-text); }
.notice { border: 1px solid #ecdcc3; background: var(--warning-soft); color: #6e4813; border-radius: 8px; padding: 12px 15px; font-size: 14px; margin-bottom: 18px; }
.notice.info { border-color: #d6e0e8; background: #f1f6fa; color: #2c4a5e; }
.notice.danger { border-color: #ecc2c4; background: var(--danger-soft); color: #7d1f24; }
.notice.ok { border-color: #c4dfd2; background: var(--success-soft); color: #1d5848; }
.messages { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }

/* Tabellen */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
table.data td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data a.row-link { font-weight: 650; color: var(--text); text-decoration: none; }
table.data a.row-link:hover { color: var(--brand-text); text-decoration: underline; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: end; }
.filters .field { margin: 0; min-width: 160px; }
.filters .grow { flex: 1; min-width: 220px; }

/* Editor */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.result-rail { position: sticky; top: 96px; display: grid; gap: 16px; }
.result-card { padding: 20px; }
.score-line { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 4px; }
.big-score { font-size: 48px; font-weight: 700; letter-spacing: -2px; line-height: 1; }
.big-score.none { font-size: 26px; letter-spacing: -.5px; }
.score-max { color: var(--muted); font-size: 16px; }
.result-label { font-weight: 700; font-size: 16px; }
.progress { height: 7px; border-radius: 4px; background: #e9ece8; overflow: hidden; margin: 6px 0 2px; }
.progress span { display: block; height: 100%; background: var(--success); width: 0; transition: width .2s; }
.progress.warn span { background: #c89a5e; }
.rail-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; font-size: 13px; }
.rail-list li { display: flex; gap: 8px; justify-content: space-between; }
.rail-list .reason { color: var(--danger); display: block; }
.area-scores li a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-scores li.low strong { color: var(--danger); }
.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.area-select { display: none; }

.question-card { padding: 22px 0; border-top: 1px solid var(--border); }
.question-card:first-child { border-top: 0; padding-top: 0; }
.question-card.excluded { opacity: .6; }
.q-head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.q-head h3 { flex: 1; min-width: 200px; font-size: 17px; }
.q-number { font-family: var(--mono); font-size: 13px; background: #eef0ed; color: var(--muted); padding: 3px 7px; border-radius: 5px; }
.q-prompt { color: var(--muted); margin: 6px 0 14px; font-size: 15px; }
.q-help { font-size: 13px; color: var(--muted); border-left: 3px solid var(--border-strong); padding-left: 10px; margin: -6px 0 14px; white-space: pre-wrap; }
.status-group { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.status-group label { position: relative; }
.status-group input { position: absolute; opacity: 0; inset: 0; }
.status-group span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; background: var(--surface); }
.status-group input:checked + span { background: #222b30; border-color: #222b30; color: #fff; }
.status-group input[value=DEFECT]:checked + span { background: var(--danger); border-color: var(--danger); }
.status-group input[value=OWN]:checked + span { background: var(--success); border-color: var(--success); }
.status-group input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.score-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.score-btn { min-width: 42px; min-height: 42px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface); font-weight: 650; cursor: pointer; }
.score-btn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.score-btn:disabled { opacity: .4; cursor: not-allowed; }
.score-input { width: 88px !important; text-align: center; font-weight: 700; }
.q-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0 16px; }
details.more { margin: 2px 0 10px; }
details.more summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); min-height: 36px; display: flex; align-items: center; }
.q-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.q-tools .field { margin: 0; }
.q-tools .weight { width: 110px; }
.attachments { list-style: none; padding: 0; margin: 4px 0 10px; display: grid; gap: 6px; }
.attachments li { display: flex; gap: 8px; align-items: center; font-size: 13px; flex-wrap: wrap; }
.attachments img { width: 56px; height: 56px; object-fit: cover; border-radius: 5px; border: 1px solid var(--border); }
.upload-label { display: inline-flex; }
.upload-label input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.area-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); align-items: center; }
.area-row:first-child { border-top: 0; }
.area-row .meta { font-size: 13px; color: var(--muted); }
.area-row .controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.area-row .controls input { width: 90px; }
.inline-number { width: 100px; }

/* Dialoge */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 18px 60px #0b141a40; color: var(--text); }
dialog.wide { width: min(1180px, calc(100vw - 32px)); }
dialog::backdrop { background: #10181d8c; }
.dialog-head { padding: 20px 24px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dialog-body { padding: 20px 24px; overflow-y: auto; max-height: calc(100vh - 220px); }
.dialog-foot { padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-muted); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare > div { border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 14px; }

/* Katalogauswahl */
.picker-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.picker-tools .grow { flex: 1; min-width: 200px; }
.picker-tools select { width: auto; min-width: 160px; }
.picker { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; min-height: 420px; }
.picker-areas { border: 1px solid var(--border); border-radius: 8px; overflow-y: auto; max-height: 56vh; }
.picker-areas button { display: flex; width: 100%; text-align: left; gap: 8px; align-items: center; border: 0; border-bottom: 1px solid var(--border); background: var(--surface); padding: 10px 12px; min-height: 48px; cursor: pointer; font-size: 14px; }
.picker-areas button.active { background: var(--brand-soft); }
.picker-areas .sel { margin-left: auto; font-size: 12px; color: var(--brand-text); font-weight: 700; white-space: nowrap; }
.picker-questions { border: 1px solid var(--border); border-radius: 8px; overflow-y: auto; max-height: 56vh; padding: 4px 14px; }
.picker-q { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: start; }
.picker-q:last-child { border-bottom: 0; }
.picker-q input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); }
.picker-q .desc { font-size: 13px; color: var(--muted); }
.picker-q .opts { display: grid; gap: 4px; justify-items: end; font-size: 13px; }
.picker-q .opts input[type=text] { width: 80px; min-height: 36px; padding: 4px 8px; }
.picker-area-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border-strong); flex-wrap: wrap; }
.picker-area-head input[type=text] { width: 90px; min-height: 36px; }

/* Wizard */
.type-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.type-choice label { position: relative; }
.type-choice input { position: absolute; opacity: 0; }
.type-choice span { display: inline-flex; min-height: 44px; align-items: center; padding: 8px 16px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 600; }
.type-choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.type-choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.blueprint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.blueprint-grid label { display: block; border: 1px solid var(--border-strong); border-radius: 9px; padding: 14px; cursor: pointer; background: var(--surface); }
.blueprint-grid input { margin-right: 6px; accent-color: var(--brand); }
.blueprint-grid label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--sidebar); }
.login-card { width: min(420px, 100%); background: var(--surface); border-radius: 14px; padding: 32px; }
.login-card .brand { color: var(--text); border: 0; padding: 0 0 20px; margin: 0; }
.login-card .brand small { color: var(--muted); }

/* Historie */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; font-size: 14px; }
.timeline time { color: var(--muted); font-size: 13px; }

/* Responsiv */
@media (max-width: 980px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .result-rail { position: static; order: 2; }
  .picker { grid-template-columns: minmax(0, 1fr); }
  .picker-areas { max-height: 30vh; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: none; }
  body.menu-open .sidebar { transform: none; box-shadow: 0 0 40px #0008; }
  .shell { margin-left: 0; width: 100%; }
  .icon-btn.menu-toggle { display: inline-grid; }
  .topbar { padding: 0 16px; min-height: 64px; }
  .user-chip { display: none; }
  main { padding: 18px 16px 40px; }
  .site-foot { padding: 12px 16px 20px; flex-direction: column; }
  h1 { font-size: 25px; }
  .form-grid, .q-grid, .compare { grid-template-columns: minmax(0, 1fr); }
  .card-head, .card-body { padding: 18px 16px; }
  .card-foot { padding: 12px 16px; }
  .area-select { display: block; margin-bottom: 14px; }
  .area-row { grid-template-columns: minmax(0, 1fr); }
  .area-row .controls { justify-content: flex-start; }
  table.data.cards thead { display: none; }
  table.data.cards tr { display: block; border-bottom: 1px solid var(--border); padding: 10px 0; }
  table.data.cards td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; text-align: right; }
  table.data.cards td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; }
  table.data.cards td.num { text-align: right; }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dialog-body { padding: 16px; }
  .save-status .save-text { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
