    :root {
      --bg-gradient-start: #0f172a;
      --bg-gradient-end: #1e293b;
      --surface: #e5f3ff;
      --surface-muted: #f1f5f9;
      --border-subtle: rgba(148, 163, 184, 0.5);
      --accent: #38bdf8;
      --accent-soft: rgba(56, 189, 248, 0.15);
      --accent-strong: #0ea5e9;
      --text-main: #0f172a;
      --text-muted: #64748b;
      --danger: #dc2626;
      --danger-soft: rgba(248, 113, 113, 0.18);
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI", sans-serif;
      color: var(--text-main);
      background: radial-gradient(circle at top, #020617 0, #020617 25%, #0b1120 100%);
      display: flex;
      justify-content: center;
      padding: 24px;
    }

    .app-shell {
      width: 100%;
      max-width: 1400px;
      border-radius: 26px;
      background: linear-gradient(145deg, #f9fafb, #e2f3ff);
      border: 1px solid rgba(148, 163, 184, 0.7);
      box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
      overflow: hidden;
      display: none; /* wird per JS angezeigt */
    }

    .layout {
      display: flex;
      width: 100%;
    }

    /* Sidebar */

    .sidebar {
      width: 220px;
      background: linear-gradient(180deg, #0f172a, #1f2937);
      color: #e5e7eb;
      padding: 18px 16px;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .sidebar-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 6px;
    }

    .logo-dot {
      width: 14px;
      height: 14px;
      border-radius: 999px;
      background: radial-gradient(circle, #e0f2fe, #38bdf8);
      box-shadow: 0 0 18px rgba(56, 189, 248, 0.9);
    }

    .sidebar-title {
      font-size: 1.1rem;
      font-weight: 600;
    }

    .sidebar-subtitle {
      font-size: 0.78rem;
      color: #9ca3af;
    }

    .nav-group-label {
      margin-top: 14px;
      margin-bottom: 6px;
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.12em;
      color: #6b7280;
    }

    .nav-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .nav-item {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .nav-sublist {
      display: none;
      flex-direction: column;
      gap: 4px;
      margin-left: 14px;
      padding-left: 10px;
      border-left: 1px solid rgba(148, 163, 184, 0.3);
    }

    .nav-item.active .nav-sublist {
      display: flex;
    }

    .nav-sublink {
      background: transparent;
      border: none;
      color: #9ca3af;
      text-align: left;
      padding: 2px 0;
      font-size: 0.75rem;
      cursor: pointer;
      transition: color 0.18s ease-out;
    }

    .nav-sublink:hover,
    .nav-sublink.active {
      color: var(--accent);
    }

    .nav-button {
      border-radius: 999px;
      border: none;
      padding: 8px 12px;
      font-size: 0.82rem;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      background: transparent;
      color: #e5e7eb;
      transition: all 0.18s ease-out;
    }

    .nav-button span.label {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .nav-button span.dot {
      width: 6px;
      height: 6px;
      border-radius: 999px;
      background: transparent;
    }

    .nav-button.active {
      background: linear-gradient(135deg, #38bdf8, #0ea5e9);
      color: #0b1120;
      box-shadow: 0 10px 24px rgba(56, 189, 248, 0.45);
    }

    .nav-button.active span.dot {
      background: #0b1120;
    }

    .nav-button:hover:not(.active) {
      background: rgba(31, 41, 55, 0.8);
    }

    .sidebar-footer {
      margin-top: auto;
      font-size: 0.72rem;
      color: #9ca3af;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .sidebar-footer strong {
      color: #e5e7eb;
    }

    /* Main */

    .main {
      flex: 1;
      padding: 18px 18px 22px;
      background: linear-gradient(135deg, #f9fafb, #e5f3ff);
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    header.main-header {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      margin-bottom: 6px;
    }

    .content {
      display: flex;
      flex-direction: column;
      gap: 14px;
      flex: 1;
    }

    .view {
      display: none;
      animation: fadeIn 0.22s ease-out;
    }

    .view.active {
      display: block;
    }

    /* Home Grid */

    .home-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 14px;
    }

    .home-tile {
      background: var(--surface);
      border-radius: 18px;
      border: 1px solid var(--border-subtle);
      padding: 18px;
      box-shadow: 0 16px 32px rgba(148, 163, 184, 0.35);
      display: flex;
      flex-direction: column;
      gap: 10px;
      position: relative;
      overflow: hidden;
    }

    .home-tile::after {
      content: "";
      position: absolute;
      inset: 0;
      background: radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.18), transparent 45%);
      pointer-events: none;
    }

    .home-tile h3 {
      margin: 0;
      font-size: 1.1rem;
    }

    .home-tile p {
      margin: 0;
      color: var(--text-muted);
      line-height: 1.4;
    }

    .home-tile .pill {
      align-self: flex-start;
    }

    .card {
      background: var(--surface);
      border-radius: 18px;
      border: 1px solid var(--border-subtle);
      padding: 12px 14px 14px;
      box-shadow: 0 14px 30px rgba(148, 163, 184, 0.4);
    }

    .card-header {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      margin-bottom: 8px;
      gap: 8px;
    }

    .card-title {
      font-size: 0.95rem;
      font-weight: 600;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      color: var(--text-muted);
    }

    .card-subtitle {
      font-size: 0.8rem;
      color: var(--text-muted);
    }

    .filter-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
    }

    .schedule-setup-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 16px;
      margin-top: 8px;
    }

    .schedule-panel {
      border: 1px solid var(--border-subtle);
      border-radius: 16px;
      padding: 14px;
      background: rgba(255, 255, 255, 0.8);
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .schedule-panel h4 {
      margin: 0;
      font-size: 0.95rem;
    }

    .schedule-panel p {
      margin: 0;
      color: var(--text-muted);
    }

    .schedule-form-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
      gap: 10px;
    }

    .schedule-plan-wrapper {
      overflow-x: auto;
      border-radius: 14px;
      border: 1px solid var(--border-subtle);
      background: white;
    }

    .schedule-plan-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.85rem;
    }

    .schedule-plan-table th,
    .schedule-plan-table td {
      border-bottom: 1px solid var(--border-subtle);
      padding: 10px;
      text-align: left;
    }

    .schedule-plan-table th {
      background: var(--surface-muted);
      font-weight: 600;
      font-size: 0.78rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-muted);
    }

    .schedule-plan-table td:first-child {
      font-weight: 500;
      width: 180px;
    }

    .schedule-plan-table tr:last-child td {
      border-bottom: none;
    }

    .schedule-select {
      width: 100%;
      border: 1px solid var(--border-subtle);
      border-radius: 10px;
      padding: 6px 8px;
      font-size: 0.85rem;
      background: var(--surface);
      min-width: 120px;
    }

    .schedule-break-row td {
      background: var(--surface-muted);
      color: var(--text-muted);
    }

    .schedule-break-label {
      font-weight: 600;
      color: var(--text-muted);
    }

    .schedule-legend {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 10px;
    }

    .subject-chip {
      border-radius: 999px;
      padding: 4px 10px;
      font-size: 0.78rem;
      color: #0b1120;
      font-weight: 600;
      border: 1px solid var(--border-subtle);
      background: var(--surface);
    }

    .mobile-schedule-day {
      border-bottom: 1px solid var(--border-subtle);
      padding: 8px 0;
    }

    .mobile-schedule-day:last-child {
      border-bottom: none;
    }

    .mobile-schedule-day-title {
      font-weight: 600;
      font-size: 0.85rem;
      margin-bottom: 2px;
    }

    .mobile-schedule-entry {
      font-size: 0.78rem;
      color: var(--text-muted);
    }

    /* Groceries */

    .grocery-groups {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-top: 10px;
    }

    .grocery-group {
      border: 1px solid var(--border-subtle);
      border-radius: 14px;
      padding: 10px 12px;
      background: rgba(255, 255, 255, 0.85);
    }

    .grocery-group-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 6px;
      font-weight: 600;
      color: var(--text-muted);
    }

    .grocery-items {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .grocery-item-row {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 10px;
      padding: 8px 0;
      border-top: 1px solid rgba(148, 163, 184, 0.3);
    }

    .grocery-item-row:first-child {
      border-top: none;
      padding-top: 0;
    }

    .grocery-item-row:last-child {
      padding-bottom: 0;
    }

    .grocery-item-row.done {
      opacity: 0.6;
    }

    .grocery-item-main {
      flex: 1;
    }

    .grocery-item-name {
      font-weight: 600;
    }

    .grocery-item-note {
      font-size: 0.78rem;
      color: var(--text-muted);
    }

    .grocery-item-actions {
      display: flex;
      flex-direction: column;
      gap: 4px;
      align-items: flex-end;
      min-width: 90px;
    }

    .filter-group {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 0.85rem;
      color: var(--text-muted);
    }

    .filter-group label {
      font-weight: 600;
    }

    .filter-input {
      min-width: 120px;
    }

    .pill {
      padding: 3px 10px;
      border-radius: 999px;
      background: var(--surface-muted);
      border: 1px solid rgba(148, 163, 184, 0.8);
      font-size: 0.75rem;
      color: var(--text-muted);
    }

    .pill-accent {
      background: var(--accent-soft);
      border-color: rgba(56, 189, 248, 0.6);
      color: var(--accent-strong);
    }

    .overview-grid {
      display: grid;
      grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr);
      gap: 10px;
    }

    .landscape-layout {
      display: flex;
      flex-direction: column;
      gap: 12px;
      width: 100%;
    }

    .landscape-card {
      width: 100%;
      min-height: 420px;
      aspect-ratio: 16 / 9;
    }

    @media (max-width: 900px) {
      .app-shell {
        flex-direction: column;
      }
      .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
      }
      .nav-list {
        flex-direction: row;
      }
      .main {
        padding: 14px;
      }
      .overview-grid {
        grid-template-columns: 1fr;
      }
    }

    .stats-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 4px;
    }

    .stat-chip {
      flex: 1 1 120px;
      min-width: 120px;
      padding: 8px 10px;
      border-radius: 14px;
      background: var(--surface-muted);
      border: 1px solid rgba(148, 163, 184, 0.7);
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .stat-label {
      font-size: 0.78rem;
      color: var(--text-muted);
    }

    .stat-main {
      display: flex;
      align-items: baseline;
    }

    .stat-value {
      font-size: 1.05rem;
      font-weight: 600;
    }

    .stat-unit {
      font-size: 0.75rem;
      color: var(--text-muted);
      margin-left: 4px;
    }

    .mobile-stats {
      margin: 8px 0 12px;
    }

    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.8rem;
    }

    .pizza-plan-table td:first-child {
      width: 45%;
      font-weight: 600;
      color: var(--text-muted);
    }

    .pizza-plan-table td:last-child {
      font-variant-numeric: tabular-nums;
    }

    .pizza-plan-list {
      margin-top: 6px;
    }

    .pizza-plan-list .btn {
      padding: 4px 10px;
      font-size: 0.75rem;
    }

    thead {
      background: var(--surface-muted);
    }

    th,
    td {
      padding: 6px 8px;
      text-align: left;
      border-bottom: 1px solid rgba(148, 163, 184, 0.6);
    }

    th {
      font-weight: 500;
      color: var(--text-muted);
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    tbody tr:hover {
      background: #e0f2fe;
    }

    tbody tr:last-child td {
      border-bottom: none;
    }

    .table-muted {
      font-size: 0.78rem;
      color: var(--text-muted);
      text-align: center;
      padding: 10px 0;
    }

    .row-high {
      background: var(--danger-soft) !important;
    }

    .row-high td.value-high {
      color: var(--danger);
      font-weight: 600;
    }

    .btn {
      border-radius: 999px;
      border: none;
      padding: 7px 14px;
      font-size: 0.8rem;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.18s ease-out;
      white-space: nowrap;
    }

    .btn-primary {
      background: linear-gradient(135deg, var(--accent), var(--accent-strong));
      color: #0b1120;
      box-shadow: 0 8px 18px rgba(56, 189, 248, 0.4);
    }

    .btn-primary:hover {
      transform: translateY(-1px);
      box-shadow: 0 12px 28px rgba(56, 189, 248, 0.55);
    }

    .btn-outline {
      background: var(--surface-muted);
      color: var(--text-main);
      border: 1px solid rgba(148, 163, 184, 0.9);
    }

    .btn-outline:hover {
      border-color: var(--accent);
      box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
    }

    .btn-ghost {
      background: transparent;
      color: var(--text-muted);
      border: 1px solid rgba(148, 163, 184, 0.4);
      padding-inline: 10px;
    }

    .btn-ghost:hover {
      color: var(--accent);
      border-color: var(--accent);
    }

    .btn-sm {
      padding: 4px 10px;
      font-size: 0.75rem;
    }

    .btn-danger {
      background: #fee2e2;
      color: #991b1b;
      border: 1px solid #fecaca;
    }

    .btn-danger:hover {
      box-shadow: 0 10px 24px rgba(248, 113, 113, 0.4);
    }

    .btn-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .form-row {
      display: flex;
      gap: 10px;
      margin-bottom: 10px;
      align-items: flex-end;
      flex-wrap: wrap;
    }

    .pizza-stack {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .pizza-time-row {
      display: flex;
      gap: 10px;
      align-items: flex-end;
      flex-wrap: nowrap;
    }

    .pizza-time-row .form-group {
      flex: 1 1 0;
      min-width: 0;
    }

    .pizza-time-row .form-group input,
    .pizza-time-row .form-group select {
      width: 100%;
      min-width: 0;
    }

    .form-group {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .checkbox-line {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 0.8rem;
      color: var(--text-main);
    }

    .checkbox-line input {
      width: 16px;
      height: 16px;
      accent-color: var(--accent);
    }

    label {
      font-size: 0.78rem;
      color: var(--text-muted);
    }

    input[type="datetime-local"],
    input[type="number"],
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea {
      background: #ffffff;
      border-radius: 12px;
      border: 1px solid rgba(148, 163, 184, 0.7);
      padding: 6px 10px;
      font-size: 0.8rem;
      color: var(--text-main);
      min-width: 120px;
    }

    textarea {
      min-height: 40px;
      resize: vertical;
    }

    input:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
    }

    .chart-container {
      margin-top: 10px;
      background: #ffffff;
      border-radius: 18px;
      padding: 12px;
      border: 1px solid rgba(148, 163, 184, 0.7);
      width: 100%;
      height: clamp(280px, 45vw, 520px);
    }

    #bpChart {
      width: 100% !important;
      height: 100% !important;
      display: block;
    }

    /* LOGIN OVERLAY */

    .login-overlay {
      position: fixed;
      inset: 0;
      background: radial-gradient(circle at center, #020617 0, #020617 40%, #020617 100%);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
    }

    .login-card {
      background: #e5f3ff;
      border-radius: 24px;
      padding: 28px 26px 22px;
      max-width: 420px;
      width: 90%;
      box-shadow: 0 24px 60px rgba(15, 23, 42, 0.6);
      border: 1px solid rgba(148, 163, 184, 0.9);
      text-align: center;
    }

    .login-title {
      margin: 0 0 4px;
      font-size: 1.3rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: #64748b;
    }

    .login-subtitle {
      margin: 0 0 18px;
      font-size: 0.95rem;
      color: var(--text-main);
    }

    .login-input {
      width: 100%;
      padding: 10px 14px;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.9);
      font-size: 0.9rem;
      margin-bottom: 10px;
      outline: none;
    }

    .login-input::placeholder {
      color: #cbd5f5;
    }

    .login-button {
      width: 100%;
      justify-content: center;
      margin-top: 4px;
      margin-bottom: 8px;
    }

    .login-error {
      margin: 0;
      font-size: 0.8rem;
      color: #b91c1c;
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(4px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* MOBILE SHELL */

    .mobile-shell {
      display: none;
      width: 100%;
      max-width: 480px;
      margin: 0 auto;
      padding: 12px;
    }

    .mobile-card {
      background: var(--surface);
      border-radius: 18px;
      border: 1px solid var(--border-subtle);
      padding: 12px 14px 14px;
      box-shadow: 0 14px 30px rgba(148, 163, 184, 0.4);
      margin-bottom: 12px;
    }

    .mobile-header-title {
      font-size: 1.1rem;
      font-weight: 600;
      margin-bottom: 4px;
    }

    .mobile-header-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }

    .mobile-header-sub {
      font-size: 0.85rem;
      color: var(--text-muted);
    }

    .mobile-nav {
      display: flex;
      gap: 8px;
      margin: 10px 0 12px;
      flex-wrap: wrap;
    }

    .mobile-tab {
      flex: 1;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.8);
      background: var(--surface-muted);
      font-size: 0.9rem;
      padding: 6px 10px;
      cursor: pointer;
      min-width: 120px;
    }

    .mobile-tab.active {
      background: linear-gradient(135deg, var(--accent), var(--accent-strong));
      color: #0b1120;
      box-shadow: 0 8px 18px rgba(56, 189, 248, 0.4);
      border-color: transparent;
    }

    .mobile-view {
      display: none;
    }

    .mobile-view.active {
      display: block;
    }

    .mobile-area {
      display: none;
    }

    .mobile-area.active {
      display: block;
    }

    .mobile-section {
      margin-top: 16px;
      padding-top: 12px;
      border-top: 1px solid var(--border-subtle);
    }

    .mobile-section-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 10px;
    }

    .mobile-section-title {
      font-size: 1rem;
      font-weight: 600;
    }

    .mobile-section-subtitle {
      font-size: 0.88rem;
      color: var(--text-muted);
    }

    .mobile-table-wrapper {
      max-height: 60vh;
      overflow-y: auto;
      border-radius: 12px;
      border: 1px solid rgba(148, 163, 184, 0.5);
      background: #fff;
    }

    .mobile-table-wrapper table {
      width: 100%;
      border-collapse: collapse;
    }

    .mobile-table-wrapper th,
    .mobile-table-wrapper td {
      padding: 6px 8px;
      font-size: 0.85rem;
      border-bottom: 1px solid rgba(148, 163, 184, 0.4);
    }

    .mobile-table-wrapper tr.row-high {
      background: var(--danger-soft);
    }

    .mobile-chart-wrapper {
      background: #fff;
      border: 1px solid var(--border-subtle);
      border-radius: 14px;
      padding: 8px;
      min-height: 260px;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 10px 24px rgba(148, 163, 184, 0.35);
    }

    .mobile-chart-canvas {
      width: 100%;
      max-height: 420px;
    }

    .mobile-chart-note {
      margin-top: 8px;
      color: var(--text-muted);
      font-size: 0.85rem;
      text-align: center;
    }

    @media (orientation: landscape) {
      .mobile-shell {
        max-width: none;
        width: 100vw;
        padding: 10px 10px 18px;
      }

      .mobile-shell.chart-mode .mobile-card {
        height: calc(100vh - 32px);
        display: flex;
        flex-direction: column;
      }

      .mobile-shell.chart-mode .mobile-chart-wrapper {
        flex: 1;
        min-height: 0;
      }

      .mobile-shell.chart-mode .mobile-chart-canvas {
        height: 100% !important;
      }
    }

    @media (max-width: 800px) {
      .app-shell {
        display: none !important;
      }
      .mobile-shell {
        display: block;
      }
      .chart-container,
      #bpChart {
        display: none !important;
      }
      body {
        padding: 12px;
        display: block;
      }
    }
  
