:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-app: #f1f5f9;
    --bg-sidebar: #ffffff;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow: hidden;
    /* App-like feel */
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 320px;
    min-width: 320px;
    min-height: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    overflow: hidden;
    flex-shrink: 0;
}

/* Scrollable area so footer stays fixed when toggling edit on/off */
.sidebar-content {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.sidebar-content > * {
    min-width: 0;
}

.sidebar-footer {
    flex-shrink: 0;
    margin-top: -0.5rem;
}

.footer-actions {
    display: flex;
    gap: 0.5rem;
}

.sidebar-footer .btn-primary,
.sidebar-footer .btn-secondary {
    width: auto !important;
    flex: 1 1 0;
    min-width: 8rem; /* Prevent shift when switching EN/NO */
}

.brand h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin: 0;
    color: var(--primary);
    margin-right: auto;
}

.brand-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}

.edit-toggle-brand {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
    margin-right: -0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Only the text label, not the switch slider */
.edit-toggle-brand > span[data-i18n] {
    min-width: 5.5rem; /* Prevent shift when switching EN/NO (e.g. "Enable Editing" / "Redigering") */
}

.switch.switch-lg {
    width: 52px;
    height: 28px;
}

.switch.switch-lg .slider {
    border: 2px solid #64748b;
    box-shadow: inset 0 0 0 1px #e2e8f0;
}

.switch.switch-lg .slider:before {
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 3px;
    background-color: #e2e8f0;
}

.switch.switch-lg input:checked + .slider:before {
    transform: translateX(22px);
}

.brand p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.controls-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.controls-row {
    display: flex;
    gap: 0.5rem;
}

.controls-row .controls-group {
    flex: 1 1 0;
}

.select-compact {
    width: 100%;
    min-width: 0;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.controls-row .select-compact {
    min-width: 6rem; /* Enough for "Hele perioden" / "Full Range" without shifting */
}

.controls-group label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

/* Clear separation between Days Selection and Options */
.controls-group.options-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Inputs */
input[type="date"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    color: var(--text-main);
}

.title-edit-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.title-input {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    background: var(--surface);
}

.title-input[readonly] {
    background: #f8fafc;
    color: var(--text-main);
    cursor: default;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.icon-btn:hover {
    color: var(--text-main);
    border-color: #cbd5f5;
}

.icon-btn[aria-pressed="true"] {
    color: var(--primary);
    border-color: var(--primary);
}

.date-inputs {
    display: flex;
    gap: 0.5rem;
}

/* Day Toggles */
.day-toggles {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.day-toggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: white;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.day-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    padding: 0;
    margin-top: 0.25rem;
}

.btn-text:hover {
    text-decoration: underline;
}

/* Color Picker */
.color-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    background: var(--bg);
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.color-option.selected {
    border-color: var(--text-main);
    transform: scale(0.9);
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background: var(--primary);
    color: white;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background: white;
    color: var(--text-muted);
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f8fafc;
}

.helper-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    padding: 1rem 2rem;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#calendar-title {
    margin: 0;
    font-family: var(--font-heading);
}

.calendar-scroll-area {
    flex: 1;
    overflow: auto;
    padding: 1.5rem;
    background: #f8fafc;
}

.paged-view .calendar-scroll-area {
    scroll-snap-type: y mandatory;
    scroll-behavior: auto;
    scroll-snap-stop: always;
}

.view-week .calendar-scroll-area {
    scroll-behavior: auto;
}

.calendar-page {
    scroll-snap-align: start;
    min-height: var(--page-inactive-height, 50%);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
}

.calendar-page .calendar-grid {
    flex: 0 0 auto;
    grid-auto-rows: minmax(120px, 120px);
}

.calendar-page.is-active {
    min-height: var(--page-active-height, 100%);
}

.view-week .calendar-page .calendar-grid {
    flex: 1;
    grid-template-rows: auto auto 1fr;
    grid-auto-rows: unset;
}

.view-week .calendar-page.is-active {
    height: 100%;
}

.view-week .calendar-page.is-active .calendar-grid {
    height: 100%;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    /* Columns determined by JS based on visible days */
    gap: 1px;
    background: var(--border);
    /* Grid lines effect */
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.cal-header,
.cal-cell,
.week-num {
    background: white;
    padding: 0.75rem;
    min-height: 120px;
    /* Tall enough for notes */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    cursor: default;
    /* Default to non-interactive */
    transition: background 0.1s;
}

.cal-cell.editable {
    cursor: pointer;
    /* Pointer only when editable */
}

.cal-cell.editable:hover {
    filter: brightness(0.98);
}

/* When editing is disabled, hide controls that modify the plan */
body:not(.editing-enabled) #add-subject-btn,
body:not(.editing-enabled) #add-holiday-btn,
body:not(.editing-enabled) #planner-title-edit,
body:not(.editing-enabled) #reset-calendar-btn {
    display: none !important;
}

/* Subject/holiday chips: no edit when editing off (click does nothing via JS guard; reduce affordance) */
body:not(.editing-enabled) .subject-chip {
    cursor: default;
}
body:not(.editing-enabled) .subject-chip .subject-click-area,
body:not(.editing-enabled) .subject-chip .subject-name {
    cursor: default;
}

.cal-cell.clickable-view {
    cursor: zoom-in;
    /* Hint that it opens/expands */
}

.cal-cell.clickable-view:hover {
    background-color: #f8fafc;
    /* Subtle hover effect */
}

.cal-header {
    background: #f1f5f9;
    font-weight: 600;
    text-align: center;
    min-height: auto;
    padding: 1rem;
    font-family: var(--font-heading);
    color: var(--text-muted);
}

.cal-cell:hover {
    filter: brightness(0.98);
}

.cal-date-num {
    font-weight: 600;
    font-size: 0.875rem;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
}

.week-num.current-week,
.cal-cell.current-week {
    background-color: #f0fdf4;
    /* Light hint of green/focus */
    border-top: 1px solid #16a34a;
    border-bottom: 1px solid #16a34a;
}

.week-num.current-week {
    border-left: 1px solid #16a34a;
    color: #16a34a;
}

/* Ensure the last cell of the current week closes the border if needed */
/* Actually, grid gap handles separation, but a full row highlight is tricky in grid cells.
   This cell-by-cell border might look like individual boxes. 
   Let's try just a background color first, it's cleaner. */

.week-num.current-week,
.cal-cell.current-week {
    background-color: #eff6ff;
    /* Light Blue Focus */
}

/* Specific heavy border on the 'today' cell to make it pop more */
.cal-cell.today {
    box-shadow: inset 0 0 0 2px var(--primary);
}

.cal-note {
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.4;
    white-space: pre-wrap;
    flex: 1;
}

.week-num {
    background: #f8fafc;
    justify-content: center;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
    min-height: auto;
    padding: 0;
}

.month-marker {
    grid-column: 1 / -1;
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.5rem 1rem;
    font-weight: 700;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.paged-view .month-marker {
    position: static;
    top: auto;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Read-only preview modal: prevent horizontal overflow on long text */
#read-only-modal .modal-content {
    min-width: 0;
}
#read-only-modal #ro-title {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}
#read-only-modal #ro-note {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow-x: hidden;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

/* Standard Close Modal Button */
.close-modal-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0.25rem;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.close-modal-btn:hover {
    background: #f1f5f9;
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
}

#day-note-input {
    width: 100%;
    height: 150px;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    resize: vertical;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    text-align: right;
}

/* Logic: Colored Cells */
.cal-cell[data-has-color="true"] {
    /* bg color applied inline via JS */
}

/* Print Styles */
@media print {
    .sidebar {
        display: none;
    }

    .app-container {
        height: auto;
        display: block;
    }

    .main-content {
        overflow: visible;
    }

    .calendar-scroll-area {
        padding: 0;
        overflow: visible;
        background: white;
    }

    .calendar-grid {
        gap: 1px solid #000;
        box-shadow: none;
        border-color: #000;
    }

    .cal-cell {
        min-height: 100px;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .month-marker {
        background: #eee !important;
        position: static;
        color: black;
    }

    /* Force background colors print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* Toggle Switches */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    /* Gray-300 */
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

input:checked+.slider {
    background-color: var(--primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Sidebar Refinements */
.sidebar {
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02), 1px 0 4px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

/* Color Palette Refinement */
.color-option {
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.color-option.selected {
    transform: scale(0.95);
    box-shadow: inset 0 0 0 2px var(--text-main), 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: transparent;
}

/* Input Styling */
input[type="date"],
select {
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    transition: all 0.2s;
    outline: none;
}

input[type="date"]:hover,
select:hover {
    border-color: #cbd5e1;
}

input[type="date"]:focus,
select:focus {
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Import Modal Specifics */


/* Subject Chips (subjects + holidays in sidebar) */
.subject-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 0;
}

.subject-chip:hover {
    border-color: var(--primary);
}

.subject-color-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.subject-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Let the chip's flex child (dot + name) shrink so long names don't cause horizontal scroll */
.subject-chip > div:first-of-type {
    min-width: 0;
}

.subject-toggle {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    padding: 2px;
}

.subject-toggle:hover {
    color: var(--text-main);
}

/* Cell header: date number + holiday banner row */
.cal-cell-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    min-height: 0;
}

.cal-holiday-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
    flex: 1;
    min-width: 0;
}

/* Holidays as compact banners beside the date (not full-day blocks) */
.cal-holiday-banner .subject-block,
.subject-block.holiday-banner-block {
    flex: 0 0 auto;
    max-width: 100%;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: auto;
}

.cal-holiday-banner .subject-block:hover,
.subject-block.holiday-banner-block:hover {
    filter: brightness(0.9);
}

/* Subject Blocks in Calendar */
.cal-cell-events {
    flex: 1;
    display: flex;
    flex-direction: row;
    /* Side-by-side */
    gap: 2px;
    min-height: 0;
    /* Important for nested flex scroll/overflow handling if needed */
}

.subject-block {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: white;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
    font-weight: 500;

    /* Fix Overflow */
    max-width: 100%;
    white-space: normal;
    word-break: break-all;
    /* Forces wrapping even for long numbers */
    overflow-wrap: anywhere;
    /* Modern support */
    overflow: hidden;

    /* Expand to fill space */
    flex: 1;
    display: flex;
    align-items: center;
    /* Vertically center text if expanded */
}

.subject-block:hover {
    filter: brightness(0.9);
}

/* Subject block layout: title (top), main content (middle), period footer (bottom) */
.subject-block-title {
    font-weight: 600;
    flex-shrink: 0;
    line-height: 1.2;
}

.subject-block-main {
    flex: 1;
    min-height: 0;
    font-size: 0.75rem;
    line-height: 1.35;
    margin-top: 0.15rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    text-overflow: ellipsis;
}

.subject-block-period-footer {
    font-size: 0.65rem;
    opacity: 0.95;
    margin-top: 0.25rem;
    padding-top: 0.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    line-height: 1.2;
    font-weight: 500;
    flex-shrink: 0;
}


.btn-xs {
    font-size: 12px;
    line-height: 1;
}

.btn-text-danger {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
}

.btn-text-danger:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Visibility Utilities */
.hidden-subject {
    display: none !important;
}

.subject-chip.subject-hidden {
    opacity: 0.6;
    background: #f1f5f9;
}


.subject-chip.chip-hidden {
    opacity: 0.6;
    background: #f1f5f9;
}

.subject-chip-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.subject-add-period-btn:hover {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

.subject-period-shortcut:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

body:not(.editing-enabled) .subject-add-period-btn {
    display: none !important;
}

body:not(.editing-enabled) .subject-period-shortcut {
    pointer-events: none;
    cursor: default;
}

.btn-text-danger.hidden {
    display: none;
}


/* Holiday Themes */

/* Default / Fallback */
.theme-default {
    background-color: #cbd5e1;
    /* Gray fallback */
}

/* Ribbons Base Class */
.subject-block.theme-ribbon {
    position: relative;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* Specific Themes */

/* Autumn: Orange/Brown Gradient with leaf hint (simulated via gradient) */
.theme-autumn {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    border-left: 4px solid #78350f !important;
}

/* Christmas: Red with Green/Gold stripes */
.theme-christmas {
    background: repeating-linear-gradient(45deg,
            #dc2626,
            #dc2626 10px,
            #16a34a 10px,
            #16a34a 20px);
    border-left: 4px solid #b91c1c !important;
}

/* Winter: Blue/White Icy */
.theme-winter {
    background: linear-gradient(to bottom, #eff6ff 0%, #bfdbfe 100%);
    color: #1e3a8a !important;
    /* Dark blue text for contrast */
    text-shadow: none !important;
    border: 1px solid #93c5fd;
    border-left: 4px solid #3b82f6 !important;
}

/* Spring: Pink/Green Fresh */
.theme-spring {
    background: linear-gradient(135deg, #a7f3d0 0%, #fbcfe8 100%);
    color: #064e3b !important;
    text-shadow: none !important;
    border-left: 4px solid #10b981 !important;
}

/* Summer: Yellow/Blue Sunny */
.theme-summer {
    background: linear-gradient(to bottom right, #fef08a 0%, #fde047 50%, #60a5fa 100%);
    color: #854d0e !important;
    text-shadow: none !important;
    border-left: 4px solid #eab308 !important;
}

/* Norwegian Flag: flag strip on the left (22:16 aspect), solid text area on the right */
.theme-flag-no {
    /* Text area: solid dark blue so white text is always readable */
    background-color: #00205b;
    position: relative;
    overflow: hidden;
    border-left: none !important;
    box-shadow: none;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Flag strip only – left portion, width chosen for ~22:16 aspect at typical banner height */
.subject-block.theme-ribbon.theme-flag-no::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 34px;
    background-color: #ef4444;
    background-image:
        linear-gradient(to right, transparent 33%, #00205b 33%, #00205b 45%, transparent 45%),
        linear-gradient(to bottom, transparent 40%, #00205b 40%, #00205b 60%, transparent 60%),
        linear-gradient(to right, transparent 28%, white 28%, white 50%, transparent 50%),
        linear-gradient(to bottom, transparent 30%, white 30%, white 70%, transparent 70%);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    border-radius: 999px 0 0 999px;
}

/* Text sits in the solid area to the right of the flag */
.subject-block.theme-ribbon.theme-flag-no {
    padding-left: 34px;
}

/* Theme Previews in Picker */
.color-option.theme-preview {
    border-radius: 50%;
    /* Circle */
    overflow: hidden;
}

/* Apply same backgrounds to previews */
.color-option.theme-preview.theme-autumn {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.color-option.theme-preview.theme-christmas {
    background: repeating-linear-gradient(45deg, #dc2626, #dc2626 5px, #16a34a 5px, #16a34a 10px);
}

.color-option.theme-preview.theme-winter {
    background: linear-gradient(to bottom, #eff6ff 0%, #bfdbfe 100%);
    border: 1px solid #93c5fd;
}

.color-option.theme-preview.theme-spring {
    background: linear-gradient(135deg, #a7f3d0 0%, #fbcfe8 100%);
}

.color-option.theme-preview.theme-summer {
    background: linear-gradient(to bottom right, #fef08a 0%, #fde047 50%, #60a5fa 100%);
}

.color-option.theme-preview.theme-flag-no,
.subject-color-dot.theme-preview.theme-flag-no {
    /* Nordic Cross Design - Bold for small sizes */
    background-color: #ef4444 !important;
    /* Red Base */
    background-image:
        /* Blue Cross (30% thickness) */
        linear-gradient(to bottom, transparent 35%, #00205b 35%, #00205b 65%, transparent 65%),
        linear-gradient(to right, transparent 35%, #00205b 35%, #00205b 65%, transparent 65%),
        /* White Cross (50% thickness) */
        linear-gradient(to bottom, transparent 25%, white 25%, white 75%, transparent 75%),
        linear-gradient(to right, transparent 25%, white 25%, white 75%, transparent 75%) !important;
    background-size: 100% 100%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Scale up the tiny sidebar dot for the flag to make detail visible */
/* Scale up the tiny sidebar dot for the flag to make detail visible */
.subject-color-dot.theme-preview.theme-flag-no {
    transform: scale(1.8);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}