:root {
    /* V2 Theme Integration */
    --bg-dark: var(--bg, #0f172a);
    --card-bg: var(--card-bg, rgba(30, 41, 59, 0.7));
    --glass-border: var(--border, rgba(255, 255, 255, 0.18));
    --text-main: var(--text-main, #f8fafc);
    --text-dim: var(--text-sub, #94a3b8);
    --accent: var(--primary, #818cf8);
    --accent-glow: rgba(129, 140, 248, 0.3);
    --yearbook-scroll-end-buffer: 56px;
    --yearbook-day-divider: rgba(148, 163, 184, 0.55);
    /* Keep local calculation or move to theme */
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', 'Inter', 'Noto Sans KR', sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
}

.dark-theme {
    background: radial-gradient(circle at 50% 10%, #1e293b 0%, #0f172a 100%);
    min-height: 100vh;
}

/* Glassmorphism utility */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.scrollable::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Layout */
.app-container {
    display: flex;
    height: 100vh;
    padding: 16px;
    gap: 16px;
}

/* Sidebar */
.stats-sidebar {
    width: 320px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
}

.semester-badge {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.75rem;
    padding: 4px 12px;
    background: var(--accent);
    border-radius: 100px;
    font-weight: 700;
}

.stats-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.stats-content::-webkit-scrollbar {
    width: 4px;
}

.stats-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.cell-pin-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.75rem;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
    line-height: 1;
}

.stat-item {
    margin-bottom: 8px;
    padding: 2px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
}

.stat-label-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px;
    gap: 1px;
}

.sub-name {
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
}

.sub-count {
    font-size: 0.65rem;
    opacity: 0.8;
    font-family: 'Outfit';
}

.stat-diff {
    font-family: 'Outfit';
}

.stat-diff.zero {
    color: #10b981;
}

.stat-diff.minus {
    color: #60a5fa;
}

.stat-diff.plus {
    color: #f43f5e;
}

.stat-bar-bg {
    height: 3px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 1px;
    overflow: hidden;
    margin-top: 2px;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: var(--transition);
}

.sidebar-section-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 10px 20px;
}

.tag-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin: 4px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.tag-chip:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
}

.tag-chip.active {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.tag-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.tag-count {
    font-size: 0.75rem;
    color: var(--text-dim);
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 8px;
    border-radius: 6px;
}

/* Focus Mode Assets */
.focus-mode .cell-subject:not(.tag-highlight) {
    opacity: 0.2;
    filter: grayscale(0.5);
    pointer-events: none;
}

.tag-highlight {
    outline: 2px solid var(--accent) !important;
    box-shadow: 0 0 15px var(--accent-glow) !important;
    z-index: 10;
    transform: scale(1.02);
}

.pin-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.65rem;
    color: var(--accent);
    opacity: 0.8;
}

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

.bulk-selection-toolbar {
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.bulk-selection-toolbar.hidden {
    display: none !important;
}

.bulk-selection-summary {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 200px;
}

.bulk-selection-count {
    font-size: 0.92rem;
    font-weight: 900;
    color: #f8fafc;
}

.bulk-selection-hint {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.bulk-selection-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.bulk-selection-actions .nav-btn {
    padding: 0 10px;
    height: 32px;
    font-size: 0.78rem;
    font-weight: 800;
}

.bulk-selection-actions .nav-btn.active {
    border-color: rgba(56, 189, 248, 0.55);
    color: #7dd3fc;
    background: rgba(14, 116, 144, 0.18);
}

.bulk-selection-actions .publish-btn:disabled,
.bulk-selection-actions .nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.bulk-edit-grid {
    display: grid;
    gap: 10px;
}

.bulk-edit-row {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.bulk-edit-head {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #e2e8f0;
}

.bulk-edit-inline {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 8px;
}

.bulk-edit-preview {
    margin-top: 12px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.45);
    padding: 10px 12px;
    font-size: 0.82rem;
    color: #cbd5e1;
}

.bulk-edit-shortcuts {
    margin-top: 10px;
    font-size: 0.76rem;
    color: #94a3b8;
}

body.bulk-select-mode-on .cell-subject {
    cursor: crosshair !important;
}

@media (max-width: 1100px) {
    .bulk-selection-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .bulk-selection-actions {
        justify-content: flex-start;
    }

    .bulk-edit-row {
        grid-template-columns: 1fr;
    }

    .bulk-edit-inline {
        grid-template-columns: 1fr;
    }
}

.top-nav {
    height: 72px;
    border-radius: 20px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-left,
.nav-center,
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-center {
    flex: 1;
    justify-content: center;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.annual-detail-display-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.42);
}

.annual-detail-display-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-right: 2px;
}

.annual-detail-display-controls .toggle-label {
    margin: 0;
    font-size: 0.78rem;
    color: #dbeafe;
}

.bulk-selection-actions .annual-detail-display-controls {
    padding: 0 10px;
    min-height: 32px;
}

.bulk-selection-actions .annual-detail-display-controls .toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
}

body.annual-detail-focus-mode.annual-detail-hide-unit #yearbook-grid .cell-unit {
    display: none !important;
}

body.annual-detail-focus-mode.annual-detail-hide-topic #yearbook-grid .cell-topic {
    display: none !important;
}

body.annual-detail-focus-mode.annual-detail-hide-content #yearbook-grid .cell-content {
    display: none !important;
}

body.annual-detail-focus-mode.annual-detail-hide-pages #yearbook-grid .cell-pages {
    display: none !important;
}

