/* ==========================================================================
   Zentra – Design im Stil von konnektiva.ch
   Basis: Bootstrap 5.3 (Grid, Modals, Dropdowns) + eigene Design-Tokens
   ========================================================================== */

:root {
  --blue: #0000ff;
  --blue-700: #0000c2;
  --violet: #3b2bff;
  --navy: #070b34;
  --ink: #0b0d24;
  --muted: #4b4e68;
  --muted-2: #7a7d95;
  --line: #e3e5ef;
  --tint: #f4f6ff;
  --ice: #d9e6ff;
  --sky: #7db4ff;
  --lilac: #c2b8ff;
  --ember: #ff5b23;
  --apricot: #ffb27a;
  --white: #ffffff;
  --success: #0f8a5f;
  --success-bg: #e3f6ee;
  --warning: #9a5b00;
  --warning-bg: #fff3dd;
  --danger: #d0212f;
  --danger-bg: #ffe7e9;

  --font: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --fs-h1: clamp(1.9rem, 1.4rem + 2vw, 3rem);
  --fs-h2: clamp(1.4rem, 1.15rem + 1vw, 2rem);
  --fs-h3: clamp(1.1rem, 1rem + .4vw, 1.35rem);

  --gutter: clamp(16px, 4vw, 40px);
  --radius-sm: 12px;
  --radius: 22px;
  --radius-lg: 34px;
  --header-h: 76px;
  --tabbar-h: 68px;
  --shadow: 0 1px 2px rgba(11,13,36,.04), 0 12px 32px -12px rgba(11,13,36,.14);
  --ease: cubic-bezier(.2,.7,.2,1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  /* Bootstrap-Variablen auf Konnektiva-Farben mappen */
  --bs-primary: var(--blue);
  --bs-primary-rgb: 0, 0, 255;
  --bs-body-font-family: var(--font);
  --bs-body-color: var(--ink);
  --bs-body-bg: #fff;
  --bs-border-color: var(--line);
  --bs-link-color: var(--blue);
  --bs-link-color-rgb: 0, 0, 255;
  --bs-link-hover-color: var(--navy);
  --bs-link-hover-color-rgb: 7, 11, 52;
  --bs-secondary-color: var(--muted);
  --bs-border-radius: var(--radius-sm);
  --bs-focus-ring-color: rgba(0, 0, 255, .25);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #fff;
  font-size: 0.97rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5 {
  font-family: var(--font);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
h1, .h1 { font-size: var(--fs-h1); }
h2, .h2 { font-size: var(--fs-h2); }
h3, .h3 { font-size: var(--fs-h3); letter-spacing: -0.02em; }
h4, .h4 { font-size: 1.1rem; letter-spacing: -0.015em; }
h5, .h5 { font-size: 1rem; letter-spacing: -0.01em; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--navy); }
.text-muted, .text-secondary { color: var(--muted) !important; }
.text-muted-2 { color: var(--muted-2); }
.text-blue { color: var(--blue) !important; }
.bg-tint { background: var(--tint) !important; }
.fw-medium { font-weight: 500 !important; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 1000;
  background: var(--blue); color: #fff; padding: .6em 1em; border-radius: 999px;
}
.skip-link:focus { left: 8px; }

/* ---------- Tagline / Eyebrow ---------- */
.tagline {
  display: inline-flex; align-items: center; gap: .6em;
  margin: 0 0 .7rem;
  font-size: .78rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: var(--blue);
}
.tagline::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.tagline-white { color: rgba(255,255,255,.8); }

/* ---------- Buttons (Pill wie Konnektiva) ---------- */
.btn {
  --btn-bg: var(--ink); --btn-fg: #fff; --btn-bd: var(--btn-bg);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: .6em 1.3em;
  font: 500 .9rem/1.2 var(--font); letter-spacing: -0.005em;
  color: var(--btn-fg); background: var(--btn-bg); border: 1.5px solid var(--btn-bd);
  border-radius: 999px; text-decoration: none; white-space: nowrap;
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease);
}
.btn:hover, .btn:focus-visible { color: var(--btn-fg); background: var(--btn-bg); border-color: var(--btn-bd); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .45; }
.btn .bi { font-size: 1.05em; }
.btn-lg { min-height: 54px; padding: .9em 1.7em; font-size: 1rem; }
.btn-sm { min-height: 36px; padding: .4em .95em; font-size: .82rem; }
.btn-icon { width: 38px; min-height: 38px; height: 38px; padding: 0; }
.btn-icon.btn-sm { width: 34px; height: 34px; min-height: 34px; }

.btn-primary, .btn-blue { --btn-bg: var(--blue); --btn-fg: #fff; --btn-bd: var(--blue); }
.btn-primary:hover, .btn-blue:hover { --btn-bg: var(--navy); --btn-bd: var(--navy); }
.btn-dark, .btn-ink { --btn-bg: var(--ink); --btn-fg: #fff; }
.btn-dark:hover, .btn-ink:hover { --btn-bg: var(--blue); --btn-bd: var(--blue); }
.btn-border, .btn-outline-secondary, .btn-outline-primary, .btn-secondary, .btn-light {
  --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--line);
}
.btn-border:hover, .btn-outline-secondary:hover, .btn-outline-primary:hover, .btn-secondary:hover, .btn-light:hover {
  --btn-bg: var(--ink); --btn-fg: #fff; --btn-bd: var(--ink);
}
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: transparent; }
.btn-ghost:hover, .btn-ghost.is-active { --btn-bg: var(--tint); --btn-fg: var(--blue); --btn-bd: var(--tint); }
.btn-success { --btn-bg: var(--blue); --btn-fg: #fff; --btn-bd: var(--blue); }
.btn-success:hover { --btn-bg: var(--navy); --btn-bd: var(--navy); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: var(--danger); }
.btn-danger:hover { --btn-bg: #a51522; --btn-bd: #a51522; }
.btn-outline-danger { --btn-bg: transparent; --btn-fg: var(--danger); --btn-bd: #f3c3c8; }
.btn-outline-danger:hover { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: var(--danger); }
.btn-warning { --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--line); }
.btn-warning:hover { --btn-bg: var(--ink); --btn-fg: #fff; --btn-bd: var(--ink); }
.btn-white { --btn-bg: #fff; --btn-fg: var(--ink); --btn-bd: #fff; }
.btn-white:hover { --btn-bg: var(--ice); --btn-bd: var(--ice); }
.btn-border-white { --btn-bg: transparent; --btn-fg: #fff; --btn-bd: rgba(255,255,255,.45); }
.btn-border-white:hover { --btn-bg: transparent; --btn-fg: #fff; --btn-bd: #fff; }
.btn-close { border-radius: 50%; }

/* ---------- Formulare ---------- */
.form-label, label.form-label, .field-label {
  display: block; font-size: .85rem; font-weight: 500; margin-bottom: 6px; color: var(--ink);
}
.form-control, .form-select {
  min-height: 48px;
  padding: .65rem .95rem;
  font: 400 .95rem/1.4 var(--font);
  color: var(--ink);
  background-color: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.form-select { padding-right: 2.5rem; }
textarea.form-control { min-height: 96px; }
.form-control:hover, .form-select:hover { border-color: #c9ccdc; }
.form-control:focus, .form-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0,0,255,.12);
}
.form-control::placeholder { color: #9a9db3; }
.form-control:disabled, .form-control[readonly] { background: var(--tint); }
.form-control-sm, .form-select-sm { min-height: 38px; font-size: .85rem; padding: .4rem .75rem; }
.form-select[multiple] { min-height: 120px; padding: .5rem; }
.form-check-input:checked { background-color: var(--blue); border-color: var(--blue); }
.form-check-input:focus { box-shadow: 0 0 0 4px rgba(0,0,255,.12); border-color: var(--blue); }
.form-text { color: var(--muted); font-size: .8rem; }
.req { color: var(--blue); }
.input-group-text { border: 1.5px solid var(--line); background: var(--tint); border-radius: var(--radius-sm); }

/* ---------- Karten ---------- */
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}
.card-body { padding: clamp(20px, 2.6vw, 30px); }
.card-header, .card-footer { background: transparent; border-color: var(--line); padding: 18px clamp(20px, 2.6vw, 30px); }
.card-title { font-size: var(--fs-h3); font-weight: 500; letter-spacing: -0.02em; margin-bottom: .4rem; }
.card-bg { background: var(--tint); border-color: transparent; }
.card-section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.card-section-title h2, .card-section-title h3 { margin: 0; }

.card-icon {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--ice); color: var(--blue); font-size: 1.3rem;
}

/* Kennzahlen */
.stat { display: flex; flex-direction: column; gap: 4px; height: 100%; }
.stat-label { font-size: .78rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.4rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: .85rem; color: var(--muted); }
@media (max-width: 575.98px) { .stat-value { font-size: 1.45rem; } .stat-label { font-size: .7rem; letter-spacing: .08em; } }
.stat-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.stat-blue .stat-label, .stat-blue .stat-hint { color: rgba(255,255,255,.8); }
.stat-blue .stat-value { color: #fff; }

/* ---------- Gradient-Flächen (wie Konnektiva) ---------- */
.gradient-panel {
  position: relative; isolation: isolate; overflow: hidden;
  color: #fff; background: var(--navy);
  border-radius: var(--radius-lg);
}
.gradient-panel::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 90% at 92% 0%, rgba(0,0,255,.95) 0%, rgba(0,0,255,0) 62%),
    radial-gradient(45% 60% at 70% 10%, rgba(125,180,255,.55) 0%, rgba(125,180,255,0) 70%),
    radial-gradient(40% 70% at 100% 70%, rgba(255,91,35,.45) 0%, rgba(255,91,35,0) 70%);
}
.gradient-panel::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--grain); background-size: 180px auto; mix-blend-mode: overlay; opacity: .16;
}
.gradient-panel h1, .gradient-panel h2, .gradient-panel h3 { color: #fff; }
.gradient-panel a:not(.btn) { color: #fff; }
.gradient-panel .text-muted { color: rgba(255,255,255,.75) !important; }

/* ---------- Header / Navigation ---------- */
.app-header {
  position: sticky; top: 0; z-index: 1030;
  height: var(--header-h);
  border-bottom: 1px solid var(--line);
}
/* Unschärfe auf Pseudo-Element, damit das fixierte Mobile-Menü nicht im Header eingeschlossen wird */
.app-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
}
.app-header-inner {
  height: 100%;
  max-width: 1440px; margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 24px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--blue); text-decoration: none; flex: 0 0 auto; }
.logo:hover { color: var(--navy); }
.logo-mark { display: inline-flex; }
.logo-mark svg { display: block; border-radius: 10px; }
.logo-word { font-size: 1.6rem; letter-spacing: -0.04em; line-height: 1; font-weight: 300; }
.logo-word b { font-weight: 700; }
.logo-white { color: #fff; }

.app-nav { flex: 1 1 auto; display: flex; align-items: center; }
.app-nav-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; align-items: center; }
.app-nav-list a {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 999px;
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: .92rem;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.app-nav-list a .bi { font-size: 1rem; color: var(--muted); transition: color .2s var(--ease); }
.app-nav-list a:hover { color: var(--blue); background: var(--tint); }
.app-nav-list a:hover .bi { color: var(--blue); }
.app-nav-list a[aria-current="page"] { color: var(--blue); background: var(--tint); }
.app-nav-list a[aria-current="page"] .bi { color: var(--blue); }
.app-nav-sep, .app-nav-manage, .app-nav-footer { display: none; }

.app-header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.user-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 14px 4px 4px; border-radius: 999px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  font: 500 .88rem var(--font);
  transition: border-color .2s var(--ease);
}
.user-chip:hover, .user-chip[aria-expanded="true"] { border-color: var(--ink); }
.user-chip-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(90% 90% at 80% 20%, var(--sky) 0%, var(--blue) 45%, var(--navy) 100%);
  color: #fff; font-size: .78rem; font-weight: 600; letter-spacing: .02em;
}

.timer-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--blue); color: #fff; text-decoration: none;
  font-weight: 500; font-size: .85rem; font-variant-numeric: tabular-nums;
}
.timer-pill:hover { background: var(--navy); color: #fff; }
.timer-pill[hidden] { display: none; }
.timer-pill-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.menu-btn {
  display: none; align-items: center; gap: 10px;
  padding: 5px 5px 5px 18px; min-height: 48px;
  border: 1.5px solid var(--ink); border-radius: 999px; background: #fff;
  font: 500 .92rem var(--font); color: var(--ink);
}
.menu-btn-icon { position: relative; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); }
.menu-btn-icon span {
  position: absolute; left: 10px; right: 10px; height: 1.6px; background: #fff; border-radius: 2px;
  transition: transform .3s var(--ease), top .3s var(--ease);
}
.menu-btn-icon span:first-child { top: 14px; }
.menu-btn-icon span:last-child { top: 21px; }
.menu-btn[aria-expanded="true"] .menu-btn-icon span:first-child { top: 17.5px; transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-btn-icon span:last-child { top: 17.5px; transform: rotate(-45deg); }

.dropdown-menu {
  border: 1px solid var(--line); border-radius: 16px; padding: 8px;
  box-shadow: var(--shadow); font-size: .92rem; min-width: 220px;
}
.dropdown-item { border-radius: 10px; padding: 9px 12px; display: flex; align-items: center; gap: 10px; color: var(--ink); }
.dropdown-item .bi { color: var(--muted); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--tint); color: var(--blue); }
.dropdown-item:hover .bi { color: var(--blue); }
.dropdown-item.active, .dropdown-item:active { background: var(--blue); color: #fff; }

@media (max-width: 1199.98px) {
  .menu-btn { display: inline-flex; }
  .app-nav {
    position: fixed; inset: var(--header-h) 0 0 0; z-index: 1029;
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 24px;
    padding: 20px var(--gutter) calc(32px + env(safe-area-inset-bottom));
    background: #fff; overflow-y: auto;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s linear .3s;
  }
  .app-nav.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .app-nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .app-nav-list li { border-bottom: 1px solid var(--line); }
  .app-nav-list a {
    display: flex; padding: 14px 4px; border-radius: 0;
    font-size: clamp(1.25rem, 4.6vw, 1.7rem); letter-spacing: -0.03em; gap: 14px;
  }
  .app-nav-list a .bi { font-size: .8em; }
  .app-nav-list a:hover, .app-nav-list a[aria-current="page"] { background: transparent; }
  .app-nav-sep { display: block; border-bottom: 0 !important; padding: 22px 4px 4px; }
  .app-nav-sep span { font-size: .78rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
  .app-nav-manage { display: block; }
  .app-nav-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  body.nav-open { overflow: hidden; }
}
@media (max-width: 575.98px) {
  .menu-btn-label { display: none; }
  .menu-btn { padding: 5px; border-color: transparent; }
  .logo-word { font-size: 1.4rem; }
  .app-nav-footer { grid-template-columns: 1fr; }
}

/* Mobile Tab-Leiste */
.tabbar { display: none; }
@media (max-width: 767.98px) {
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1025;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 6px 6px env(safe-area-inset-bottom);
    background: rgba(255,255,255,.97);
    border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 0; background: none; color: var(--muted); text-decoration: none;
    font: 500 .68rem var(--font); border-radius: 14px;
  }
  .tabbar .bi { font-size: 1.3rem; }
  .tabbar a[aria-current="page"] { color: var(--blue); }
  .tabbar .tabbar-main .bi {
    display: grid; place-items: center; width: 44px; height: 32px; border-radius: 999px;
    background: var(--blue); color: #fff; font-size: 1.15rem;
  }
  body.app { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}

/* ---------- Seitenaufbau ---------- */
.app-main { min-height: calc(100vh - var(--header-h) - 70px); padding: clamp(24px, 4vw, 48px) 0 clamp(48px, 6vw, 80px); }
.container-app { max-width: 1440px; margin: 0 auto; padding: 0 var(--gutter); }
.container-narrow { max-width: 860px; }

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px;
  margin-bottom: clamp(20px, 3vw, 36px);
}
.page-head h1 { margin: 0; }
.page-head p.lead { margin: 10px 0 0; color: var(--muted); font-size: 1.02rem; max-width: 60ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.section-gap { margin-top: clamp(24px, 3vw, 40px); }

.breadcrumb-nav {
  display: flex; flex-wrap: wrap; align-items: center; gap: .55em; margin-bottom: 14px;
  font-size: .78rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.breadcrumb-nav a { color: var(--muted); text-decoration: none; }
.breadcrumb-nav a:hover { color: var(--blue); }

.app-footer { border-top: 1px solid var(--line); padding: 22px 0; font-size: .82rem; color: var(--muted); }
.app-footer .container-app { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.app-footer a { color: var(--muted); }

/* ---------- Tabellen ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.table-wrap .table-responsive { margin: 0; }
.table {
  --bs-table-bg: transparent; --bs-table-hover-bg: var(--tint);
  margin: 0; font-size: .92rem; color: var(--ink);
}
.table > :not(caption) > * > * { padding: 14px 16px; border-bottom-color: var(--line); vertical-align: middle; }
.table thead th {
  font-size: .72rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); background: var(--tint); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table tbody tr:last-child > * { border-bottom: 0; }
.table tfoot td, .table tfoot th { background: var(--tint); font-weight: 500; border-top: 1px solid var(--line); border-bottom: 0; }
.table-bordered > :not(caption) > * > * { border-width: 0 0 1px; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn + .btn, .table .actions form + .btn, .table .actions .btn + form { margin-left: 4px; }
.table .actions form { display: inline; }
.row-muted td { color: var(--muted-2); }
.row-billed td { color: var(--muted); }
.table a.row-link { color: var(--ink); font-weight: 500; text-decoration: none; }
.table a.row-link:hover { color: var(--blue); }

/* Tabellen als Karten auf Smartphone und Tablet */
@media (max-width: 991.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td, .table-stack tfoot { display: block; width: 100%; }
  .table-stack tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack > :not(caption) > * > * { padding: 3px 0; border: 0 !important; background: transparent !important; }
  .table-stack td { display: flex; justify-content: space-between; gap: 16px; text-align: right; }
  .table-stack td[data-label]::before {
    content: attr(data-label); flex: 0 0 auto; text-align: left;
    font-size: .72rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 2px;
  }
  .table-stack td.stack-title { display: block; text-align: left; font-size: 1rem; font-weight: 500; padding-bottom: 6px; }
  .table-stack td.stack-title::before { display: none; }
  .table-stack td.actions { justify-content: flex-end; padding-top: 10px; }
  .table-stack td.actions::before { display: none; }
  .table-stack tfoot tr { background: var(--tint); }
  .table-stack td:empty { display: none; }
}

/* ---------- Badges / Status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .38em .8em; border-radius: 999px;
  font-size: .72rem; font-weight: 500; letter-spacing: .02em;
  background: var(--tint); color: var(--muted); border: 1px solid var(--line);
}
.badge-blue, .badge.bg-primary { background: var(--blue) !important; color: #fff; border-color: var(--blue); }
.badge-ice { background: var(--ice); color: var(--blue); border-color: var(--ice); }
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-bg); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bg); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bg); }
.badge-navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Alerts ---------- */
.alert {
  border: 0; border-radius: var(--radius-sm); padding: 14px 18px; font-size: .92rem;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-dismissible { padding-right: 3.2rem; }
.alert-dismissible .btn-close { padding: 1.05rem 1rem; }
.alert-success { background: var(--success-bg); color: #0b5e41; }
.alert-danger { background: var(--danger-bg); color: #8f1520; }
.alert-warning { background: var(--warning-bg); color: #6d4100; }
.alert-info { background: var(--tint); color: var(--navy); }

/* ---------- Modals ---------- */
.modal-content { border: 0; border-radius: var(--radius); box-shadow: 0 30px 80px -20px rgba(7,11,52,.35); }
.modal-header { border-bottom: 0; padding: 24px 28px 4px; }
.modal-title { font-size: 1.3rem; font-weight: 500; letter-spacing: -0.02em; }
.modal-body { padding: 16px 28px; }
.modal-footer { border-top: 0; padding: 8px 28px 26px; gap: 8px; }
.modal-footer > * { margin: 0; }
.modal-backdrop { --bs-backdrop-bg: #070b34; --bs-backdrop-opacity: .45; }
@media (max-width: 575.98px) {
  .modal-dialog { margin: 0; min-height: 100%; display: flex; align-items: flex-end; }
  .modal-content { border-radius: var(--radius) var(--radius) 0 0; max-height: 92vh; overflow-y: auto; }
  .modal.fade .modal-dialog { transform: translateY(40px); }
  .modal.show .modal-dialog { transform: none; }
  .modal-footer { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .modal-footer .btn { flex: 1 1 auto; }
}

/* ---------- Tabs (Segment-Control) ---------- */
.seg-tabs {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px;
  background: var(--tint); border-radius: 999px; border: 0; margin-bottom: 24px;
}
.seg-tabs { max-width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.seg-tabs::-webkit-scrollbar { display: none; }
.seg-tabs .nav-item { flex: 0 0 auto; }
.seg-tabs .nav-link {
  border: 0; border-radius: 999px; padding: 9px 18px;
  color: var(--muted); font-weight: 500; font-size: .9rem; background: transparent;
}
.seg-tabs .nav-link:hover { color: var(--ink); }
.seg-tabs .nav-link.active { background: #fff; color: var(--blue); box-shadow: 0 1px 2px rgba(11,13,36,.08), 0 4px 12px -4px rgba(11,13,36,.15); }

/* ---------- Zeiterfassung: Wochenleiste ---------- */
.week-bar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 6px; border-radius: 16px; border: 1.5px solid var(--line);
  text-decoration: none; color: var(--ink); background: #fff;
  transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.week-day:hover { border-color: var(--ink); color: var(--ink); }
.week-day .wd { font-size: .72rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.week-day .dn { font-size: 1.25rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.2; }
.week-day .hrs { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.week-day.is-today .dn { color: var(--blue); }
.week-day.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.week-day.is-active .wd, .week-day.is-active .hrs { color: rgba(255,255,255,.85); }
.week-day.is-active .dn { color: #fff; }
.week-day.is-weekend:not(.is-active) { background: var(--tint); border-color: transparent; }
@media (max-width: 575.98px) {
  .week-bar { gap: 4px; }
  .week-day { padding: 9px 2px; border-radius: 12px; }
  .week-day .dn { font-size: 1.05rem; }
  .week-day .hrs { font-size: .66rem; }
}
.week-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.week-nav .week-label { font-weight: 500; margin: 0 6px; }

/* ---------- Timer ---------- */
.timer-display {
  font-size: clamp(3.2rem, 2rem + 7vw, 6.5rem);
  font-weight: 500; letter-spacing: -0.05em; line-height: 1;
  font-variant-numeric: tabular-nums;
  margin: 8px 0 28px;
}
.timer-card.is-running .timer-display { color: #fff; }
.timer-status { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 500; }
.timer-status .timer-pill-dot { background: var(--ember); }

/* ---------- Leere Zustände ---------- */
.empty-state { text-align: center; padding: clamp(32px, 5vw, 56px) 20px; color: var(--muted); }
.empty-state .bi { font-size: 2rem; color: var(--blue); display: block; margin-bottom: 10px; }
.empty-state p { margin: 0 auto; max-width: 42ch; }

/* ---------- Filterleiste ---------- */
.filter-bar { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 20px; }
@media (min-width: 768px) { .filter-bar { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: end; } }

/* ---------- Definitionen (Detailseiten) ---------- */
.meta-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin: 0; }
.meta-list dt { font-size: .72rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.meta-list dd { margin: 0; font-weight: 500; }

/* ---------- Positionen-Editor (Offerten) ---------- */
.items-editor .item-row { display: grid; grid-template-columns: minmax(0, 3fr) 90px 90px 120px 120px 44px; gap: 8px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.items-editor .item-row .item-total { padding-top: 12px; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.items-editor .items-head { display: grid; grid-template-columns: minmax(0, 3fr) 90px 90px 120px 120px 44px; gap: 8px; font-size: .72rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
@media (max-width: 767.98px) {
  .items-editor .items-head { display: none; }
  .items-editor .item-row { grid-template-columns: 1fr 1fr; padding: 14px 0; }
  .items-editor .item-row .item-desc { grid-column: 1 / -1; }
  .items-editor .item-row .item-total { padding-top: 0; text-align: left; align-self: center; }
}
.totals { margin-left: auto; max-width: 340px; }
.totals div { display: flex; justify-content: space-between; padding: 6px 0; }
.totals .grand { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; font-size: 1.15rem; font-weight: 500; }

/* ==========================================================================
   Login / Fehlerseiten
   ========================================================================== */
body.auth { min-height: 100vh; background: var(--navy); position: relative; isolation: isolate; }
body.auth::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(55% 75% at 12% 100%, rgba(255,91,35,.85) 0%, rgba(255,91,35,0) 65%),
    radial-gradient(50% 70% at 30% 70%, rgba(255,178,122,.35) 0%, rgba(255,178,122,0) 70%),
    radial-gradient(70% 90% at 85% 10%, #0000ff 0%, rgba(0,0,255,0) 65%),
    radial-gradient(40% 50% at 95% 60%, rgba(125,180,255,.7) 0%, rgba(125,180,255,0) 70%);
}
body.auth::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--grain); background-size: 180px auto; mix-blend-mode: overlay; opacity: .18;
}
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px var(--gutter); }
.auth-card {
  width: 100%; max-width: 440px;
  background: #fff; border-radius: var(--radius-lg);
  padding: clamp(28px, 5vw, 44px);
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.5);
}
.auth-card .logo { display: flex; margin-bottom: 28px; }
.auth-card h1 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); margin-bottom: 6px; }
.auth-foot { margin-top: 22px; text-align: center; font-size: .82rem; color: rgba(255,255,255,.75); }
.auth-foot a { color: #fff; }

/* ==========================================================================
   Öffentliche Info-Seiten
   ========================================================================== */
body.site { background: #fff; }
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.site-header .inner { max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); height: var(--header-h); display: flex; align-items: center; gap: 24px; }
.site-nav { display: flex; gap: 28px; margin-left: auto; align-items: center; }
.site-nav a:not(.btn) { position: relative; color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 6px 0; }
.site-nav a:not(.btn)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--blue); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.site-nav a:not(.btn):hover::after, .site-nav a[aria-current="page"]::after { transform: scaleX(1); }
@media (max-width: 760px) {
  .site-nav a:not(.btn) { display: none; }
}
.site-wrap { max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); }
.hero { padding: clamp(56px, 9vw, 140px) 0 clamp(40px, 6vw, 90px); }
.hero h1 { font-size: clamp(2.6rem, 1.4rem + 5vw, 5.6rem); letter-spacing: -0.05em; line-height: .98; max-width: 18ch; }
.hero h1 .light { font-weight: 300; }
.hero .lead { font-size: clamp(1.05rem, 1rem + .4vw, 1.3rem); color: var(--muted); max-width: 52ch; margin: 24px 0 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 28px 0 0; }
.tags li { font-size: .75rem; font-weight: 500; letter-spacing: .02em; padding: .3em .8em; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.section { padding: clamp(56px, 8vw, 120px) 0; }
.feature-grid { display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .feature-grid { grid-template-columns: 1fr; } }
.feature { padding: clamp(24px, 3vw, 36px); border-radius: var(--radius); border: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; gap: 10px; }
.feature h3 { margin: 6px 0 0; }
.feature p { color: var(--muted); margin: 0; }
.feature img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); margin-top: 8px; }
.feature-num { font-size: .8rem; font-weight: 500; color: var(--blue); }
.band { padding: clamp(48px, 7vw, 100px) clamp(24px, 5vw, 72px); }
.band h2 { font-size: clamp(2.2rem, 1.2rem + 4vw, 4.6rem); letter-spacing: -0.045em; line-height: 1; }
.band h2 .light { font-weight: 300; }
.site-footer { background: var(--navy); color: rgba(255,255,255,.82); position: relative; isolation: isolate; overflow: hidden; margin-top: clamp(56px, 8vw, 120px); }
.site-footer::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 80% at 92% 0%, rgba(0,0,255,.95) 0%, rgba(0,0,255,0) 60%), radial-gradient(45% 60% at 70% 10%, rgba(125,180,255,.55) 0%, rgba(125,180,255,0) 70%), radial-gradient(40% 55% at 100% 45%, rgba(255,91,35,.45) 0%, rgba(255,91,35,0) 70%); }
.site-footer a { color: rgba(255,255,255,.9); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding: 64px 0 40px; }
.site-footer h3 { font-size: .8rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.6); margin-bottom: 14px; }
.site-footer ul { list-style: none; padding: 0; display: grid; gap: 8px; font-size: .94rem; }
.site-footer .bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 22px 0 28px; border-top: 1px solid rgba(255,255,255,.14); font-size: .82rem; color: rgba(255,255,255,.65); }
@media (max-width: 760px) { .site-footer .grid { grid-template-columns: 1fr; gap: 28px; } }

/* ==========================================================================
   Druck
   ========================================================================== */
@media print {
  .app-header, .tabbar, .app-footer, .page-actions, .btn, .no-print, .alert { display: none !important; }
  body.app { padding: 0; }
  .app-main { padding: 0; }
  .card, .table-wrap { border-color: #ccc; }
  a { color: inherit; text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Positionen: kompakte, automatisch wachsende Beschreibungsfelder */
.items-editor textarea.form-control { min-height: 38px; resize: vertical; overflow: hidden; }

/* Desktop-Navigation auf mittleren Breiten kompakter */
.app-nav-list a { white-space: nowrap; }
@media (min-width: 1200px) and (max-width: 1439.98px) {
  .app-header-inner { gap: 14px; }
  .app-nav-list a { padding: 10px 10px; font-size: .9rem; }
  .app-nav-list a .bi { display: none; }
  .user-chip-name { display: none; }
  .user-chip { padding: 4px 10px 4px 4px; }
}
