/* Klotz – Projektübersicht. One size, one face, three colours. */
:root {
  --bg: #fff; --fg: #000; --muted: #8c8c8c; --line: #e5e5e5; --card: #f4f4f4; --track: #d4d4d4; --card-done: #e6ffe6;
  --red: #ff2d1a; --green: #00d000; --green-text: #008a00; --blue: #1f3dff;
  --brand: var(--red);   /* client colour, overridden per client */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #000; --fg: #fff; --muted: #7a7a7a; --line: #2e2e2e; --card: #141414; --track: #3a3a3a; --card-done: #032b03; --red: #ff4b3a; --green: #00d000; --green-text: #00ff00; --blue: #5c74ff; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #000; --fg: #fff; --muted: #7a7a7a; --line: #2e2e2e; --card: #141414; --track: #3a3a3a; --card-done: #032b03; --red: #ff4b3a; --green: #00d000; --green-text: #00ff00; --blue: #5c74ff; color-scheme: dark; }

.client-name { font-weight: 700; }
.has-brand .client-name { color: var(--brand); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.375 "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; font: inherit; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
a:hover, .link:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
.muted { color: var(--fg); }   /* no grey text: kept as a hook, rendered black */
.red { color: var(--red); } .green { color: var(--green-text); } .blue { color: var(--blue); }
.brand { color: var(--brand); } .fg { color: var(--fg); }

.page { max-width: 1440px; margin: 0 auto; padding: 24px 24px 96px; min-height: 100vh; display: flex; flex-direction: column; }
/* With a finished-projects band, it docks at the very bottom of the page. */
.page:has(.done-group:not([hidden])) { padding-bottom: 0; }

/* Header */
.top { display: grid; grid-template-columns: 1fr auto; gap: 16px 24px; align-items: center; padding-bottom: 56px; }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.link { background: none; border: 0; padding: 0; cursor: pointer; }
.theme-toggle { font-size: 18px; line-height: 1; }

/* Top: waiting list (left) and key figures (right) */
.overview > * { min-width: 0; }
.overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 24px; padding-bottom: 40px; }
.section-title { font-weight: 700; padding-bottom: 8px; }
.todo ul { display: grid; gap: 4px; }
.todo a {
  display: flex; gap: 12px; align-items: baseline; padding: 6px 14px; border-radius: 1rem;
  background: color-mix(in srgb, var(--brand) 18%, var(--bg));
}
.todo a:hover { text-decoration: none; background: color-mix(in srgb, var(--brand) 28%, var(--bg)); }
.todo a strong { flex-shrink: 0; }
.todo .step { font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo a .arrow { margin-left: auto; padding-left: 8px; }

.metrics ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.metric { display: flex; flex-direction: column; gap: 4px; padding: 10px 16px; border-radius: 1rem; background: var(--card); }
.m-title, .m-meta { font-size: 12px; }
.m-value { font-size: 48px; line-height: 1.1; font-weight: 700; margin: 4px 0; text-align: center; }
.m-title { font-weight: 700; }
/* Next to the waiting list, start level with its boxes (below its headline). */
@media (min-width: 901px) { .todo + .metrics { padding-top: calc(1.375em + 8px); } }

.contact { margin-top: 32px; font-size: 12px; }
.page:has(.done-group:not([hidden])) .contact { margin: 0; padding: 24px 0; background: color-mix(in srgb, var(--green) 8%, var(--bg)); box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--green) 8%, var(--bg)); clip-path: inset(0 -100vmax); }

/* Milestones: overview and filter for the list */
.milestones { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; padding-bottom: 40px; }
.milestone {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 16px; border: 0; border-radius: 1rem;
  font: inherit; color: var(--fg); text-align: left; cursor: pointer;
}
.milestone:hover { box-shadow: inset 0 0 0 1px var(--fg); }
.milestone.on { box-shadow: inset 0 0 0 2px var(--fg); }
.milestone:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.ms-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.ms-head > span { flex-shrink: 0; white-space: nowrap; font-size: 12px; }
.ms-meta { font-size: 12px; }
.project { scroll-margin-top: 24px; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 16px 24px; padding-bottom: 16px; }
.sort { font-size: 12px; }
.sort select { font: inherit; color: var(--fg); background: transparent; border: 0; border-bottom: 1px solid var(--fg); padding: 0 2px; cursor: pointer; }
.filter-note { font-size: 12px; }

.flash { padding: 12px 0; border-top: 1px solid var(--fg); color: var(--green-text); }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 12px; }
.legend i { display: inline-block; width: 24px; height: 12px; border-radius: 4px; margin-right: 8px; background: currentColor; vertical-align: -2px; }
.legend i.muted { background: color-mix(in srgb, var(--muted) 30%, var(--card)); }
.legend i.running { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--green) 30%, var(--card)) 0 4px, color-mix(in srgb, var(--green) 12%, var(--card)) 4px 8px); }
.legend i.green { background: color-mix(in srgb, var(--green) 30%, var(--card)); }
.legend i.brand { background: color-mix(in srgb, var(--brand) 28%, var(--card)); }
.legend i.fg { background: color-mix(in srgb, var(--fg) 16%, var(--card)); }

