    /* =====================
    CSS RESET / BASE
    ===================== */
    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    html,
    body {
        margin: 0;
        padding: 0;
    }

    body {
        font-family: "Inter", system-ui, -apple-system, sans-serif;
        letter-spacing: 0.015em;
        background: #fafafa;
        color: #222;
        line-height: 1.5;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    h1, h3,
    .timetable,
    .form-row {
    font-family: "Oxanium", "Inter", sans-serif;
    letter-spacing: 0.02em;
    }

    /* =====================
    THEME TRANSITIONS
    ===================== */
    body,
    .form-section,
    input,
    select,
    button,
    th,
    td {
        transition:
            background-color 0.35s ease,
            color 0.35s ease,
            border-color 0.35s ease;
    }

    /* =====================
    LAYOUT
    ===================== */
    body>* {
        max-width: 1300px;
        margin-left: auto;
        margin-right: auto;
    }

    h1,
    h3 {
        font-weight: 500;
    }

    h1 {
        margin-top: 1.5rem;
        margin-bottom: 0.5rem;
    }

    h3 {
        margin-top: 0.25rem;
        margin-bottom: 0.5rem;
    }

    /* =====================
    FORM SECTIONS
    ===================== */
    .form-section {
        background: #ffffff;
        margin-left: auto;
        margin-right: auto;
        border: 1px solid #e5e5e5;
        border-radius: 10px;
        padding: 1rem;
        margin-bottom: 1.25rem;
    }

    .form-section p {
        margin-top: 0.25rem;
        margin-bottom: 0.5rem;
        color: #555;
    }

    /* Dynamic backend-injected rows */
    #slotInputs,
    #overrideInputs {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin: 0.75rem 0;
    }

    /* =====================
    FORM ROW (UNIFIED)
    ===================== */
    .form-row {
        display: grid;
        align-items: center;
        gap: 0.5rem;
        padding: 0.35rem 0;
    }

    .form-row .tt-data {
        display: contents;
    }

    /* Slot rows: exactly ONE select */
    .form-row:has(select.row_slot):not(:has(select.row_day)) {
        grid-template-columns:
            minmax(80px, 100px)
            /* Slot */
            minmax(100px, 130px)
            /* Course No */
            minmax(260px, 2fr)
            /* Course Name */
            minmax(140px, 1fr)
            /* Venue */
            28px;
        /* Close */
    }

    /* Override rows: Day + Slot */
    .form-row:has(select.row_day) {
        grid-template-columns:
            minmax(90px, 110px)
            /* Day */
            minmax(80px, 100px)
            /* Slot */
            minmax(100px, 130px)
            /* Course No */
            minmax(260px, 2fr)
            /* Course Name */
            minmax(140px, 1fr)
            /* Venue */
            28px;
        /* Close */
    }


    /* Flatten injected wrapper */
    .form-row .tt-data {
        display: contents;
    }

    .form-row input,
    .form-row select {
        width: 100%;
        max-width: 100%;
        height: 36px;
        padding: 0.45rem 0.6rem;
        border-radius: 6px;
        border: 1px solid #ccc;
        font-size: 0.9rem;
    }

    .row_course_name {
        font-weight: 500;
    }

    .row_venue {
        color: #555;
    }

    .row_day,
    .row_slot {
        font-weight: 500;
    }

    .close-btn {
        font-size: 18px;
        text-align: center;
        cursor: pointer;
        color: #aaa;
        user-select: none;
    }

    .close-btn:hover {
        color: #222;
    }

    .form-row {
        padding: 0.1rem 0;
    }


    /* =====================
    BUTTONS
    ===================== */
    button {
    appearance: none;
    border: 1px solid #d0d0d0;
    background: #ffffff;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    }

    /* Hover ONLY on non-touch devices */
    @media (hover: hover) and (pointer: fine) {
    button:hover {
        background: #f2f2f2;
    }
    }

    button:active {
    transform: translateY(1px);
    }

    /* =====================
    CHECKBOX GRID FIX
    ===================== */
    #use_mtech_slot {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 120px));
        gap: 0.5rem 1rem;
        align-items: center;
    }

    #use_mtech_slot label {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        white-space: nowrap;
    }

    /* =====================
    TIMETABLE WRAPPER
    ===================== */
    .timetable {
        border-collapse: collapse;
        margin-top: 1rem;
        font-variant: small-caps;
        font-size: 0.85rem;
    }

    /* Horizontal scroll on small screens */
    .timetable {
        width: 100%;
        max-width: 100%;
    }

    .timetable td {
        font-size: clamp(0.55rem, 0.9vw, 0.85rem);
    }

    table {
        border-collapse: collapse;
    }

    th,
    td {
        border: 0px solid #bdbdbd;
        padding: 0.4rem;
        text-align: center;
        min-width: 100px;
    }

    /* Wrapper for scrolling */
    table {
        display: block;
        overflow-x: auto;
    }

    /* =====================
    COLOR CLASSES
    ===================== */

    .yellow       { background: #fff59a; }
    .orange       { background: #ffc48a; }
    .lavender     { background: #c1b0e0; }
    .sky          { background: #b7dfea; }
    .pink         { background: #f6d8c6; }
    .gray         { background: #d2b5b4; }
    .lite_green   { background: #dfe8c8; }
    .green        { background: #bfe3b8; }
    .lite_blue    { background: #d3edf6; }
    .blue         { background: #b7c9e8; }
    .mossgreen    { background: #d2cc9f; }
    .red          { background: #e4b1af; }
    .sandal       { background: #fff6df; }
    .lite_yellow  { background: #fff6b3; }
    .gray_light   { background: #f4f1ee; }

    /* =====================
    PRINT STYLES
    ===================== */
    .only-print {
        display: none;
    }

    @media print {
        .no-print {
            display: none !important;
        }

        .only-print {
            display: block;
        }

        body {
            background: #ffffff;
            margin: 0;
        }

        table {
            display: table;
            width: 100%;
            min-width: unset;
        }
    }

    /* =====================
    RESPONSIVE TWEAKS
    ===================== */

    @media (max-width: 768px) {
        .form-row {
            grid-template-columns: 1fr 1fr !important;
        }

        .row_course_name,
        .row_venue {
            grid-column: span 2;
        }

        .close-btn {
            justify-self: end;
        }

        h1 {
            font-size: 1.4rem;
        }

        h3 {
            font-size: 1.05rem;
        }

        button {
            margin-bottom: 0.4rem;
        }

        #timetable {
            display: block;
            max-width: 100%;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
        }

        body {
            overflow-x: hidden;
        }

    }

    @media (max-width: 480px) {
        body {
            padding: 0.5rem;
        }

        button {
            width: 100%;
        }
    }

    /* =====================
   DARK MODE (SYSTEM DEFAULT)
===================== */
    @media (prefers-color-scheme: dark) {
        body:not(.light-mode) {
            background: #1a1a1a;
            color: #e5e5e5;
        }

        body:not(.light-mode) h1,
        body:not(.light-mode) h3 {
            color: #f0f0f0;
        }

        body:not(.light-mode) .form-section {
            background: #252525;
            border-color: #2a2a2a;
        }

        body:not(.light-mode) .form-section p {
            color: #b5b5b5;
        }

        body:not(.light-mode) input,
        body:not(.light-mode) select {
            background: #222222;
            color: #e5e5e5;
            border-color: #6b6b6b;
        }

        body:not(.light-mode) input::placeholder {
            color: #888;
        }

        body:not(.light-mode) button {
            background: #3a3a3a;
            color: #e5e5e5;
            border-color: #3a3a3a;
        }

        body:not(.light-mode) button:hover {
            background: #2a2a2a;
        }

        body:not(.light-mode) .close-btn {
            color: #777;
        }

        body:not(.light-mode) .close-btn:hover {
            color: #fff;
        }

        body:not(.light-mode) th,
        body:not(.light-mode) td {
            border-color: #3a3a3a;
        }

        body:not(.light-mode) .yellow       { background: #a79604; color: #f0fffc; }
        body:not(.light-mode) .orange       { background: #b76a2f; color: #fff3e0; }
        body:not(.light-mode) .lavender     { background: #5f4a7a; color: #f3e8ff; }
        body:not(.light-mode) .sky          { background: #2f6f85; color: #e1f5fe; }
        body:not(.light-mode) .pink         { background: #9b6b4d; color: #fce4ec; }
        body:not(.light-mode) .gray         { background: #4e1e1b; color: #f0f0f0; }
        body:not(.light-mode) .lite_green   { background: #4e6a3a; color: #e8f5e9; }
        body:not(.light-mode) .green        { background: #275822; color: #e8f5e9; }
        body:not(.light-mode) .lite_blue    { background: #254d58; color: #e3f2fd; }
        body:not(.light-mode) .blue         { background: #00163f; color: #e3f2fd; }
        body:not(.light-mode) .mossgreen    { background: #5a5430; color: #f1f8e9; }
        body:not(.light-mode) .red          { background: #8f1713; color: #ffebee; }
        body:not(.light-mode) .sandal       { background: #4a4434; color: #efebe9; }
        body:not(.light-mode) .lite_yellow  { background: #6b641e; color: #fffde7; }
        body:not(.light-mode) .gray_light   { background: #2a2a2a; }
    }


    /* =====================
   THEME TOGGLE
===================== */
    .theme-toggle {
        display: flex;
        justify-content: left;
        margin: 0.5rem 0;
    }

    .theme-toggle label {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        font-size: 0.85rem;
        cursor: pointer;
        user-select: none;
    }

    /* =====================
   DARK MODE TOGGLE UI
===================== */
    .theme-switch {
        position: relative;
        width: 60px;
        height: 32px;
    }

    .theme-switch input {
        display: none;
    }

    .theme-switch .slider {
        position: relative;
        width: 100%;
        height: 100%;
        background: #ddd;
        border-radius: 999px;
        cursor: pointer;
        transition: background 0.35s ease;
    }

    .theme-switch .icon {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        font-size: 12px;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 2;
        /* icons ABOVE knob */
    }


    .theme-switch .sun {
        left: 8px;
        opacity: 1;
    }

    .theme-switch .moon {
        right: 8px;
        opacity: 0;
    }

    /* Knob */
    .theme-switch .slider::before {
        content: "";
        position: absolute;
        top: 3px;
        left: 3px;
        width: 25px;
        height: 26px;
        background: #fff;
        border-radius: 50%;
        transition: transform 0.1s ease;
        z-index: 1;
    }

    /* Checked (dark mode) */
    .theme-switch input:checked+.slider {
        background: #555;
    }

    .theme-switch input:checked+.slider::before {
        background: #1e1e1e;
        transform: translateX(29px);
    }

    .theme-switch input:checked+.slider .sun {
        opacity: 0;
    }

    .theme-switch input:checked+.slider .moon {
        opacity: 1;
    }

    /* =====================
   LINK COLORS
===================== */
    a {
        color: #1565c0;
        text-decoration: none;
    }

    a:hover {
        text-decoration: underline;
    }

    @media (prefers-color-scheme: dark) {
        body:not(.light-mode) a {
            color: #90caf9;
        }

        body:not(.light-mode) a:hover {
            color: #bbdefb;
        }
    }

/* =====================
   MODERN CHECKBOX FIX
   Light + Dark Mode
===================== */

/* Base reset + sizing */
.resp_checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 4px;
  border: 2px solid var(--cb-border);
  background: var(--cb-bg);
  color: var(--cb-check);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease;
}

/* Checkmark */
.resp_checkbox::before {
  content: "";
  width: 10px;
  height: 10px;
  background: currentColor;
  border-radius: 2px;
  transform: scale(0);
  transition: transform 0.12s ease-in-out;
}

.resp_checkbox:checked::before {
  transform: scale(1);
}

/* Hover / focus / active */
.resp_checkbox:hover {
  border-color: currentColor;
}

.resp_checkbox:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--cb-focus);
}

.resp_checkbox:active {
  transform: scale(0.95);
}

/* Label alignment */
label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

/* =====================
   LIGHT MODE VARIABLES
===================== */
body {
  --cb-border: #aaa8a8;
  --cb-bg: #ffffff;
  --cb-check: #797979;
  --cb-focus: rgba(0, 0, 0, 0.15);
}

/* =====================
   DARK MODE VARIABLES
===================== */

/* SYSTEM DARK (only if user didn't force light) */
@media (prefers-color-scheme: dark) {
  body:not(.light-mode) {
    --cb-border: #666666;
    --cb-bg: #1e1e1e;
    --cb-check: #d4d4d4;
    --cb-focus: rgba(255, 255, 255, 0.25);
  }
}

/* =====================
   PRINT SAFETY
===================== */
@media print {
  input[type="checkbox"] {
    border: 1px solid #000;
    box-shadow: none !important;
  }
}


    /* Manual override */
    body.dark-mode a {
        color: #90caf9;
    }

    body.dark-mode a:hover {
        color: #bbdefb;
    }

.td-muted {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.05);
  color: #a5a5a5;
  background-color: #ececec;
}

/* Dark mode tuning */
body:not(.light-mode) .td-muted {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
  color: #999999;
  background-color: #292929;
}