  :root {
    --bg-color: #fafafa;
    --primary-color: #203A43;
    --accent-color: #F5A623;
    --text-color: #333;
    --font-family: 'Poppins', sans-serif;
    --transition: 0.3s ease;
    --max-width: 1200px;
    --card-bg: #ffffff;
    --warning-color: #d00030;
    --success-color: #2e7d32;
  }

  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  body {
    font-family: var(--font-family);
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 2rem 1rem;
  }

  .page-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
  }

  .sidebar-toggle {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 120;
    padding: 0.45rem 0.8rem;
    background: #203A43;
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease, transform 0.2s ease;
    display: none;
  }

  .sidebar-toggle:hover {
    background: #1b2f36;
    transform: translateY(-1px);
  }

  .sidebar-toggle:active {
    transform: translateY(0);
  }

  h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    display: block;
    width: 100%;
  }

  .page-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 2rem 0 1.5rem 0;
    padding-bottom: 1rem;
    border-bottom: 4px solid var(--accent-color);
    letter-spacing: -1px;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2a4a56 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: block;
    width: 100%;
  }

  .page-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color) 0%, #ffb84d 100%);
    border-radius: 2px;
  }

  @media (max-width: 768px) {
    .page-title {
      font-size: 2.2rem;
      margin: 1.5rem 0 1rem 0;
      padding-bottom: 0.75rem;
      letter-spacing: -0.5px;
    }

    .parental-deduction-table {
      font-size: 0.85rem;
    }

    .parental-deduction-table th,
    .parental-deduction-table td {
      padding: 0.5rem 0.6rem !important;
    }

    .parental-deduction-table th {
      font-size: 0.8rem;
    }
  }

  .lead {
    margin-bottom: 2rem;
    max-width: 900px;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #444;
    padding-top: 0.5rem;
  }

  .notice {
    font-size: 0.9rem;
    color: #555;
    background: #fff7e6;
    border-left: 4px solid var(--accent-color);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
  }

  .explanation-toggle {
    background: #203A43;
    color: #fff;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1rem;
  }

  .explanation-toggle:hover {
    background: #2e7d32;
    transform: translateY(-1px);
  }

  .explanation-toggle:active {
    transform: translateY(0);
  }

  .explanation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
  }

  .explanation-popup {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    padding-top: 3rem;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    color: #1b3a4b;
    line-height: 1.7;
  }

  .close-popup-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #666;
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
  }

  .close-popup-btn:hover {
    background: #f0f0f0;
    color: #333;
    transform: rotate(90deg);
  }

  .close-popup-btn:active {
    transform: rotate(90deg) scale(0.95);
  }

  .explanation-box {
    display: none;
    background: #eef6ff;
    border-left: 4px solid #1976d2;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    color: #1b3a4b;
    line-height: 1.7;
  }

  .explanation-box.show {
    display: block;
  }

  .info-tip-toggle {
    background: #ffffff;
    color: #203A43;
    border: 1px solid rgba(32, 58, 67, 0.25);
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
  }

  .info-tip-toggle:hover,
  .info-tip-toggle:focus-visible {
    background: #f0f7ff;
    border-color: #1976d2;
    color: #1b3a4b;
    outline: none;
  }

  .info-tip-toggle .toggle-icon {
    font-size: 1rem;
    line-height: 1;
  }

  .info-tip-box {
    display: none;
    background: #f5faff;
    border-left: 4px solid #1976d2;
    border-radius: 8px;
    padding: 0.9rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #1b3a4b;
    line-height: 1.7;
  }

  .info-tip-box.show {
    display: block;
  }

  .info-tip-box ul {
    margin: 0.75rem 0 0.75rem 1.25rem;
    padding: 0;
  }

  .info-tip-box li {
    margin-bottom: 0.35rem;
  }

  .frequency-warning {
    display: none;
    margin-top: 0.6rem;
    padding: 0.55rem 0.75rem;
    border-left: 3px solid #c62828;
    background: #fdecea;
    color: #b71c1c;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.5;
    gap: 0.55rem;
    align-items: flex-start;
  }

  .frequency-warning.show {
    display: flex;
  }

  .frequency-warning-icon {
    font-size: 1.1rem;
    line-height: 1;
    margin-right: 0.35rem;
  }

  .period-info {
    font-size: 0.85rem;
    color: #1b3a4b;
    background: #f5f5f5;
    border-left: 4px solid #1976d2;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  .period-summary-section {
    margin-bottom: 0.6rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
  }

  .period-summary-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0.4rem;
  }

  .period-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    padding: 0.2rem 0;
  }

  .period-summary-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.4rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid rgba(25, 118, 210, 0.2);
  }

  .period-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0.25rem;
    margin-bottom: 0.15rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
  }

  .period-summary-row:hover {
    background-color: rgba(0, 0, 0, 0.02);
  }

  .period-summary-row.deduction {
    background-color: #fff5f5;
    border-left: 3px solid #c62828;
    padding-left: 0.4rem;
  }

  .period-summary-row.result {
    background-color: #e3f2fd;
    border-left: 3px solid #1976d2;
    padding-left: 0.4rem;
    font-weight: 600;
    margin-top: 0.25rem;
  }

  .period-summary-label {
    color: #555;
    font-weight: 500;
    font-size: 0.85rem;
  }

  .period-summary-value {
    color: #333;
    font-weight: 600;
    text-align: right;
    font-size: 0.85rem;
  }

  .period-summary-value.highlight-blue {
    color: #1565c0;
    font-weight: 700;
  }

  .period-summary-value.highlight-red {
    color: #c62828;
    font-weight: 700;
  }

  .period-summary-highlight {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 3px solid #1976d2;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    color: #0d47a1;
    margin: 0.25rem 0;
    font-size: 0.85rem;
  }

  .period-summary-calculation {
    background: #fafafa;
    border-radius: 6px;
    padding: 0.25rem;
    margin-top: 0.25rem;
  }

  .period-summary-breakdown {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    margin-top: 0.25rem;
    padding-left: 0.25rem;
  }

  .period-summary-note {
    font-size: 0.8rem;
    color: #2e7d32;
    font-style: italic;
    margin-top: 0.5rem;
    padding: 0.4rem 0.5rem;
    background: #e8f5e9;
    border-left: 3px solid #2e7d32;
    border-radius: 6px;
  }

  .period-summary-explanation {
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
    margin-top: 0.2rem;
    padding-left: 0.25rem;
  }

  .period-summary-subtext {
    font-size: 0.75rem;
    color: #888;
    font-weight: normal;
    margin-left: 0.5rem;
  }

  .period-summary-value.highlight-total {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
  }

  .period-summary-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
  }

  .period-summary-split .period-summary-box {
    flex: 1 1 auto;
    min-width: 150px;
  }

  .period-summary-box {
    flex: 1;
    min-width: 120px;
    max-width: 100%;
    background: #fafafa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    text-align: center;
    transition: all 0.2s ease;
    overflow: hidden;
    box-sizing: border-box;
  }

  .period-summary-box:hover {
    border-color: #bbb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .period-summary-box.school-box {
    border-color: #1976d2;
    background: #e3f2fd;
  }

  .period-summary-box.off-box {
    border-color: #f57c00;
    background: #fff3e0;
  }

  .period-summary-box.total-box {
    border-color: var(--primary-color);
    background: #f5f5f5;
    font-weight: 600;
  }

  .period-summary-box-title {
    font-size: 0.75rem;
    color: #666;
    font-weight: 600;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .period-summary-box-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.2rem;
  }

  .period-summary-box.school-box .period-summary-box-value {
    color: #1565c0;
  }

  .period-summary-box.off-box .period-summary-box-value {
    color: #e65100;
  }

  .period-summary-box.total-box .period-summary-box-value {
    color: var(--primary-color);
    font-size: 1.2rem;
  }

  .period-summary-box-subtitle {
    font-size: 0.7rem;
    color: #888;
    font-style: italic;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    line-height: 1.3;
    margin-top: 0.2rem;
  }

  .period-summary-box-divider {
    font-size: 1.2rem;
    font-weight: 700;
    color: #999;
    flex-shrink: 0;
  }

  .period-summary-subsection {
    margin-top: 0.5rem;
    padding-left: 0.5rem;
    border-left: 2px solid #e0e0e0;
  }

  .period-summary-subtitle {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.4rem;
  }

  .period-info.pulse-animation {
    animation: periodPulse 6s ease-out;
  }

  @keyframes periodPulse {
    0% {
      transform: scale(1);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    8.33% {
      transform: scale(1.05);
      box-shadow: 0 4px 16px rgba(25, 118, 210, 0.3);
    }

    16.66% {
      transform: scale(1);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    33.33% {
      transform: scale(1.05);
      box-shadow: 0 4px 16px rgba(25, 118, 210, 0.3);
    }

    41.66% {
      transform: scale(1);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    50% {
      transform: scale(1.05);
      box-shadow: 0 4px 16px rgba(25, 118, 210, 0.3);
    }

    58.33% {
      transform: scale(1);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    100% {
      transform: scale(1);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
  }

  .period-info strong {
    color: #1976d2;
  }

  .period-info-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .period-info-header:hover {
    opacity: 0.8;
  }

  .period-info-toggle {
    font-size: 1rem;
    font-weight: bold;
    color: #1976d2;
    transition: transform 0.2s ease;
    display: inline-block;
    width: 1.2rem;
    text-align: center;
    line-height: 1;
  }

  .period-info.collapsed .period-info-toggle {
    transform: rotate(0deg);
  }

  .period-info.expanded .period-info-toggle {
    transform: rotate(90deg);
  }

  .period-info-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
  }

  .period-info.collapsed .period-info-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
  }

  .period-info.expanded .period-info-content {
    max-height: 2000px;
    opacity: 1;
    margin-top: 0.5rem;
  }

  .btn-calculate-period {
    background: var(--success-color);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    margin-bottom: 1.5rem;
    display: inline-block;
  }

  .period-buttons-container .btn-calculate-period {
    margin-bottom: 0;
  }

  .btn-calculate-period:hover {
    background: #1b5e20;
    transform: translateY(-1px);
  }

  .btn-calculate-period:active {
    transform: translateY(0);
  }

  .btn-period-analysis {
    background: #1976d2;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    margin-bottom: 0;
    display: inline-block;
  }

  .btn-period-analysis:hover {
    background: #1565c0;
    transform: translateY(-1px);
  }

  .btn-period-analysis:active {
    transform: translateY(0);
  }

  .btn-period-analysis:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }

  .btn-period-secondary {
    background: #6c757d;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    margin-bottom: 0;
    display: inline-block;
  }

  .btn-period-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
  }

  .btn-period-secondary:active {
    transform: translateY(0);
  }

  .btn-period-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }

  .period-buttons-container {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
  }

  .period-buttons-container button {
    margin-bottom: 0;
    margin-top: 0;
    vertical-align: middle;
    height: auto;
    line-height: 1.5;
  }

  .period-info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
  }

  .period-info-popup {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    padding-top: 3rem;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    color: #1b3a4b;
    line-height: 1.7;
    width: 100%;
  }

  .close-popup-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #666;
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  }

  .close-popup-btn:hover {
    background: #f0f0f0;
    color: #333;
    transform: rotate(90deg);
  }

  .close-popup-btn:active {
    transform: rotate(90deg) scale(0.95);
  }

  .period-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .period-actions-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .period-action-btn {
    background: #ffffff;
    color: var(--primary-color);
    border: 1px solid rgba(32, 58, 67, 0.25);
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 4px 12px rgba(32, 58, 67, 0.08);
    cursor: pointer;
    transition: var(--transition), transform 0.2s ease;
  }

  .period-action-btn:hover {
    background: #f0f7ff;
    border-color: #1976d2;
    color: #0f2530;
    transform: translateY(-1px);
  }

  .period-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    border-color: rgba(32, 58, 67, 0.15);
  }

  .period-action-btn:focus-visible {
    outline: 3px solid rgba(25, 118, 210, 0.3);
    outline-offset: 2px;
  }

  .inline-popover {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .inline-popover .popover-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 320px;
    max-width: min(480px, 85vw);
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid rgba(25, 118, 210, 0.15);
    box-shadow: 0 18px 38px rgba(21, 58, 77, 0.25);
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 40;
  }

  .inline-popover.open .popover-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .popover-close {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    border: none;
    background: transparent;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    color: #888;
    padding: 0.15rem;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
  }

  .popover-close:hover,
  .popover-close:focus-visible {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
    outline: none;
  }

  .weekday-label:has(input:checked) {
    border-color: var(--success-color) !important;
    background: #e8f5e9 !important;
  }

  .weekday-label:hover {
    border-color: var(--accent-color) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  /* Gör veckoschema-boxarna mindre (hälften så stora) */
  .weekday-label {
    padding: 0.25rem 0.375rem !important;
    font-size: 0.85rem !important;
  }

  .weekday-label span {
    font-size: 0.85rem !important;
  }

  .weekday-label input[type="checkbox"] {
    transform: scale(0.9) !important;
  }

  /* Gör "ingen sysselsättning"-rutan mindre */
  #noSchoolLabel {
    padding: 0.375rem 0.5rem !important;
    font-size: 0.85rem !important;
  }

  #noSchoolLabel span {
    font-size: 0.85rem !important;
  }

  #noSchoolLabel input[type="checkbox"] {
    transform: scale(1.0) !important;
  }

  .calculator {
    display: grid;
    gap: 2.5rem;
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 2rem;
  }

  .card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    transition: box-shadow 0.3s ease;
    position: relative;
    margin-bottom: 0.75rem;
    /* Minskat mellanrum mellan större rutorna */
  }

  .card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  }

  .card.prerequisites {
    border-left: 4px solid #1976d2;
    background: #e8f0ff;
  }

  .card.basic-needs {
    border-left: 4px solid #f57c00;
    background: #fffaf5;
  }

  .card.other-needs {
    border-left: 4px solid #2e7d32;
    background: #f5faf7;
  }

  .card.results-card {
    border-left: 5px solid #F5A623;
    background: #fffef8;
    border: 2px solid #F5A623;
    border-left: 5px solid #F5A623;
    box-shadow: 0 4px 16px rgba(245, 166, 35, 0.2);
  }

  .card.results-card.basic-needs {
    background: #fffef8;
    border: 2px solid #F5A623;
    border-left: 5px solid #F5A623;
    box-shadow: 0 4px 16px rgba(245, 166, 35, 0.2);
  }

  .remaining-awake-box {
    background: #e3f2fd;
    border: 2px solid #1565c0 !important;
  }

  .remaining-awake-box .result-label {
    color: #0d47a1;
    font-weight: 600;
  }

  .remaining-awake-box .result-value {
    color: #1565c0;
  }

  .card h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .card h2 .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 600;
    flex-shrink: 0;
  }

  .card h2 .section-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
  }

  .card h3 {
    font-size: 1.15rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--primary-color);
  }

  .days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
    max-width: 90%;
  }

  .field-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
  }

  .field-group input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 0.95rem;
  }

  .field-help {
    font-size: 0.8rem;
    color: #777;
    margin-top: 0.2rem;
  }

  .category-header {
    margin-top: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--accent-color);
    background: linear-gradient(to right, rgba(245, 166, 35, 0.1) 0%, transparent 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
  }

  .category-header .category-icon {
    font-size: 1.3rem;
  }

  .category-header .category-time-summary {
    margin-left: auto;
    margin-right: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    display: none;
    white-space: nowrap;
    box-shadow: none;
    transition: all 0.2s ease;
  }

  .category-header.collapsed .category-time-summary {
    display: inline-block;
  }

  .category-header .category-time-summary:hover {
    background: #eeeeee;
    border-color: #bbb;
  }

  .category-header .notes-toggle {
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
  }

  .category-header .notes-toggle:hover {
    background: rgba(255, 255, 255, 1);
    border-color: var(--accent-color);
  }

  .category-notes {
    margin: 0.5rem 0 1rem;
    padding: 0.75rem;
    background: #fffef5;
    border: 1px solid #f0e68c;
    border-radius: 6px;
    display: none;
  }

  .category-notes.show {
    display: block;
  }

  /* --- CSS FÖR KOLLAPSBARA KATEGORIER --- */
  .category-header.collapsible {
    cursor: pointer;
    /* Visa att rubriken är klickbar */
    user-select: none;
    /* Förhindra textmarkering vid klick */
    padding-left: 0.5rem;
    /* Ge plats för pilen utan att flytta innehållet */
    transition: background-color 0.2s ease;
  }

  .category-header.collapsible:hover {
    background-color: rgba(32, 58, 67, 0.05);
    /* Lätt hover-effekt */
  }

  .category-header .category-toggle-icon {
    display: inline-block;
    transition: transform 0.2s ease;
    margin-right: 0.75rem;
    font-size: 0.9rem;
    width: 1rem;
    text-align: center;
    color: #555;
  }

  .category-content {
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      opacity 0.3s ease,
      padding-top 0.3s ease,
      padding-bottom 0.3s ease;
    /* Standardläge: kollapsad */
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
  }

  /* När rubriken INTE har klassen 'collapsed' (dvs expanderad) */
  .category-header.collapsible:not(.collapsed)+.category-content {
    max-height: 5000px;
    /* Sätt ett högt värde för att rymma allt innehåll */
    opacity: 1;
    /* Behåll padding för att undvika att innehållet "slår i" rubriken */
    padding-top: 1rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
    /* Visuell avdelare */
  }

  /* Rotera pilen när kollapsad (standardläge) */
  .category-header.collapsible .category-toggle-icon {
    transform: rotate(-90deg);
    /* Rotera pilen */
  }

  /* När expanderad, rotera tillbaka pilen */
  .category-header.collapsible:not(.collapsed) .category-toggle-icon {
    transform: rotate(0deg);
  }

  /* Lägg till mellanrum när kategori är kollapsad för att undvika att resultatboxen kommer för nära */
  .category-header.collapsible.collapsed {
    margin-bottom: 0.75rem;
  }

  /* --- SLUT PÅ CSS --- */
  .category-notes textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
  }

  .category-notes textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(245, 166, 35, 0.1);
  }

  .category-notes-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.4rem;
    font-weight: 500;
  }

  .needs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
  }

  .needs-table tbody tr {
    transition: background-color 0.2s ease;
  }

  .needs-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
  }

  .needs-table tbody tr:hover {
    background-color: #f0f7ff;
  }

  .needs-table th,
  .needs-table td {
    border: 1px solid #e4e4e4;
    padding: 0.6rem 0.75rem;
    text-align: left;
    vertical-align: middle;
  }

  .needs-table th {
    background: #f2f2f2;
    font-weight: 600;
    text-align: center;
  }

  .needs-table th .column-total {
    display: block;
    font-size: 0.75rem;
    font-weight: normal;
    font-style: italic;
    color: #666;
    margin-top: 0.25rem;
    line-height: 1.3;
  }

  .needs-table td.need-name {
    font-weight: 500;
    width: 22%;
  }

  .needs-table td.time-input-cell {
    text-align: left;
    white-space: normal;
  }

  .line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.1rem;
    margin-bottom: 0.15rem;
  }

  .label-mini {
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.15rem;
  }

  .time-input-cell input[type="number"] {
    padding: 0.25rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 0.8rem;
    text-align: right;
  }

  .time-input-cell .time-input-small {
    width: 3.2rem;
  }

  .time-input-cell span {
    font-size: 0.75rem;
    margin: 0 0.1rem;
  }

  /* Widen nighttime support fields */
  .active-waiting-hours,
  .active-waiting-minutes,
  .active-waiting-nights,
  .passive-waiting-hours,
  .passive-waiting-minutes,
  .passive-waiting-nights {
    width: 6rem !important;
    padding: 0.4rem !important;
  }

  .count-input {
    width: 3.2rem;
  }

  .freq-mode {
    font-size: 0.75rem;
    padding: 0.1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
  }

  .double-cell {
    text-align: center;
    width: 8%;
  }

  .double-cell input {
    transform: scale(1.1);
    cursor: pointer;
  }

  .avg-cell {
    text-align: center;
    font-size: 0.75rem;
    color: #333;
    white-space: nowrap;
  }

  .avg-time {
    display: inline-block;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #fafafa;
  }

  .avg-week-cell {
    text-align: center;
    font-size: 0.75rem;
    color: #333;
    white-space: nowrap;
  }

  .avg-week {
    display: inline-block;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #f2f8ff;
  }

  .holiday-list {
    padding: 0.75rem 1rem;
    background: #f9f9f9;
    border-left: 3px solid #1b5e20;
    border-radius: 6px;
    max-height: 60vh;
    overflow-y: auto;
    min-width: 280px;
  }

  .holiday-list ul {
    font-size: 0.85rem;
    color: #666;
    margin-left: 0.25rem;
  }

  .double-fields {
    display: none;
  }

  .need-row.double-enabled .double-fields {
    display: block;
  }

  .add-row-btn {
    margin: 0.25rem 0 0.75rem;
    font-size: 0.8rem;
    border-radius: 999px;
    border: 1px solid #ccc;
    background: #f7f7f7;
    padding: 0.25rem 0.8rem;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
  }

  .add-row-btn:hover {
    background: #ececec;
    border-color: var(--accent-color);
  }

  .custom-name-input {
    width: 100%;
    padding: 0.25rem 0.3rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 0.8rem;
  }

  .results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
  }

  .results-grid.summary-grid .result-box {
    background: #ffffff;
    border: 2px solid rgba(32, 58, 67, 0.2);
    box-shadow: 0 3px 10px rgba(32, 58, 67, 0.08);
    transition: all 0.2s ease;
  }

  .results-grid.summary-grid .result-box:hover {
    box-shadow: 0 5px 16px rgba(32, 58, 67, 0.12);
    transform: translateY(-2px);
  }

  .results-grid.summary-grid .result-box.highlight {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3e0 100%);
    border: 2px solid var(--accent-color);
    box-shadow: 0 4px 16px rgba(245, 166, 35, 0.25);
  }

  .results-grid.summary-grid .result-box.highlight:hover {
    box-shadow: 0 6px 20px rgba(245, 166, 35, 0.3);
    transform: translateY(-2px);
  }

  .results-grid.summary-grid .result-box .result-label {
    color: #1f3a61;
    font-weight: 600;
    font-size: 0.8rem;
  }

  .results-grid.summary-grid .result-box.highlight .result-label {
    color: #8a4b00;
  }

  .results-grid.summary-grid .result-box.highlight .result-value {
    color: #e65100;
  }

  .result-box {
    border-radius: 12px;
    padding: 0.9rem;
    background: #ffffff;
    border: 2px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    position: relative;
  }

  .result-box:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
  }

  .result-box-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    z-index: 10;
  }

  .result-box-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
  }

  .result-box-content {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
  }

  .result-box.collapsed .result-box-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
  }

  .result-box:not(.collapsed) .result-box-content {
    max-height: 2000px;
    opacity: 1;
  }

  .result-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.4rem;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.01em;
  }

  .result-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.2rem;
    line-height: 1.2;
  }

  .result-sub {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.1rem;
  }

  .result-sub-double {
    color: #2e7d32;
    font-weight: 600;
  }

  .result-math {
    font-size: 0.7rem;
    color: #444;
    margin-top: 0.4rem;
    padding: 0.4rem;
    border-top: none;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
    letter-spacing: 0.01em;
    background: #fafafa;
    border-radius: 6px;
  }

  .result-box.highlight .result-math {
    background: transparent;
    padding-top: 0.4rem;
    padding-bottom: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  /* Säkerställ korrekt flexbox-layout för återstående vaken tid beräkningar */
  #remainingAwakeTimeMathContainer>div,
  #finalBasicWeekMathContainer>div,
  #finalOtherWeekMathContainer>div,
  #finalTotalWeekMathContainer>div {
    display: flex !important;
    justify-content: space-between !important;
    flex-direction: row !important;
    margin-bottom: 0.3rem;
  }

  #remainingAwakeTimeMathContainer>div[style*="display: none"],
  #finalBasicWeekMathContainer>div[style*="display: none"],
  #finalOtherWeekMathContainer>div[style*="display: none"],
  #finalTotalWeekMathContainer>div[style*="display: none"] {
    display: none !important;
  }

  .hint {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
  }

  .category-summary {
    font-size: 0.9rem;
    color: #444;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    font-style: italic;
  }

  .category-summary-card {
    margin-top: 0.75rem;
    padding: 1rem;
    border: 2px solid rgba(32, 58, 67, 0.15);
    border-radius: 12px;
    background: #fffdfa;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
  }

  .category-summary-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.35rem;
  }

  .category-summary-text {
    color: #333;
    margin-bottom: 0.35rem;
  }

  .category-summary-double {
    color: #2e7d32;
    font-weight: 500;
    margin-bottom: 0.35rem;
  }

  .category-summary-math {
    font-size: 0.8rem;
    color: #555;
    font-style: italic;
  }

  .no-school-mode .school-column,
  .no-school-mode th.school-column,
  .no-school-mode td.school-column {
    display: none !important;
  }

  .no-school-mode .occup-field-group {
    display: none !important;
  }

  /* Day Type 3 Column Styling */
  .type3-column {
    background-color: #fff9c4 !important;
    border-left: 2px solid #f5a623 !important;
  }

  .type3-column th.type3-column,
  .type3-column td.type3-column {
    background-color: #fff9c4 !important;
  }

  /* Hide Day Type 3 by default - show only when toggle is checked */
  body:not(.show-day-type-3) .type3-column,
  body:not(.show-day-type-3) .day-type-3-settings {
    display: none !important;
  }

  /* Show Day Type 3 when toggle is checked */
  body.show-day-type-3 .type3-column {
    display: table-cell !important;
  }

  body.show-day-type-3 .day-type-3-settings {
    display: block !important;
  }

  /* Day Type 4 Column Styling */
  .type4-column {
    background-color: #e8f5e9 !important;
    border-left: 2px solid #2e7d32 !important;
  }

  .type4-column th.type4-column,
  .type4-column td.type4-column {
    background-color: #e8f5e9 !important;
  }

  /* Hide Day Type 4 by default - show only when toggle is checked */
  body:not(.show-day-type-4) .type4-column,
  body:not(.show-day-type-4) .day-type-4-settings {
    display: none !important;
  }

  /* Show Day Type 4 when toggle is checked */
  body.show-day-type-4 .type4-column {
    display: table-cell !important;
  }

  body.show-day-type-4 .day-type-4-settings {
    display: block !important;
  }

  /* Ensure table layout handles 4 columns gracefully */
  .needs-table {
    table-layout: auto;
    overflow-x: auto;
  }

  /* Narrower inputs for 4 columns on desktop */
  @media (min-width: 769px) {
    .needs-table .time-input-small {
      width: 2.6rem;
      font-size: 0.85rem;
    }
  }

  @media (max-width: 768px) {
    .needs-table {
      font-size: 0.8rem;
    }

    .type3-column {
      min-width: 180px;
    }

    .needs-table {
      display: block;
      overflow-x: auto;
      white-space: nowrap;
    }
  }

  .grand-card {
    border: 2px solid var(--accent-color);
    position: relative;
  }

  .grand-card::before {
    content: "Grand finale";
    position: absolute;
    top: -0.8rem;
    right: 1rem;
    background: var(--accent-color);
    color: #fff;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
  }

  .result-box.highlight {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3e0 100%);
    border: 2px solid var(--accent-color);
    box-shadow: 0 4px 16px rgba(245, 166, 35, 0.25);
  }

  .result-box.highlight:hover {
    box-shadow: 0 6px 20px rgba(245, 166, 35, 0.3);
    transform: translateY(-2px);
  }

  .calculator-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .reset-btn {
    background: #b00020;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
  }

  .reset-btn:hover {
    background: #d00030;
    transform: translateY(-1px);
  }

  .reset-btn:active {
    transform: translateY(0);
  }

  #calculationExplanationToggle.reset-btn:hover {
    background: #2e7d32;
  }

  .warning-message {
    color: var(--warning-color);
    font-size: 0.85rem;
    margin-top: 1rem;
  }

  .final-summary {
    font-size: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f7f7f7;
    border-radius: 10px;
    border: 2px solid rgba(32, 58, 67, 0.2);
    border-left: 3px solid #203A43;
  }

  .invalid-input {
    border-color: var(--warning-color) !important;
  }

  .valid-input {
    border-color: var(--success-color) !important;
    transition: border-color var(--transition);
  }

  .results-grid.grouped {
    border: 1px solid rgba(32, 58, 67, .1);
    background: #fafbfc;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
    margin-top: .5rem;
  }

  .screen-only {
    display: block;
  }

  .print-only {
    display: none;
  }

  @media print {
    #keyFieldsReminder {
      display: none !important;
    }

    .calculator,
    .calculator-header,
    .screen-only,
    .sidebar-toggle,
    .sticky-sidebar,
    .info-tip-toggle,
    .info-tip-box,
    .notes-toggle,
    .category-notes,
    .explanation-overlay,
    .explanation-popup,
    button,
    .reset-btn {
      display: none !important;
    }

    .print-only {
      display: block !important;
    }

    body {
      background: white;
    }

    .print-only h1 {
      color: #203A43;
      border-bottom: 3px solid #F5A623;
      padding-bottom: 0.5rem;
      margin-bottom: 1.5rem;
    }
  }

  .sticky-sidebar {
    display: none;
  }

  /* Sticky sidebar för mindre skärmar (1024px och uppåt) */
  @media (min-width: 1024px) {
    .sticky-sidebar {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      position: fixed;
      z-index: 100;
      width: 200px;
      top: 1rem;
      left: 1rem;
      max-height: calc(100vh - 2rem);
      overflow-y: auto;
    }

    .page-wrapper {
      margin-left: 220px;
      margin-right: 1rem;
      width: calc(100% - 240px);
      max-width: none;
    }

    .sticky-sidebar .result-box {
      padding: 0.5rem 0.6rem;
      border-radius: 6px;
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    }

    .sticky-sidebar .result-label {
      font-size: 0.7rem;
      line-height: 1.2;
      margin-bottom: 0.3rem;
    }

    .sticky-sidebar .result-value {
      font-size: 0.9rem;
      margin-bottom: 0.15rem;
    }

    .sticky-sidebar .result-sub {
      font-size: 0.65rem;
      margin-top: 0.05rem;
    }

    .sticky-sidebar .result-math {
      display: none;
    }

    .sticky-sidebar ul {
      margin-bottom: 0;
    }

    .sticky-sidebar .result-note {
      font-size: 0.7rem;
      margin-top: -0.5rem;
    }

    .sidebar-toggle {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      left: calc(200px + 1.5rem);
      bottom: 1rem;
    }

    .sidebar-collapsed .sidebar-toggle {
      left: 1rem;
      bottom: 1rem;
    }

    .sidebar-collapsed .sticky-sidebar {
      display: none;
    }

    .sidebar-collapsed .page-wrapper {
      margin-left: 1rem;
      margin-right: 1rem;
      width: calc(100% - 2rem);
      max-width: none;
    }
  }

  /* Sticky sidebar för större skärmar (1400px och uppåt) - mer utrymme */
  @media (min-width: 1400px) {
    .sticky-sidebar {
      width: 220px;
      top: 2rem;
      left: 2rem;
      gap: 1.5rem;
    }

    .page-wrapper {
      margin-left: 260px;
      margin-right: 2rem;
      width: calc(100% - 300px);
    }

    .sticky-sidebar .result-box {
      padding: 0.8rem 0.9rem;
    }

    .sticky-sidebar .result-label {
      font-size: 0.85rem;
    }

    .sticky-sidebar .result-value {
      font-size: 1.1rem;
    }

    .sticky-sidebar .result-sub {
      font-size: 0.75rem;
    }

    .sticky-sidebar .result-note {
      font-size: 0.75rem;
    }

    .sidebar-toggle {
      left: calc(220px + 2.5rem);
      bottom: 1.5rem;
    }

    .sidebar-collapsed .sidebar-toggle {
      left: 1.5rem;
      bottom: 1.5rem;
    }

    .sidebar-collapsed .page-wrapper {
      margin-left: 2rem;
      margin-right: 2rem;
      width: calc(100% - 4rem);
    }
  }

  /* -- NY CSS FÖR UTGRÅNING -- */
  .simplified-info-text {
    display: none;
    font-size: 0.8rem;
    color: #004d40;
    font-style: italic;
    padding: 0.5rem;
    background: #e0f2f1;
    border-radius: 4px;
    text-align: center;
  }

  .time-input-cell.simplified {
    background-color: #f8f8f8;
    opacity: 0.7;
    position: relative;
  }

  .time-input-cell.simplified .line,
  .time-input-cell.simplified .double-fields {
    display: none;
  }

  .time-input-cell.simplified .simplified-info-text {
    display: block;
  }

  /* -- SLUT PÅ NY CSS -- */
  .inline-warning {
    display: none;
    margin: 0.5rem 0 0.75rem;
    padding: 0.6rem 0.8rem;
    background: #fff3cd;
    border: 1px solid #ffb74d;
    color: #7a4700;
    border-radius: 6px;
    font-size: 0.85rem;
    box-shadow: 0 3px 10px rgba(122, 71, 0, 0.1);
  }

  .inline-warning.show {
    display: block;
  }

  /* ============================================
       AUTHENTICATION STYLES
       ============================================ */
  /* Auth Overlay */
  .auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2a4a56 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }

  .auth-overlay.hidden {
    display: none;
  }

  .auth-container {
    width: 100%;
    max-width: 450px;
  }

  .auth-header {
    text-align: center;
    color: white;
    margin-bottom: 2rem;
  }

  .auth-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: white;
  }

  .auth-header p {
    font-size: 1.1rem;
    opacity: 0.9;
  }

  /* Auth Box */
  .auth-box {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  }

  .auth-box h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.5rem;
  }

  /* Auth Form */
  .auth-form-group {
    margin-bottom: 1.5rem;
  }

  .auth-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
  }

  .auth-form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
  }

  .auth-form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
  }

  /* Auth Buttons */
  .auth-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }

  .auth-btn-primary {
    background: var(--primary-color);
    color: white;
  }

  .auth-btn-primary:hover {
    background: #2a4a56;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  .auth-btn-secondary {
    background: var(--border-color);
    color: var(--text-color);
  }

  .auth-btn-secondary:hover {
    background: #d0d0d0;
  }

  .auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
  }

  /* Auth Links */
  .auth-links {
    text-align: center;
    margin-top: 1rem;
  }

  .auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
  }

  .auth-links a:hover {
    color: #2a4a56;
    text-decoration: underline;
  }

  /* Auth Messages */
  .auth-error {
    padding: 0.75rem 1rem;
    background: #ffebee;
    border-left: 4px solid var(--danger-color);
    color: var(--danger-color);
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
  }

  .auth-success {
    padding: 0.75rem 1rem;
    background: #e8f5e9;
    border-left: 4px solid var(--success-color);
    color: var(--success-color);
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
  }

  /* Loading State */
  .auth-loading {
    text-align: center;
    color: white;
  }

  .auth-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
  }

  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }

  .auth-loading p {
    font-size: 1.1rem;
    opacity: 0.9;
  }

  /* Access Denied Screen */
  .access-denied-content {
    text-align: center;
    padding: 2rem 0;
  }

  .access-denied-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
  }

  .access-denied-content h2 {
    color: var(--danger-color);
    margin-bottom: 1rem;
  }

  .access-denied-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
  }

  /* User Info Bar */
  .user-info-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .user-info-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .user-info-email {
    font-weight: 600;
    font-size: 0.9rem;
  }

  .user-info-status {
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .user-info-status.trial {
    background: #fff3e0;
    color: var(--warning-color);
  }

  .user-info-status.paid {
    background: #e8f5e9;
    color: var(--success-color);
  }

  .user-info-logout {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .user-info-logout:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
  }

  /* Adjust page wrapper when user info bar is shown */
  body.logged-in .page-wrapper {
    margin-top: 60px;
  }

  body.logged-in .sticky-sidebar {
    top: 70px;
    max-height: calc(100vh - 90px);
  }

  /* Responsive Auth Styles */
  @media (max-width: 768px) {
    .auth-header h1 {
      font-size: 2rem;
    }

    .auth-box {
      padding: 2rem 1.5rem;
    }

    .user-info-bar {
      padding: 0.75rem 1rem;
      flex-direction: column;
      gap: 0.75rem;
    }

    .user-info-content {
      flex-direction: column;
      gap: 0.5rem;
      width: 100%;
      text-align: center;
    }

    body.logged-in .page-wrapper {
      margin-top: 100px;
    }
  }

  /* === Day Type UX Improvements === */
  .btn-add-daytype:hover {
    background: #f5f5f5 !important;
    border-color: #bbb !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  }

  .btn-add-daytype:active {
    transform: translateY(0);
  }

  .btn-add-daytype:disabled {
    transform: none;
    box-shadow: none;
  }

  .btn-remove-daytype:hover {
    text-decoration: underline;
    background: rgba(211, 47, 47, 0.05) !important;
    border-radius: 4px;
  }

  .days-budget-viz {
    background: #ffffff;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
  }

  .budget-bar {
    height: 100%;
    border-radius: 3px;
  }

  /* Animation for budget bar */
  @keyframes budgetPulse {
    0% {
      opacity: 1;
    }

    50% {
      opacity: 0.7;
    }

    100% {
      opacity: 1;
    }
  }

  .budget-error {
    animation: budgetPulse 2s infinite;
  }

  /* Highlight invalid inputs */
  .invalid-input {
    border-color: #d32f2f !important;
    background-color: #ffebee !important;
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.2);
  }