/* =====================================================================
   Oberfläche nach dem Login: obere Leiste, Startseite, Bereichsseiten
   ===================================================================== */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- Obere Leiste ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 max(24px, calc((100% - 1240px) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-seal { width: 34px; height: 34px; flex: none; filter: grayscale(1) contrast(1.15); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.user-wrap { position: relative; }
.user-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 10px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--hover); border-color: var(--line-strong); }
.user-btn .start-avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.user-btn-name { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 300px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: pop-in .15s ease-out;
}
.user-menu[hidden] { display: none; }
.user-menu-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.user-menu-who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.user-menu-who strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.user-menu-item:hover, .user-menu-item:focus-visible { background: var(--hover); }
.user-menu-item svg { color: var(--text-dim); }

.shell-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ---------- Startseite ---------- */
.home {
  width: 100%;
  max-width: 1288px;
  margin: 0 auto;
  padding: 56px 24px 40px;
  animation: rise .35s ease-out;
}
.home-hero { margin-bottom: 48px; }
.home-eyebrow { margin: 0 0 10px; font-size: 13.5px; color: var(--text-dim); }
.home-hero h1 { font-size: clamp(34px, 5vw, 56px); letter-spacing: -.04em; line-height: 1.05; margin: 0; }
.home-sub { margin: 14px 0 0; color: var(--text-dim); font-size: 16px; }
.home-group { margin-bottom: 40px; }
.home-group h2 {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  margin: 0 0 14px;
}
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  min-height: 168px;
  padding: 20px 20px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background .2s, border-color .2s, color .2s, transform .2s, box-shadow .2s;
}
.tile:hover, .tile:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.tile-top { display: flex; align-items: flex-start; justify-content: space-between; }
.tile-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text);
  transition: background .2s, color .2s;
}
.tile:hover .tile-icon, .tile:focus-visible .tile-icon { background: color-mix(in srgb, var(--accent-fg) 14%, transparent); color: var(--accent-fg); }
.tile-arrow { color: var(--text-faint); transition: transform .2s, color .2s; }
.tile:hover .tile-arrow, .tile:focus-visible .tile-arrow { color: var(--accent-fg); transform: translate(2px, -2px); }
.tile-text { display: flex; flex-direction: column; gap: 4px; }
.tile-name { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.tile-desc { font-size: 13.5px; color: var(--text-dim); line-height: 1.45; transition: color .2s; }
.tile:hover .tile-desc, .tile:focus-visible .tile-desc { color: color-mix(in srgb, var(--accent-fg) 70%, transparent); }

/* Hervorgehobene Kachel „Dokument erstellen“ */
.tile-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.tile-primary .tile-icon { background: color-mix(in srgb, var(--accent-fg) 14%, transparent); color: var(--accent-fg); }
.tile-primary .tile-arrow { color: var(--accent-fg); }
.tile-primary .tile-desc { color: color-mix(in srgb, var(--accent-fg) 70%, transparent); }
.tile-primary:hover { opacity: .92; }
@media (min-width: 820px) { .tile-primary { grid-column: span 2; } }

.home-foot { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-faint); }

/* ---------- Bereichsseite ---------- */
.app-page {
  height: calc(100dvh - var(--header-h));
  display: flex;
  flex-direction: column;
  animation: fade-in .2s ease-out;
}
.app-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px max(24px, calc((100% - 1240px) / 2)) 14px;
}
.app-page:has(> .win-body-flush) .app-head { padding-left: 24px; padding-right: 24px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.app-titles { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.app-icon { display: none; }
.app-title { font-size: 24px; letter-spacing: -.025em; margin: 0; white-space: nowrap; }
.app-sub { color: var(--text-dim); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.app-sub:not(:empty)::before { content: "/"; margin-right: 10px; color: var(--text-faint); }
.app-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px max(24px, calc((100% - 1240px) / 2)) 40px;
}
.app-body.win-body-flush { padding: 0; overflow: hidden; }

/* ---------- Handy ---------- */
@media (max-width: 767px) {
  :root { --header-h: 58px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .brand-text span { display: none; }
  .user-btn { padding: 0 4px; }
  .user-btn-name, .user-btn > svg { display: none; }
  .user-menu { width: min(300px, calc(100vw - 28px)); }
  .home { padding: 32px 16px 28px; }
  .home-hero { margin-bottom: 32px; }
  .tile-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { min-height: 132px; padding: 16px; gap: 18px; border-radius: 16px; }
  .tile-desc { display: none; }
  .tile-name { font-size: 15px; }
  .tile-primary { grid-column: span 2; }
  .tile-primary .tile-desc { display: block; }
  .app-head { padding: 12px 14px 10px; }
  .app-page:has(> .win-body-flush) .app-head { padding: 10px 14px; }
  .app-title { font-size: 19px; }
  .app-sub { font-size: 13.5px; }
  .app-body { padding: 4px 14px 28px; }
}