/* Index */
.list { display: grid; gap: 12px; }

.row {
  display: grid; gap: 0; align-items: baseline;
  grid-template-columns: 50% 25% 25%;   /* medium at 50 %, category at 75 % */
}

.project { background: var(--card); overflow: hidden; border-radius: 1rem; }
.project { cursor: pointer; }
.project .summary { outline: none; }
.project .summary:focus-visible .title { outline: 1px solid var(--fg); outline-offset: 2px; }
.project:hover .title,
.project.open .title { text-decoration: underline; text-underline-offset: 3px; }
.row .title { font-weight: 700; }
.row > * { padding-right: 24px; min-width: 0; }
.date { font-variant-numeric: tabular-nums; }

.ball::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: currentColor; margin-right: 8px; transform: translateY(-1px); }
.ball.client { color: var(--brand); }
.ball.studio { color: var(--fg); }
.ball.done { color: var(--green); }
.ball.idle { color: var(--muted); }

.sortable .project { cursor: grab; }
.sortable .project:active { cursor: grabbing; }
.project .detail { cursor: auto; }
.hint { padding-top: 16px; font-size: 12px; }

/* Finished projects, folded away */
.done-group {
  --done-bg: color-mix(in srgb, var(--green) 8%, var(--bg));
  flex-grow: 1; margin-top: 40px; padding: 24px 0 48px; background: var(--done-bg); cursor: pointer;
  /* full viewport width without breaking out of the layout */
  box-shadow: 0 0 0 100vmax var(--done-bg); clip-path: inset(0 -100vmax);
}
.done-toggle .arrow { display: inline-block; transition: transform .15s; }
.done-toggle .count { display: inline-block; min-width: 1.6em; padding: 1px 8px; margin-left: 4px; border-radius: 1rem; background: var(--fg); color: var(--bg); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.done-group.open .done-toggle .arrow { transform: rotate(90deg); }
.done-list { display: none; margin-top: 12px; }
.done-group .project { cursor: pointer; }
.done-group.open .done-list { display: grid; }
.drag-ghost { opacity: .25; }
.drag-chosen { background: var(--card); }

/* Timeline: full row width, every phase visible */
.timeline { position: relative; display: flex; gap: 2px; margin-top: 16px; }
.timeline .phase { flex: 1; min-width: 0; display: flex; flex-direction: column-reverse; }
.timeline .bar { height: 1px; margin-top: 5px; background: var(--track); }
.timeline .phase.done .bar { height: 6px; margin-top: 0; background: var(--green); }
.timeline .phase.now .bar { height: 6px; margin-top: 0; background: currentColor; }
.timeline .name { display: flex; justify-content: space-between; gap: 8px; padding: 0 4px 2px 0; font-size: 12px; white-space: nowrap; color: var(--fg); }
.timeline .phase:last-child .name { padding-right: 0; }
.timeline .ph-label { overflow: hidden; text-overflow: ellipsis; }
.timeline .phase.now .ph-label { font-weight: 700; }
.timeline .end { flex-shrink: 0; color: var(--fg); }
.dates-m { display: none; }
.project .summary .muted, .timeline .muted, .dates-m .muted { color: inherit; }
.timeline .today { position: absolute; bottom: 0; height: 14px; width: 1px; background: var(--fg); }

/* Detail */
/* Expanded project: content and buttons left, facts and history right – all smaller than the list. */
.detail { display: none; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px 48px; padding: 16px 16px 20px; font-size: 14px; }
.project.open .detail { display: grid; }
.d-main { display: grid; gap: 14px; align-content: start; }
.d-text { white-space: pre-line; }
.d-side { font-size: 12px; display: grid; gap: 4px; align-content: start; }
.d-label { font-weight: 700; padding-top: 12px; }
.assets { display: flex; flex-wrap: wrap; gap: 8px; }
.assets .arrow { margin-left: 2px; }
.label { padding-bottom: 8px; }

.history li { display: grid; grid-template-columns: 72px 1fr; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); }
.history .body { white-space: pre-line; }

.next { border-left: 2px solid var(--brand); padding-left: 16px; }

