/* components.css */
/* Contains styles for reusable UI elements and specific components */
/* like forms, buttons, tables, cards, modals, etc. */

/* --- Form Elements --- */
.input-group {
    margin-bottom: 15px;
}
.input-group small {
    display: block;
    font-size: 0.85em;
    color: var(--dark-gray);
    margin-top: 3px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 10px; /* Base padding */
    border: 1px solid var(--input-border-color);
    border-radius: 4px;
    box-sizing: border-box;
    background-color: var(--background-color); /* Match page background */
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.2s ease;
    min-height: 40px; /* Ensure consistent height */
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color); /* Highlight border on focus */
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2); /* Add a subtle focus ring */
}

.input-group input[type="radio"] {
     width: auto; /* Don't force full width */
     margin-right: 5px;
     vertical-align: middle;
}
.input-group label[for="snowball"],
.input-group label[for="avalanche"] {
     display: inline-block; /* Keep label next to radio */
     font-weight: normal;
     margin-bottom: 0;
     vertical-align: middle;
     cursor: pointer; /* Indicate clickable label */
}
/* Add some spacing between radio options */
.input-group div + div {
    margin-top: 5px;
}

/* --- Buttons --- */
button {
    background-color: var(--primary-color);
    color: var(--button-text-color);
    border: none;
    padding: 10px 18px; /* Slightly more padding */
    border-radius: 5px; /* Slightly more rounded */
    cursor: pointer;
    font-weight: bold;
    margin-right: 8px; /* Adjust spacing */
    margin-top: 10px;
    transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.1s ease;
    box-sizing: border-box;
    min-height: 40px;
    vertical-align: bottom;
}
button:hover {
     opacity: 0.85; /* Slightly more pronounced hover */
}
button:active {
    transform: scale(0.98); /* Add a subtle press effect */
}

#theme-toggle {
     background-color: var(--secondary-color);
     position: fixed;
     top: 15px;
     right: 15px;
     z-index: 1000;
     padding: 8px 12px;
     font-size: 0.9em;
     min-height: auto; /* Override general button min-height */
 }
#recalculate {
    background-color: var(--accent-color);
}
#recalculate:hover {
     opacity: 0.85;
}

/* Export Buttons */
.export-button {
    background-color: var(--secondary-color);
    color: var(--button-text-color);
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 15px;
    margin-bottom: 10px;
    margin-right: 5px;
    transition: background-color 0.2s ease;
    display: inline-block;
    min-height: auto;
    vertical-align: middle;
}
.export-button:hover {
     opacity: 0.9;
}

.remove-snowflake-btn { /* Moved from snowflake.css as it's a button type */
    background-color: var(--accent-color);
    color: var(--button-text-color);
    border: none;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    margin-left: 10px;
    margin-top: 0;
    min-height: auto;
    vertical-align: middle;
    transition: opacity 0.2s ease;
}
.remove-snowflake-btn:hover { opacity: 0.8; }


/* --- Tables --- */
table {
    width: 100%;
    border-collapse: collapse; /* Use collapse for cleaner borders */
    margin-top: 15px;
    border-spacing: 0; /* Remove spacing with border-collapse */
}
th, td {
    padding: 10px 12px; /* Consistent padding */
    text-align: left;
    border-bottom: 1px solid var(--table-border-color);
    white-space: nowrap; /* Ensure no wrapping BY DEFAULT */
    vertical-align: middle; /* Align text vertically */
}
th {
    background-color: var(--light-gray);
    font-weight: bold;
    color: var(--text-color); /* Ensure header text is readable */
    position: sticky; /* Make header sticky on scroll if needed */
    top: 0; /* Required for sticky */
    z-index: 2; /* Ensure header is above body rows */
}
/* Add zebra striping for better readability (Applies to tables *not* explicitly excluded) */
/* Exclude comparison table from zebra striping */
table:not(.comparison-table) tbody tr:nth-child(even) {
    background-color: var(--light-gray);
    transition: background-color 0.3s ease;
}
tbody tr:hover {
    background-color: var(--medium-gray); /* Highlight row on hover */
    transition: background-color 0.1s ease;
}

