/* Gemeinsamer Rahmen: Leiste links, Kopfzeile, Marke, Nutzermenue, Symbole.
   Nur Tokens aus static/ui/tokens.css, keine rohen Farbwerte (docs/konzept-dashboard-stil.md). */

.ic { width: 16px; height: 16px; stroke-width: 1.5; flex: none; display: inline-block; vertical-align: middle; }
.ic.s { width: 14px; height: 14px; }
.ic.xs { width: 11px; height: 11px; stroke-width: 2.5; }

/* Eigener Reset: auf Seiten ohne body.ui gibt es sonst keinen. :where haelt die Spezifitaet niedrig. */
:where(.rail, .topbar) a { color: inherit; text-decoration: none; }
:where(.rail, .topbar) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:where(.rail, .topbar) [hidden] { display: none !important; }
:where(.rail, .topbar) :is(p, h1, h2, h3, ul, ol, form) { margin: 0; padding: 0; }

/* ---------- Rahmen ---------- */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; z-index: 30;
  background: var(--rail); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 12px 12px; gap: 18px;
  font: var(--t-body); color: var(--ink);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 0; }
.brand-mark {
  width: 28px; height: 28px; background: var(--acid); color: var(--ink); flex: none;
  display: grid; place-items: center; font: 500 13px/1 var(--f); letter-spacing: -0.02em; border: 1px solid var(--ink);
}
.brand-name { font: 500 13.5px/1.1 var(--f); white-space: nowrap; }
.brand-name .mono { display: block; font: var(--t-label); letter-spacing: .09em; color: var(--ink-3); margin-top: 3px; }
.search {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 8px;
  border: 1px solid var(--line-2); background: var(--sheet); color: var(--ink-3); font: var(--t-small); white-space: nowrap;
  transition: border-color .2s var(--ease);
}
.search:hover { border-color: var(--ink); }
.kbd {
  font: 400 10px/1 var(--m); color: var(--ink-3); border: 1px solid var(--line-2);
  padding: 3px 4px 2px; margin-left: auto; background: var(--paper); white-space: nowrap;
}
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-h { padding: 0 8px 6px; font: var(--t-label); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  height: 32px; padding: 0 8px; color: var(--ink-2); white-space: nowrap; text-align: left;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav-item:hover { background: var(--ink-a04); color: var(--ink); }
.nav-item.on { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.nav-item .count { margin-left: auto; font: var(--t-num); font-size: 11px; color: var(--ink-3); }
.nav-item.on .count { color: var(--ink); }
.proj { display: grid; gap: 2px; padding: 10px 8px 12px; border-top: 1px solid var(--line); min-width: 0; }
.proj-code { font: var(--t-label); letter-spacing: .09em; color: var(--ink-3); }
.proj-name { font: 500 13.5px/1.35 var(--f); }
.proj-mode { font: var(--t-small); color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.spine { position: relative; }
.spine::before { content: ""; position: absolute; left: 19px; top: 16px; bottom: 16px; width: 1px; background: var(--line-2); }
.step { padding-left: 6px; }
.step .no {
  position: relative; z-index: 1; width: 26px; height: 20px; display: grid; place-items: center; flex: none;
  font: 400 10.5px/1 var(--m); color: var(--ink-3); background: var(--rail);
}
.step:hover .no { background: transparent; }
.step.done .no { color: var(--ink); }
.step.on .no { background: var(--ink); color: var(--acid); }
.pip { margin-left: auto; width: 7px; height: 7px; background: var(--ink); border-radius: 50%; flex: none; }
.pip.acid { background: var(--acid); box-shadow: 0 0 0 1px var(--ink); }
.rail-foot { margin-top: auto; display: grid; gap: 6px; position: relative; }
.user {
  display: flex; align-items: center; gap: 10px; padding: 12px 8px 8px; border-top: 1px solid var(--line);
  white-space: nowrap; width: 100%; text-align: left;
}
.user:hover { background: var(--ink-a04); }
.user .txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; font: var(--t-small); }
.user .muted { color: var(--ink-3); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--on-ink);
  display: grid; place-items: center; font: 500 10.5px/1 var(--f); flex: none; text-transform: uppercase;
}
.avatar.light { background: var(--wash); color: var(--ink); border: 1px solid var(--line-2); }
.avatar.xs { width: 20px; height: 20px; font-size: 8.5px; }
.avatars { display: inline-flex; }
.avatars .avatar { box-shadow: 0 0 0 2px var(--sheet); }
.avatars .avatar + .avatar { margin-left: -5px; }
.menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 40;
  background: var(--sheet); border: 1px solid var(--ink); box-shadow: var(--shadow-pop); display: grid; padding: 4px;
}
.menu a, .menu button { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; font: var(--t-small); text-align: left; width: 100%; }
.menu a:hover, .menu button:hover { background: var(--wash); }
.menu .menu-h { padding: 8px 10px 6px; font: var(--t-label); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 4px 0; }
.menu form { margin: 0; }
.menu .danger { color: var(--err); }

.rail-toggle { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: color-mix(in oklab, var(--paper) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 8px; font: var(--t-small); color: var(--ink-3); white-space: nowrap; min-width: 0; overflow: hidden; }
.crumbs a { overflow: hidden; text-overflow: ellipsis; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--ink-4); }
.crumbs .here { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }

.due { display: inline-flex; align-items: center; gap: 8px; font: var(--t-small); white-space: nowrap; }
.due .dot, .sd { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-4); flex: none; display: inline-block; }
.due.ok .dot, .sd.ok { background: var(--ok); }
.due.warn .dot, .sd.warn { background: var(--warn); }
.due.err .dot, .sd.err { background: var(--err); }
.sd.ink { background: var(--ink); }
.sd.ring { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); }

/* ---------- Schmale Fenster (GM2-Arbeitsseiten ab 1024 voll nutzbar) ---------- */
@media (min-width: 721px) and (max-width: 1280px) {
  :root { --rail-w: 60px; }
  .rail { padding: 14px 10px; align-items: stretch; }
  .brand-name, .nav-item .txt, .nav-h, .proj, .user .txt, .search .txt, .search .kbd, .nav-item .count, .nav-item .kbd, .step .pip { display: none; }
  .brand { justify-content: center; padding: 2px 0 0; }
  .search { justify-content: center; padding: 0; }
  .nav-item { justify-content: center; padding: 0; }
  .step { padding-left: 0; }
  .user { justify-content: center; padding: 12px 0 0; }
  .menu { left: 0; right: auto; width: 220px; }
  .topbar { padding-left: 22px; padding-right: 22px; }
}

/* ---------- Handy: Leiste wird zur Kopfzeile mit Menueknopf ---------- */
@media (max-width: 720px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .rail {
    height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between;
    padding: 10px 14px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .rail > :not(.brand, .rail-toggle) { display: none; }
  .rail-toggle { display: grid; place-items: center; width: 36px; height: 36px; }
  .topbar { position: static; padding-left: 14px; padding-right: 14px; }
  .rail.open { position: fixed; inset: 0; height: 100dvh; flex-direction: column; flex-wrap: nowrap; align-items: stretch; overflow-y: auto; }
  .rail.open > * { display: revert; }
  .rail.open > .brand, .rail.open > .nav, .rail.open > .search { display: flex; }
  .rail.open > .proj, .rail.open > .rail-foot { display: grid; }
  .rail.open > .rail-toggle { display: grid; position: absolute; top: 10px; right: 14px; }
}