body.annual-detail-focus-mode.annual-detail-hide-location #yearbook-grid .cell-location {
    display: none !important;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 1.5rem;
    color: var(--accent);
}

.brand h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}

.brand h1 span {
    font-weight: 400;
    opacity: 0.5;
    font-size: 0.9rem;
}

.class-selector-wrap {
    margin-left: 20px;
}

.nav-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.nav-select:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.nav-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 0 15px var(--accent-glow);
}

.publish-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.85rem;
    box-shadow: 0 4px 14px 0 var(--accent-glow);
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.publish-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 6px 20px 0 var(--accent-glow);
}

.publish-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    filter: none;
    box-shadow: none;
}

/* Grid Container */
.grid-container {
    flex: 1;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#btn-exit-annual-detail-focus {
    display: none;
    position: fixed;
    top: 14px;
    right: 16px;
    z-index: 3600;
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
    font-weight: 800;
}

#btn-exit-annual-detail-focus:hover {
    background: rgba(30, 41, 59, 0.98);
    border-color: rgba(248, 113, 113, 0.75);
    color: #ffffff;
}

body.annual-detail-focus-mode .stats-sidebar,
body.annual-detail-focus-mode .top-nav,
body.annual-detail-focus-mode #btn-print-floating {
    display: none !important;
}

body.annual-detail-focus-mode .app-container {
    padding: 10px;
    gap: 0;
}

body.annual-detail-focus-mode .main-content {
    gap: 8px;
    min-height: 0;
    height: calc(100vh - 20px);
    overflow: hidden;
}

body.annual-detail-focus-mode .grid-container {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    border-radius: 18px;
}

body.annual-detail-focus-mode .grid-scroll-area {
    flex: 1;
    min-height: 0;
    height: auto;
}

body.annual-detail-focus-mode #btn-exit-annual-detail-focus {
    display: flex !important;
}

body.weekly-focus-mode .stats-sidebar,
body.weekly-focus-mode .top-nav,
body.weekly-focus-mode #btn-print-floating,
body.weekly-focus-mode #bulk-selection-toolbar,
body.weekly-focus-mode #btn-exit-annual-detail-focus {
    display: none !important;
}

body.weekly-focus-mode .app-container {
    display: block;
    padding: 12px;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

body.weekly-focus-mode .main-content {
    gap: 0;
    min-height: calc(100vh - 24px);
    height: calc(100vh - 24px);
    overflow: hidden;
}

body.weekly-focus-mode #weekly-view-container {
    width: 100%;
    margin-top: 0 !important;
    min-height: 0;
    height: 100%;
    overflow: hidden !important;
}

/* In annual detail focus mode, keep week index but hide date/event side columns
   to give more room for lesson content cells. */
body.annual-detail-focus-mode #yearbook-grid thead .main-header .col-date,
body.annual-detail-focus-mode #yearbook-grid thead .main-header .col-event,
body.annual-detail-focus-mode #yearbook-grid tbody td.col-date,
body.annual-detail-focus-mode #yearbook-grid tbody td.col-event {
    display: none !important;
}

body.annual-detail-focus-mode #yearbook-grid thead .main-header .col-week,
body.annual-detail-focus-mode #yearbook-grid tbody td.col-week {
    width: 72px;
    min-width: 72px;
}

body.annual-detail-focus-mode #yearbook-grid tbody td.col-week {
    padding: 8px 4px;
    text-align: center;
    vertical-align: middle;
}

body.annual-detail-focus-mode #yearbook-grid .col-week-month {
    display: block;
    margin-bottom: 3px;
    color: var(--accent);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    line-height: 1.1;
    white-space: nowrap;
}

body.annual-detail-focus-mode #yearbook-grid .col-week-day {
    display: block;
    margin-bottom: 4px;
    color: var(--text-dim);
    font-size: 0.56rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

body.annual-detail-focus-mode #yearbook-grid .col-week-number {
    display: block;
    color: var(--text);
    font-size: 0.96rem;
    font-weight: 900;
    line-height: 1;
}

.grid-scroll-area {
    flex: 1;
    overflow: auto;
    position: relative;
    padding-bottom: var(--yearbook-scroll-end-buffer);
    scroll-padding-bottom: var(--yearbook-scroll-end-buffer);
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    border: 1px solid var(--glass-border);
    padding: 8px;
    text-align: center;
    font-size: 0.85rem;
}

thead th {
    background: rgba(15, 23, 42, 0.8);
    position: sticky;
    top: 0;
    z-index: 10;
}

.main-header th {
    top: 0;
    z-index: 11;
    height: 40px;
}

.period-header th {
    top: 40px;
    z-index: 11;
    height: 32px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Weekday boundary visibility: Tue~Fri starts get a stronger divider */
#yearbook-grid thead .main-header th[colspan="6"]+th[colspan="6"] {
    border-left: 2px solid var(--yearbook-day-divider);
}

#yearbook-grid thead .period-header th:nth-child(6n+7) {
    border-left: 2px solid var(--yearbook-day-divider);
}

#yearbook-grid tbody td.day-start {
    border-left: 2px solid var(--yearbook-day-divider) !important;
}

.col-week {
    width: 45px;
    position: sticky;
    left: 0;
    z-index: 12;
    background: #0f172a;
}

.col-date {
    width: 90px;
    position: sticky;
    left: 45px;
    z-index: 12;
    background: #0f172a;
    cursor: pointer;
    transition: background 0.2s;
}

