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

    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Oxygen, Ubuntu, Cantarell, sans-serif;
      background: #f5f5f5;
      padding: 10px;
    }

    .container {
      max-width: 1200px;
      margin: 0 auto;
      background: white;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      overflow: hidden;
    }

    header {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      padding: 20px;
      text-align: center;
    }

    h1 {
      font-size: 28px;
      margin-bottom: 5px;
    }

    .subtitle {
      font-size: 14px;
      opacity: 0.9;
    }

    .controls {
      display: flex;
      gap: 10px;
      justify-content: center;
      flex-wrap: wrap;
      padding: 15px;
      border-bottom: 1px solid #eee;
      background: #fafafa;
    }

    .month-nav {
      display: flex;
      gap: 6px;
      align-items: center;
      flex-wrap: wrap;
    }

    .month-nav button {
      min-width: 36px;
    }

    input,
    button,
    select {
      padding: 8px 12px;
      border: 1px solid #ddd;
      border-radius: 4px;
      font-size: 14px;
      font-family: inherit;
    }

    button {
      background: #667eea;
      color: white;
      border: none;
      cursor: pointer;
      transition: background 0.3s;
    }

    button:hover {
      background: #764ba2;
    }

    button[data-participant-id="1"]:hover {
      background: #1A8FE3;
    }

    button[data-participant-id="2"]:hover {
      background: #6610F2;
    }

    button[data-participant-id="3"]:hover {
      background: #D11149;
    }

    button[data-participant-id="4"]:hover {
      background: #E6C229;
    }

    button:active {
      transform: scale(0.98);
    }

    input[type="month"] {
      padding: 8px 12px;
      border: 1px solid #ddd;
      border-radius: 4px;
    }

    .content {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
      padding: 20px;
    }

    @media (max-width: 768px) {
      .content {
        grid-template-columns: 1fr;
      }
    }

    .section {
      display: flex;
      flex-direction: column;
    }

    .section h2 {
      font-size: 18px;
      margin-bottom: 15px;
      color: #333;
      border-bottom: 2px solid #667eea;
      padding-bottom: 10px;
    }

    .calendar {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 5px;
    }

    .calendar-actions {
      display: flex;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
      margin: 12px 0 16px;
    }

    .calendar-actions button {
      padding: 6px 10px;
      font-size: 12px;
    }

    .calendar-help {
      font-size: 12px;
      color: #888;
    }

    .calendar-day {
      aspect-ratio: 1;
      border: 1px solid #ddd;
      border-radius: 4px;
      padding: 4px;
      font-size: 11px;
      background: white;
      display: flex;
      flex-direction: column;
      cursor: pointer;
      transition: all 0.2s;
    }

    .calendar-day.selected {
      border-color: var(--participant-color, #667eea);
      box-shadow: inset 0 0 0 1px var(--participant-color, #667eea);
    }

    .calendar-day:hover {
      background: #f0f0f0;
      border-color: #667eea;
    }

    .calendar-day.other-month {
      opacity: 0.3;
      pointer-events: none;
    }

    .calendar-day-date {
      font-weight: bold;
      flex-shrink: 0;
    }

    .calendar-day-presence {
      display: flex;
      flex-direction: column;
      gap: 2px;
      margin-top: 4px;
    }

    .calendar-day-presence-row {
      display: flex;
      gap: 2px;
      align-items: center;
    }

.calendar-day-presence-column {
  flex: 1; /* Ensure columns take equal space */
  display: flex;
  justify-content: center; /* Center the line horizontally */
}

    .calendar-day-presence-line {
      height: 2px;
      border-radius: 999px;
      flex: 1;
      opacity: 0.75;
      background: var(--participant-color, #667eea);
    }

    .calendar-day-presence-line.lunch {
      opacity: 0.75;
    }

    .calendar-day-presence-line.dinner { 
      opacity: 0.95;
    }

    .calendar-day-meals {
      display: flex;
      gap: 2px;
      align-items: flex-end;
      margin-top: 4px;
    }

    .meal-badge {
      width: 50%;
      height: 8px;
      border-radius: 2px;
      background: #ddd;
      cursor: pointer;
      transition: background 0.2s;
    }

    .meal-badge.active {
      background: var(--participant-color, #667eea);
    }

    .meal-badge:hover {
      opacity: 0.7;
    }

    .budget-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 14px;
    }

    .budget-table thead {
      background: #f5f5f5;
      border-bottom: 2px solid #667eea;
    }

    .budget-table th,
    .budget-table td {
      padding: 12px;
      text-align: right;
      border-bottom: 1px solid #eee;
    }

    .budget-table th:first-child,
    .budget-table td:first-child {
      text-align: left;
    }

    .budget-table tr:hover {
      background: #f9f9f9;
    }

    .summary-cards {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      margin-bottom: 14px;
    }

    .summary-card {
      background: #f7f8ff;
      border: 1px solid #e4e7ff;
      border-radius: 6px;
      padding: 10px 12px;
    }

    .summary-card .label {
      display: block;
      font-size: 12px;
      color: #666;
      margin-bottom: 4px;
    }

    .summary-card .value {
      font-size: 20px;
      font-weight: 700;
      color: #333;
    }

    .summary-card .value.positive {
      color: #2e7d32;
    }

    .summary-card .value.negative {
      color: #c62828;
    }

    .settlement-list,
    .transfer-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 12px;
    }

    .settlement-item,
    .transfer-item {
      background: #f5f5f5;
      border-radius: 6px;
      padding: 10px 12px;
      font-size: 13px;
      display: flex;
      justify-content: space-between;
      gap: 12px;
    }

    .settlement-item strong,
    .transfer-item strong {
      color: #333;
    }

    .balance-positive {
      color: #2e7d32;
      font-weight: 700;
    }

    .balance-negative {
      color: #c62828;
      font-weight: 700;
    }

    .add-expense {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-top: 10px;
    }

    .expense-inputs {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .transfer-inputs {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    @media (max-width: 768px) {
      .expense-inputs {
        grid-template-columns: 1fr;
      }

      .transfer-inputs {
        grid-template-columns: 1fr;
      }

      .summary-cards {
        grid-template-columns: 1fr;
      }
    }

    .expense-list {
      margin-top: 15px;
      max-height: 300px;
      overflow-y: auto;
    }

    .expense-item {
      background: #f5f5f5;
      padding: 10px;
      border-radius: 4px;
      margin-bottom: 8px;
      font-size: 13px;
      display: flex;
      justify-content: space-between;
    }

    .participant-selector {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-bottom: 10px;
    }

    .participant-toggle {
      padding: 6px 12px;
      border: 2px solid #ddd;
      border-radius: 20px;
      cursor: pointer;
      background: white;
      font-size: 13px;
      transition: all 0.2s;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      color: #ddd;
    }

    .participant-toggle.active {
      border-color: var(--participant-color, #667eea);
      background: var(--participant-color, #667eea);
      color: white;
    }

    .participant-toggle-swatch {
      width: 8px;
      height: 8px;
      border-radius: 999px;
      background: var(--participant-color, #667eea);
      flex-shrink: 0;
    }

    .participant-toggle.active .participant-toggle-swatch {
      background: rgba(255, 255, 255, 0.9);
    }

    .empty-state {
      text-align: center;
      padding: 30px;
      color: #999;
    }

    .loading {
      text-align: center;
      padding: 20px;
      color: #999;
    }
