/* Layout: feste grüne Seitenleiste (Marke) + helle Arbeitsfläche; Karten nur für eigenständige Objekte */
:root {
  --forest: #1E3A37; --deep: #132624; --teal: #2B796E; --mint: #90EFC0; --sun: #F2F26E;
  --bg: #F3F6F3; --surface: #FFFFFF; --ink: #1F2925; --muted: #5E6B66; --line: #DCE4DF;
  --good: #1F8A5B; --warn: #B7791F; --bad: #C2453D; --chip: #E8F0EC;
  --font: "Urbanist", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1B19; --surface: #15262380; --ink: #E7F0EC; --muted: #9DB2AA; --line: #284440;
    --chip: #1D3531; --good: #5BD69B; --warn: #E8B44C; --bad: #F07A72; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1B19; --surface: #15262380; --ink: #E7F0EC; --muted: #9DB2AA; --line: #284440;
  --chip: #1D3531; --good: #5BD69B; --warn: #E8B44C; --bad: #F07A72; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--teal); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(26px, 3.4vw, 36px); font-weight: 800; }
h2 { font-size: 21px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 700; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }

.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--forest); color: #fff; padding: 24px 16px; position: sticky; top: 0; height: 100vh;
        display: flex; flex-direction: column; gap: 4px; }