.col-date:hover {
    background: rgba(129, 140, 248, 0.15) !important;
}

.col-date:hover::after {
    content: "⏱️ 시수 조정";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-weight: 800;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 20;
}

.col-event {
    width: 140px;
    font-weight: 600;
    font-size: 0.8rem;
}

@media screen {
    #yearbook-grid tbody tr.is-current-week > td {
        border-top-color: rgba(96, 165, 250, 0.72);
        border-bottom-color: rgba(96, 165, 250, 0.72);
    }

    #yearbook-grid tbody tr.is-current-week > td:first-child {
        box-shadow: inset 3px 0 0 rgba(56, 189, 248, 0.92);
    }

    #yearbook-grid tbody tr.is-current-week > td.col-week,
    #yearbook-grid tbody tr.is-current-week > td.col-date,
    #yearbook-grid tbody tr.is-current-week > td.col-event {
        background:
            linear-gradient(180deg, rgba(56, 189, 248, 0.16), rgba(129, 140, 248, 0.08)),
            #0f172a;
    }

    #yearbook-grid tbody tr.is-current-week > td.cell-subject,
    #yearbook-grid tbody tr.is-current-week > td.cell-event-merged,
    #yearbook-grid tbody tr.is-current-week > td.cell-disabled,
    #yearbook-grid tbody tr.is-current-week > td.cell-semester-out {
        box-shadow:
            inset 0 2px 0 rgba(96, 165, 250, 0.72),
            inset 0 -2px 0 rgba(96, 165, 250, 0.55),
            inset 0 0 0 1px rgba(191, 219, 254, 0.2);
    }

    .col-week.is-current-week-cell {
        padding: 6px 4px;
        text-align: center;
        vertical-align: middle;
    }

    .current-week-compact-number {
        font-size: 1rem;
        font-weight: 900;
        line-height: 1;
    }

    .current-week-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-top: 4px;
        padding: 2px 6px;
        border-radius: 999px;
        background: rgba(56, 189, 248, 0.2);
        border: 1px solid rgba(125, 211, 252, 0.55);
        color: #e0f2fe;
        font-size: 0.6rem;
        font-weight: 800;
        letter-spacing: 0.02em;
        line-height: 1.1;
        white-space: nowrap;
        box-shadow: 0 0 14px rgba(56, 189, 248, 0.18);
    }

    body.annual-detail-focus-mode .current-week-badge {
        margin-top: 5px;
    }
}

/* Cell Styles */
.cell-subject {
    cursor: pointer;
    transition: var(--transition);
    height: 48px;
    position: relative;
}

#yearbook-grid .cell-topic,
#yearbook-grid .cell-content {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.3;
}

#yearbook-grid .cell-topic {
    -webkit-line-clamp: 2;
    line-clamp: 2;
    max-height: 2.6em;
}

#yearbook-grid .cell-content {
    -webkit-line-clamp: 3;
    line-clamp: 3;
    max-height: 3.9em;
    margin-top: 2px;
    font-size: 0.72rem;
    color: rgba(226, 232, 240, 0.92);
}

#yearbook-grid .cell-location {
    margin-top: 2px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.25;
    color: #93c5fd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-subject:hover {
    filter: brightness(1.4);
    z-index: 5;
}

.cell-subject.drag-over {
    background-color: rgba(255, 255, 255, 0.2) !important;
    outline: 2px dashed #fff !important;
    outline-offset: -4px;
    z-index: 10;
}

/* Modification indicator removed per user request */
.cell-subject.override::after {
    display: none;
}

.conflict-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.7rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}

.cell-event-merged {
    background: rgba(255, 255, 255, 0.03);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.8rem;
}

.event-cell {
    /* Background filling is handled by JS logic with high opacity */
    z-index: 2;
}

.fixed-cell {
    /* Outline removed for cleaner UI as requested */
}

.cell-disabled {
    background: repeating-linear-gradient(45deg,
            rgba(0, 0, 0, 0.1),
            rgba(0, 0, 0, 0.1) 10px,
            rgba(255, 255, 255, 0.03) 10px,
            rgba(255, 255, 255, 0.03) 20px) !important;
    cursor: pointer !important;
    /* Changed from not-allowed to pointer */
    /* pointer-events: none; Removed to allow click */
    opacity: 0.4;
    color: transparent !important;
    /* Hide text */
    position: relative;
    user-select: none;
}

/* Optional: Icon for disabled cells */
.cell-disabled:hover::after {
    content: "⏱️";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: var(--text-dim);
    opacity: 0.8;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 500;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 600;
    width: 650px;
    max-width: 95%;
    border-radius: 24px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-family: 'Outfit';
    font-size: 1.5rem;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.2rem;
}

.modal-desc {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.config-table {
    width: 100%;
}

.config-table th {
    background: rgba(0, 0, 0, 0.2);
}

.config-table td {
    padding: 4px;
}

.config-select {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    border-radius: 8px;
    font-size: 0.8rem;
    outline: none;
}

.event-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.event-input-row input[type="text"] {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 10px 16px;
    border-radius: 12px;
}

.date-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--glass-border) !important;
    color: white !important;
    padding: 10px;
    border-radius: 12px;
}

.event-list {
    max-height: 300px;
    overflow-y: auto;
}

.event-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--glass-border);
}

.event-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.event-date {
    font-family: 'Outfit';
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
}

.event-name {
    font-weight: 600;
}

