/* ============================================================
   Team-Dashboard · base.css
   Grundgerüst: Basiselemente, Seitenleiste, Seitenkopf, Tabellen,
   Verhalten auf schmalen Bildschirmen und im Druck.
   ============================================================ */

/* ---------------------------------------------- Basis */

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.with-side { display: flex; }
body.with-side::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(680px 460px at 86% -8%, color-mix(in srgb, var(--accent-2) 9%, transparent), transparent 64%),
    radial-gradient(600px 430px at -6% 22%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 64%),
    var(--bg);
}

a { color: var(--accent); }
::selection { background: var(--accent-ring); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }

h1 {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.024em;
  margin-bottom: 0.15rem;
  text-wrap: balance;
}
/* h2 ist die Abschnittsmarke innerhalb einer Karte, nicht eine zweite Überschrift.
   Klein, gesperrt, ruhig – sie ordnet, ohne mit h1 zu konkurrieren. */
h2 {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin: 1.7rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
h3 { font-size: var(--fs-base); font-weight: 640; letter-spacing: -0.012em; }

.muted { color: var(--text-2); font-size: var(--fs-md); }
.small-text { font-size: var(--fs-sm); }
/* Zahlen, die untereinander stehen, sollen fluchten */
.count, .tk-qbtn span, .chat-unread, .chat-badge { font-variant-numeric: tabular-nums; }
.icon { flex-shrink: 0; vertical-align: -0.125em; }

/* ---------------------------------------------- Sidebar */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
  padding: 1.2rem 0.85rem 1rem;
  background: var(--side-bg);
  border-right: 1px solid var(--side-border);
  z-index: 40;
  overflow: hidden;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(260px 210px at 16% -6%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%);
}
.sidebar > * { position: relative; }

.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; padding: 0.1rem 0.35rem; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 12px;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 10px 20px -9px color-mix(in srgb, var(--accent) 55%, transparent);
}
.brand-mark.big { width: 3.2rem; height: 3.2rem; border-radius: 17px; }
.brand-name { color: var(--side-text-strong); font-weight: 650; letter-spacing: -0.012em; font-size: 0.97rem; }

.side-nav { display: flex; flex-direction: column; gap: 0.18rem; flex: 1; }
.side-label {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--side-text) 62%, transparent);
  padding: 0.85rem 0.75rem 0.3rem;
}
.side-nav .side-label:first-child { padding-top: 0.2rem; }
.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--side-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 530;
  transition: color 0.15s, background 0.15s;
}
.side-link:hover { color: var(--side-text-strong); background: var(--side-hover); }
.side-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  font-weight: 620;
}
.side-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-2);
}
.side-link .icon { opacity: 0.75; }
.side-link.active .icon { opacity: 1; }

.side-footer {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border-top: 1px solid var(--side-border);
  padding-top: 0.85rem;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  color: color-mix(in srgb, var(--side-text-strong) 82%, transparent);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.side-user:hover, .side-user.active { background: var(--side-hover); color: var(--side-text-strong); }
.side-user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.88rem; font-weight: 550; }

/* Abmelden ist ein POST-Formular (GET-Logout wäre per Fremdseite auslösbar).
   display:contents hält den Button im Flex-Fluss der Fußzeile. */
.side-logout { display: contents; }

.side-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--side-text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.side-icon:hover { color: var(--side-text-strong); background: var(--side-hover); }
.theme-sun { display: none; }
.theme-moon { display: inline-flex; }
:root[data-theme="dark"] .theme-sun { display: inline-flex; }
:root[data-theme="dark"] .theme-moon { display: none; }

.content { flex: 1; min-width: 0; }
main { max-width: 1320px; margin: 0 auto; padding: clamp(1.1rem, 2.4vw, 2.1rem); }

/* ---------------------------------------------- Seitenkopf */

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1.15rem;
}
.board-head h1 { margin-bottom: 0.1rem; }
.board-title { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.board-title h1 { margin-bottom: 0; }
.user-switcher { width: auto; font-weight: 600; padding: 0.4rem 2rem 0.4rem 0.7rem; font-size: 0.86rem; }
.week-nav { display: flex; align-items: center; gap: 0.4rem; }
.week-nav .btn { padding: 0.44rem 0.58rem; }
.week-label { display: flex; align-items: center; gap: 0.5rem; margin-right: 0.5rem; font-size: 0.92rem; }

.overdue {
  background: var(--amber-bg);
  border-color: color-mix(in srgb, var(--amber-fg) 30%, transparent);
  color: var(--amber-fg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.89rem;
}
.overdue strong { color: inherit; }

/* ---------------------------------------------- Tabellen */

.export-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.export-table th {
  text-align: left;
  padding: 0.5rem 0.68rem;
  color: var(--text-3);
  font-weight: 680;
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}
.export-table td { text-align: left; padding: 0.62rem 0.68rem; border-bottom: 1px solid var(--border); }
.export-table tbody tr { transition: background 0.12s; }
.export-table tbody tr:hover { background: var(--surface-2); }
.export-table tr:last-child td { border-bottom: none; }

/* ---------------------------------------------- Mobil */

@media (max-width: 920px) {
  body.with-side { display: block; }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.8rem;
    border-right: none;
    border-bottom: 1px solid var(--side-border);
  }
  .side-nav { flex-direction: row; gap: 0.15rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-label { display: none; }
  .side-link { padding: 0.45rem 0.62rem; }
  .side-link.active::before { display: none; }
  .side-footer { border-top: none; padding-top: 0; }
  .protocol-head { flex-wrap: wrap; }
  .protocol-actions { flex-direction: row; width: 100%; }
}
@media (max-width: 700px) {
  .side-link span, .side-user-name, .brand-name { display: none; }
}

/* ---------------------------------------------- Druck */

@media print {
  body.with-side { display: block; background: #fff; color: #000; }
  body.with-side::before { display: none; }
  .sidebar, .btn, .flash, .finalize-bar, .back-link, .new-todo, .agenda-nav,
  .protocol-actions, .js-edit, .card-menu, .top-tools, form { display: none !important; }
  main { max-width: 100%; padding: 0; }
  .card { border: none; box-shadow: none; padding: 0.4rem 0; margin-bottom: 0.3rem; animation: none; }
  .top-item { border-left: none; }
  .date-block { box-shadow: none; border: 1px solid #999; background: #fff; color: #111; }
  .date-block .m { opacity: 1; }
  .top-badge { background: #eee; color: #111; }
}
