    body {
      font-family: Arial, sans-serif;
      margin: 20px;
      background-color: #f4f7f6;
      color: #333;
      font-size: 16px;
    }

    #app-container {
      max-width: 1000px;
      margin: 0 auto;
      padding: 20px;
      background-color: #ffffff;
      border-radius: 12px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    #header-container {
      display: flex;
      flex-direction: column;
      gap: 20px;
      margin-bottom: 20px;
    }

    #title h1 {
      font-size: 2.2em;
      font-weight: 700;
      color: #005EB8;
      margin: 0;
    }

    #main-content-row {
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 25px;
      width: 100%;
    }

    #explainer {
      border: 1px solid #005EB8;
      padding: 15px;
      background-color: #005EB8;
      color: white;
      border-radius: 8px;
      font-size: 0.95em;
      line-height: 1.5;
      flex: 1 1 auto;
      min-width: 0;
      min-height: 100px;
    }

    #explainer p { margin: 0 0 10px; }
    #explainer p:last-child { margin-bottom: 0; }

    /* --- STABLE TABLE STYLING --- */
    table {
      table-layout: fixed;
      border-collapse: separate;
      border-spacing: 0;
      width: 100%;
      margin-top: 20px;
      border-radius: 8px;
      border: 1px solid #e0e0e0;
      overflow: hidden;
    }

    th, td {
      border-bottom: 1px solid #e0e0e0;
      border-right: 1px solid #e0e0e0;
      padding: 12px 10px;
      text-align: center;
      overflow: hidden;
    }

    th:first-child, td:first-child {
      width: 40%;
      text-align: left;
      background-color: #fafafa;
      font-weight: 600;
    }

    th:nth-child(2), td:nth-child(2),
    th:nth-child(3), td:nth-child(3) {
      width: 30%;
    }

    th {
      background-color: #f0f0f0;
      font-weight: 700;
      color: #555;
    }

    /* Roles that do not exist in a given session */
    .na-cell {
      background-color: #f7f7f7;
      color: #595959; /* was #999, below WCAG AA contrast */
      font-size: 0.85em;
      font-style: italic;
    }

    /* --- Controls --- */
    .slider-box {
      display: flex;
      align-items: center;
      gap: 8px;
      width: 100%;
      justify-content: center;
    }

    input[type="range"] {
      width: 70%;
      min-width: 50px;
      accent-color: #005EB8;
    }

    input:focus-visible {
      outline: 3px solid #005EB8;
      outline-offset: 2px;
    }

    .val-label {
      font-weight: bold;
      color: #005EB8;
      min-width: 18px;
      display: inline-block;
    }

    .sup-status {
      font-size: 0.85em;
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 2.5em;
      color: #666;
      font-weight: 500;
      line-height: 1.2;
    }

    /* --- Routine-to-same-day conversions (day-level adjustment) --- */
    #conversion-box {
      margin-top: 20px;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      padding: 14px 16px;
      background-color: #f0f4ff;
    }

    #conversion-box .conv-row {
      display: flex;
      align-items: center;
      gap: 16px;
      flex-wrap: wrap;
    }

    #conversion-box label.conv-title {
      font-weight: 600;
      flex: 1 1 260px;
    }

    #conversion-box .conv-controls {
      display: flex;
      align-items: center;
      gap: 12px;
      flex: 1 1 300px;
    }

    #conversion-box input[type="range"] { flex: 1 1 auto; width: auto; }

    #converted_num {
      width: 4.5em;
      padding: 6px 8px;
      font-family: inherit;
      font-size: 1em;
      font-weight: 700;
      color: #005EB8;
      border: 1px solid #b8c4d6;
      border-radius: 4px;
      text-align: center;
    }

    #conversion-breakdown {
      margin-top: 8px;
      font-size: 0.85em;
      color: #555;
    }

    /* --- Recommendation Circle --- */
    /* Fixed-width column: the circle can never widen this container, which is
       what previously created a feedback loop with the explainer's height. */
    #recommendation-section {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 10px;
      flex: 0 0 170px;
      width: 170px;
    }

    #status-label {
      font-size: 0.75em;
      font-weight: 700;
      letter-spacing: 0.08em;
      color: white;
      padding: 4px 14px;
      border-radius: 20px;
      display: none;
    }

    #circle-caption {
      font-size: 0.7em;
      color: #666;
      text-align: center;
      line-height: 1.3;
    }

    #recommendation {
      font-weight: bold;
      text-align: center;
      color: white;
      border-radius: 50%;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
      display: flex;
      justify-content: center;
      align-items: center;
      width: 130px;
      height: 130px;
      font-size: 44px;
      transition: background-color 0.3s, width 0.2s, height 0.2s;
    }

    .bg-red { background-color: #DA291C; }
    .bg-amber { background-color: #ED8B00; }
    .bg-green { background-color: #009639; }
    .bg-black { background-color: #000000; }

    .controls-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 15px;
      margin-top: 15px;
      flex-wrap: wrap;
    }

    #legend {
      font-size: 0.8em;
      color: #666;
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }

    .legend-item { display: flex; align-items: center; gap: 5px; }

    .legend-dot {
      width: 11px;
      height: 11px;
      border-radius: 50%;
      display: inline-block;
    }

    .reset-btn {
      background-color: #666;
      color: white;
      border: none;
      padding: 8px 16px;
      border-radius: 4px;
      cursor: pointer;
      font-family: inherit;
      font-size: 0.95em;
    }

    .reset-btn:hover { background-color: #4d4d4d; }

    #criticalWarning {
      background-color: #DA291C;
      color: white;
      border: 2px solid #8f1a11;
      border-radius: 8px;
      padding: 12px 16px;
      font-size: 0.95em;
      line-height: 1.4;
    }

    #criticalWarning ul { margin: 8px 0 0; padding-left: 20px; }
    #criticalWarning li { margin-bottom: 4px; }

    #supervision-note {
      margin-top: 18px;
      font-size: 0.85em;
      color: #555;
      line-height: 1.5;
      border-left: 3px solid #005EB8;
      padding-left: 12px;
    }

    #supervision-note strong { color: #333; }

    /* Mobile Adjustments */
    @media (max-width: 650px) {
      #main-content-row { gap: 15px; }
      #recommendation-section { flex: 0 0 auto; width: auto; }
      #recommendation { width: 90px; height: 90px; font-size: 32px; }
      th:first-child, td:first-child { width: 35%; font-size: 0.8em; }
      .sup-status { font-size: 0.75em; }
    }

    @media (prefers-reduced-motion: reduce) {
      #recommendation { transition: none; }
    }
  
    /* Moved out of style attributes (the site's Content Security Policy blocks them) */
    tr.row-status { background-color: #fdfdfd; }
    tr.row-total { background-color: #f0f4ff; }

    /* Narrow phones: the table scrolls inside its own box instead of the whole page scrolling sideways */
    .table-scroll { overflow-x: auto; margin-top: 20px; }
    .table-scroll table { margin-top: 0; min-width: 0; }

    /* Small phones: stack the circle above the explainer, which was squeezed to a sliver beside it */
    @media (max-width: 480px) {
      body { margin: 8px; }
      #app-container { padding: 14px; }
      #main-content-row { flex-direction: column; align-items: stretch; }
      #recommendation-section { width: auto; }
    }