.btn-del-event {
    color: var(--text-dim);
    cursor: pointer;
    background: none;
    border: none;
    transition: var(--transition);
}

.btn-del-event:hover {
    color: #f43f5e;
}

/* Popover */
.popover {
    position: fixed;
    z-index: 1000;
    width: 280px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }

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

.subject-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

/* Curriculum checkbox + drag selection */
.curriculum-select-all,
.curriculum-row-check {
    accent-color: var(--accent);
}

.curriculum-select-cell {
    text-align: center;
    width: 68px;
}

.curriculum-select-cell-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.curriculum-row-grip {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.55);
    color: #93c5fd;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    padding: 0;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.curriculum-row-grip:active {
    cursor: grabbing;
}

.curriculum-row-grip:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.45);
    color: #dbeafe;
}

.curriculum-row-grip.disabled,
.curriculum-row-grip:disabled {
    cursor: default;
    opacity: 0.35;
}

#curriculum-table tbody tr.selected td,
#grade-curriculum-table tbody tr.selected td {
    background: rgba(59, 130, 246, 0.16);
}

#curriculum-table tbody tr.curriculum-row-dragging td,
#grade-curriculum-table tbody tr.curriculum-row-dragging td {
    opacity: 0.55;
}

#curriculum-table tbody tr.curriculum-drop-before td,
#grade-curriculum-table tbody tr.curriculum-drop-before td {
    border-top: 2px solid #60a5fa;
}

#curriculum-table tbody tr.curriculum-drop-after td,
#grade-curriculum-table tbody tr.curriculum-drop-after td {
    border-bottom: 2px solid #60a5fa;
}

#curriculum-selection-bar {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 1400;
    min-width: 320px;
    max-width: min(92vw, 720px);
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(99, 102, 241, 0.4);
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 20px 44px rgba(2, 6, 23, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#curriculum-selection-bar .curriculum-selection-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

#curriculum-selection-bar .curriculum-selection-meta .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    color: #dbeafe;
    background: rgba(37, 99, 235, 0.22);
}

#curriculum-selection-bar .curriculum-selection-meta .context {
    font-size: 0.8rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#curriculum-selection-bar .curriculum-selection-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#curriculum-selection-bar .nav-btn,
#curriculum-selection-bar .publish-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
}

.curriculum-bulk-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.curriculum-bulk-grid .nav-btn {
    width: 100%;
    justify-content: center;
    padding: 11px 10px;
}

.curriculum-bulk-grid .nav-btn.danger {
    border-color: rgba(244, 63, 94, 0.35);
    color: #fda4af;
    background: rgba(244, 63, 94, 0.14);
}

/* Column Resizer */
.resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    cursor: col-resize;
    user-select: none;
    height: 100%;
}

.resizer:hover,
.resizing {
    border-right: 2px solid var(--accent);
}

@media (max-width: 780px) {
    #curriculum-selection-bar {
        width: calc(100vw - 20px);
        min-width: 0;
        flex-direction: column;
        align-items: stretch;
    }

    #curriculum-selection-bar .curriculum-selection-meta,
    #curriculum-selection-bar .curriculum-selection-actions {
        width: 100%;
        justify-content: space-between;
    }

    .curriculum-bulk-grid {
        grid-template-columns: 1fr;
    }
}

.subject-chip {
    padding: 10px 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.8rem;
    transition: var(--transition);
}

.subject-chip:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.input-group {
    margin-bottom: 12px;
}

.input-group label,
.popover-content label {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-dim);
    margin-bottom: 4px;
    text-transform: uppercase;
}

#picker-activity-input,
#picker-location-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
}

#picker-location-select option,
select option {
    background: #1e293b;
    color: white;
}

.popover-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    gap: 8px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    color: white;
}

.summary-table th,
.summary-table td {
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 4px;
    text-align: center;
}

.summary-table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 700;
}

.summary-row-label {
    background: rgba(129, 140, 248, 0.1);
    font-weight: 800;
    width: 120px;
}

.summary-target-row {
    background: rgba(251, 191, 36, 0.1);
}

.summary-diff-row {
    background: rgba(0, 0, 0, 0.3);
}

.summary-diff.plus {
    color: #f43f5e;
    font-weight: 800;
}

.summary-diff.minus {
    color: #60a5fa;
    font-weight: 800;
}

.summary-diff.zero {
    color: #10b981;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.summary-table-wrap {
    overflow-x: auto;
    padding-bottom: 20px;
}

.hidden {
    display: none !important;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    color: var(--text-dim);
    transition: color 0.2s;
}

.toggle-label:hover {
    color: white;
}

.toggle-label input {
    cursor: pointer;
}

/* Weekly View Styles */
.weekly-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid var(--glass-border);
}

.weekly-table th,
.weekly-table td {
    border: 1px solid var(--glass-border);
    padding: 15px;
    text-align: center;
    vertical-align: middle;
}

.weekly-row-event th,
.weekly-row-header th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 800;
    color: var(--text-dim);
}

.weekly-row-footer th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 800;
    color: var(--text-dim);
}

.weekly-cell-subject {
    min-height: 120px;
}

.weekly-sub-name {
    font-size: 1.1rem;
    font-weight: 900;
    margin-bottom: 8px;
    display: block;
}

.weekly-topic {
    font-size: 0.95rem;
    color: #3b82f6;
    /* Modern Blue to match image's ink feel */
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 5px;
}

.weekly-pages {
    font-size: 0.8rem;
    font-style: italic;
    opacity: 0.7;
    margin-top: 5px;
}