/* Comparison Table Specifics */
.comparison-table th, .comparison-table td {
    text-align: center;
    border: 1px solid var(--table-border-color); /* Keep border for comparison */
    vertical-align: top; /* Align content to top */
}
.comparison-table td:first-child, .comparison-table th:first-child {
    text-align: left;
    font-weight: bold;
}
/* Remove explicit background for comparison table rows to avoid conflict */
.comparison-table tbody tr {
    background-color: transparent; /* Use default background */
}
/* Keep hover effect for comparison table */
.comparison-table tbody tr:hover {
    background-color: var(--medium-gray);
}


/* --- Debt Entry & Rate Change --- */
.debt-entry {
    background-color: var(--light-gray);
    padding: 20px; /* Increase padding */
    border-radius: 8px;
    margin-bottom: 20px; /* Increase spacing */
    border: 1px solid var(--medium-gray); /* Add subtle border */
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.rate-change-group {
    border-left: 3px solid var(--secondary-color);
    padding-left: 15px; /* Increase padding */
    margin-top: 15px; /* Increase spacing */
    background-color: rgba(41, 128, 185, 0.05); /* Subtle background hint */
    border-radius: 0 4px 4px 0; /* Match outer radius */
    padding-top: 10px;
    padding-bottom: 5px;
}

/* --- Recommendation Box --- */
.recommendation {
    margin-top: 30px; /* More space above */
    padding: 20px;
    background-color: var(--recommendation-bg);
    border: 1px solid var(--recommendation-border);
    border-radius: 5px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.recommendation h3 {
    color: var(--primary-color);
    margin-top: 0;
    border-bottom: none; /* Remove border from h3 inside recommendation */
    padding-bottom: 0;
}
.recommendation ul {
    padding-left: 20px;
    margin-top: 0.5em;
    margin-bottom: 1em;
    list-style: disc;
}
.recommendation li { margin-bottom: 0.5em; }
.recommendation p {
    line-height: 1.7;
    /* Ensure pre-wrap works for newlines in recommendation text */
    white-space: pre-wrap;
}
/* Style bold text used for subheadings */
.recommendation p strong {
    color: var(--primary-color); /* Or another distinct color */
    font-weight: bold;
    display: block; /* Put subheading on its own line */
    margin-top: 0.8em; /* Space above subheading */
    margin-bottom: 0.3em; /* Space below subheading */
}
/* Adjust first strong element if needed */
.recommendation p strong:first-of-type {
    margin-top: 0;
}


/* --- Story Box --- */
 .story {
    background-color: var(--story-bg);
    border-left: 5px solid var(--story-border);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.story p { margin-top: 5px; line-height: 1.5; }
.story h4 { margin-top: 0; margin-bottom: 8px; } /* Adjust story heading */

/* --- Educational Resources Links & Tips --- */
.educational-resources ul { list-style: disc; padding-left: 25px; margin-top: 0.5em; margin-bottom: 1.5em; }
.educational-resources li { margin-bottom: 0.7em; }
.educational-resources a { color: var(--resource-link-color); text-decoration: none; transition: color 0.2s ease; }
.educational-resources a:hover { color: var(--resource-link-hover); text-decoration: underline; }
.educational-resources strong { color: var(--secondary-color); }

/* --- Value Proposition / Trust Signal --- */
.value-list {
    list-style: none; /* Remove default bullets */
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Space between list items */
}
.value-list li {
    display: flex; /* Align icon and text */
    align-items: flex-start; /* Align items to the top */
    gap: 8px; /* Space between icon and text */
    font-size: 0.95em;
    line-height: 1.5;
    color: var(--text-color);
}
.value-icon {
    flex-shrink: 0; /* Prevent icon from shrinking */
    width: 16px;
    height: 16px;
    margin-top: 3px; /* Adjust vertical alignment */
    color: var(--primary-color); /* Use theme color for icon */
}
.trust-signal {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--light-gray); /* Subtle background */
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9em;
    color: var(--text-color);
    margin-top: 10px; /* Space above trust signal */
    border: 1px solid var(--medium-gray);
}
body.dark-mode .trust-signal {
     background-color: var(--medium-gray);
     border-color: var(--dark-gray);
}
.trust-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--dark-gray); /* Use a more neutral color */
}
body.dark-mode .trust-icon {
    color: var(--text-color);
}
.trust-signal span {
    flex-grow: 1; /* Allow text to take remaining space */
}
.privacy-link {
    font-size: 0.9em;
    color: var(--footer-link);
    text-decoration: underline;
    white-space: nowrap; /* Prevent wrapping */
}
.privacy-link:hover {
    color: var(--footer-link-hover);
}
.resource-button { /* Button within value column */
    display: inline-block; /* Treat like a button */
    background-color: var(--secondary-color); /* Use secondary color */
    color: var(--button-text-color);
    padding: 10px 18px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin-top: auto; /* Push button towards the bottom */
}
.resource-button:hover {
    background-color: #2471a3; /* Darken secondary color on hover */
     opacity: 0.9;
}
body.dark-mode .resource-button:hover {
    background-color: #5dade2; /* Lighten secondary color on hover */
}
.resource-button:active {
    transform: scale(0.98);
}

