:root {
  --orange: #ff3b00;
  --orange-hi: #ff5a26;
  --orange-dim: #3a1608;
  --ink: #0d0d0c;
  --surface: #161614;
  --surface-2: #1d1d1a;
  --line: #2c2c28;
  --line-hi: #3d3d37;
  --text: #f3f0ea;
  --muted: #8f8b82;
  --ok: #4fd18b;
  --warn: #ffb020;
  --bad: #ff5d5d;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: var(--orange); color: #000; }

.app { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
.sidebar { background: var(--orange); color: #000; display: flex; flex-direction: column; padding: 22px 16px 18px; overflow: auto; }
.brand { display: flex; align-items: flex-end; gap: 10px; text-decoration: none; padding: 4px 8px 22px; }
.brand img { height: 38px; display: block; }
.brand span { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; line-height: 1; padding-bottom: 2px; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; opacity: 0.62; padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; font-weight: 600; color: #000; }
.nav-item:hover { background: rgba(0,0,0,0.12); }
.nav-item.active { background: #000; color: var(--orange); }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.side-foot { font-size: 11px; opacity: 0.6; padding: 12px 10px 0; font-weight: 600; }

.view { overflow: auto; padding: 32px 40px 80px; outline: none; }
.page { max-width: 1120px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin: 0; line-height: 1.1; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 14px; letter-spacing: -0.01em; }
h3 { font-size: 13px; font-weight: 700; margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.sub { color: var(--muted); margin-top: 6px; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 10px; display: inline-block; text-decoration: none; }
.crumb:hover { color: var(--orange); }

.btn { background: var(--surface-2); border: 1px solid var(--line-hi); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--orange); }
.btn.primary { background: var(--orange); color: #000; border-color: var(--orange); }
.btn.primary:hover { background: var(--orange-hi); }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.icon { padding: 6px 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 18px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px 18px; grid-template-columns: repeat(12, 1fr); }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-6 { grid-column: span 6; } .col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
@media (max-width: 980px) { .app { grid-template-columns: 200px 1fr; } .view { padding: 22px; } .col-3, .col-4, .col-6, .col-8 { grid-column: span 12; } }

.field label, .lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; letter-spacing: 0.01em; }
.req::after { content: " *"; color: var(--orange); }
input[type=text], input[type=email], input[type=date], input[type=number], input[type=url], select, textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line-hi); border-radius: 8px; padding: 9px 11px; color: var(--text);
}
input::placeholder, textarea::placeholder { color: #5d5a54; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,59,0,0.18); }
textarea { min-height: 96px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
select option { background: #1d1d1a; }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(0.8); }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line-hi); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { background: none; border: 0; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--orange); color: #000; }
.seg button:not(.on):hover { color: var(--text); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 22px; overflow-x: auto; }
.tab { padding: 11px 16px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--orange); }
.tab .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-left: 7px; }

.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line-hi); padding: 3px 4px 3px 10px; border-radius: 999px; font-size: 13px; }
.chip.plain { padding: 3px 10px; }
.chip button { background: none; border: 0; cursor: pointer; color: var(--muted); border-radius: 50%; width: 20px; height: 20px; line-height: 1; }
.chip button:hover { background: var(--orange); color: #000; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line-hi); }
.pill.s-fertig, .pill.ok { color: var(--ok); border-color: rgba(79,209,139,.4); }
.pill.s-wartet, .pill.warn { color: var(--warn); border-color: rgba(255,176,32,.4); }
.pill.s-eingereicht { color: #000; background: var(--orange); border-color: var(--orange); }
.pill.bad { color: var(--bad); border-color: rgba(255,93,93,.4); }

table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.t td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--surface-2); }
.t td.num, .t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cover-thumb { width: 44px; height: 44px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); object-fit: cover; display: block; }
.cover-ph { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 6px; background: var(--orange); }
.cover-ph img { width: 30px; }
.title-cell { font-weight: 700; }
.meter { width: 90px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle; }
.meter i { display: block; height: 100%; background: var(--orange); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); border: 1px dashed var(--line-hi); border-radius: 14px; }
.empty strong { display: block; font-size: 18px; color: var(--text); margin-bottom: 6px; }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.line-row { display: grid; gap: 10px; align-items: center; grid-template-columns: 1.4fr 2fr 1.1fr auto; padding: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.role-toggles { display: flex; flex-wrap: wrap; gap: 5px; }
.role-toggles button { background: transparent; border: 1px solid var(--line-hi); color: var(--muted); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; cursor: pointer; }
.role-toggles button:hover { color: var(--text); border-color: var(--text); }
.role-toggles button.on { background: var(--orange); border-color: var(--orange); color: #000; font-weight: 700; }

.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 980px) { .split-grid { grid-template-columns: 1fr; } }
.split-panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.split-row { display: grid; grid-template-columns: 1fr 96px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.split-row .pct { position: relative; }
.split-row .pct input { padding-right: 24px; text-align: right; font-variant-numeric: tabular-nums; }
.split-row .pct::after { content: "%"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.split-row .pct.auto input { color: var(--orange); }
.split-row .pct.auto input::placeholder { color: var(--orange); opacity: 1; }
.split-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 700; }
.bar { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; display: flex; margin: 6px 0 2px; }
.bar i { display: block; height: 100%; }

.tracks-layout { display: grid; grid-template-columns: 250px 1fr; gap: 20px; align-items: start; }
@media (max-width: 980px) { .tracks-layout { grid-template-columns: 1fr; } }
.track-list { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; }
.track-item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; text-align: left; }
.track-item:hover { border-color: var(--line-hi); }
.track-item.on { border-color: var(--orange); background: var(--orange-dim); }
.track-item .n { font-weight: 800; color: var(--orange); width: 18px; font-variant-numeric: tabular-nums; }
.track-item .tt { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check .mark { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; margin-top: 1px; }
.check.ok .mark { background: var(--ok); color: #000; }
.check.todo .mark { background: transparent; border: 2px solid var(--warn); color: var(--warn); }
.check .where { color: var(--muted); font-size: 12.5px; }

.drop { border: 1.5px dashed var(--line-hi); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--orange); background: var(--orange-dim); }
.file { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; }
.file .fname { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .fmeta { color: var(--muted); font-size: 12.5px; }
.file img.prev { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 8px; width: 100%; }
.progress i { display: block; height: 100%; background: var(--orange); width: 0; transition: width .1s; }

.savebar { position: fixed; right: 26px; bottom: 20px; background: var(--surface); border: 1px solid var(--line-hi); border-radius: 999px; padding: 7px 14px; font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; z-index: 20; }
.savebar i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.savebar.dirty i { background: var(--warn); }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: #000; color: var(--text); border: 1px solid var(--orange); padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: 80vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.66); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--line-hi); border-radius: 16px; padding: 24px; width: min(520px, 100%); max-height: 90vh; overflow: auto; }
.modal h2 { margin-bottom: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.callout { padding: 12px 14px; border-radius: 10px; background: var(--orange-dim); border: 1px solid rgba(255,59,0,.4); font-size: 13px; }
.callout.warn { background: rgba(255,176,32,.08); border-color: rgba(255,176,32,.4); }
.callout.bad { background: rgba(255,93,93,.08); border-color: rgba(255,93,93,.4); color: #ffb3b3; }
.callout.ok { background: rgba(79,209,139,.08); border-color: rgba(79,209,139,.4); }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; }
.tot td { font-weight: 800; }
.tab-num { font-variant-numeric: tabular-nums; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.kpi b { display: block; font-size: 28px; letter-spacing: -0.03em; font-weight: 800; }
.kpi span { color: var(--muted); font-size: 12.5px; }
.kpi.hot { background: var(--orange); color: #000; border-color: var(--orange); }
.kpi.hot span { color: rgba(0,0,0,.7); }

/* ---- Mac-App-Fenster (Titelleiste ausgeblendet, Ampel-Buttons liegen über der Seitenleiste) ---- */
.drag { display: none; }
.in-app .drag { display: block; position: fixed; top: 0; left: 0; right: 0; height: 24px; -webkit-app-region: drag; z-index: 60; }
.in-app .sidebar { padding-top: 46px; }
.in-app .view { padding-top: 40px; }
.in-app .nav-item, .in-app .brand, .in-app .btn, .in-app input, .in-app select, .in-app textarea { -webkit-app-region: no-drag; }

/* ---- Anmeldung & Zugänge ---- */
#auth { position: fixed; inset: 0; z-index: 50; background: var(--ink); display: grid; place-items: center; padding: 20px; overflow: auto; }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line-hi); border-radius: 18px; padding: 30px 28px; }
.auth-logo { height: 38px; display: block; margin-bottom: 18px; background: var(--orange); padding: 8px 12px; border-radius: 9px; box-sizing: content-box; }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-form { display: grid; gap: 14px; margin-top: 16px; }
.auth-form .field { margin: 0; }
.secret { font-family: var(--mono); font-size: 14px; background: var(--surface-2); border: 1px solid var(--line-hi); padding: 8px 10px; border-radius: 8px; letter-spacing: .06em; word-break: break-all; }
.steps { margin: 6px 0 12px 18px; padding: 0; font-size: 13.5px; color: var(--muted); }
.btn.link { background: none; border: 0; color: var(--muted); text-decoration: underline; margin-top: 12px; }
.acct { display: grid; gap: 2px; } .acct b { font-size: 13px; } .acct span { font-weight: 500; }
.col-list { display: grid; gap: 8px; }
[hidden] { display: none !important; }
.side-foot .btn { background: #000; color: var(--orange); border-color: #000; opacity: 1; }
.side-foot .btn:hover { background: #1a1a18; }
.side-foot .acct b, .side-foot .acct span { color: #000; }
[inert] { opacity: .55; }

.qr-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 6px 0 12px; }
.qr { width: 200px; height: 200px; border-radius: 10px; overflow: hidden; background: #fff; flex: none; }
.qr svg { display: block; width: 100%; height: 100%; }
.qr-wrap .hint { flex: 1; min-width: 180px; margin: 0; }