.weekly-materials {
    font-size: 0.75rem;
    color: #60a5fa;
    margin-top: 8px;
    font-weight: 500;
}

/* Drag & Drop Feedback */
.weekly-cell-subject[draggable="true"] {
    cursor: grab;
    transition: background-color 0.2s, transform 0.2s, opacity 0.2s;
    user-select: none;
}

.weekly-cell-subject[draggable="true"]:active {
    cursor: grabbing;
}

.weekly-cell-subject.dragging {
    opacity: 0.4;
    transform: scale(0.96);
    border: 2px dashed var(--accent);
}

.weekly-cell-subject.drag-over {
    background-color: rgba(129, 140, 248, 0.15) !important;
    box-shadow: inset 0 0 0 2px var(--accent);
}


.popover-footer {
    display: flex;
    align-items: center;
    margin-top: 16px;
    gap: 8px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    color: white;
}

.summary-table th,
.summary-table td {
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 4px;
    text-align: center;
}

.summary-table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 700;
}

.summary-row-label {
    background: rgba(129, 140, 248, 0.1);
    font-weight: 800;
    width: 120px;
}

.summary-target-row {
    background: rgba(251, 191, 36, 0.1);
}

.summary-diff-row {
    background: rgba(0, 0, 0, 0.3);
}

.summary-diff.plus {
    color: #f43f5e;
    font-weight: 800;
}

.summary-diff.minus {
    color: #60a5fa;
    font-weight: 800;
}

.summary-diff.zero {
    color: #10b981;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.summary-table-wrap {
    overflow-x: auto;
    padding-bottom: 20px;
}

.hidden {
    display: none !important;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    color: var(--text-dim);
    transition: color 0.2s;
}

.toggle-label:hover {
    color: white;
}

.toggle-label input {
    cursor: pointer;
}

/* Weekly View Styles */
.weekly-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid var(--glass-border);
}

.weekly-table th,
.weekly-table td {
    border: 1px solid var(--glass-border);
    padding: 15px;
    text-align: center;
    vertical-align: middle;
}

.weekly-row-event th,
.weekly-row-header th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 800;
    color: var(--text-dim);
}

.weekly-row-footer th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 800;
    color: var(--text-dim);
}

.weekly-cell-subject {
    min-height: 120px;
}

.weekly-sub-name {
    font-size: 1.1rem;
    font-weight: 900;
    margin-bottom: 8px;
    display: block;
}

.weekly-topic {
    font-size: 0.95rem;
    color: #3b82f6;
    /* Modern Blue to match image's ink feel */
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 5px;
}

.weekly-pages {
    font-size: 0.8rem;
    font-style: italic;
    opacity: 0.7;
    margin-top: 5px;
}

.weekly-materials {
    font-size: 0.75rem;
    color: #60a5fa;
    margin-top: 8px;
    font-weight: 500;
}

/* Drag & Drop Feedback */
.weekly-cell-subject[draggable="true"] {
    cursor: grab;
    transition: background-color 0.2s, transform 0.2s, opacity 0.2s;
    user-select: none;
}

.weekly-cell-subject[draggable="true"]:active {
    cursor: grabbing;
}

.weekly-cell-subject.dragging {
    opacity: 0.4;
    transform: scale(0.96);
    border: 2px dashed var(--accent);
}

.weekly-cell-subject.drag-over {
    background-color: rgba(129, 140, 248, 0.15) !important;
    box-shadow: inset 0 0 0 2px var(--accent);
}

.weekly-cell-subject.drag-invalid {
    background-color: rgba(239, 68, 68, 0.15) !important;
    cursor: no-drop;
}

@media print {
    @page {
        size: portrait;
        margin: 0;
    }

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

/* ============================================================ 
   MOBILE PORTRAIT SHARE VIEW (Rev.7 - High Aesthetics)
   ============================================================ */
body.mobile-share-mode {
    background: #fdfcf7 !important;
    /* Soft Paper Background */
    color: #2b2b2b !important;
    overflow-y: auto !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.mobile-share-mode .app-container {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    max-width: 600px !important;
    margin: 0 auto !important;
    display: block !important;
    position: relative;
    padding: 0 !important;
}

/* Hide Everything except the mobile view container */
body.mobile-share-mode aside,
body.mobile-share-mode nav,
body.mobile-share-mode .navbar,
body.mobile-share-mode .top-nav,
body.mobile-share-mode .grid-container,
body.mobile-share-mode .weekly-view-container,
body.mobile-share-mode #weekly-view-container,
body.mobile-share-mode .sidebar {
    display: none !important;
}

body.mobile-share-mode #mobile-share-view {
    display: block !important;
}

/* New Mobile Container Header */
.mobile-portrait-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 40px 60px;
    background: #fff;
    border-bottom: 4px double #d4d4d4;
    text-align: center;
    position: relative;
}

.mobile-portrait-header::before {
    content: 'WEEKLY LEARNING GUIDE';
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 800;
    color: #d4d4d4;
    letter-spacing: 4px;
    margin-bottom: 20px;
}

.mobile-portrait-header h1 {
    font-family: 'MaruBuri', serif !important;
    font-size: 2.8rem;
    font-weight: 800;
    margin: 0;
    color: #1a1a1a;
    letter-spacing: -2px;
    line-height: 1.1;
}

.mobile-portrait-header .week-range {
    font-family: 'GmarketSans', sans-serif !important;
    font-size: 1.1rem;
    color: #888;
    margin-top: 20px;
    font-weight: 500;
}