/* --- Blog Card Styles (General) --- */
.blog-posts-container { /* Grid container */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px; /* Space between cards */
}
.blog-post-card {
    display: block; /* Make the anchor a block element */
    text-decoration: none; /* Remove underline from link */
    color: inherit; /* Inherit text color */
    background-color: var(--background-color); /* Card background */
    border: 1px solid var(--medium-gray); /* Card border */
    border-radius: 8px; /* Rounded corners */
    overflow: hidden; /* Ensure image corners are clipped */
    box-shadow: 0 2px 5px var(--container-shadow); /* Subtle shadow */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.blog-post-card:hover {
    transform: translateY(-5px); /* Lift card slightly on hover */
    box-shadow: 0 6px 15px var(--container-shadow); /* Enhance shadow on hover */
}
.card-image {
    width: 100%;
    aspect-ratio: 16 / 10; /* Adjust as needed */
    overflow: hidden; /* Hide parts of image that overflow */
}
.card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the area, cropping if necessary */
    transition: transform 0.3s ease;
}
.blog-post-card:hover .card-image img {
    transform: scale(1.05); /* Slightly zoom image on card hover */
}
.card-content {
    padding: 15px 20px 20px 20px; /* Padding inside the card below image */
}
.card-category {
    display: inline-block; /* Treat as block but only take needed width */
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--secondary-color); /* Use secondary color */
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.card-title {
    font-size: 1.2rem; /* Adjust title size */
    font-weight: 600; /* Slightly less bold than h2 */
    color: var(--text-color); /* Main text color */
    margin-top: 0;
    margin-bottom: 10px;
    line-height: 1.4;
    color: inherit; /* Inherit color from parent anchor */
}
.card-date {
    font-size: 0.85em;
    color: var(--dark-gray); /* Use subdued text color */
    display: block; /* Put date on its own line */
}
.card-excerpt {
    font-size: 0.95em;
    color: var(--dark-gray);
    margin-top: 10px;
    line-height: 1.5;
}

/* --- Blog Card in Sidebar --- */
.sidebar-blog-card {
    margin-top: 20px; /* Add space above the card */
    margin-bottom: 10px; /* Add space below the card */
}
.sidebar-blog-card h4 {
    margin-bottom: 10px;
    font-size: 1em; /* Slightly smaller heading */
    color: var(--secondary-color);
    text-align: left;
    border-bottom: none; /* Remove border if not desired here */
    padding-bottom: 0;
}
.sidebar-blog-card .blog-post-card {
    box-shadow: 0 1px 3px var(--container-shadow); /* Less shadow */
}
.sidebar-blog-card .blog-post-card:hover {
     transform: translateY(-2px); /* Less hover */
     box-shadow: 0 3px 8px var(--container-shadow);
}