.side img.logo { width: 150px; margin: 4px 10px 28px; }
.side a { color: #DCEDE6; text-decoration: none; padding: 9px 12px; border-radius: 10px; font-weight: 600; display: flex; justify-content: space-between; }
.side a:hover { background: rgba(255,255,255,.07); }
.side a.on { background: rgba(144,239,192,.16); color: #fff; }
.side .badge-n { background: var(--sun); color: var(--forest); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.side .foot { margin-top: auto; font-size: 12px; color: #9DB8AF; padding: 0 12px; }
main { padding: 28px max(16px, env(safe-area-inset-right, 0px)) 64px max(24px, env(safe-area-inset-left, 0px)); min-width: 0; }
.page { max-width: 1280px; display: flex; flex-direction: column; gap: 28px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px max(16px, env(safe-area-inset-left, 0px)); }
  .side img.logo { width: 100px; margin: 0 12px 0 0; }
  .side .foot { display: none; }
  main { padding-left: max(16px, env(safe-area-inset-left, 0px)); }
}

.flash { background: #FFFBD1; color: #4A4300; border: 1px solid #EDE58A; padding: 10px 14px; border-radius: 12px; font-weight: 600; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.kpi b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 13px; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid2 > *, .grid3 > * { min-width: 0; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.panel h3 { color: var(--muted); font-weight: 700; font-size: 14px; }
.note { font-size: 13px; color: var(--muted); }

/* Balken */
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(80px, 1fr) 70px; gap: 10px; align-items: center; font-size: 14px; }
.bar .track { height: 10px; border-radius: 5px; background: var(--chip); overflow: hidden; }
.bar .fill { height: 100%; background: var(--teal); border-radius: 5px; }
.bar .fill.hi { background: var(--good); }
.bar b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.bar small { color: var(--muted); font-weight: 500; }

/* Chips & Labels */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--ink); white-space: nowrap; }
.chip.type { background: var(--forest); color: #fff; }
.chip.product { background: #DDF7EA; color: #1B5E4D; }
.chip.funnel { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.chip.region { background: #EAF1FF; color: #2F4C86; }
.chip.warn { background: #FFF4D6; color: #7A5300; }
.chip.good { background: #DDF5E7; color: #17673F; }
.chip.status-freigegeben { background: var(--good); color: #fff; }
.chip.status-verworfen { background: var(--bad); color: #fff; }
.chip.status-entwurf { background: var(--sun); color: var(--forest); }
.chip.offen { background: #FFF4D6; color: #7A5300; }
.chip.läuft { background: #EAF1FF; color: #2F4C86; }
.chip.erledigt { background: #DDF5E7; color: #17673F; }

/* Score */
.score { --v: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none;
         background: conic-gradient(var(--c, var(--teal)) calc(var(--v) * 1%), var(--chip) 0); }
.score span { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center;
              font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.score.sm { width: 46px; height: 46px; } .score.sm span { width: 36px; height: 36px; font-size: 14px; }
.score.lg { width: 96px; height: 96px; } .score.lg span { width: 78px; height: 78px; font-size: 28px; }

/* Motiv-Karten */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform .15s ease, box-shadow .15s ease; }
.mcard:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(19,38,36,.12); }
.mcard img { display: block; width: 100%; aspect-ratio: 4/5; object-fit: cover; background: var(--chip); }
.mcard .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.mcard .row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.mcard h3 { font-size: 15px; }
@media (prefers-reduced-motion: reduce) { .mcard, .mcard:hover { transition: none; transform: none; } }

/* Tabellen */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td img.th { width: 56px; height: 70px; object-fit: cover; border-radius: 8px; display: block; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 46ch; }

/* Detail */
.formats { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 4px; }
.formats figure { margin: 0; flex: none; }
.formats img { height: 380px; width: auto; border-radius: 14px; box-shadow: 0 10px 28px rgba(19,38,36,.14); display: block; }
.formats figcaption { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 6px; }
@media (max-width: 860px) { .formats img { height: 260px; } }
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.orig img.big { width: 100%; border-radius: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
pre.copy { white-space: pre-wrap; font-family: inherit; margin: 0; background: var(--bg); padding: 12px 14px; border-radius: 12px; font-size: 14px; }

.sugg { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sugg li { display: grid; grid-template-columns: 70px 1fr; gap: 10px; font-size: 14px; }
.prio { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 6px; height: fit-content; text-align: center; }
.prio.hoch { background: #FDE3E1; color: #8E2A23; } .prio.mittel { background: #FFF4D6; color: #7A5300; }
.prio.niedrig { background: var(--chip); color: var(--muted); } .prio.info { background: #E2F3EC; color: #1B5E4D; }

.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; font-size: 14px; }
.checks li { display: flex; gap: 8px; align-items: baseline; }
.checks .y { color: var(--good); font-weight: 800; } .checks .n { color: var(--bad); font-weight: 800; } .checks .u { color: var(--muted); }

/* Formulare */
form.stack { display: flex; flex-direction: column; gap: 12px; }
label { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
input[type=text], input[type=password], input[type=file], textarea, select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; }
textarea { min-height: 84px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .row2, .row3 { grid-template-columns: 1fr; } }
.btn { font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 10px 20px; cursor: pointer; background: var(--forest); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn.sun { background: var(--sun); color: var(--forest); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .6; cursor: progress; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters label { min-width: 160px; }
details.box { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); }
details.box summary { cursor: pointer; font-weight: 700; }
.likert { display: grid; grid-template-columns: minmax(0, 90px) repeat(7, minmax(0, 1fr)) minmax(0, 90px); gap: 4px; align-items: center; font-size: 13px; }
.likert .l, .likert .r { overflow-wrap: anywhere; }
@media (max-width: 420px) { .likert { font-size: 11px; gap: 2px; } }
.likert input { margin: 0 auto; display: block; accent-color: var(--teal); }
.likert .l { text-align: right; color: var(--muted); } .likert .r { color: var(--muted); }
.hist { display: flex; gap: 10px; overflow-x: auto; }
.hist form { margin: 0; display: flex; flex-direction: column; gap: 4px; align-items: center; font-size: 12px; }
.hist img { width: 90px; border-radius: 8px; }
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(120% 90% at 100% 0%, #2B5A54, var(--forest) 50%, var(--deep)); padding: 16px; }
.login .card { background: #fff; color: #1F2925; border-radius: 22px; padding: 32px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login img { width: 160px; }

/* Fortschritt der Änderungswünsche */
.wunsch { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
.wunsch:first-child { border-top: 0; }
.wunsch-top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
.wunsch-text { min-width: 0; overflow-wrap: anywhere; }
.prog { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--teal); border-radius: 4px; transition: width .6s ease; }
.prog i.done { background: var(--good); } .prog i.err { background: var(--bad); }
.wunsch[data-status="offen"] .prog i, .wunsch[data-status="läuft"] .prog i { background-image: linear-gradient(90deg, var(--teal) 0%, var(--mint) 50%, var(--teal) 100%); background-size: 200% 100%; animation: prog-shine 1.6s linear infinite; }
@keyframes prog-shine { from { background-position: 200% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .prog i { transition: none; animation: none !important; } }
.chip.fehler { background: #FDE3E1; color: #8E2A23; }

/* Themen-Reiter im Motive-Tab */
.seg-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-tabs a { text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 14px; display: inline-flex; gap: 8px; align-items: center; }
.seg-tabs a span { background: var(--chip); border-radius: 999px; padding: 0 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.seg-tabs a.on { background: var(--forest); color: #fff; border-color: var(--forest); }
.seg-tabs a.on span { background: var(--sun); color: var(--forest); }
