/* App-Shell: linke Sidebar, oben Topbar, Page-Head, Hauptbereich + Rail, Footer.
   Bewusst klassisch: feste Sidebar links, sticky Topbar mit Brotkrumen,
   Page-Head mit Kontext-Karte. */

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
  background: var(--canvas);
}

/* ---------- SIDEBAR ---------- */
.app-sidebar {
  background: var(--sb-bg);
  color: var(--sb-ink);
  display: flex; flex-direction: column;
  border-right: 1px solid #0a1120;
  position: sticky; top: 0;
  height: 100vh;
}

.sb-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--sb-border);
  color: var(--primary-3);
}
.sb-logo .logo-mark {
  width: 36px; height: 36px;
  background: rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-2);
  display: grid; place-items: center;
}
.sb-logo .logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.sb-logo .brand { font-size: 14.5px; font-weight: 600; color: #ffffff; letter-spacing: 0.01em; }
.sb-logo .brand-sub { font-size: 10.5px; color: var(--sb-ink-2); margin-top: 2px; }

.sb-nav {
  display: flex; flex-direction: column;
  padding: 14px 10px;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}
.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  color: var(--sb-ink);
  text-decoration: none;
  font-size: 13.5px;
  border-radius: var(--radius-2);
  position: relative;
  transition: background-color 140ms ease, color 140ms ease;
}
.sb-item:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; }
.sb-item .ic { display: grid; place-items: center; opacity: 0.85; flex-shrink: 0; }
.sb-item.is-active {
  background: var(--sb-active-bg);
  color: var(--sb-ink-active);
  font-weight: 500;
}
.sb-item.is-active::before {
  content: "";
  position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--sb-active-bar);
}
.sb-item.is-active .ic { opacity: 1; color: var(--primary-3); }

.sb-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sb-ink-2);
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  min-width: 22px;
  text-align: center;
}
.sb-badge-warn {
  background: var(--warn);
  color: #ffffff;
}

.sb-divider {
  height: 1px;
  background: var(--sb-border);
  margin: 10px 4px;
}

.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px;
  border-top: 1px solid var(--sb-border);
  background: var(--sb-bg-2);
}
.sb-user .avatar {
  width: 36px; height: 36px;
  background: var(--av, var(--primary-2));
  color: #ffffff;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.sb-user .user-block { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.sb-user .user-name { font-size: 13px; color: #ffffff; font-weight: 500; }
.sb-user .user-role { font-size: 10.5px; color: var(--sb-ink-2); margin-top: 1px; }
.sb-user .user-chev {
  appearance: none; background: transparent; border: 0;
  color: var(--sb-ink-2);
  cursor: pointer; padding: 4px; border-radius: 4px;
}
.sb-user .user-chev:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }

/* ---------- CONTENT GRID ---------- */
.app-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
}

/* ---------- TOPBAR ---------- */
.app-topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  z-index: 8;
}
.crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  flex-shrink: 0;
}
.crumbs .sep { color: var(--muted-2); }
.crumbs .is-active { color: var(--ink); font-weight: 500; }

.search {
  position: relative;
  flex: 1; max-width: 480px;
  margin: 0 16px;
  height: 36px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  display: flex; align-items: center;
  padding: 0 12px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.search:focus-within {
  border-color: var(--primary-3);
  box-shadow: 0 0 0 3px var(--primary-softer);
  background: var(--surface);
}
.search-ic { color: var(--muted); display: grid; place-items: center; margin-right: 8px; }
.search input {
  border: 0; background: transparent; outline: 0;
  flex: 1; font-size: 13.5px; color: var(--ink);
  height: 100%;
}
.search input::placeholder { color: var(--muted-2); }
.search-kbd {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 4px;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.ic-btn {
  appearance: none;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary-grad);
  color: #ffffff;
  border: 0;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(29, 78, 216, 0.32), 0 4px 12px rgba(29, 78, 216, 0.18);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}
.ic-btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 2px 6px rgba(29, 78, 216, 0.36), 0 8px 18px rgba(29, 78, 216, 0.22); }
.ic-btn:active { transform: translateY(0); }
.ic-btn-square {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line);
  box-shadow: none;
  padding: 0;
  width: 36px;
  position: relative;
  justify-content: center;
}
.ic-btn-square:hover { background: var(--canvas); border-color: var(--muted-2); transform: none; box-shadow: var(--shadow-1); }
.notif-dot {
  position: absolute; top: 7px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--bad);
  border: 2px solid var(--surface);
}

.tb-divider { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.tb-clock {
  display: flex; flex-direction: column; line-height: 1.15;
  text-align: right;
  margin-left: 4px;
}
.tb-clock .clk-time {
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.tb-clock .clk-date { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* ---------- PAGE HEAD ---------- */
/* Padding-right: 0, damit die 360-px-Spalte fuer das Schichtpanel buendig
   ueber der gleich breiten Rail-Spalte sitzt — sonst entsteht ein 24-px-
   Versatz nach links. */
.page-head {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 1fr 360px;
  gap: 20px;
  padding: 24px 0 0 24px;
}
.page-title { display: flex; flex-direction: column; gap: 6px; }
.ph-eyebrow {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--primary-2);
}
.page-title h1 {
  font-size: 24px; font-weight: 600;
  letter-spacing: -0.015em; color: var(--ink);
  margin: 0; line-height: 1.2;
}
.ph-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.meta-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 12px;
  color: var(--ink-2);
  box-shadow: var(--shadow-1);
}
.meta-pill.is-muted { color: var(--muted); background: var(--canvas); box-shadow: none; }
.meta-pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.meta-pill .dot-ok { background: var(--ok-2); box-shadow: 0 0 0 3px var(--ok-soft); }
.meta-pill .dot-team { background: var(--primary-3); }

.shift-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-3);
  padding: 14px 16px;
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: 8px;
}
.sc-row { display: flex; justify-content: space-between; align-items: center; }
.sc-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.sc-percent {
  font-family: var(--mono); font-size: 22px; font-weight: 700;
  color: var(--primary-2);
  font-variant-numeric: tabular-nums;
}
.sc-bar {
  height: 8px;
  background: var(--line-3);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}
.sc-fill {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--primary-2), var(--primary-3));
  border-radius: var(--radius-pill);
  transition: width 240ms ease;
}
.sc-row-meta { font-size: 12px; color: var(--muted); }
.sc-row-meta span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- MAIN CONTENT ---------- */
.page-main {
  padding: 20px 24px 28px;
  display: flex; flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.page-rail {
  border-left: 1px solid var(--line);
  background: var(--surface);
  display: flex; flex-direction: column;
  min-height: 0;
}

/* ---------- FOOTER ---------- */
.app-foot {
  grid-column: 1 / -1;
  display: flex; justify-content: space-between;
  padding: 14px 24px;
  font-size: 11.5px; color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.foot-right { color: var(--muted-2); }

@media (max-width: 1280px) {
  .app-content { grid-template-columns: minmax(0, 1fr); }
  .page-head { grid-template-columns: 1fr; }
  .page-rail { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
  .search { display: none; }
  .ic-btn .lbl { display: none; }
}