/* --- Blog Card Button (for Modal Trigger) --- */
.blog-card-button {
    /* Reset button defaults */
    border: none;
    padding: 0;
    margin: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    width: 100%; /* Make button take full width of its container */
    display: block; /* Ensure it behaves like the card link */
}
.blog-card-button:focus {
    outline: 2px solid var(--primary-color); /* Example focus outline */
    outline-offset: 2px;
}
.blog-card-button:focus:not(:focus-visible) {
     outline: none; /* Remove outline for mouse clicks if desired */
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed; /* Stay in place */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent black background */
    display: flex; /* Use flexbox for centering */
    align-items: center;
    justify-content: center;
    z-index: 1001; /* Ensure it's above other content */
    opacity: 0; /* Hidden by default */
    visibility: hidden; /* Hidden by default */
    transition: opacity 0.3s ease, visibility 0.3s ease; /* Smooth transition */
}
.modal-overlay:not(.hidden) { /* Style when modal is shown */
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background-color: var(--background-color); /* Use theme background */
    color: var(--text-color); /* Use theme text color */
    padding: 30px 40px; /* Generous padding */
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    width: 90%; /* Responsive width */
    max-width: 700px; /* Max width */
    max-height: 85vh; /* Max height, allows scrolling */
    overflow-y: auto; /* Enable vertical scroll if content overflows */
    position: relative; /* Needed for absolute positioning of close button */
    transform: scale(0.95); /* Start slightly scaled down */
    transition: transform 0.3s ease;
}
.modal-overlay:not(.hidden) .modal-content {
    transform: scale(1); /* Scale to full size when shown */
}
.modal-close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem; /* Large close icon */
    font-weight: bold;
    color: var(--dark-gray);
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: color 0.2s ease;
}
.modal-close-button:hover {
    color: var(--primary-color); /* Use theme color on hover */
}
body.dark-mode .modal-close-button:hover {
     color: var(--primary-color); /* Ensure hover works in dark mode */
}
.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--primary-color); /* Theme color for heading */
    border-bottom: 1px solid var(--medium-gray);
    padding-bottom: 10px;
}
.modal-content p {
    line-height: 1.7;
    margin-bottom: 15px;
}
.modal-content ol,
.modal-content ul {
    padding-left: 30px; /* Indent lists */
    margin-bottom: 15px;
}
.modal-content li {
    margin-bottom: 10px; /* Space between list items */
}
.modal-content ul ul { /* Nested lists */
    margin-top: 5px;
    margin-bottom: 8px;
}
.modal-content strong {
    color: var(--secondary-color); /* Highlight strong text */
}

/* --- Pagination Styles --- */
.pagination {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--medium-gray);
}
.page-link {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid var(--medium-gray);
    border-radius: 4px;
    text-decoration: none;
    color: var(--footer-link); /* Use footer link color */
    background-color: var(--background-color);
    transition: background-color 0.2s ease, color 0.2s ease;
}
.page-link:hover {
    background-color: var(--light-gray);
    color: var(--primary-color);
    border-color: var(--dark-gray);
}
.page-link.current {
    background-color: var(--primary-color);
    color: var(--button-text-color);
    border-color: var(--primary-color);
    font-weight: bold;
}

/* --- Utility Classes --- */
.hidden { display: none; }

.time-from-today {
    display: block;
    font-size: 0.9em;
    color: var(--dark-gray);
    margin-top: 4px;
    white-space: normal; /* Allow wrapping */
}
.results-summary p { margin-bottom: 0.8em; }

/* Placeholder styling for ad blocks (if used) */
.ad-placeholder {
    border: 1px dashed var(--dark-gray);
    background-color: var(--light-gray);
    min-height: 250px; /* Example height */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--dark-gray);
    font-size: 0.9em;
    border-radius: 4px;
    width: 100%; /* Make placeholder take full width of ad column */
}
/* ... other component styles ... */