/* The Lesson Cards */
.mobile-lesson-list {
    padding: 60px 30px 140px;
    background: #fdfcf7;
}

.mobile-day-card {
    margin-bottom: 60px;
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

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

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

.mobile-day-label {
    font-family: 'GmarketSans', sans-serif !important;
    font-size: 1.6rem;
    font-weight: 800;
    color: #1a1a1a;
    padding-bottom: 20px;
    border-bottom: 2.5px solid #1a1a1a;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.mobile-day-label span {
    font-family: 'Outfit', sans-serif !important;
    font-size: 1rem;
    color: #bbb;
    font-weight: 600;
}

.mobile-lesson-item {
    display: flex;
    margin-bottom: 35px;
    position: relative;
    padding-left: 10px;
}

.mobile-lesson-period {
    min-width: 50px;
    font-family: 'Outfit', sans-serif !important;
    font-size: 1.8rem;
    font-weight: 900;
    color: #e5e5e5;
    line-height: 1;
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-lesson-content {
    flex: 1;
}

.mobile-lesson-subject {
    font-family: 'GmarketSans', sans-serif !important;
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 8px;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    border-left: 4px solid currentColor;
}

.mobile-lesson-topic {
    font-family: 'MaruBuri', serif !important;
    font-size: 1.3rem;
    font-weight: 700;
    color: #2b2b2b;
    line-height: 1.5;
    letter-spacing: -0.5px;
}

.mobile-lesson-pages {
    font-family: 'Outfit', sans-serif !important;
    font-size: 0.9rem;
    color: #999;
    margin-top: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mobile-lesson-pages::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 1px;
    background: #eee;
}

/* Footer for Share Mode */
.mobile-portrait-footer {
    padding: 100px 40px;
    text-align: center;
    border-top: 1px solid #eee;
    font-size: 0.9rem;
    color: #bbb;
    font-family: 'GmarketSans', sans-serif !important;
    background: #fff;
}

/* Pinned Marker */
.mobile-lesson-item.pinned::after {
    content: 'PINNED';
    position: absolute;
    right: 0;
    top: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 0.6rem;
    font-weight: 900;
    color: #f59e0b;
    letter-spacing: 1px;
}

/* ============================================================ 
   JEONDAM (SUBJECT TEACHER) STYLES
   ============================================================ */
.cell-subject.jeondam-cell {
    background-image: repeating-linear-gradient(45deg,
            rgba(255, 255, 255, 0.03),
            rgba(255, 255, 255, 0.03) 10px,
            rgba(0, 0, 0, 0.03) 10px,
            rgba(0, 0, 0, 0.03) 20px) !important;
    position: relative;
    border-bottom: none !important;
}

.jeondam-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--accent);
    color: white;
    font-size: 0.55rem;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 900;
    pointer-events: none;
}

.jeondam-badge-mini {
    background: var(--accent);
    color: white;
    font-size: 0.6rem;
    padding: 0px 3px;
    border-radius: 3px;
    font-weight: 900;
    line-height: 1.2;
}

/* Weekly View Label */
.weekly-jeondam-label {
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.1);
    color: #666;
    padding: 1px 4px;
    border-radius: 4px;
    margin-left: 5px;
    font-weight: 700;
    vertical-align: middle;
}

/* Jeondam Counter Sidebar Item */
.jeondam-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.jeondam-stat-label {
    font-weight: 700;
}

.jeondam-stat-count {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
}

.jeondam-stat-diff {
    font-size: 0.75rem;
    margin-left: 5px;
}

.jeondam-stat-diff.plus {
    color: #22d3ee;
}

.jeondam-stat-diff.minus {
    color: #fb7185;
}

.jeondam-stat-diff.zero {
    color: #94a3b8;
}

#btn-exit-mobile-share {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: #f59e0b;
    color: #0f172a;
    padding: 16px 40px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    z-index: 10000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: none;
    cursor: pointer;
    display: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    text-transform: uppercase;
}

#btn-exit-mobile-share:hover {
    background: #fff;
    transform: translateX(-50%) scale(1.05);
}

body.mobile-share-mode #btn-exit-mobile-share {
    display: block;
}

/* Audit Log & History Mode Styles */
.chip-btn {
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: #cbd5e1;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chip-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-2px);
}

.audit-highlight {
    animation: audit-glow 2s infinite alternate;
    z-index: 10;
}

@keyframes audit-glow {
    from {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3) inset;
    }

    to {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.7) inset, 0 0 8px rgba(255, 215, 0, 0.4);
    }
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    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: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border: 1px solid var(--glass-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

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

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

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

@media print {
    body.mobile-share-mode #btn-exit-mobile-share {
        display: none !important;
    }
}

/* Smart Wizard Styles */
.wizard-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
}

.wizard-steps .step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-dim);
    font-weight: 700;
}

.wizard-steps .step.active {
    color: var(--accent);
}

.wizard-steps .step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
}

.wizard-steps .step.active .step-num {
    background: var(--accent);
    color: white;
}

.wizard-steps .step-line {
    width: 50px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 15px;
}

.wizard-content {
    padding: 24px 40px;
    animation: fadeIn 0.3s ease-in-out;
}

.wizard-content.hidden {
    display: none;
}

.wizard-hero {
    text-align: center;
    margin-bottom: 30px;
}

.wizard-hero h4 {
    font-size: 1.5rem;
    font-family: 'Outfit';
    margin-bottom: 8px;
    color: white;
}

