        :root {
            --primary: #6b7d5c;        /* olive green */
            --primary-hover: #5a6a4d;
            --primary-soft: #f4f6f2;   /* very light olive tint */

            --bg-main: #f7f8f6;
            --bg-card: #ffffff;

            --text-main: #1f2937;
            --text-muted: #6b7280;

            --border: #e5e7eb;

            --danger: #fca5a5;
            --danger-text: #7f1d1d;

            --radius: 14px;
        }
        
        body {
            margin: 0;
            font-family: "Segoe UI", Arial, sans-serif;
            background: var(--bg-main);
            color: var(--text-main);
        }

        .layout {
            display: flex;
            min-height: 100vh;
        }

        /* Sidebar */
        .sidebar {
            width: 240px;
            background: #ffffff;
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            transition: width 0.25s ease;
            overflow: visible;
        }

        .sidebar.collapsed {
            width: 110px;
        }

        .sidebar-logo {
            padding: 18px;
            display: flex;
            justify-content: center;
        }

        .sidebar-logo img {
            height: 80px;
            object-fit: contain;
        }

        .nav-group {
            flex: 1;
        }

        .nav-link {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 18px;
            text-decoration: none;
            color: #334155;
            position: relative;
            white-space: nowrap;
            transition: background 0.2s ease;
        }

        .nav-link:hover {
            background: #f6f8f4;
        }


        .icon {
            width: 24px;
            display: flex;
            justify-content: center;
            flex-shrink: 0;
        }

        .icon svg {
            width: 25px;
            height: 25px;
        }

        /* Smooth text animation */
        .nav-link .text,
        .collapse-text {
            opacity: 1;
            max-width: 180px;
            overflow: hidden;
            white-space: nowrap;
            transition: opacity 0.15s ease, max-width 0.25s ease;
        }

        .sidebar.collapsed .nav-link .text,
        .sidebar.collapsed .collapse-text {
            opacity: 0;
            max-width: 0;
        }

        .sidebar.collapsed .nav-link {
            justify-content: center;
            padding: 12px 0;
        }

        /* Tooltip */
        .sidebar.collapsed .nav-link:hover::after,
        .sidebar.collapsed .collapse-btn:hover::after {
            content: attr(data-label);
            position: fixed;   /* 🔥 KEY FIX */
            left: 80px;
            background: #111827;
            color: white;
            padding: 6px 10px;
            border-radius: 6px;
            font-size: 12px;
            white-space: nowrap;
            z-index: 9999;
        }

        /* Bottom collapse button */
        .sidebar-footer {
            padding: 16px;
        }

        .collapse-btn {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 8px;
            border: none;
            border-radius: 10px;
            background: #f1f5f9;
            padding: 10px 12px;
            cursor: pointer;
            transition: background 0.2s ease;
            overflow: hidden;
            position: relative;
        }

        .collapse-btn:hover {
            background: #e2e8f0;
        }

        .sidebar.collapsed .collapse-btn {
            justify-content: center;
            padding: 10px 0;
        }

        .collapse-text {
            font-size: 14px;
            color: #334155;
        }

        .collapse-btn svg {
            width: 25px;
            height: 25px;
            color: #334155;
            flex-shrink: 0;
        }

        .collapse-btn:hover svg {
            color: #111827;
        }

        /* Main content */
        .content {
            flex: 1;
            padding: 24px 32px;
            max-width: 1400px;
        }

        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .page-title {
            font-size: 32px;
            font-weight: 600;
            color: #1e293b;
        }

        .top-logo {
            height: 80px;
            width: auto;
            object-fit: contain;
            opacity: 0.9;
            transition: transform 0.2s ease;
        }

        .top-logo:hover {
            transform: scale(1.05);
        }

        /* Cards and tables */
        .card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 20px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
            transition: box-shadow 0.2s ease;
        }

        .card:hover {
            box-shadow: 0 6px 16px rgba(0,0,0,0.06);
        }

        .card.filter-card {
            background: #f9fbfa;
        }

        .btn-primary,
        .btn-secondary,
        .btn-danger,
        .btn-small {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
            padding: 10px 14px;
            text-decoration: none;
            cursor: pointer;
            font-size: 14px;
            min-height: 42px;
        }

        .btn-primary {
            background: #6b7d5c;
            color: white;
            font-weight: 600;
            box-shadow: 0 2px 6px rgba(107,125,92,0.25);
        }

        .btn-primary:hover {
            background: #5a6a4d;
        }

        .btn-secondary {
            background: #f1f3ef;
            color: #2f3a2b;
            border: 1px solid #d9dfd4;
            font-weight: 500;
        }

        .btn-secondary:hover {
            background: #e7ebe3;
        }

        .btn-danger {
            background: #fee2e2;
            color: var(--danger-text);
        }

        .btn-danger:hover {
            background: #fecaca;
        }

        .btn-small {
            padding: 6px 10px;
            font-size: 13px;
            background: #f1f5f9;
            color: #334155;
        }

        .btn-small:hover {
            background: #e2e8f0;
        }

        .table-wrapper {
            overflow-x: auto;
        }

        .data-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
        }

        .data-table th {
            background: #f3f5f1;
        color: #374151;
            font-weight: 600;
            text-align: left;
            padding: 12px;
            border-bottom: 1px solid #e5e7eb;
            white-space: nowrap;
        }

        .data-table td {
            padding: 14px 12px;
            border-bottom: 1px solid #f1f5f9;
            white-space: nowrap;
        }

        .data-table tr:hover {
            background: #f8fafc;
        }

        input:focus,
        select:focus,
        textarea:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 2px rgba(107,125,92,0.15);
        }

        .status-pill {
            padding: 4px 10px;
            border-radius: 999px;
            font-size: 12px;
            background: #eef2ea;
            color: #3f4f3a;
        }

        /* Forms */
        .form-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
        }

        label {
            display: block;
            font-weight: 600;
            margin-bottom: 6px;
            margin-top: 10px;
            color: #334155;
        }

        input,
        textarea,
        select {
            width: 100%;
            padding: 10px;
            box-sizing: border-box;
            border: 1px solid #cbd5e1;
            border-radius: 10px;
            font-size: 14px;
        }

        input[type="file"] {
            background: #ffffff;
            border: 1px solid #cbd5e1;
        }

        textarea {
            min-height: 80px;
        }

        .alert {
            background: #fee2e2;
            color: #991b1b;
            border: 1px solid #fecaca;
            padding: 12px 14px;
            border-radius: 10px;
            margin-bottom: 14px;
        }

        .filter-row {
            display: grid;
            grid-template-columns: 2fr 1fr 2fr auto auto;
            gap: 12px;
            align-items: center;
        }

        /* Top action buttons alignment */
        .button-row {
            display: flex;
            gap: 10px;
            margin-bottom: 18px;
            align-items: center;
            flex-wrap: wrap;
        }

        .button-row form {
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .button-row .btn-primary,
        .button-row .btn-secondary,
        .button-row button {
            height: 48px;
            min-width: 120px;
            padding: 0 18px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            white-space: nowrap;
        }

        .button-row input[type="file"] {
            height: 48px;
            width: 300px;
            padding: 12px;
            background: #ffffff;
            border: 1px solid #cbd5e1;
            border-radius: 10px;
            box-sizing: border-box;
        }

        .btn-primary,
        .btn-secondary,
        .btn-danger,
        .btn-small,
        button,
        a {
            font-weight: 500;
        }

        .button-row a,
        .button-row button {
            font-weight: 500;
        }

        .alert {
            background: #dcfce7;
            color: #166534;
            border: 1px solid #bbf7d0;
            padding: 12px 14px;
            border-radius: 10px;
            margin-bottom: 14px;
        }

        .nav-link.active {
            background: #f2f4f0;
            color: #3f4f3a;
            border-left: 4px solid var(--primary);
        }

        .nav-link.active svg {
            color: #3f4f3a;
        }

        .form-card {
            max-width: 950px;
        }

        .form-section {
            margin-bottom: 24px;
        }

        .form-section-title {
            font-size: 16px;
            font-weight: 700;
            color: #1e293b;
            margin-bottom: 12px;
        }

        .form-help {
            color: #64748b;
            font-size: 13px;
            margin-top: 8px;
        }

        .checkbox-list {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px 16px;
            margin-top: 10px;
        }

        .checkbox-item {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            font-weight: 400;
            margin: 0;
            padding: 10px;
            border: 1px solid #e5e7eb;
            border-radius: 10px;
            background: #f8fafc;
        }

        .checkbox-item input {
            width: auto;
            margin-top: 3px;
        }

        .warning-text {
            color: #991b1b;
            font-size: 12px;
        }

        /* Active (green / olive) */
        .status-active {
            background: #eef2ea;
            color: #3f4f3a;
        }

        /* Inactive (pastel red) */
        .status-inactive {
            background: #fdecec;
            color: #7f1d1d;
        }

        /* =========================
        PUBLIC REGISTRATION PAGE
        ========================= */

        .public-page {
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 40px 20px;
            background: #f7f7f5;
        }

        .public-card {
            width: 100%;
            max-width: 700px;
            background: white;
            border-radius: 24px;
            padding: 40px;
            box-shadow: 0 8px 30px rgba(0,0,0,0.08);
        }

        .public-logo {
            text-align: center;
            margin-bottom: 20px;
        }

        .public-logo img {
            height: 100px;
            width: auto;
        }

        .public-card h1 {
            text-align: center;
            margin-bottom: 10px;
            font-size: 32px;
        }

        .public-subtitle {
            text-align: center;
            color: #666;
            margin-bottom: 30px;
        }

        .form-field {
            margin-bottom: 20px;
        }

        .form-field label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
        }

        .public-card input,
        .public-card select,
        .public-card textarea {
            width: 100%;
            padding: 12px 14px;
            border-radius: 12px;
            border: 1px solid #d9d9d9;
            font-size: 15px;
            box-sizing: border-box;
        }

        .public-card textarea {
            min-height: 120px;
            resize: vertical;
        }

        .public-card input:focus,
        .public-card select:focus,
        .public-card textarea:focus {
            outline: none;
            border-color: #9ba88d;
            box-shadow: 0 0 0 3px rgba(155,168,141,0.15);
        }

        .field-error {
            margin-top: 6px;
            color: #c0392b;
            font-size: 14px;
        }

        .public-submit {
            width: 100%;
            margin-top: 10px;
            min-height: 48px;
            border-radius: 12px;
            font-size: 16px;
        }

        /* =========================
        MOBILE RESPONSIVE
        ========================= */

        @media (max-width: 768px) {

            .public-page {
                padding: 16px;
                align-items: flex-start;
            }

            .public-card {
                padding: 24px 18px;
                border-radius: 18px;
                box-shadow: none;
                max-width: 100%;
            }

            .public-logo img {
                height: 72px;
            }

            .public-card h1 {
                font-size: 26px;
                line-height: 1.2;
            }

            .public-subtitle {
                font-size: 14px;
                margin-bottom: 24px;
            }

            .form-field {
                margin-bottom: 16px;
            }

            .form-field label {
                font-size: 14px;
            }

            .public-card input,
            .public-card select,
            .public-card textarea {
                min-height: 46px;
                font-size: 16px;
                border-radius: 10px;
            }

            .public-card textarea {
                min-height: 100px;
            }

            .public-submit {
                min-height: 50px;
                font-size: 16px;
            }
        }

        /* For Invoice and Receipts */

        .invoice-table {
            min-width: 1800px;
        }

        .invoice-table input,
        .invoice-table select {
            min-width: 140px;
            font-size: 13px;
            padding: 8px;
        }

        .invoice-table input[type="checkbox"] {
            min-width: auto;
            width: 18px;
            height: 18px;
        }

        .invoice-table .center-cell {
            text-align: center;
        }

        .invoice-table .new-row {
            background: #f8faf7;
        }

        .invoice-table .new-row td {
            vertical-align: middle;
        }

        .invoice-action-row {
            margin-bottom: 18px;
            gap: 16px;
        }

        .pagination-row {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 14px;
            margin-top: 18px;
        }

        .pagination-row span {
            color: #4b5563;
            font-weight: 500;
        }

        .tabs {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            margin-bottom: 16px;
        }

        .tab-button {
            border: 1px solid #d9dfd4;
            background: #f1f3ef;
            color: #2f3a2b;
            border-radius: 10px;
            padding: 10px 14px;
            cursor: pointer;
        }

        .tab-button.active {
            background: var(--primary);
            color: white;
        }

        /* Strong checkbox alignment fix */
        form .checkbox-row {
            display: flex !important;
            flex-direction: row !important;
            align-items: center !important;
            gap: 24px !important;
            margin: 14px 0 !important;
            flex-wrap: wrap !important;
        }

        form .checkbox-row label {
            display: flex !important;
            flex-direction: row !important;
            align-items: center !important;
            gap: 8px !important;
            width: auto !important;
            margin: 0 !important;
            white-space: nowrap !important;
        }

        form .checkbox-row input[type="checkbox"] {
            display: inline-block !important;
            width: 16px !important;
            min-width: 16px !important;
            max-width: 16px !important;
            height: 16px !important;
            margin: 0 !important;
            padding: 0 !important;
        }

        .form-field.checkbox-inline-field {
            display: flex !important;
            align-items: center !important;
            gap: 10px !important;
            margin: 14px 0 !important;
        }

        .form-field.checkbox-inline-field input[type="checkbox"] {
            width: 16px !important;
            min-width: 16px !important;
            max-width: 16px !important;
            height: 16px !important;
            margin: 0 !important;
            padding: 0 !important;
        }

        .form-field.checkbox-inline-field label {
            margin: 0 !important;
            width: auto !important;
            font-weight: 600;
        }

        .btn-small,
        button.btn-small {
            border: none;
            padding: 6px 10px;
            font-size: 13px;
            background: #f1f5f9;
            color: #334155;
            border-radius: 10px;
            font-weight: bold;
            min-height: 42px;
        }

        /* =========================
           LOGIN PAGE
           Two-panel layout: brand (left) + form (right).
           All selectors scoped to body.login-page or .login-*.
        ========================= */

        body.login-page {
            /* Override sidebar-app layout: login is full-viewport centered */
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            min-height: 100svh;
            padding: 24px 16px;
            box-sizing: border-box;
            background: var(--bg-main);
        }

        /* Outer shell — card that contains both panels */
        .login-shell {
            display: flex;
            flex-direction: row;
            width: 100%;
            max-width: 960px;
            /* min-width: 0 lets the shell shrink below its content-based
               intrinsic size so padding and max-width govern at small viewports */
            min-width: 0;
            min-height: 540px;
            border-radius: 24px;
            overflow: hidden;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.09);
        }

        /* ── Brand panel ──────────────────────────────── */
        .login-brand-panel {
            flex: 0 0 42%;
            background: #edf0eb;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 48px 36px;
            box-sizing: border-box;
            position: relative;
        }

        .login-brand-inner {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            width: 100%;
        }

        .login-logo {
            margin-bottom: 28px;
        }

        .login-logo img {
            width: 148px;
            height: auto;
            display: block;
        }

        .login-tagline {
            font-family: Georgia, 'Times New Roman', serif;
            font-style: italic;
            font-size: 15px;
            line-height: 1.65;
            color: #4a5940;
            margin: 0;
        }

        /* Five-line musical staff decoration */
        .login-staff {
            margin-top: 36px;
            width: 80%;
        }

        .login-staff-lines {
            height: 40px;
            background: repeating-linear-gradient(
                to bottom,
                transparent 0px,
                transparent 7px,
                rgba(74, 89, 64, 0.18) 7px,
                rgba(74, 89, 64, 0.18) 8px
            );
        }

        /* ── Form panel ──────────────────────────────── */
        .login-form-panel {
            flex: 1;
            min-width: 0;
            background: var(--bg-card);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 48px 40px;
            box-sizing: border-box;
        }

        .login-card {
            width: 100%;
            max-width: 360px;
        }

        .login-heading {
            font-family: Georgia, 'Times New Roman', serif;
            font-style: italic;
            font-weight: normal;
            font-size: 30px;
            color: #1a1f16;
            margin: 0 0 8px 0;
        }

        .login-subheading {
            font-size: 14px;
            color: var(--text-muted);
            margin: 0 0 24px 0;
            line-height: 1.55;
        }

        /* ── Messages ──────────────────────────────────── */
        .login-message {
            padding: 11px 14px;
            border-radius: 10px;
            font-size: 14px;
            line-height: 1.45;
            margin-bottom: 18px;
            border-width: 1px;
            border-style: solid;
            overflow-wrap: break-word;
        }

        .login-message--success {
            background: #f0fdf4;
            border-color: #bbf7d0;
            color: #166534;
        }

        .login-message--warning {
            background: #fffbeb;
            border-color: #fde68a;
            color: #92400e;
        }

        .login-message--error {
            background: #fef2f2;
            border-color: #fecaca;
            color: #991b1b;
        }

        /* ── Form fields ──────────────────────────────── */
        .login-field {
            margin-bottom: 20px;
        }

        /* Override global label margin for the login form */
        .login-field label {
            margin-top: 0;
            font-size: 14px;
            font-weight: 600;
            color: #334155;
        }

        .password-field-wrapper {
            position: relative;
        }

        .password-field-wrapper input[type="password"],
        .password-field-wrapper input[type="text"] {
            /* Reserve room for the toggle button */
            padding-right: 48px;
        }

        .password-toggle {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            padding: 4px;
            cursor: pointer;
            color: var(--text-muted);
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            /* Reset global button font-weight override */
            font-weight: normal;
            min-height: unset;
        }

        .password-toggle:hover {
            color: var(--primary);
            background: var(--primary-soft);
        }

        .password-toggle:focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }

        /* ── Submit button ─────────────────────────────── */
        .login-submit {
            display: block;
            width: 100%;
            min-height: 48px;
            padding: 0 20px;
            background: var(--primary);
            color: #ffffff;
            font-size: 15px;
            font-weight: 600;
            letter-spacing: 0.01em;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(107, 125, 92, 0.28);
            transition: background 0.18s ease, box-shadow 0.18s ease;
        }

        .login-submit:hover {
            background: var(--primary-hover);
            box-shadow: 0 4px 14px rgba(107, 125, 92, 0.32);
        }

        .login-submit:focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 3px;
        }

        .login-submit:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            box-shadow: none;
        }

        /* ── Desktop: two-column shell (≥ 900px) ─────── */
        /* Already the default — handled by the base rules above */

        /* ── Tablet (481px – 899px): stacked panels ──── */
        @media (max-width: 899px) {
            body.login-page {
                padding: 16px;
            }

            .login-shell {
                flex-direction: column;
                min-height: unset;
                max-width: 520px;
                box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
            }

            .login-brand-panel {
                flex: none;
                padding: 32px 28px 24px;
            }

            .login-logo img {
                width: 100px;
                height: auto;
            }

            .login-tagline {
                font-size: 14px;
            }

            .login-staff {
                display: none;
            }

            .login-form-panel {
                padding: 32px 28px 36px;
            }
        }

        /* ── Mobile (≤ 480px): compact ───────────────── */
        @media (max-width: 480px) {
            body.login-page {
                padding: 12px;
                justify-content: flex-start;
            }

            .login-shell {
                border-radius: 18px;
                max-width: 100%;
            }

            .login-brand-panel {
                padding: 24px 20px 18px;
            }

            .login-logo img {
                width: 80px;
                height: auto;
            }

            .login-logo {
                margin-bottom: 14px;
            }

            .login-tagline {
                font-size: 13px;
            }

            .login-form-panel {
                padding: 24px 20px 28px;
            }

            .login-heading {
                font-size: 26px;
            }

            .login-card {
                max-width: 100%;
            }
        }

        /* ── Very small (≤ 340px) ─────────────────────── */
        @media (max-width: 340px) {
            .login-heading {
                font-size: 22px;
            }

            .login-logo img {
                width: 68px;
                height: auto;
            }
        }

        /* =========================
           STUDENT PORTAL
           Top-header layout, independent of the admin sidebar.
           All selectors scoped to body.student-portal or .sp-*.
        ========================= */

        body.student-portal {
            display: block;
            min-height: 100vh;
            background: var(--bg-main);
            padding: 0;
        }

        /* ── Header ─────────────────────────────────── */
        .sp-header {
            background: var(--bg-card);
            border-bottom: 1px solid var(--border);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .sp-header-inner {
            max-width: 1100px;
            margin: 0 auto;
            padding: 0 24px;
            height: 64px;
            display: flex;
            align-items: center;
            gap: 32px;
        }

        .sp-logo-link {
            display: flex;
            align-items: center;
            text-decoration: none;
            flex-shrink: 0;
        }

        .sp-logo {
            height: 44px;
            width: auto;
            object-fit: contain;
        }

        /* ── Navigation ──────────────────────────────── */
        .sp-nav {
            display: flex;
            align-items: center;
            gap: 4px;
            flex: 1;
        }

        .sp-nav-link {
            display: inline-flex;
            align-items: center;
            padding: 8px 14px;
            border-radius: 8px;
            text-decoration: none;
            color: #334155;
            font-size: 14px;
            font-weight: 500;
            transition: background 0.15s ease, color 0.15s ease;
            white-space: nowrap;
        }

        .sp-nav-link:hover {
            background: var(--primary-soft);
            color: var(--primary);
        }

        .sp-nav-link.active {
            background: var(--primary-soft);
            color: var(--primary);
            font-weight: 600;
        }

        /* ── User area ───────────────────────────────── */
        .sp-user {
            display: flex;
            align-items: center;
            gap: 16px;
            flex-shrink: 0;
            margin-left: auto;
        }

        .sp-greeting {
            font-size: 14px;
            font-weight: 500;
            color: var(--text-muted);
            white-space: nowrap;
        }

        .sp-logout-btn {
            display: inline-flex;
            align-items: center;
            padding: 7px 14px;
            background: none;
            border: 1px solid var(--border);
            border-radius: 8px;
            font-size: 13px;
            font-weight: 500;
            color: #334155;
            cursor: pointer;
            transition: background 0.15s ease, border-color 0.15s ease;
            white-space: nowrap;
            min-height: unset;
        }

        .sp-logout-btn:hover {
            background: #f8fafc;
            border-color: #94a3b8;
        }

        /* ── Messages ────────────────────────────────── */
        .sp-messages {
            max-width: 1100px;
            margin: 16px auto 0;
            padding: 0 24px;
        }

        .sp-message {
            padding: 12px 16px;
            border-radius: 10px;
            font-size: 14px;
            border: 1px solid transparent;
            margin-bottom: 8px;
        }

        .sp-message--success {
            background: #f0fdf4;
            border-color: #bbf7d0;
            color: #166534;
        }

        .sp-message--warning {
            background: #fffbeb;
            border-color: #fde68a;
            color: #92400e;
        }

        .sp-message--error {
            background: #fef2f2;
            border-color: #fecaca;
            color: #991b1b;
        }

        /* ── Content area ────────────────────────────── */
        .sp-content {
            max-width: 1100px;
            margin: 0 auto;
            padding: 32px 24px 48px;
        }

        .sp-page-header {
            margin-bottom: 28px;
        }

        .sp-page-title {
            font-size: 28px;
            font-weight: 700;
            color: #1e293b;
            margin: 0 0 4px 0;
        }

        .sp-page-subtitle {
            font-size: 14px;
            color: var(--text-muted);
            margin: 0;
        }

        /* ── Cards ───────────────────────────────────── */
        .sp-card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 24px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        }

        .sp-card-title {
            font-size: 13px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            margin: 0 0 12px 0;
        }

        .sp-card-value {
            font-size: 18px;
            font-weight: 600;
            color: #1e293b;
            margin: 0 0 4px 0;
        }

        .sp-card-meta {
            font-size: 13px;
            color: var(--text-muted);
            margin: 0;
        }

        .sp-empty {
            font-size: 14px;
            color: var(--text-muted);
            margin: 0;
        }

        /* ── Breadcrumbs ─────────────────────────────── */
        .sp-breadcrumbs {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 4px;
            font-size: 13px;
            color: var(--text-muted);
            margin: 6px 0 20px;
        }

        .sp-breadcrumb-link {
            color: var(--primary);
            text-decoration: none;
            font-weight: 500;
        }

        .sp-breadcrumb-link:hover {
            text-decoration: underline;
        }

        .sp-breadcrumb-sep {
            color: var(--text-muted);
        }

        .sp-breadcrumb-current {
            font-weight: 600;
            color: var(--text-main);
        }

        /* ── Folder grid ─────────────────────────────── */
        .sp-folder-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
            gap: 14px;
            margin: 16px 0 24px;
        }

        .sp-folder-card {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 16px;
            border-radius: var(--radius);
            background: var(--card-bg);
            border: 1px solid var(--border);
            text-decoration: none;
            transition: box-shadow 0.15s, transform 0.15s;
        }

        .sp-folder-card:hover {
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.09);
            transform: translateY(-2px);
        }

        .sp-folder-icon {
            width: 28px;
            height: 28px;
            color: var(--primary);
            flex-shrink: 0;
        }

        .sp-folder-label {
            font-weight: 600;
            font-size: 14px;
            color: var(--text-main);
            word-break: break-word;
        }

        /* ── File list ───────────────────────────────── */
        .sp-file-list {
            padding: 0;
            overflow: hidden;
        }

        .sp-file-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 14px 20px;
            border-bottom: 1px solid var(--border);
        }

        .sp-file-row:last-child {
            border-bottom: none;
        }

        .sp-file-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .sp-file-icon {
            width: 20px;
            height: 20px;
            color: var(--text-muted);
            flex-shrink: 0;
        }

        .sp-file-name {
            font-weight: 500;
            font-size: 14px;
            color: var(--text-main);
        }

        .sp-file-open {
            color: var(--primary);
            font-size: 13px;
            font-weight: 600;
            text-decoration: none;
            white-space: nowrap;
        }

        .sp-file-open:hover {
            text-decoration: underline;
        }

        .sp-file-actions {
            display: flex;
            align-items: center;
            gap: 14px;
            flex-shrink: 0;
        }

        .sp-file-join {
            color: #2d6a4f;
            font-size: 13px;
            font-weight: 700;
            text-decoration: none;
            white-space: nowrap;
        }

        .sp-file-join:hover {
            text-decoration: underline;
        }

        .sp-ts-indicator {
            font-size: 12px;
            font-weight: 600;
            color: #2d6a4f;
            white-space: nowrap;
        }

        /* ── Dashboard grid ──────────────────────────── */
        .sp-dashboard-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 16px;
        }

        /* ── Profile table ───────────────────────────── */
        .sp-profile-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
        }

        .sp-profile-table th {
            width: 160px;
            text-align: left;
            font-weight: 600;
            color: #374151;
            padding: 12px 16px 12px 0;
            border-bottom: 1px solid var(--border);
            vertical-align: top;
        }

        .sp-profile-table td {
            padding: 12px 0;
            border-bottom: 1px solid var(--border);
            color: #1f2937;
        }

        /* ── Mobile responsive ───────────────────────── */
        @media (max-width: 768px) {
            .sp-header-inner {
                height: auto;
                flex-wrap: wrap;
                padding: 12px 16px;
                gap: 0;
                row-gap: 8px;
            }

            .sp-logo-link {
                flex: 1;
            }

            .sp-user {
                margin-left: 0;
            }

            .sp-nav {
                order: 3;
                flex: 0 0 100%;
                overflow-x: auto;
                padding-bottom: 4px;
                gap: 2px;
            }

            .sp-nav-link {
                padding: 7px 12px;
                font-size: 13px;
            }

            .sp-content {
                padding: 20px 16px 40px;
            }

            .sp-dashboard-grid {
                grid-template-columns: 1fr;
            }

            .sp-folder-grid {
                grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
                gap: 10px;
            }

            .sp-page-title {
                font-size: 22px;
            }
        }

        /* ── Annotation toolbar ─────────────────────── */
        .ann-toolbar {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 4px;
            padding: 6px 10px;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 8px;
            margin-bottom: 8px;
        }

        .ann-tool-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            height: 30px;
            padding: 0 10px;
            background: transparent;
            border: 1px solid transparent;
            border-radius: 5px;
            color: var(--text-main);
            cursor: pointer;
            font-size: 13px;
            font-family: inherit;
            white-space: nowrap;
            transition: background 0.12s, border-color 0.12s;
            user-select: none;
        }
        .ann-tool-btn:hover:not(:disabled) {
            background: var(--bg-main);
            border-color: var(--border);
        }
        .ann-tool-btn.active {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
        }
        .ann-tool-btn:disabled {
            opacity: 0.35;
            cursor: default;
        }

        .ann-toolbar-sep {
            width: 1px;
            height: 20px;
            background: var(--border);
            margin: 0 3px;
            flex-shrink: 0;
        }

        /* Color swatches */
        .ann-color-row {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .ann-color-swatch {
            width: 22px;
            height: 22px;
            border-radius: 50%;
            border: 2px solid transparent;
            cursor: pointer;
            padding: 0;
            transition: border-color 0.12s, transform 0.12s;
        }
        .ann-color-swatch.active,
        .ann-color-swatch:hover {
            border-color: var(--text-main);
            transform: scale(1.15);
        }

        /* Width buttons */
        .ann-width-btn {
            height: 28px;
            padding: 0 8px;
            background: transparent;
            border: 1px solid var(--border);
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
            color: var(--text-muted);
            transition: background 0.12s, border-color 0.12s;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .ann-width-btn.active {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
        }
        .ann-width-btn:hover:not(.active) {
            background: var(--bg-main);
        }

        /* Save status */
        .ann-save-status {
            font-size: 12px;
            color: var(--text-muted);
            margin-left: 4px;
            min-width: 64px;
        }
        .ann-save-status.saving { color: #d97706; }
        .ann-save-status.saved  { color: var(--primary); }
        .ann-save-status.error  { color: #dc2626; font-weight: 600; }

        /* ── PDF page container (canvas + SVG overlay) ── */
        .pdf-page-container {
            position: relative;
            display: inline-block;
            line-height: 0;
        }

        #annotation-svg {
            position: absolute;
            top: 0;
            left: 0;
            overflow: visible;
            touch-action: none;
        }

        /* ── Note editor overlay ────────────────────── */
        .note-editor-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.35);
            z-index: 9000;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .note-editor-box {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 20px;
            width: min(360px, 92vw);
            display: flex;
            flex-direction: column;
            gap: 12px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.18);
        }
        .note-editor-box label {
            font-size: 13px;
            font-weight: 600;
            color: var(--text-main);
        }
        .note-editor-box textarea {
            width: 100%;
            box-sizing: border-box;
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 8px;
            font-size: 13px;
            font-family: inherit;
            resize: vertical;
            min-height: 80px;
            color: var(--text-main);
            background: var(--bg-main);
        }
        .note-editor-actions {
            display: flex;
            gap: 8px;
            justify-content: flex-end;
        }
        .note-editor-actions button {
            height: 32px;
            padding: 0 16px;
            border-radius: 6px;
            border: 1px solid var(--border);
            cursor: pointer;
            font-size: 13px;
            font-family: inherit;
        }
        .note-editor-actions .note-confirm-btn {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
        }
        .note-editor-actions .note-cancel-btn {
            background: transparent;
            color: var(--text-muted);
        }

        /* Note bubble tooltip */
        .ann-note-bubble {
            background: #fef3c7;
            border: 1px solid #d97706;
            border-radius: 5px;
            padding: 4px 7px;
            font-size: 11px;
            color: #78350f;
            word-break: break-word;
            line-height: 1.4;
            pointer-events: none;
        }

        @media (max-width: 768px) {
            .ann-toolbar { gap: 3px; padding: 5px 8px; }
            .ann-tool-btn { height: 28px; padding: 0 8px; font-size: 12px; }
        }

        /* ================================
           Material Library — File Explorer
           ================================ */

        .fx-breadcrumbs {
            font-size: 14px;
            color: var(--text-muted);
            margin-top: 14px;
            margin-bottom: 24px;
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .fx-breadcrumbs a {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            color: var(--primary);
            text-decoration: none;
            font-weight: 500;
        }

        .fx-breadcrumbs a:hover {
            text-decoration: underline;
        }

        .fx-breadcrumb-home svg {
            width: 15px;
            height: 15px;
        }

        .fx-breadcrumb-sep {
            color: #cbd5e1;
        }

        .fx-breadcrumb-current {
            color: var(--text-main);
            font-weight: 600;
        }

        .fx-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
            margin-bottom: 22px;
        }

        .fx-toolbar-left,
        .fx-toolbar-right {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }

        /* Buttons scoped to the Material Library toolbar only */
        .fx-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            height: 36px;
            padding: 0 12px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            text-decoration: none;
            cursor: pointer;
            white-space: nowrap;
            border: 1px solid transparent;
            box-sizing: border-box;
        }

        .fx-btn svg {
            width: 15px;
            height: 15px;
            flex-shrink: 0;
        }

        .fx-btn-primary {
            background: var(--primary);
            color: #fff;
        }

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

        .fx-btn-secondary,
        .fx-btn-back {
            background: #fff;
            color: var(--text-main);
            border-color: var(--border);
        }

        .fx-btn-secondary:hover,
        .fx-btn-back:hover {
            background: #f8fafc;
        }

        .fx-btn-back.fx-btn-disabled {
            color: var(--text-muted);
            opacity: 0.45;
            pointer-events: none;
        }

        .fx-search {
            position: relative;
            display: flex;
            align-items: center;
            margin: 0;
        }

        .fx-search-btn {
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: none;
            border: none;
            cursor: pointer;
            color: var(--text-muted);
            padding: 0;
        }

        .fx-search-btn svg {
            width: 15px;
            height: 15px;
        }

        .fx-search input {
            width: 190px;
            height: 36px;
            padding: 0 12px 0 32px;
            border-radius: 8px;
            border: 1px solid var(--border);
            font-size: 13px;
            box-sizing: border-box;
            background: #fff;
        }

        .fx-sort-pill {
            display: flex;
            align-items: center;
            gap: 6px;
            height: 36px;
            padding: 0 10px;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: #fff;
            box-sizing: border-box;
        }

        .fx-sort-pill svg {
            width: 15px;
            height: 15px;
            color: var(--text-muted);
            flex-shrink: 0;
        }

        .fx-sort-pill label {
            margin: 0;
            font-weight: 500;
            color: var(--text-muted);
            font-size: 13px;
        }

        .fx-sort-select {
            border: none;
            background: transparent;
            outline: none;
            font-size: 13px;
            font-weight: 600;
            color: var(--text-main);
            padding: 0;
            height: 100%;
            cursor: pointer;
            max-width: 140px;
        }

        .fx-explorer {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            overflow: visible;
            margin-top: 26px;
        }

        .fx-row {
            display: grid;
            grid-template-columns: 2.2fr 2fr 120px 90px 56px;
            align-items: center;
            gap: 14px;
            padding: 11px 20px;
            border-bottom: 1px solid #f1f5f9;
            position: relative;
        }

        .fx-row:last-child {
            border-bottom: none;
        }

        .fx-header-row {
            background: #f3f5f1;
            color: #374151;
            font-weight: 600;
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: 0.02em;
            border-radius: var(--radius) var(--radius) 0 0;
        }

        .fx-row:not(.fx-header-row):hover {
            background: #f8fafc;
        }

        .fx-row.fx-inactive {
            opacity: 0.55;
        }

        .fx-col-name {
            min-width: 0;
            display: flex;
            align-items: center;
            gap: 12px;
            font-weight: 500;
            font-size: 14px;
            overflow: hidden;
        }

        .fx-col-name a,
        .fx-filename {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .fx-icon {
            font-size: 20px;
            line-height: 1;
            flex-shrink: 0;
        }

        .fx-col-name a {
            color: var(--text-main);
            text-decoration: none;
        }

        .fx-col-name a:hover {
            color: var(--primary);
            text-decoration: underline;
        }

        .fx-badge-inactive {
            flex-shrink: 0;
            padding: 2px 8px;
            border-radius: 999px;
            font-size: 11px;
            font-weight: 600;
            background: #f1f5f9;
            color: var(--text-muted);
        }

        .fx-col-desc {
            min-width: 0;
            font-size: 13px;
            color: var(--text-muted);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .fx-col-modified,
        .fx-col-size {
            font-size: 13px;
            color: var(--text-muted);
            white-space: nowrap;
        }

        .fx-col-actions {
            display: flex;
            justify-content: flex-end;
        }

        .fx-menu {
            position: relative;
        }

        .fx-menu-btn {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: #fff;
            color: var(--text-muted);
            font-size: 16px;
            line-height: 1;
            cursor: pointer;
        }

        .fx-menu-btn:hover {
            background: #f1f5f9;
            color: var(--text-main);
        }

        .fx-menu-dropdown {
            display: none;
            position: absolute;
            right: 0;
            top: calc(100% + 4px);
            min-width: 160px;
            background: #fff;
            border: 1px solid var(--border);
            border-radius: 10px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.12);
            padding: 6px;
            z-index: 20;
        }

        .fx-menu.fx-menu-open .fx-menu-dropdown {
            display: block;
        }

        .fx-menu-form {
            margin: 0;
        }

        .fx-menu-item {
            display: block;
            width: 100%;
            box-sizing: border-box;
            text-align: left;
            padding: 8px 10px;
            border: none;
            background: none;
            border-radius: 6px;
            font-size: 13px;
            font-family: inherit;
            color: var(--text-main);
            text-decoration: none;
            cursor: pointer;
        }

        .fx-menu-item:hover {
            background: var(--primary-soft);
            color: var(--primary);
        }

        .fx-menu-divider {
            height: 1px;
            background: var(--border);
            margin: 6px 4px;
        }

        @media (max-width: 768px) {
            .fx-toolbar {
                align-items: stretch;
            }
            .fx-toolbar-right {
                width: 100%;
            }
            .fx-search {
                flex: 1;
            }
            .fx-search input {
                width: 100%;
            }
            .fx-row {
                grid-template-columns: 1fr 40px;
                padding: 10px 14px;
            }
            .fx-col-desc,
            .fx-col-modified,
            .fx-col-size {
                display: none;
            }
        }

        /* ================================
           Student Material Assignment Manager — Tree
           ================================ */

        .mgr-summary {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-bottom: 18px;
        }

        .mgr-summary-item {
            display: flex;
            align-items: baseline;
            gap: 6px;
            padding: 10px 16px;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 10px;
        }

        .mgr-summary-value {
            font-size: 18px;
            font-weight: 700;
            color: var(--text-main);
        }

        .mgr-summary-label {
            font-size: 12px;
            color: var(--text-muted);
        }

        .mgr-tree {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 6px;
        }

        .mgr-node > .mgr-row {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 7px 10px;
            border-radius: 8px;
        }

        .mgr-node > .mgr-row:hover {
            background: #f8fafc;
        }

        .mgr-row-folder {
            background: #fbfcfa;
        }

        .mgr-row-folder:hover {
            background: #f3f5f1;
        }

        .mgr-row-main {
            display: flex;
            align-items: center;
            gap: 6px;
            flex: 1 1 auto;
            min-width: 0;
        }

        .mgr-chevron {
            width: 20px;
            height: 20px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: none;
            background: none;
            color: var(--text-muted);
            cursor: pointer;
            padding: 0;
            flex-shrink: 0;
        }

        .mgr-chevron svg {
            width: 13px;
            height: 13px;
            transform: rotate(90deg);
            transition: transform 0.12s ease;
        }

        .mgr-node.mgr-collapsed > .mgr-row .mgr-chevron svg {
            transform: rotate(0deg);
        }

        .mgr-chevron-spacer {
            width: 20px;
            flex-shrink: 0;
        }

        .mgr-icon {
            width: 18px;
            height: 18px;
            flex-shrink: 0;
            color: var(--text-muted);
        }

        .mgr-row-folder .mgr-icon {
            color: var(--primary);
        }

        .mgr-icon svg {
            width: 100%;
            height: 100%;
        }

        .mgr-name {
            font-size: 14px;
            color: var(--text-main);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .mgr-row-folder .mgr-name {
            font-weight: 600;
        }

        .mgr-badge-inactive {
            flex-shrink: 0;
            padding: 2px 8px;
            border-radius: 999px;
            font-size: 11px;
            font-weight: 600;
            background: #f1f5f9;
            color: var(--text-muted);
        }

        .mgr-row-status {
            flex: 0 0 200px;
            font-size: 13px;
        }

        .mgr-status-muted {
            color: var(--text-muted);
            font-size: 12px;
            background: #f1f5f9;
            padding: 3px 9px;
            border-radius: 999px;
        }

        .mgr-status-none {
            color: #cbd5e1;
            font-size: 12px;
        }

        .mgr-row-action {
            flex: 0 0 100px;
            text-align: right;
        }

        .mgr-inline-form {
            margin: 0;
            display: inline-block;
        }

        .mgr-via-note {
            color: var(--text-muted);
            font-size: 12px;
            font-style: italic;
        }

        .mgr-children {
            margin-left: 19px;
            padding-left: 16px;
            border-left: 1px dashed var(--border);
        }

        .mgr-node.mgr-collapsed > .mgr-children {
            display: none;
        }

        @media (max-width: 768px) {
            .mgr-row-status {
                flex-basis: 130px;
            }
            .mgr-row-action {
                flex-basis: 80px;
            }
            .mgr-children {
                margin-left: 10px;
                padding-left: 10px;
            }
        }