/* Style for the local storage note below Save/Load buttons */
.local-storage-note {
    margin-top: 15px; /* Add some space above the note */
    margin-bottom: 0; /* Reset bottom margin if needed */
    text-align: center; /* Center the text */
    font-size: 0.85em; /* Make it slightly smaller */
    color: var(--dark-gray); /* Use a subdued color */
    padding: 0 10px; /* Add some horizontal padding */
}

.local-storage-note small {
    line-height: 1.4; /* Adjust line height for readability */
}

/* --- Ad Placeholder Styles --- */
.ad-placeholder {
    border: 1px dashed var(--medium-gray);
    background-color: var(--light-gray);
    padding: 10px;
    text-align: center;
    font-size: 0.9em;
    color: var(--dark-gray);
    border-radius: 4px;
    margin: 25px auto; /* Add vertical margin and center horizontally */
    display: flex; /* Use flexbox for centering content */
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden; /* Hide overflow */
}
/* Dark mode adjustments */
body.dark-mode .ad-placeholder {
     background-color: var(--medium-gray);
     border-color: var(--dark-gray);
     color: var(--text-color);
}

.ad-placeholder a {
    color: inherit; /* Inherit color from placeholder */
    text-decoration: none;
    font-weight: bold;
    display: block; /* Ensure link fills container */
    width: 100%;
    height: 100%;
    line-height: 1.5; /* Improve text spacing */
    padding: 5px; /* Add padding inside link for better centering */
    box-sizing: border-box;
}
.ad-placeholder a:hover {
    text-decoration: underline;
}

.ad-banner {
    min-height: 90px; /* For 728x90 or similar */
    /* Adjust line-height specifically if needed for taller banners */
    /* max-width: 728px; */ /* Example */
    max-width: 970px; /* Allow wider banner */
    width: 100%; /* Take available width */
}

.ad-square {
    width: 300px;
    height: 250px;
    max-width: 100%; /* Ensure it doesn't overflow container on small screens */
}
/* Adjust link line-height for square ad if text centering looks off */
.ad-square a {
    /* line-height: 230px; */ /* Example if direct vertical center needed */
}


.ad-sticky-footer {
    height: 50px;
    margin: 0; /* Reset margin for sticky */
    border-radius: 0;
    border: none; /* Remove default border */
    border-top: 1px solid var(--medium-gray); /* Add top border */
}
body.dark-mode .ad-sticky-footer {
     border-top-color: var(--dark-gray);
}

/* --- Styling for Skipped Month Row in Monthly Schedule --- */
.skipped-month-row {
    background-color: var(--accent-color) !important; /* Use accent color for highlight */
    color: #333 !important; /* Dark text for non-sticky cells */
    font-style: italic;
}
/* Dark mode specific style for skipped row text (non-sticky cells) */
body.dark-mode .skipped-month-row {
    color: #111 !important; /* Darker text for better contrast on yellow in dark mode */
}
/* Adjust hover for skipped row if needed */
.skipped-month-row:hover {
    background-color: #d4ac0d !important; /* Darker yellow on hover */
}
body.dark-mode .skipped-month-row:hover {
    background-color: #e5b80b !important; /* Slightly lighter yellow on hover in dark mode */
}

/* --- FIX: Styling for Sticky Columns within Skipped Month Row --- */
.table-wrapper table#monthly-schedule tbody tr.skipped-month-row td:first-child,
.table-wrapper table#monthly-schedule tbody tr.skipped-month-row td:nth-child(2) {
    color: var(--text-color) !important; /* Override dark text, use default text color */
    background-color: var(--background-color) !important; /* Ensure sticky background overrides yellow */
}
/* FIX: Hover state for sticky columns within skipped month row */
.table-wrapper table#monthly-schedule tbody tr.skipped-month-row:hover td:first-child,
.table-wrapper table#monthly-schedule tbody tr.skipped-month-row:hover td:nth-child(2) {
    color: var(--text-color) !important; /* Keep text readable */
    background-color: var(--medium-gray) !important; /* Match general row hover background */
}