/* Actions */
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  appearance: none; border: 1px solid var(--fg); background: var(--bg); color: var(--fg);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; line-height: 1.375;
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn.solid { background: var(--fg); color: var(--bg); }
.btn.solid:hover { opacity: .8; }
.btn.strong { font-weight: 700; }
.btn.brand-btn, .btn.brand-btn:hover { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.has-brand .btn.brand-btn { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.brand-btn:hover { opacity: .85; }
.btn.small { padding: 4px 14px; }
.btn.brand-outline { background: transparent; border-color: transparent; color: var(--fg); }
.has-brand .btn.brand-outline { color: var(--brand); }
.btn.brand-outline:hover { background: var(--fg); color: var(--bg); text-decoration: none; }
.has-brand .btn.brand-outline:hover { background: var(--brand); color: #fff; }
a.btn:hover { text-decoration: none; }
.btn.approve:hover, .btn.approve.solid { background: var(--green); border-color: var(--green); color: #000; }

textarea, input[type=text], input[type=email], input[type=password] {
  width: 100%; border: 0; border-bottom: 1px solid var(--fg); background: transparent;
  padding: 8px 0; border-radius: 0; outline: none;
}
textarea { min-height: 120px; resize: vertical; border: 1px solid var(--fg); padding: 12px; }
textarea:focus, input:focus { border-color: var(--brand); }
.feedback { display: none; max-width: 720px; }
.feedback.open { display: block; }
.feedback .actions { margin-top: 12px; }
.error { color: var(--red); padding-top: 8px; }

.request { margin-top: 72px; border-top: 1px solid var(--fg); padding-top: 12px; }
.request form { display: grid; gap: 16px; max-width: 720px; margin-top: 24px; }

.empty { border-top: 1px solid var(--fg); padding: 12px 0; }

/* Auth */
.auth { max-width: 400px; display: grid; gap: 24px; }
.auth label { display: grid; gap: 4px; }
.auth label input { color: var(--fg); }

@media (max-width: 900px) {
  .page { padding: 16px 16px 72px; }
  .top { padding-bottom: 40px; grid-template-columns: 1fr; }
  .todo a { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; }
  .todo a strong { grid-column: 1; }
  .todo a .arrow { grid-column: 2; grid-row: 1; padding-left: 0; }
  .todo .step { grid-column: 1 / -1; white-space: normal; }
  .toolbar { flex-direction: column-reverse; }
  .row { grid-template-columns: 1fr auto; gap: 2px 12px; }
  .row > * { padding-right: 0; }
  .row > .c-medium { grid-column: 1; grid-row: 2; }
  .row > .c-cat { grid-column: 2; grid-row: 1; }
  .timeline .name { font-size: 0; }
  .timeline .phase.now .ph-label:not(.is-date) { font-size: 12px; overflow: visible; }
  .timeline .phase.now:last-child .name { justify-content: flex-end; }
  .dates-m { display: flex; justify-content: space-between; margin-top: 16px; font-size: 12px; }
  .dates-m + .timeline { margin-top: 4px; }
  .detail { grid-template-columns: 1fr; }
  .history li { grid-template-columns: 1fr; gap: 0; }
}

/* Progress fill: the head of each box (title + phases) is the progress bar – done, current, open – in soft tints. */
.project {
  --soft-done: color-mix(in srgb, var(--green) 30%, var(--card));
  --soft-now: var(--card);
}
.project > .head {
  padding: 6px 16px 0;
  background: linear-gradient(to right,
    var(--soft-done) 0 var(--stop-done), var(--soft-now) var(--stop-done) var(--stop-fade), var(--card) var(--stop-now));   /* current phase fades out over its last third */
}
.project.s-client { --soft-now: color-mix(in srgb, var(--brand) 28%, var(--card)); }
.project.s-studio { --soft-now: color-mix(in srgb, var(--fg) 16%, var(--card)); }
.project.s-idle { --soft-now: color-mix(in srgb, var(--muted) 30%, var(--card)); }
/* "Läuft": nothing left to do for anyone, it just hasn't happened yet – striped green. */
.project.is-running > .head {
  background:
    linear-gradient(to right, var(--soft-done) 0 var(--stop-done), transparent var(--stop-done) var(--stop-now), var(--card) var(--stop-now)),
    repeating-linear-gradient(-45deg, var(--soft-done) 0 6px, color-mix(in srgb, var(--green) 12%, var(--card)) 6px 12px);
}
.timeline .bar { display: none; }
.milestone {
  background: linear-gradient(to right, color-mix(in srgb, var(--green) 30%, var(--card)) 0 var(--progress), var(--card) var(--progress));
}
.timeline { margin-top: 8px; }
.timeline .name { padding-bottom: 6px; }
.timeline .today { height: 100%; bottom: 0; }

/* Temporarily hidden: medium and category in the project rows. Delete this block to show them again. */
.row > .c-medium, .row > .c-cat { display: none; }
.row { grid-template-columns: 1fr !important; }

/* Temporarily hidden: request form at the bottom of the page. Delete this line to show it again. */
.request { display: none; }