.wizard-hero p {
    color: var(--text-dim);
}

.gap-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.gap-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.gap-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.gap-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.strategy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.strategy-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.strategy-card:hover:not(.disabled) {
    transform: translateY(-5px);
    border-color: var(--accent);
    background: rgba(129, 140, 248, 0.1);
}

.strategy-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

.strategy-card .icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--accent);
}

.wizard-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.custom-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 10px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.custom-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.preview-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
}

.selected-cell {
    outline: 3px solid var(--warning);
    outline-offset: -3px;
    position: relative;
    z-index: 10;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.5) inset;
}

/* Sidebar jeondam focus mode (from teacher stats click) */
.cell-subject.jeondam-focus-dim {
    opacity: 0.2 !important;
    filter: grayscale(0.85) brightness(0.8);
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.cell-subject.jeondam-focus-cell {
    opacity: 1 !important;
    filter: none !important;
    outline: 4px solid #f59e0b !important;
    outline-offset: -4px;
    box-shadow:
        0 0 0 3px rgba(245, 158, 11, 0.45) inset,
        0 0 18px rgba(245, 158, 11, 0.85);
    z-index: 20 !important;
    animation: jeondamFocusPulse 1.2s ease-in-out infinite;
}

@keyframes jeondamFocusPulse {
    0% {
        transform: scale(1);
        box-shadow:
            0 0 0 3px rgba(245, 158, 11, 0.35) inset,
            0 0 8px rgba(245, 158, 11, 0.55);
    }

    50% {
        transform: scale(1.03);
        box-shadow:
            0 0 0 3px rgba(245, 158, 11, 0.6) inset,
            0 0 24px rgba(245, 158, 11, 0.95);
    }

    100% {
        transform: scale(1);
        box-shadow:
            0 0 0 3px rgba(245, 158, 11, 0.35) inset,
            0 0 8px rgba(245, 158, 11, 0.55);
    }
}

/* Smart Palette Styles */
.palette-panel {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 280px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

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

.palette-header {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 800;
    font-size: 0.9rem;
}

.palette-header button {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
}

.palette-grid {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.palette-btn {
    padding: 8px 4px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.palette-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.palette-btn.active {
    border-color: var(--accent);
    background: rgba(129, 140, 248, 0.2);
    box-shadow: 0 0 10px var(--accent-glow);
}

.palette-footer {
    padding: 10px;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border);
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* Theme Switcher Float */
.theme-switcher-float {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 6px;
    display: flex;
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 2500;
}

.theme-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.theme-btn.active {
    background: var(--accent);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* --- Minimal Theme Styles --- */
body.theme-minimal .cell-subject {
    background-color: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    transition: transform 0.2s, box-shadow 0.2s;
}

body.theme-minimal .cell-subject:hover {
    transform: translateY(-2px);
    transform: none;
    /* Disable lift to keep grid stable */
    background: rgba(255, 255, 255, 0.08) !important;
    box-shadow: inset 0 0 0 1px var(--accent);
}

/* Alternate Day Backgrounds for Minimal Theme (High Contrast v2) */
body.theme-minimal [data-day-idx="0"] {
    background: rgba(255, 255, 255, 0.01) !important;
}

/* Mon */
body.theme-minimal [data-day-idx="1"] {
    background: rgba(255, 255, 255, 0.18) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* Tue - Very Distinct */
body.theme-minimal [data-day-idx="2"] {
    background: rgba(255, 255, 255, 0.01) !important;
}

/* Wed */
body.theme-minimal [data-day-idx="3"] {
    background: rgba(255, 255, 255, 0.18) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* Thu - Very Distinct */
body.theme-minimal [data-day-idx="4"] {
    background: rgba(255, 255, 255, 0.01) !important;
}

/* Fri */

body.theme-minimal .main-header th[colspan="6"] {
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    color: var(--text-dim);
}

body.theme-minimal .cell-subject.override {
    border-bottom: none;
}

body.theme-minimal .selected-cell {
    background: rgba(129, 140, 248, 0.15) !important;
    box-shadow: inset 0 0 0 2px var(--accent) !important;
    z-index: 5;
}

body.theme-minimal .cell-subject div {
    filter: saturate(1.2) brightness(1.2);
    /* Make text pop on dark without bg */
}

body.theme-minimal .audit-highlight {
    animation: audit-glow-minimal 2s infinite alternate;
}

@keyframes audit-glow-minimal {
    from {
        box-shadow: 0 0 5px var(--warning) inset;
    }

    to {
        box-shadow: 0 0 15px var(--warning) inset;
    }
}

.lesson-edit-modal {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.lesson-edit-modal .modal-body {
    overflow-y: auto;
}

.lesson-edit-meta-grid {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.lesson-edit-location-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lesson-edit-field-hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.lesson-edit-curriculum-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#modal-lesson-edit .lesson-edit-curriculum-actions,
#modal-lesson-edit #edit-lesson-curriculum-list,
#modal-lesson-edit #edit-lesson-curriculum-empty {
    display: none !important;
}

.lesson-edit-curriculum-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.lesson-edit-curriculum-eyebrow {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-neon);
}

.lesson-edit-curriculum-summary {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-dim);
    text-align: left;
    max-width: none;
}

.lesson-edit-curriculum-note {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px dashed rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.35);
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.5;
}

.lesson-edit-curriculum-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lesson-edit-danger-btn {
    border-color: rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

.lesson-edit-danger-btn:hover {
    border-color: rgba(248, 113, 113, 0.55);
    background: rgba(127, 29, 29, 0.25);
}

.lesson-edit-curriculum-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}

.lesson-edit-curriculum-row {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.52);
}

.lesson-edit-curriculum-row.is-active {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(30, 41, 59, 0.92);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.22);
}

.lesson-edit-curriculum-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.lesson-edit-curriculum-row-seq {
    font-size: 0.88rem;
    font-weight: 800;
    color: #e2e8f0;
}

.lesson-edit-curriculum-row-period {
    font-size: 0.76rem;
    color: var(--accent-neon);
    font-weight: 700;
}

.lesson-edit-curriculum-row-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lesson-edit-curriculum-row-title {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.4;
    color: #f8fafc;
}

.lesson-edit-curriculum-row-detail {
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-dim);
}

.lesson-edit-curriculum-empty {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px dashed rgba(148, 163, 184, 0.2);
    color: var(--text-dim);
    font-size: 0.84rem;
    line-height: 1.5;
    background: rgba(15, 23, 42, 0.38);
}

.lesson-curriculum-adjust-modal {
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    --lesson-curriculum-adjust-columns: 36px 54px 78px 122px minmax(0, 1.05fr) minmax(0, 1.35fr);
}

#modal-lesson-curriculum-adjust-backdrop {
    background: rgba(2, 6, 23, 0.86);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#modal-lesson-curriculum-adjust.glass {
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 14px 32px rgba(2, 6, 23, 0.38);
}

.lesson-curriculum-adjust-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.lesson-curriculum-adjust-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.lesson-curriculum-adjust-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.lesson-curriculum-adjust-summary {
    font-size: 0.86rem;
    line-height: 1.35;
    color: var(--text-dim);
    max-width: none;
}

.lesson-curriculum-adjust-actions {
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.lesson-curriculum-adjust-actions .nav-btn.btn-sm {
    min-height: 32px;
    padding: 6px 11px;
    font-size: 0.78rem;
}

.lesson-curriculum-adjust-head {
    display: grid;
    grid-template-columns: var(--lesson-curriculum-adjust-columns);
    gap: 8px;
    align-items: center;
    padding: 0 12px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.lesson-curriculum-adjust-head-cell {
    min-width: 0;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(147, 197, 253, 0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-curriculum-adjust-head-cell-check {
    text-align: center;
}

.lesson-curriculum-adjust-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 320px;
    max-height: 62vh;
    overflow-y: auto;
    padding: 8px 0 0;
    overscroll-behavior: contain;
    contain: content;
    scrollbar-gutter: stable;
}

.lesson-curriculum-adjust-selection-summary {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.3;
}

.lesson-curriculum-adjust-selection-summary.is-warning {
    color: #fbbf24;
}

.lesson-curriculum-adjust-row {
    display: grid;
    grid-template-columns: var(--lesson-curriculum-adjust-columns);
    gap: 8px;
    padding: 8px 12px;
    min-height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.82);
    align-items: center;
    cursor: pointer;
    contain: layout paint style;
    transition: none;
}

.lesson-curriculum-adjust-row.is-selected {
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(20, 31, 51, 0.9);
}

.lesson-curriculum-adjust-row.is-active {
    border-color: rgba(59, 130, 246, 0.48);
    background: rgba(30, 41, 59, 0.94);
}

.lesson-curriculum-adjust-check {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lesson-curriculum-adjust-check-input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.lesson-curriculum-adjust-list.is-pending {
    pointer-events: none;
}

.lesson-curriculum-adjust-cell {
    display: block;
    min-width: 0;
}

.lesson-curriculum-adjust-label {
    display: none;
}

.lesson-curriculum-adjust-value {
    display: block;
    font-size: 0.84rem;
    line-height: 1.2;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
}

.lesson-curriculum-adjust-value.is-muted {
    color: var(--text-dim);
}

.lesson-curriculum-adjust-placement-note {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid rgba(147, 197, 253, 0.26);
    background: rgba(59, 130, 246, 0.12);
    font-size: 0.68rem;
    font-weight: 700;
    color: #93c5fd;
    line-height: 1.15;
    vertical-align: middle;
}

.lesson-curriculum-adjust-footer-note {
    font-size: 0.78rem;
    color: var(--text-dim);
}

@media (max-width: 1180px) {
    .lesson-curriculum-adjust-modal {
        --lesson-curriculum-adjust-columns: 34px 50px 72px 112px minmax(0, 1fr) minmax(0, 1.22fr);
    }
}

@media (max-width: 900px) {
    .lesson-edit-meta-grid {
        grid-template-columns: 1fr;
    }

    .lesson-edit-curriculum-header {
        flex-direction: column;
    }

    .lesson-curriculum-adjust-topbar {
        flex-direction: column;
    }

    .lesson-curriculum-adjust-actions {
        justify-content: flex-start;
    }

    .lesson-curriculum-adjust-head {
        padding: 0 10px 6px;
    }

    .lesson-curriculum-adjust-list {
        max-height: 54vh;
    }

    .lesson-curriculum-adjust-modal {
        --lesson-curriculum-adjust-columns: 30px 42px 64px 96px minmax(0, 0.95fr) minmax(0, 1.15fr);
    }

    .lesson-curriculum-adjust-row {
        gap: 6px;
        padding: 7px 10px;
    }

    .lesson-curriculum-adjust-check {
        justify-content: center;
    }
}