/* --- Styling for Table Footnote --- */
.table-footnote {
    font-size: 0.85em;
    color: var(--dark-gray);
    text-align: right;
    margin-top: 5px;
    padding-right: 10px;
}
.table-footnote small {
    font-style: italic;
}

/* --- Enhanced Styling for Consolidation Row --- */
#consolidation-row {
    /* background-color: var(--light-gray); */ /* Let it inherit default or comparison table style */
    border-top: 2px solid var(--secondary-color); /* Add a top border */
    border-bottom: 2px solid var(--secondary-color); /* Add a bottom border */
    font-weight: 500; /* Slightly bolder text */
}
/* Dark mode adjustment - remove explicit background */
/* body.dark-mode #consolidation-row {
    background-color: var(--medium-gray);
} */
#consolidation-row td {
    vertical-align: middle; /* Align content vertically */
}

/* --- Wrapper for Monthly Schedule Table Scroll --- */
.table-wrapper {
    overflow-x: auto; /* Enable horizontal scroll */
    margin-top: 10px; /* Add some space above the table */
    border: 1px solid var(--table-border-color); /* Add border around wrapper */
    border-radius: 4px; /* Optional: round corners */
    position: relative; /* Needed for scroll hint pseudo-element */
}
/* Ensure the table inside the wrapper takes necessary width */
.table-wrapper table#monthly-schedule {
    margin-top: 0; /* Reset margin for table inside wrapper */
    display: table; /* Override block display set earlier for general tables */
    white-space: nowrap; /* Keep nowrap */
    width: auto; /* Allow table to expand beyond container */
    min-width: 100%; /* Ensure it fills wrapper at minimum */
    border: none; /* Remove border from table itself if wrapper has one */
    border-collapse: separate; /* Use separate for better border control with colspan */
    border-spacing: 0;
}
.table-wrapper table#monthly-schedule th,
.table-wrapper table#monthly-schedule td {
     /* Keep padding and text-align */
     padding: 8px 10px; /* Slightly reduced padding */
     text-align: right; /* Right-align numbers */
     border-bottom: 1px solid var(--table-border-color);
     white-space: nowrap; /* Keep nowrap for data cells */
     vertical-align: middle;
}

/* --- Styling for Monthly Schedule Header (SINGLE ROW) --- */
.table-wrapper table#monthly-schedule thead .sticky-header-row th {
    /* background-color: var(--light-gray); */ /* OLD COLOR */
    background-color: #3a506b; /* <<< CHANGED: New background color for header */
    position: sticky;
    top: 0; /* Stick the single header row to the top */
    z-index: 3; /* Above sticky columns and body */
    text-align: center;
    font-weight: bold; /* Make headers bold */
    border-left: 1px solid var(--medium-gray); /* Add left border for separation */
    white-space: normal; /* Allow wrapping */
    vertical-align: bottom; /* Align text to bottom */
    padding-top: 6px; /* Adjust padding */
    padding-bottom: 6px;
    font-size: 0.9em; /* Slightly smaller font */
}
/* First header cell no left border */
.table-wrapper table#monthly-schedule thead .sticky-header-row th:first-child {
    border-left: none;
}

/* Styling for the debt group end border (last metric in group) */
.table-wrapper table#monthly-schedule thead th.debt-group-end,
.table-wrapper table#monthly-schedule tbody td.debt-group-end {
    border-right: 1px solid var(--medium-gray); /* Standard border */
}
/* Remove right border from the very last header cell (Total Remaining) */
.table-wrapper table#monthly-schedule thead .sticky-header-row th:last-child {
    border-right: none;
}


