    :root {
      --bg: #0f172a;
      --surface: #1e293b;
      --surface2: #334155;
      --border: #334155;
      --border2: #475569;
      --text: #f1f5f9;
      --text-muted: #94a3b8;
      --accent: #3b82f6;
      --hour-h: 64px;
      --time-w: 52px;
    }

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

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
      background: var(--bg);
      color: var(--text);
      height: 100dvh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    /* ── Header ──────────────────────────────────────────────── */
    header {
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      padding: 10px 18px;
      display: flex;
      align-items: center;
      gap: 12px;
      flex-shrink: 0;
      z-index: 20;
    }

    .logo {
      font-size: 16px;
      font-weight: 700;
      letter-spacing: -0.3px;
      white-space: nowrap;
    }
    .logo span { color: var(--accent); }

    .week-nav {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-left: 8px;
    }

    button {
      font-family: inherit;
      cursor: pointer;
      border: none;
      transition: background 0.12s;
    }

    .btn {
      background: var(--surface2);
      color: var(--text);
      border: 1px solid var(--border2);
      padding: 6px 12px;
      border-radius: 6px;
      font-size: 13px;
      line-height: 1;
    }
    .btn:hover { background: var(--border2); }
    .btn-icon { padding: 6px 10px; font-size: 16px; line-height: 1; }
    .btn-primary {
      background: var(--accent);
      border-color: #2563eb;
      color: #fff;
    }
    .btn-primary:hover { background: #2563eb; }

    .week-label {
      font-size: 13px;
      font-weight: 600;
      min-width: 180px;
      text-align: center;
      color: var(--text-muted);
    }

    .last-updated {
      font-size: 11px;
      color: var(--text-muted);
      opacity: 0.7;
    }

    .spacer { flex: 1; }

    .status-legend {
      display: flex;
      gap: 10px;
      align-items: center;
      flex-shrink: 0;
    }
    .legend-item {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 11px;
      color: var(--text-muted);
      white-space: nowrap;
    }
    .legend-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
    }

    /* ── Error banner ────────────────────────────────────────── */
    .error-banner {
      background: #450a0a;
      border-bottom: 1px solid #dc2626;
      padding: 8px 18px;
      font-size: 12px;
      color: #fca5a5;
      display: none;
      flex-shrink: 0;
    }
    .error-banner.visible { display: block; }

    /* ── Calendar layout ─────────────────────────────────────── */
    .cal-wrap {
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    /* Day headers */
    .day-headers {
      display: grid;
      grid-template-columns: var(--time-w) repeat(7, 1fr);
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }

    .day-headers > .th-time { /* spacer */ }

    .th-day {
      padding: 8px 6px;
      text-align: center;
      border-left: 1px solid var(--border);
    }
    .th-day.today { background: rgba(59,130,246,0.08); }
    .th-name {
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-muted);
    }
    .th-num {
      font-size: 22px;
      font-weight: 700;
      margin-top: 1px;
      line-height: 1;
    }
    .th-day.today .th-num { color: var(--accent); }
    .th-month {
      font-size: 10px;
      color: var(--text-muted);
      margin-top: 1px;
    }

    .th-locations {
      position: relative;
      height: 14px;
      margin-top: 4px;
    }
    .th-location {
      position: absolute;
      top: 0;
      font-size: 9px;
      line-height: 14px;
      color: var(--text-muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* Scrollable grid */
    .cal-scroll {
      flex: 1;
      overflow-y: scroll;
      overflow-x: hidden;
    }

    .cal-grid {
      display: grid;
      grid-template-columns: var(--time-w) repeat(7, 1fr);
      position: relative;
    }

    /* Time gutter */
    .time-gutter {
      grid-column: 1;
      grid-row: 1 / span 999;
      position: sticky;
      left: 0;
      z-index: 10;
      background: var(--bg);
    }

    .time-label {
      height: var(--hour-h);
      display: flex;
      align-items: flex-start;
      justify-content: flex-end;
      padding: 3px 8px 0 0;
      font-size: 10px;
      color: var(--text-muted);
      border-top: 1px solid var(--border);
      white-space: nowrap;
    }

    /* Day columns */
    .day-col {
      position: relative;
      border-left: 1px solid var(--border);
    }
    .day-col.weekend { background: rgba(255,255,255,0.012); }
    .day-col.today-col { background: rgba(59,130,246,0.03); }

    .hour-row {
      height: var(--hour-h);
      border-top: 1px solid var(--border);
    }
    .half-row {
      position: absolute;
      top: calc(var(--hour-h) / 2);
      left: 0; right: 0;
      height: 1px;
      background: rgba(71,85,105,0.3);
    }

    /* ── Event cards ─────────────────────────────────────────── */
    .ev {
      position: absolute;
      border-radius: 4px;
      padding: 3px 5px;
      overflow: hidden;
      cursor: pointer;
      font-size: 11px;
      line-height: 1.25;
      border-left: 3px solid rgba(0,0,0,0.25);
      z-index: 3;
      transition: filter 0.12s, z-index 0s;
      user-select: none;
    }
    .ev:hover { filter: brightness(1.18); z-index: 50; }

    .ev-title {
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ev-time, .ev-loc, .ev-client {
      font-size: 10px;
      opacity: 0.78;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-top: 1px;
    }
    .ev-staff {
      margin-top: 3px;
      display: flex;
      gap: 4px;
      flex-wrap: wrap;
    }
    .ev-pill {
      background: rgba(0,0,0,0.22);
      border-radius: 3px;
      padding: 1px 4px;
      font-size: 10px;
      white-space: nowrap;
    }
    .ev-pill.full { background: rgba(0,0,0,0.3); }
    .ev-pill.warn { background: rgba(220,38,38,0.45); }

    /* ── Now indicator ───────────────────────────────────────── */
    .now-bar {
      position: absolute;
      left: 0; right: 0;
      height: 2px;
      background: #f87171;
      z-index: 8;
      pointer-events: none;
    }
    .now-bar::before {
      content: '';
      position: absolute;
      left: -4px;
      top: -4px;
      width: 10px;
      height: 10px;
      background: #f87171;
      border-radius: 50%;
    }

    /* ── Detail panel ────────────────────────────────────────── */
    .detail {
      position: fixed;
      top: 0; right: 0; bottom: 0;
      width: 440px;
      max-width: 92vw;
      background: var(--surface);
      border-left: 1px solid var(--border2);
      z-index: 100;
      display: flex;
      flex-direction: column;
      transform: translateX(100%);
      transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
    }
    .detail.open { transform: translateX(0); }

    .detail-head {
      padding: 14px 16px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .detail-head h2 { font-size: 14px; flex: 1; }

    .detail-body { padding: 14px 16px; overflow-y: auto; flex: 1; }

    .detail-status-bar {
      border-radius: 6px;
      border: 1px solid transparent; /* Farbe wird per JS gesetzt (statusabhängig) */
      padding: 8px 12px;
      margin-bottom: 14px;
      font-size: 12px;
    }
    .detail-status-bar strong { display: block; font-size: 14px; margin-top: 2px; }
    .status-pill { border-radius: 3px; padding: 1px 6px; font-size: 11px; }
    .status-label { font-size: 11px; }

    .detail-row {
      display: flex;
      gap: 8px;
      padding: 5px 0;
      font-size: 12px;
      border-bottom: 1px solid var(--border);
    }
    .detail-row:last-child { border-bottom: none; }
    .dr-label { color: var(--text-muted); min-width: 90px; flex-shrink: 0; }

    .staff-list {
      list-style: none;
      margin-top: 6px;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .staff-pending { color: var(--text-muted); font-size: 11px; }
    .vehicle-meta { color: var(--text-muted); font-size: 11px; margin-top: 1px; }

    .detail-section { margin-bottom: 20px; }
    .detail-section:last-child { margin-bottom: 0; }
    .detail-section-title {
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-muted);
      margin-bottom: 6px;
    }
    .detail-text {
      font-size: 12px;
      line-height: 1.5;
      white-space: pre-wrap;
      overflow-wrap: break-word;
    }

    .comment-item { margin-bottom: 10px; }
    .comment-item:last-child { margin-bottom: 0; }
    .comment-meta { font-size: 10px; color: var(--text-muted); margin-bottom: 2px; }

    .attachments-list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 4px;
      font-size: 12px;
    }

    /* ── Loading ─────────────────────────────────────────────── */
    .loading-overlay {
      position: absolute;
      inset: 0;
      background: rgba(15,23,42,0.75);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      font-size: 13px;
      color: var(--text-muted);
      z-index: 40;
    }
    .spinner {
      width: 20px; height: 20px;
      border: 2px solid var(--border2);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 0.6s linear infinite;
      flex-shrink: 0;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ── Settings modal ──────────────────────────────────────── */
    .overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.55);
      z-index: 200;
      align-items: center;
      justify-content: center;
    }
    .overlay.open { display: flex; }

    .modal {
      background: var(--surface);
      border: 1px solid var(--border2);
      border-radius: 12px;
      padding: 22px 24px;
      width: 420px;
      max-width: calc(100vw - 32px);
    }
    .modal h2 { font-size: 15px; margin-bottom: 18px; }

    .fg { margin-bottom: 14px; }
    .fg label {
      display: block;
      font-size: 11px;
      color: var(--text-muted);
      margin-bottom: 4px;
      font-weight: 500;
    }
    .fg input {
      width: 100%;
      background: var(--bg);
      border: 1px solid var(--border2);
      color: var(--text);
      padding: 8px 10px;
      border-radius: 6px;
      font-size: 13px;
      font-family: inherit;
    }
    .fg input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

    .fg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 20px;
    }

    /* ── Auth status (Settings-Modal) ─────────────────────────────── */
    .auth-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
    .auth-row.tight { margin-bottom: 10px; }
    .auth-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .auth-dot.ok  { background: #22c55e; }
    .auth-dot.bad { background: #ef4444; }
    .auth-muted { color: var(--text-muted); font-size: 12px; }
    .auth-logout {
      display: inline-block; margin-top: 10px;
      color: #f87171; font-size: 12px; text-decoration: none;
    }

    /* ── "Mit Crewbrain anmelden"-Button ──────────────────────────── */
    .login-btn, .login-btn-sm {
      display: inline-block;
      background: var(--accent);
      color: #fff;
      font-weight: 600;
      text-decoration: none;
      transition: background 0.15s;
    }
    .login-btn:hover, .login-btn-sm:hover { background: #2563eb; }
    .login-btn {
      display: block;
      border-radius: 8px;
      padding: 12px 20px;
      font-size: 14px;
    }
    .login-btn-sm {
      border-radius: 6px;
      padding: 8px 14px;
      font-size: 13px;
    }

    /* ── Utility ───────────────────────────────────────────────────── */
    .hidden { display: none !important; }

    /* ── Header ────────────────────────────────────────────────────── */
    .user-badge { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
    .btn-logout-header { font-size: 11px; padding: 4px 8px; text-decoration: none; }
    .btn-settings-gear { padding: 6px 10px; font-size: 13px; }

    /* ── Settings-Modal Auth-Status ───────────────────────────────── */
    .auth-status-box {
      background: var(--bg); border: 1px solid var(--border2); border-radius: 8px;
      padding: 12px 14px; margin-bottom: 18px; font-size: 13px;
    }

    /* ── Login-Screen ──────────────────────────────────────────────── */
    .login-screen {
      display: flex; position: fixed; inset: 0; background: var(--bg); z-index: 300;
      align-items: center; justify-content: center; flex-direction: column; gap: 16px;
    }
    .login-card {
      background: var(--surface); border: 1px solid var(--border2); border-radius: 16px;
      padding: 40px 44px; text-align: center; max-width: 360px; width: 90%;
    }
    .login-title { font-size: 28px; font-weight: 800; letter-spacing: -1px; margin-bottom: 6px; }
    .login-title .accent { color: var(--accent); }
    .login-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
