    body{font-family: sans-serif; background:#1a3a5f; color:white; padding:0; font-size:1.1em;} 
    .studio{width:100%; max-width:100%; min-height:100vh; margin:0; background:white; color:#333; padding:20px; border-radius:0; position:relative; box-sizing:border-box;}
    textarea, input[type="text"], select { font-family: sans-serif; padding:12px; border-radius:6px; border:1px solid #ccc; width:100%; box-sizing:border-box; font-size:1.1rem; }
    textarea.auto-height { height: auto; min-height: 45px; overflow-y: hidden; resize: none; }
    .nav-tab { padding: 12px 25px; background: #eee; border-radius: 8px 8px 0 0; cursor: pointer; font-weight: bold; color: #666; font-size: 0.9em; display: inline-block;}
    .nav-tab.active { background: #1a3a5f; color: white; }
    .media-nav-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; border: none; cursor: pointer; background: transparent; color: #64748b; transition: all 0.15s ease; user-select: none; }
    .media-nav-tab:hover { color: #0f172a; background: rgba(255, 255, 255, 0.6); }
    .media-nav-tab.active { background: #ffffff !important; color: #0f172a !important; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important; font-weight: 700; }
    .page-content { display: none; }
    .page-content.active { display: block; }
    .section-card{background:#f8f9fa;border:2px dashed #cbd5e0;padding:25px;margin-bottom:25px;border-radius:10px;}
    .tag { display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 4px; text-decoration: none; font-weight: bold; text-transform: uppercase; font-size: 0.8rem; border: 1px solid #ccc; color: #666; background: #fff; cursor: pointer; font-family: sans-serif; }
    .tag:hover { background: #1a3a5f; color: white; }
    .btn-autofill { background: #fff44f !important; color: #333 !important; border: 1px solid #d4c900; }
    .tag-del { border-color: #e74c3c; color: #e74c3c; }
    .tag-link { border-color: #f39c12; color: #f39c12; }
    @keyframes r2-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
    .r2-spin-anim { animation: r2-spin 0.85s linear infinite; }
    
    /* --- ORGANIZER FILE MANAGER UI --- */
    .file-manager {
        display: flex;
        height: calc(100vh - 185px);
        min-height: 520px;
        border: 2px solid #ddd;
        border-radius: 8px;
        overflow: hidden;
        background: #fff;
        resize: vertical;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }
    .fm-column { display: flex; flex-direction: column; border-right: 1px solid #ddd; overflow-y: auto; }
    .fm-column-header { background: #f0f2f5; padding: 0 12px; height: 38px; min-height: 38px; display: flex; align-items: center; justify-content: space-between; font-weight: bold; border-bottom: 1px solid #ddd; font-size: 0.8rem; color: #1a3a5f; box-sizing: border-box; flex-shrink: 0; }
    .fm-left {
        width: clamp(250px, 20vw, 340px);
        flex-shrink: 0;
        background: rgba(248, 250, 252, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    .fm-right { flex: 1; position: relative; }
    .fm-col-teachers {
        width: clamp(190px, 17vw, 250px);
        flex-shrink: 0;
        background: rgba(248, 250, 252, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    .fm-col-classes {
        width: clamp(170px, 15vw, 230px);
        flex-shrink: 0;
        background: rgba(248, 250, 252, 0.65);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    .fm-col-tests {
        flex: 1;
        min-width: 320px;
        position: relative;
        background: #ffffff;
    }
    .fm-item { padding: 10px 14px; margin: 2px 6px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; display: flex; align-items: center; min-height: 42px; line-height: 1.25; box-sizing: border-box; transition: background-color 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease; font-size: 0.94rem; color: #334155; }
    .fm-item:hover { background: rgba(148, 163, 184, 0.12); color: #0f172a; }
    .fm-item.selected { background: linear-gradient(135deg, rgba(59, 130, 246, 0.13) 0%, rgba(147, 197, 253, 0.22) 100%); backdrop-filter: blur(12px) saturate(160%); -webkit-backdrop-filter: blur(12px) saturate(160%); border-color: rgba(59, 130, 246, 0.28); color: #0f172a; font-weight: 600; box-shadow: 0 1px 3px rgba(37, 99, 235, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.75); }
    .fm-icon { 
        display: inline-flex; 
        align-items: center; 
        justify-content: center; 
        width: 18px; 
        height: 18px; 
        margin-right: 8px; 
        color: #64748b; 
        flex-shrink: 0; 
        vertical-align: middle;
        transition: color 0.15s ease;
    }
    .fm-icon svg {
        display: block;
        width: 15px;
        height: 15px;
    }
    .fm-item:hover .fm-icon,
    .fm-item-header:hover .fm-icon { 
        color: #1a3a5f; 
    }
    .fm-item.selected .fm-icon,
    .fm-item-wrap.selected .fm-icon { 
        color: #2563eb; 
    }
    .fm-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 10px; min-height: 40px; }
    .fm-toolbar .tag { opacity: 0.35; pointer-events: none; transition: opacity 0.22s ease; }
    .fm-toolbar.active .tag { opacity: 1; pointer-events: auto; }

    /* --- HYBRID CLASS COMBOBOX --- */
    .hybrid-class-combobox { position: relative; display: inline-flex; align-items: center; width: 100%; }
    .hybrid-class-combobox input { width: 100%; padding-right: 28px !important; box-sizing: border-box; }
    .hybrid-combo-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: #64748b; cursor: pointer; font-size: 0.78rem; padding: 4px 6px; border-radius: 4px; line-height: 1; }
    .hybrid-combo-toggle:hover { background: #f1f5f9; color: #0f172a; }
    .hybrid-combo-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 230px; overflow-y: auto; background: #ffffff; border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14); z-index: 36500; padding: 4px; }
    .hybrid-combo-opt { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-radius: 6px; font-size: 0.88rem; font-weight: 600; color: #1e293b; cursor: pointer; transition: background 0.12s ease; }
    .hybrid-combo-opt:hover { background: #eff6ff; color: #1d4ed8; }
    .hybrid-combo-opt.is-create { color: #059669; border-top: 1px dashed #e2e8f0; margin-top: 2px; padding-top: 8px; }
    .hybrid-combo-opt.is-create:hover { background: #ecfdf5; color: #047857; }

    /* --- CLASSES & GROUPS HEADER ADD BUTTONS & ROW ACTIONS --- */
    .fm-col-add-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; border: 1px solid #cbd5e1; background: #ffffff; color: #1a3a5f; font-weight: 800; font-size: 1rem; line-height: 1; cursor: pointer; transition: all 0.15s ease; padding: 0; }
    .fm-col-add-btn:hover { background: #1a3a5f; color: #ffffff; border-color: #1a3a5f; transform: scale(1.05); }
    .cg-row-del { opacity: 0; border: none; background: transparent; color: #94a3b8; cursor: pointer; width: 18px; height: 18px; padding: 0; font-size: 0.72rem; line-height: 1; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.15s ease; margin-left: 4px; }
    .fm-item:hover .cg-row-del { opacity: 1; }
    .cg-row-del:hover { color: #dc2626; background: #fef2f2; }
    .cg-inline-add { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; align-items: center; }
    .cg-inline-add input { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 0.84rem; font-weight: 600; }
    .cg-roster-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1px solid #f1f5f9; }
    .cg-roster-row input { width: 100%; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 0.84rem; box-sizing: border-box; }
    .gb-preset-btn { display: inline-flex; align-items: center; padding: 0 11px; height: 32px; border-radius: 6px; border: 1px solid #cbd5e1; background: #ffffff; color: #334155; font-size: 0.825rem; font-weight: 600; cursor: pointer; transition: all 0.15s ease; box-sizing: border-box; }
    .gb-preset-btn:hover { background: #f1f5f9; border-color: #94a3b8; color: #0f172a; }
    .gb-preset-btn.active { background: #1a3a5f; color: #ffffff; border-color: #1a3a5f; font-weight: 700; }

    /* --- TOP-LEVEL LONGITUDINAL GRADEBOOK (ENGEN ORGANIZER/EDITOR CONSISTENCY) --- */
    .gb-kpi-bar { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
    .gb-kpi-card { display: inline-flex; align-items: center; gap: 6px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 0 10px; height: 34px; box-sizing: border-box; }
    .gb-kpi-card .lbl { font-size: 0.72rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.03em; margin: 0; }
    .gb-kpi-card .val { font-size: 0.85rem; font-weight: 700; color: #1a3a5f; font-variant-numeric: tabular-nums; }
    .gb-kpi-card.gb-kpi-avg { background: #fef2f2; border: 1px solid #fca5a5; box-shadow: inset 0 2px 0 #fca5a5; color: #991b1b; }
    .gb-kpi-card.gb-kpi-avg .lbl { color: #991b1b; }
    .gb-kpi-card.gb-kpi-avg .val { color: #991b1b; }
    .gb-kpi-card.gb-kpi-gdpr { background: #eff6ff; border: 1px solid #93c5fd; color: #1e3a8a; cursor: pointer; transition: background-color 0.12s ease, border-color 0.12s ease; }
    .gb-kpi-card.gb-kpi-gdpr:hover { background: #dbeafe; border-color: #3b82f6; }
    .gb-kpi-card.gb-kpi-gdpr .lbl { color: #1e40af; }
    .gb-kpi-card.gb-kpi-gdpr .val { color: #1d4ed8; }
    .gb-matrix-wrap { overflow: auto; border: none; background: #ffffff; flex: 1 1 auto; min-height: 0; width: 100%; }
    .gb-table { width: auto; border-collapse: separate; border-spacing: 0; font-family: sans-serif; font-size: 0.85rem; font-variant-numeric: tabular-nums; color: #1e293b; }
    .gb-table th, .gb-table td { padding: 0; border-bottom: 1px solid #cbd5e1; border-right: 1px solid #cbd5e1; text-align: center; white-space: nowrap; height: 30px; box-sizing: border-box; }
    .gb-table th { position: sticky; top: 0; background: #f0f2f5; color: #1a3a5f; font-weight: 700; z-index: 5; border-bottom: 1.5px solid #cbd5e1; vertical-align: middle; padding: 6px 10px; text-align: left; }
    .gb-table th.gb-sticky-idx, .gb-table td.gb-sticky-idx { position: sticky; left: 0; min-width: 36px; width: 36px; max-width: 36px; background: #f8fafc; color: #64748b; font-size: 0.78rem; font-weight: 700; z-index: 7; border-right: 1px solid #cbd5e1; padding: 0; text-align: center; }
    .gb-table th.gb-sticky-idx { background: #f1f5f9; z-index: 9; padding: 0 6px; }
    .gb-idx-btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 29px; padding: 0; margin: 0; border: none; background: transparent; color: #64748b; font-family: inherit; font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; transition: background-color 0.12s ease, color 0.12s ease; }
    .gb-idx-btn:hover { background: #e0f2fe; color: #0369a1; }
    .gb-idx-btn.is-focused { background: #1d4ed8; color: #ffffff; }
    .gb-idx-btn.is-focused:hover { background: #1e40af; color: #ffffff; }
    .gb-table th.gb-col-sticky-left, .gb-table td.gb-col-sticky-left { position: sticky; left: 36px; background: #ffffff; z-index: 6; text-align: left; border-right: 1.5px solid #94a3b8; padding: 0 12px; }
    .gb-table th.gb-col-sticky-left { background: #eff6ff; color: #1e3a8a; box-shadow: inset 0 2px 0 #93c5fd; z-index: 8; }
    .gb-table th.gb-avg-col { background: #fef2f2; color: #991b1b; box-shadow: inset 0 2px 0 #fca5a5; text-align: center; }
    .gb-table td.gb-avg-col { background: #ffffff; padding: 0 12px; font-weight: 700; color: #1a3a5f; text-align: center; }
    .gb-table th.gb-col-test { background: #f1f5f9; color: #334155; box-shadow: inset 0 2px 0 #94a3b8; }
    .gb-table th.gb-col-test .gb-col-title-btn { color: #334155; }
    .gb-table th.gb-col-essay { background: #f5f3ff; color: #5b21b6; box-shadow: inset 0 2px 0 #c4b5fd; }
    .gb-table th.gb-col-essay .gb-col-title-btn { color: #5b21b6; }
    .gb-table tbody td:not(.gb-sticky-idx) { background: #ffffff; }
    .gb-table tbody tr:hover td:not(.gb-sticky-idx) { background: #f8fafc; }
    .gb-cell-btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 29px; padding: 0 10px; border-radius: 0; border: 1px solid transparent; background: transparent; cursor: pointer; font-family: inherit; box-sizing: border-box; font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #1a3a5f; transition: background-color 0.12s ease, color 0.12s ease; }
    .gb-cell-btn:hover { background: #eff6ff !important; border-color: #3b82f6; }
    .gb-cell-btn.is-bypassed { color: #94a3b8 !important; text-decoration: line-through; background: #f1f5f9 !important; font-weight: 500; }
    .gb-cell-btn.is-bypassed:hover { background: #e2e8f0 !important; border-color: #94a3b8; }
    .gb-col-title-btn { background: none; border: none; padding: 0; margin: 0; font-family: inherit; font-size: 0.85rem; font-weight: 700; color: #1a3a5f; line-height: 1.25; cursor: pointer; text-align: left; }
    .gb-col-title-btn:hover { color: #2563eb; text-decoration: underline; }
    .gb-hover-card { position: fixed; z-index: 29950; display: none; pointer-events: none; background: #ffffff; border: 1px solid #cbd5e1; border-left: 3.5px solid #1a3a5f; border-radius: 8px; padding: 9px 12px; box-shadow: 0 10px 26px rgba(15, 23, 42, 0.16); font-family: sans-serif; font-size: 0.825rem; color: #1e293b; min-width: 190px; max-width: 280px; }
    @page { size: auto; margin: 10mm; }
    /* --- EDITOR SECTION LABELS (A, B, C) --- */
    #sections-wrap { 
        counter-reset: sec_letter; 
    }

    .section-card { 
        counter-increment: sec_letter; 
        position: relative !important; 
        border-top: 3px solid #1a3a5f !important; /* Thick top border for the badge to sit on */
        margin-top: 40px !important;
    }

    /* This creates the A, B, C badge in the top-left corner */
    .section-card::before {
        content: "SECTION " counter(sec_letter, upper-alpha);
        position: absolute;
        top: -16px;
        left: 0px;
        background: #1a3a5f;
        color: white;
        padding: 3px 12px;
        font-weight: bold;
        border-radius: 4px;
        font-size: 0.8rem;
        z-index: 100;
        box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
    } /* Native Fullscreen Image Styling */
    .sec-media:fullscreen { 
        object-fit: contain !important; 
        background: black !important; 
        width: 100vw !important; 
        height: 100vh !important; 
    }
    .sec-media:-webkit-full-screen { 
        object-fit: contain !important; 
        background: black !important; 
        width: 100vw !important; 
        height: 100vh !important; 
    }
    /* --- HARMONICA ACCORDION STYLES --- */
.fm-item-wrap { border-bottom: 1px solid #f1f5f9; }
.fm-item-header { padding: 12px 15px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; transition: background-color 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1), color 0.22s ease, border-color 0.22s ease; font-size: 0.95rem; color: #1e293b; border-left: 3px solid transparent; }
.fm-item-header:hover { background: rgba(241, 245, 249, 0.78); }
.fm-item-wrap.selected .fm-item-header { background: linear-gradient(135deg, rgba(59, 130, 246, 0.11) 0%, rgba(186, 230, 253, 0.22) 100%); backdrop-filter: blur(12px) saturate(160%); -webkit-backdrop-filter: blur(12px) saturate(160%); color: #0f172a; font-weight: 600; border-left-color: #3b82f6; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 2px rgba(15, 23, 42, 0.03); }

.accordion-arrow, .subfolder-arrow { display: inline-block; transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease; }
.accordion-arrow.open, .subfolder-arrow.open { transform: rotate(180deg); }

.fm-subdrawer { display: grid; grid-template-rows: 0fr; opacity: 0; background: linear-gradient(180deg, rgba(248, 250, 252, 0.72) 0%, rgba(255, 255, 255, 0.96) 100%); border-left: 3px solid rgba(59, 130, 246, 0.38); transition: grid-template-rows 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease; overflow: hidden; }
.fm-subdrawer.active { grid-template-rows: 1fr; opacity: 1; }
.fm-subdrawer-inner { min-height: 0; overflow: hidden; padding: 0 0 0 25px; transition: padding 0.28s cubic-bezier(0.22, 1, 0.36, 1); }
.fm-subdrawer.active .fm-subdrawer-inner { padding: 6px 0 10px 25px; }
.fm-category-title { font-size: 0.75rem; font-weight: bold; color: #7f8c8d; text-transform: uppercase; margin: 8px 0 4px 10px; }
.fm-subfile { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; font-size: 0.85rem; color: #1e293b; border-radius: 6px; margin: 3px 10px 3px 0; border: 1px solid #e2e8f0; background: #ffffff; cursor: pointer; transition: all 0.15s ease; user-select: none; }
.fm-subfile:hover { background: #eff6ff; border-color: #93c5fd; }
.fm-subfile.selected { background: #dbeafe; border-color: #2563eb; color: #1e3a8a; box-shadow: 0 1px 4px rgba(37, 99, 235, 0.15); }
.btn-icon.sub-action-disabled { opacity: 0.32 !important; cursor: not-allowed !important; pointer-events: none !important; }

.sub-actions { display: flex; gap: 4px; }
.btn-mini { padding: 2px 6px; font-size: 0.7rem; border-radius: 3px; border: 1px solid #ccc; background: white; cursor: pointer; text-decoration: none; color: #333; }
.btn-mini:hover { background: #1a3a5f; color: white; }
.btn-mini-del { border-color: #e74c3c; color: #e74c3c; }
.btn-mini-del:hover { background: #e74c3c; color: white; }

/* --- FILE VIEWER MODAL OVERLAY --- */
#file-modal-overlay { position: fixed; top:0; left:0; width:100%; height:100%; background: #1a3a5f; z-index: 30000; display:none; align-items:center; justify-content:center; padding:10px; box-sizing:border-box; }
#file-modal { width: 100%; height: 100%; background: white; border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; box-shadow: none; }
#file-modal { width: 100%; max-width: 1150px; height: 100%; background: white; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
#file-modal { width: 100%; max-width: 1150px; height: 100%; background: white; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
#file-modal { width: 100%; max-width: 1150px; height: calc(100vh - 40px); background: white; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
#file-modal { width: 100vw; height: 100vh; background: white; border-radius: 0; display: flex; flex-direction: column; overflow: hidden; box-shadow: none; }
#file-modal-header { background: #1a3a5f; color: white; padding: 12px 20px; font-weight: bold; display: flex; justify-content: space-between; align-items: center; }
#file-modal-editor { flex: 1; padding: 15px; background: #ffffff; color: #000000; font-family: monospace; font-size: 0.95rem; border: none; resize: none; outline: none; line-height: 1.5; box-sizing: border-box; width: 100%; white-space: pre-wrap; word-break: break-word; overflow-y: auto; tab-size: 4; }
/* --- TWO-TIER SUBFOLDER ACCORDION --- */
.fm-subfolder-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(241, 245, 249, 0.82);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 7px;
    margin: 6px 10px 4px 0;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.fm-subfolder-header:hover { background: rgba(226, 232, 240, 0.75); border-color: #cbd5e1; }
.fm-subfolder-body { display: grid; grid-template-rows: 0fr; opacity: 0; padding-left: 10px; margin-bottom: 0; overflow: hidden; transition: grid-template-rows 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease, margin-bottom 0.25s ease; }
.fm-subfolder-body.open { grid-template-rows: 1fr; opacity: 1; margin-bottom: 6px; }
.fm-subfolder-body-inner { min-height: 0; overflow: hidden; }

.fm-version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    font-size: 0.85rem;
    color: #1e293b;
    border-radius: 6px;
    margin: 3px 10px 3px 0;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.fm-version-item:hover {
    background: #f5f3ff;
    border-color: #c4b5fd;
}
.fm-version-item.selected {
    background: #ede9fe;
    border-color: #7c3aed;
    color: #4c1d95;
    box-shadow: 0 1px 4px rgba(124, 58, 237, 0.15);
}
.fm-version-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: #f3e8ff;
    color: #6b21a8;
    border: 1px solid #d8b4fe;
    font-family: monospace;
}
.fm-version-item.selected .fm-version-badge {
    background: #7c3aed;
    color: #ffffff;
    border-color: #6d28d9;
}
#btn-ai-create-test {
    border: 1px solid #c084fc;
    background-color: #ffffff;
    color: #334155;
}
#btn-ai-create-test svg {
    color: #9333ea;
}
#btn-ai-create-test:hover {
    border-color: #9333ea;
    background-color: #faf5ff;
    color: #0f172a;
}

#btn-ai-transform {
    border: 1px solid #f59e0b;
    background-color: #ffffff;
    color: #334155;
}
#btn-ai-transform svg {
    color: #d97706;
}
#btn-ai-transform:not(.toolbar-disabled):hover {
    border-color: #d97706;
    background-color: #fffbeb;
    color: #0f172a;
}

#btn-host-live {
    border: 1px solid #93c5fd;
    background-color: #ffffff;
    color: #334155;
}
#btn-host-live svg {
    color: #2563eb;
}
#btn-host-live:not(.toolbar-disabled):hover {
    border-color: #2563eb;
    background-color: #eff6ff;
    color: #0f172a;
}
#btn-del {
    color: #dc2626;
}
#fm-toolbar .toolbar-btn {
    opacity: 0.35;
    pointer-events: none;
}
#fm-toolbar #btn-ai-create-test {
    opacity: 1 !important;
    pointer-events: auto !important;
}
#fm-toolbar.active .toolbar-btn {
    opacity: 1;
    pointer-events: auto;
}
#fm-toolbar.active .toolbar-btn.toolbar-disabled,
.toolbar-btn.toolbar-disabled {
    opacity: 0.38;
    color: #94a3b8;
    background-color: #f8fafc;
    border-color: #e2e8f0;
    cursor: not-allowed;
}
#fm-toolbar.active .toolbar-btn.toolbar-disabled svg,
.toolbar-btn.toolbar-disabled svg {
    color: #94a3b8 !important;
}

/* --- RICH RESULTS DASHBOARD UI --- */
.res-stats-bar { display: flex; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; }
.res-stat-card { background: white; border: 1px solid #cbd5e0; padding: 12px 18px; border-radius: 8px; flex: 1; min-width: 140px; box-shadow: 0 2px 4px rgba(0,0,0,0.04); }
.res-stat-card .val { font-size: 1.4rem; font-weight: bold; color: #1a3a5f; }
.res-stat-card .lbl { font-size: 0.75rem; text-transform: uppercase; color: #7f8c8d; font-weight: bold; }

.student-nav-bar { display: flex; flex-wrap: wrap; gap: 8px; background: white; padding: 12px; border-radius: 8px; border: 1px solid #cbd5e0; margin-bottom: 20px; }
.st-chip { background: #edf2f7; color: #1a3a5f; border: 1px solid #cbd5e0; padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: bold; cursor: pointer; transition: all 0.15s; }
.st-chip:hover { background: #1a3a5f; color: white; border-color: #1a3a5f; }

.st-card { background: white; border: 1px solid #cbd5e0; border-radius: 10px; margin-bottom: 20px; padding: 18px; box-shadow: 0 3px 6px rgba(0,0,0,0.05); }
.st-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #edf2f7; padding-bottom: 10px; margin-bottom: 15px; }
.st-name { font-size: 1.2rem; font-weight: bold; color: #1a3a5f; }
.st-grade-badge { padding: 4px 10px; border-radius: 4px; color: white; font-weight: bold; font-size: 0.9rem; }

.sec-title-badge { font-weight: bold; background: #1a3a5f; color: white; padding: 4px 10px; border-radius: 4px; font-size: 0.85rem; display: inline-block; margin-top: 10px; margin-bottom: 8px; }
.q-line { padding: 6px 10px; background: #ffffff; border: 1px solid #edf2f7; border-left: 3px solid #cbd5e0; margin-bottom: 4px; border-radius: 4px; font-family: monospace; font-size: 0.9rem; line-height: 1.5; }
.q-line-c { border-left-color: #27ae60 !important; } /* Correct - Green */
.q-line-w { border-left-color: #e74c3c !important; } /* Wrong - Red */
.q-line-t { border-left-color: #e67e22 !important; } /* Typo - Orange */
.q-line-a { border-left-color: #2980b9 !important; } /* Accepted - Blue */

.code-select { width: auto !important; display: inline-block !important; padding: 2px 5px !important; font-weight: bold; font-size: 11px; border-radius: 4px; margin-right: 8px; cursor: pointer; outline: none; transition: all 0.15s ease; text-align: center; }

.note-red { color: #d63031 !important; font-weight: bold !important; background: transparent; padding: 0 4px; border: none; display: inline-block; margin-left: 5px; outline: none; min-width: 15px; cursor: text; }
.note-red:empty::before { content: "add note"; color: #b2bec3; font-weight: normal; font-style: italic; }
.note-red:focus { background: transparent; border-bottom: 1px dashed #d63031; }

/* RESULTS BREAKDOWN SECTION PILLS & NAVIGATION */
.res-sec-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #475569;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}
.res-sec-pill:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}
.res-sec-pill.active {
    background: #1a3a5f !important;
    border: 1.5px solid #1a3a5f !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(26, 58, 95, 0.18);
}
.btn-back-overview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1a3a5f;
    color: #ffffff;
    border: none;
    height: 30px;
    padding: 0 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn-back-overview:hover {
    background: #0f2540;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
    transform: translateY(-0.5px);
}
.st-overview-row {
    transition: all 0.15s ease;
}
.st-overview-row:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.06);
}
/* PERSONAL ACCOUNT ICON BUTTON */
.account-icon-btn {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    background: #ffffff;
    color: #1a3a5f;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
    margin-left: 4px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.account-icon-btn:hover {
    background: #eff6ff;
    color: #2563eb;
    border-color: #2563eb;
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.18);
}

/* SETTINGS COGWHEEL BUTTON */
.settings-cog-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    background: #ffffff;
    color: #1a3a5f;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
    margin-left: 8px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.settings-cog-btn:hover {
    background: #f1f5f9;
    color: #2563eb;
    border-color: #2563eb;
    transform: rotate(60deg) scale(1.08);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}
/* LOGOUT ICON BUTTON */
.logout-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
    margin-left: 6px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.logout-icon-btn:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #fca5a5;
    transform: translateX(2px) scale(1.05);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.15);
}
/* COMPACT ICON BUTTONS */
.sub-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    text-decoration: none;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

/* SPECIAL COLOR HIGHLIGHTS ON HOVER */
.btn-icon-audit:hover { background: #f3e8ff; color: #7e22ce; border-color: #d8b4fe; }
.btn-icon-mail:hover { background: #e0e7ff; color: #4338ca; border-color: #a5b4fc; }
.btn-icon-del:hover { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }

/* AUTO-FILL ICON HOVER HIGHLIGHT */
.btn-icon-autofill:hover { 
    background: #fef3c7; 
    color: #b45309; 
    border-color: #fde68a; 
}

/* TOP TOOLBAR ICON BUTTONS */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #334155;
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.22s ease, background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease;
    text-decoration: none;
    box-sizing: border-box;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

.toolbar-btn:not(.toolbar-disabled):hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}
/* FULLSCREEN EMAIL DISTRIBUTION MODAL */
#email-dist-modal {
    background: #ffffff;
    width: 95vw;
    height: 92vh;
    max-width: 1400px;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
}

.email-modal-grid {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0; /* Prevents flex children from overflowing bounds */
}

.email-modal-col-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.email-modal-col-right {
    flex: 1.1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
}

/* EXPANDABLE STATS CHART CARDS (FULL WINDOW OVERLAY, NOT BROWSER FULLSCREEN) */
.stats-chart-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}
.stats-chart-card:hover {
    border-color: #94a3b8;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.stats-chart-card .stats-chart-canvas-wrap {
    height: 240px;
    position: relative;
}
.stats-chart-card .stats-expand-hint {
    font-size: 0.72rem;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    user-select: none;
}
.stats-chart-card:hover .stats-expand-hint {
    background: #e2e8f0;
    color: #1e293b;
}
.stats-chart-card.stats-card-expanded {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    margin: 0 !important;
    padding: 24px 32px !important;
    border-radius: 0 !important;
    border: none !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    cursor: zoom-out;
}
.stats-chart-card.stats-card-expanded .stats-chart-canvas-wrap {
    flex: 1 !important;
    height: auto !important;
    min-height: 0 !important;
    width: 100% !important;
}
.stats-chart-card.stats-card-expanded h4 {
    font-size: 1.1rem !important;
}
.stats-chart-card.stats-card-expanded .stats-expand-hint {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
    font-size: 0.8rem !important;
    padding: 4px 12px !important;
}

/* --- UNIFIED PROGRESSIVE DISCLOSURE: TRANSLUCENT GLASS EDITOR & ORGANIZER UI --- */
#page-editor {
    font-size: 0.94rem;
    color: #334155;
    max-width: 1020px;
    margin: 0 auto;
}
#page-editor input[type="text"],
#page-editor input[type="number"],
#page-editor select,
#page-editor textarea {
    font-size: 0.94rem;
    padding: 7px 11px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    background: #ffffff;
    line-height: 1.45;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#page-editor input[type="text"]:focus,
#page-editor input[type="number"]:focus,
#page-editor select:focus,
#page-editor textarea:focus {
    outline: none;
    border-color: #64748b;
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.14);
}
#page-editor input[type="text"],
#page-editor select {
    height: 36px;
}
#page-editor textarea.auto-height {
    min-height: 36px;
}
#page-editor .section-card {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-top: 3px solid #64748b !important;
    padding: 14px 16px;
    margin-bottom: 20px;
    margin-top: 28px !important;
    border-radius: 9px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
#page-editor .section-card::before {
    content: attr(data-section-label);
    position: absolute;
    top: -14px;
    left: 0px;
    padding: 2px 10px;
    font-size: 0.78rem;
    font-weight: bold;
    background: #475569 !important;
    color: #ffffff;
    border-radius: 4px;
    z-index: 100;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.06);
}
/* --- PAGINATED SECTION PILLS NAVIGATION --- */
#editor-sec-pills-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.editor-sec-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 32px;
    padding: 0 11px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: grab;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}
.editor-sec-pill:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}
.editor-sec-pill:active {
    cursor: grabbing;
}
.editor-sec-pill.active {
    background: #f1f5f9 !important;
    border: 1.5px solid #64748b !important;
    color: #0f172a !important;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.editor-sec-pill.sortable-ghost {
    opacity: 0.35;
    background: #e2e8f0 !important;
    border: 1.5px dashed #64748b !important;
}
.editor-sec-pill.sortable-chosen {
    cursor: grabbing !important;
    background: #f1f5f9 !important;
    border-color: #64748b !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}
.sec-pill-drag-icon {
    opacity: 0.4;
    color: #64748b;
    flex-shrink: 0;
    transition: opacity 0.15s ease;
}
.editor-sec-pill:hover .sec-pill-drag-icon {
    opacity: 0.8;
}
.editor-sec-pill.active .sec-pill-drag-icon {
    opacity: 0.7;
    color: #334155;
}
.editor-sec-pill-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    border: 1.5px dashed #94a3b8;
    background: #ffffff;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
}
.editor-sec-pill-add:hover {
    background: #f1f5f9;
    border-color: #475569;
    color: #0f172a;
    transform: translateY(-0.5px);
}
.editor-sec-pill-add:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: #cbd5e1;
}
#page-editor .q-item-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 6px;
}
#page-editor .q-sort-wrap .q-item-row:not(:last-child) {
    position: relative;
    padding-bottom: 8px;
    margin-bottom: 8px !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.65);
}
#page-editor .q-sort-wrap .q-item-row:not(:last-child)::after {
    display: none;
}
#page-editor .q-item-num {
    height: 36px;
    min-width: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 0.84rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #64748b;
    user-select: none;
    flex-shrink: 0;
}
#page-editor .q-item-row textarea {
    height: 36px;
    min-height: 36px !important;
    padding: 6px 10px !important;
    line-height: 22px !important;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: hidden;
    resize: none;
    box-sizing: border-box;
    display: block;
}
#page-editor .q-item-row input[type="text"],
#page-editor .q-item-row textarea.q-ans-input {
    background: #f8fafc;
    color: #1e3a8a;
    border-color: #cbd5e1;
}
#page-editor .q-item-row input[type="text"] {
    height: 36px !important;
    min-height: 36px !important;
    padding: 6px 10px !important;
    line-height: 22px !important;
    box-sizing: border-box;
}
#page-editor .q-item-row input[type="text"]:focus,
#page-editor .q-item-row textarea.q-ans-input:focus {
    background: #ffffff;
    border-color: #2563eb;
}
#page-editor .q-item-row .tag-del {
    height: 32px;
    width: 28px;
    margin-top: 2px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1;
    border: 1px solid transparent;
    background: transparent;
    color: #94a3b8;
    opacity: 0.55;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
}
#page-editor .q-item-row:hover .tag-del {
    opacity: 1;
}
#page-editor .q-item-row .tag-del:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #ef4444;
    opacity: 1;
}
#page-editor .btn-add-q-item {
    height: 32px;
    padding: 0 12px;
    font-size: 0.85rem;
    border-radius: 6px;
    border: 1px solid rgba(217, 119, 6, 0.45);
    color: #b45309;
    background: #fffbeb;
    text-transform: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
}
#page-editor .btn-add-q-item:hover {
    background: #fef3c7;
    border-color: #d97706;
    color: #92400e;
}
.editor-meta-card,
.sec-glass-header,
.pool-drawer-wrap,
.sec-questions-group,
.essay-scaffold-wrap {
    background: #ffffff;
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}
.editor-meta-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 155px auto;
    align-items: end;
    gap: 10px 12px;
    margin-bottom: 16px;
    border-left: 3.5px solid #64748b;
}
.editor-page-mode-cell {
    display: flex;
    align-items: center;
    height: 36px;
    white-space: nowrap;
}
.editor-page-mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 11px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-weight: 600;
    font-size: 0.80rem;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.editor-page-mode-pill:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}
.editor-meta-card .hybrid-class-combobox {
    min-width: 0;
}
.editor-meta-card .hybrid-class-combobox input {
    width: 0;
    min-width: 100%;
}
.editor-meta-card input[name="title"] {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}
.editor-meta-card input[name="title"]::placeholder {
    font-size: 0.95rem;
    font-weight: normal;
    color: #94a3b8;
}
.sec-glass-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    border-left: 3.5px solid #2563eb;
}
.tools-toggle-btn > svg:first-child {
    color: #2563eb;
}
.sec-header-fields-grid {
    display: grid;
    grid-template-columns: minmax(220px, 480px) auto;
    justify-content: start;
    gap: 10px 14px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(148, 163, 184, 0.45);
}
.sec-header-fields-grid .sec-instr-col {
    max-width: 780px;
}
.sec-header-fields-grid input[name^="section_title"] {
    font-weight: 700;
    color: #0f172a;
}
.sec-header-fields-grid input[name^="section_title"]::placeholder {
    font-weight: normal;
    color: #94a3b8;
}
.sec-field-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.sec-field-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #475569;
    line-height: 1.1;
}
.sec-field-col input {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}
.sec-field-col select {
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
}
#page-editor .sec-field-col select[name^="section_type"] {
    border-color: rgba(37, 99, 235, 0.45);
    background: #eff6ff;
    color: #1e40af;
    font-weight: 600;
}
#page-editor .sec-field-col select[name^="section_type"]:hover {
    background: #dbeafe;
    border-color: #2563eb;
}
#page-editor .sec-field-col select[name^="section_type"]:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16);
}
.pool-drawer-wrap {
    margin-bottom: 10px;
    border-color: #cbd5e1;
    border-left: 4px solid #64748b;
}
.sec-questions-group {
    margin-bottom: 2px;
    border-left: 4px solid #d97706;
}
.essay-scaffold-wrap {
    border-left: 4px solid #d97706;
}
.sec-questions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px dashed rgba(148, 163, 184, 0.4);
}
.sec-glass-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}
.sec-glass-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.sec-harmonica-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 11px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
}
.sec-harmonica-toggle:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}
.sec-harmonica-toggle.is-open {
    background: #ffffff;
    border-color: #64748b;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.sec-harmonica-toggle .harmonica-chevron {
    transition: transform 0.2s ease;
    opacity: 0.7;
}
.sec-harmonica-toggle.is-open .harmonica-chevron {
    transform: rotate(180deg);
    opacity: 1;
}
.sec-tools-drawer {
    border-top: 1px dashed rgba(148, 163, 184, 0.5);
    padding: 8px 0 2px 0;
    margin-top: 8px;
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.sec-tools-pills-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.sec-glass-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 11px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
    user-select: none;
}
.sec-glass-pill:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
    transform: translateY(-0.5px);
}
.sec-glass-pill.is-active {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.sec-glass-pill.strictness-trigger-btn,
.sec-glass-pill.strictness-trigger-btn.is-active,
.sec-glass-pill.media-trigger-btn,
.sec-glass-pill.media-trigger-btn.is-active,
.sec-glass-pill.rl-trigger-btn,
.sec-glass-pill.rl-trigger-btn.is-active {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
}
.sec-glass-pill.strictness-trigger-btn:hover,
.sec-glass-pill.media-trigger-btn:hover,
.sec-glass-pill.rl-trigger-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}
.sec-ask-ai-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid #c084fc;
    background-color: #ffffff;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
}
.sec-ask-ai-pill svg {
    color: #9333ea;
}
.sec-ask-ai-pill:hover {
    background-color: #faf5ff;
    border-color: #9333ea;
    color: #0f172a;
}
.sec-pool-top-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid #94a3b8;
    background-color: #ffffff;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
}
.sec-pool-top-btn svg {
    color: #64748b;
}
.sec-pool-top-btn:hover {
    background-color: #f1f5f9;
    border-color: #475569;
    color: #0f172a;
}
.sec-pool-top-btn.is-active {
    background-color: #f1f5f9;
    border-color: #475569;
    color: #0f172a;
}
.sec-populate-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 11px;
    border-radius: 6px;
    border: 1px solid #94a3b8;
    background-color: #ffffff;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
}
.sec-populate-btn svg {
    color: #475569;
}
.sec-populate-btn:hover {
    background-color: #f1f5f9;
    border-color: #475569;
    color: #0f172a;
}
.sec-del-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid #fca5a5;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
}
.sec-del-icon-btn svg {
    color: #dc2626;
}
.sec-del-icon-btn:hover {
    background-color: #fef2f2;
    border-color: #ef4444;
}
.sec-del-icon-btn:hover svg {
    color: #b91c1c;
}
#btn-editor-new-test,
.btn-new-test {
    border: 1px solid #fca5a5;
    background-color: #ffffff;
    color: #334155;
}
#btn-editor-new-test svg,
.btn-new-test svg {
    color: #dc2626;
}
#btn-editor-new-test:hover,
.btn-new-test:hover {
    background-color: #fef2f2;
    border-color: #ef4444;
    color: #0f172a;
}
#btn-editor-new-test,
#btn-editor-save-generate {
    white-space: nowrap;
    justify-content: center;
    transform: none;
}
#btn-editor-new-test:active,
#btn-editor-save-generate:active {
    transform: none;
    animation: none;
}
#btn-editor-save-generate,
.btn-save-generate {
    border: 1px solid #93c5fd;
    background-color: #ffffff;
    color: #334155;
}
#btn-editor-save-generate svg,
.btn-save-generate svg {
    color: #1a3a5f;
}
#btn-editor-save-generate:hover,
.btn-save-generate:hover {
    background-color: #eff6ff;
    border-color: #2563eb;
    color: #0f172a;
}
.syntax-helper-bar {
    border-top: 1px dashed rgba(148, 163, 184, 0.5);
    border-bottom: 1px dashed rgba(148, 163, 184, 0.5);
    padding: 8px 0;
    margin: 6px 0 10px 0;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1.1fr);
    gap: 10px;
    align-items: stretch;
    font-size: 0.88rem;
    color: #0f172a;
}
.syntax-helper-bar code {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: monospace;
    font-size: 0.86rem;
    color: #334155;
    font-weight: 700;
}
.syntax-model-box {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-left: 3px solid #64748b;
    border-radius: 6px;
    padding: 8px 10px;
    font-family: monospace;
    font-size: 0.88rem;
    color: #0f172a;
    line-height: 1.5;
    box-sizing: border-box;
}
.syntax-model-box .tok {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 700;
}
.syntax-model-box .cue {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 600;
}
.syntax-legend-list {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.88rem;
    color: #0f172a;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 3px;
    box-sizing: border-box;
}
.fm-diagnostics-wrap {
    margin-top: 6px;
    border: 1px solid rgba(203, 213, 225, 0.68);
    border-radius: 7px;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.78), rgba(241, 245, 249, 0.62));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow: hidden;
}
.fm-diagnostics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    font-size: 0.77rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.fm-diagnostics-header:hover {
    background: rgba(226, 232, 240, 0.55);
    color: #1e293b;
}

/* --- SETTINGS MODAL (FULL-VIEWPORT ADMIN CONSOLE & READABLE R2 PANEL) --- */
.settings-dialog {
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    color: #1a3a5f;
}
.settings-dialog--compact {
    width: 94vw;
    max-width: 780px;
    max-height: 94vh;
    border-radius: 12px;
}
.settings-dialog--fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
}
.settings-modal-header {
    background: #1a3a5f;
    color: #ffffff;
    padding: 16px 28px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.settings-dialog--compact .settings-modal-header {
    padding: 14px 20px;
}
.settings-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    background: #f1f5f9;
    padding: 24px 28px;
}
.settings-dialog--compact .settings-modal-body {
    padding: 18px 22px;
    background: #f8fafc;
}
.settings-dialog--compact .settings-col {
    gap: 14px;
}
.settings-admin-grid {
    max-width: 1720px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1.45fr 1fr;
    gap: 24px;
    align-items: start;
}
.settings-user-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
.settings-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}
.settings-card {
    background: #ffffff;
    padding: 22px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    box-sizing: border-box;
}
.settings-dialog--compact .settings-card {
    padding: 16px 18px;
    border-radius: 9px;
}
.settings-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.settings-card-title {
    margin: 0;
    font-size: 1.04rem;
    font-weight: 700;
    color: #1a3a5f;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.settings-field-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
#settings-modal-overlay .settings-input {
    width: 100%;
    font-size: 0.94rem;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    background: #ffffff;
    color: #0f172a;
}
#settings-modal-overlay .settings-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.settings-r2-panel {
    margin-top: 18px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.settings-r2-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.settings-r2-metric-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 10px;
    text-align: center;
}
.settings-r2-metric-label {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.settings-r2-metric-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin-top: 4px;
}
.settings-r2-metric-sub {
    font-size: 0.74rem;
    color: #94a3b8;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settings-r2-subcard {
    margin-top: 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
}
.settings-r2-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.settings-modal-footer {
    padding: 14px 28px;
    background: #e2e8f0;
    border-top: 1px solid #cbd5e1;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}
.settings-dialog--compact .settings-modal-footer {
    padding: 12px 20px;
}
@media (max-width: 1280px) {
    .settings-admin-grid {
        grid-template-columns: 1fr 1fr;
    }
    .settings-col-r2 {
        grid-column: 1 / -1;
        order: 2;
    }
}
@media (max-width: 820px) {
    .settings-modal-body {
        padding: 16px;
    }
    .settings-admin-grid {
        grid-template-columns: 1fr;
    }
    .settings-r2-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Read & Listen Asset inline formatting toolbar & live WYSIWYG editor */
.rl-fmt-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 4px;
    height: 24px;
    box-sizing: border-box;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
}
.rl-fmt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 4px;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: #334155;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.rl-fmt-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.rl-fmt-btn:active {
    background: #cbd5e1;
}
.rl-fmt-sep {
    width: 1px;
    height: 13px;
    background: #cbd5e1;
    margin: 0 2px;
}
select.rl-fmt-select {
    width: auto !important;
    min-width: 0;
    height: 20px !important;
    padding: 0 4px !important;
    margin: 0;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #ffffff;
    color: #334155;
    font-size: 0.72rem !important;
    line-height: 18px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    box-sizing: border-box;
}
select.rl-fmt-select:focus {
    border-color: #2563eb;
}
.rl-rich-editor {
    width: 100%;
    min-height: 76px;
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid #cbd5e0;
    padding: 8px 10px;
    border-radius: 4px;
    box-sizing: border-box;
    background: #ffffff;
    color: #1e293b;
    font-size: 0.9rem;
    line-height: 1.55;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
}
.rl-rich-editor:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.14);
}
.rl-rich-editor:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    pointer-events: none;
}

/* === MOBILE TEACHER BACKEND: ORGANIZER, EDITOR, RESULTS & SETTINGS (<= 768px ONLY — DESKTOP UNTOUCHED) === */
@media (max-width: 768px) {
    html, body {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    .container,
    .page-content {
        padding-left: 10px !important;
        padding-right: 10px !important;
        box-sizing: border-box !important;
        max-width: 100vw !important;
    }

    /* --- Organizer Toolbar & File Manager --- */
    .fm-toolbar {
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding: 8px !important;
        box-sizing: border-box !important;
    }
    .fm-toolbar .toolbar-group {
        flex-wrap: wrap !important;
        gap: 6px !important;
        width: 100% !important;
    }
    .fm-toolbar .toolbar-btn {
        padding: 7px 10px !important;
        font-size: 0.8rem !important;
        min-height: 36px !important;
    }
    .file-manager,
    .file-manager.fm-admin-tree {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        gap: 10px !important;
    }
    .fm-column {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        flex: none !important;
        border-right: none !important;
        border-bottom: 1px solid #e2e8f0 !important;
        max-height: 260px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .fm-item {
        padding: 9px 10px !important;
        font-size: 0.88rem !important;
        min-height: 38px !important;
    }

    /* --- Test Editor --- */
    #page-editor .fm-toolbar > div[style*="margin-left: auto"] {
        margin-left: 0 !important;
        width: 100% !important;
        justify-content: space-between !important;
    }
    .editor-meta-card {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        padding: 12px !important;
    }
    .editor-page-mode-cell {
        justify-content: flex-start !important;
    }
    #editor-section-nav {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
    }
    #editor-sec-pills-wrap {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        max-width: 100% !important;
        padding-bottom: 4px !important;
    }
    .section-card {
        padding: 10px !important;
        margin-bottom: 14px !important;
    }
    .sec-glass-header {
        padding: 10px !important;
    }
    .sec-glass-top-row {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .sec-glass-group {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .sec-header-fields-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .sec-questions-group {
        padding: 10px !important;
    }
    .sec-questions-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 7px !important;
    }
    .sec-translate-bar {
        width: 100% !important;
        gap: 6px !important;
    }
    .q-item-row {
        gap: 6px !important;
    }
    .q-item-row .drag-handle {
        padding-top: 7px !important;
    }
    /* Prevent iOS auto-zoom in Editor inputs */
    #page-editor input[type="text"],
    #page-editor input[type="number"],
    #page-editor select,
    #page-editor textarea {
        font-size: 16px !important;
    }

    /* --- File Viewer / Results Modal --- */
    #file-modal-overlay {
        padding: 0 !important;
    }
    #file-modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
    }
    #file-modal-header {
        flex-wrap: wrap !important;
        gap: 8px !important;
        padding: 10px 12px !important;
    }
    #file-modal-formatted,
    #file-modal-stats {
        padding: 12px !important;
    }
    #file-modal-stats > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    /* --- Settings, Submodals & Style Library --- */
    .settings-modal-overlay,
    .settings-submodal {
        padding: 6px !important;
    }
    .settings-dialog,
    .settings-submodal > div {
        width: calc(100vw - 12px) !important;
        max-width: calc(100vw - 12px) !important;
        max-height: 95dvh !important;
        border-radius: 12px !important;
    }
    .settings-submodal > div > div[style*="grid-template-columns"],
    #stg-sub-ai > div > div[style*="grid-template-columns"],
    #stg-sub-storage > div > div[style*="grid-template-columns"],
    #stg-sub-billing > div > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        padding: 12px !important;
        gap: 12px !important;
    }
    .settings-card > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    #admin-style-library-modal > div {
        width: calc(100vw - 10px) !important;
        max-width: calc(100vw - 10px) !important;
        max-height: 95dvh !important;
    }
    #admin-style-lib-search {
        width: 100% !important;
    }

    /* --- Tables across Results, Classes, Admin Panel --- */
    .page-content table,
    #file-modal table,
    .settings-submodal table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