/* --- Styling for Sticky Columns (Month & Date) --- */
.table-wrapper table#monthly-schedule th:first-child, /* Month Header */
.table-wrapper table#monthly-schedule td:first-child, /* Month Data */
.table-wrapper table#monthly-schedule th:nth-child(2), /* Date Header */
.table-wrapper table#monthly-schedule td:nth-child(2) { /* Date Data */
    text-align: left; /* Left-align Month and Date */
    position: sticky;
    left: 0;
    background-color: var(--background-color); /* Match background */
    z-index: 1; /* Keep above non-sticky body cells */
    border-right: 1px solid var(--table-border-color); /* Separator */
    border-left: none; /* No left border for first column */
    white-space: nowrap; /* Prevent wrapping for Month/Date */
    vertical-align: middle; /* Ensure vertical alignment */
}
/* Adjust left position for the second sticky column */
.table-wrapper table#monthly-schedule th:nth-child(2),
.table-wrapper table#monthly-schedule td:nth-child(2) {
    /* Estimate width of first column (padding + text).
       This value might need manual adjustment based on font size/content.
       Alternatively, use JavaScript to calculate this dynamically. */
    left: 65px; /* ADJUST THIS VALUE based on the rendered width of the first column */
}

/* Ensure first two headers are above everything when scrolling */
.table-wrapper table#monthly-schedule thead .sticky-header-row th:first-child,
.table-wrapper table#monthly-schedule thead .sticky-header-row th:nth-child(2) {
    z-index: 4; /* Highest z-index */
    /* background-color: var(--light-gray); */ /* OLD COLOR */
    background-color: #3a506b; /* <<< CHANGED: Ensure consistent background for sticky headers */
    font-weight: bold; /* Keep Month/Date bold */
    white-space: nowrap; /* Prevent wrapping */
    vertical-align: middle; /* Center vertically */
    font-size: 1em; /* Reset font size if needed */
}


/* Zebra striping adjustment for sticky columns */
/* Apply zebra striping to monthly schedule table specifically */
.table-wrapper table#monthly-schedule tbody tr:nth-child(even) {
    background-color: var(--light-gray);
    transition: background-color 0.3s ease;
}
.table-wrapper table#monthly-schedule tbody tr:nth-child(even) td:first-child,
.table-wrapper table#monthly-schedule tbody tr:nth-child(even) td:nth-child(2) {
    background-color: var(--light-gray); /* Match even row background */
}
.table-wrapper table#monthly-schedule tbody tr:hover td:first-child,
.table-wrapper table#monthly-schedule tbody tr:hover td:nth-child(2) {
    background-color: var(--medium-gray); /* Match hover background */
}
/* Ensure hover applies to the whole row in monthly schedule */
.table-wrapper table#monthly-schedule tbody tr:hover {
    background-color: var(--medium-gray);
    transition: background-color 0.1s ease;
}

/* --- NEW: Visual Hint for Horizontal Scrolling --- */
.table-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px; /* Width of the fade effect */
    background: linear-gradient(to left, var(--background-color), rgba(255, 255, 255, 0)); /* Adjust gradient colors to match theme */
    pointer-events: none; /* Don't interfere with mouse events */
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s ease-in-out;
    /* Adjust based on scrollbar width if necessary */
    /* right: 15px; */
}
/* Show the hint only if scrolling is actually possible */
/* This requires knowing if scrollWidth > clientWidth, which is tricky in pure CSS. */
/* A simpler approach is to always show it if overflow-x is auto and content *might* overflow. */
/* Alternatively, JavaScript could add a class when scrolling is active. */
/* For simplicity, we'll assume it might scroll and let the browser handle visibility */

/* Dark mode adjustment for scroll hint gradient */
body.dark-mode .table-wrapper::after {
    background: linear-gradient(to left, var(--background-color), rgba(30, 39, 46, 0)); /* Use dark background */
}

/* Consider showing hint on hover/focus within wrapper if pure CSS activation needed */
/*
.table-wrapper:hover::after {
    opacity: 1;
}
*/