.materials-page {
    padding: 70px 20px 100px;
    background: #f8fafc;
    min-height: calc(100vh - 120px);
}

.materials-container {
    max-width: 1180px;
    margin: 0 auto;
}

.materials-header {
    text-align: center;
    margin-bottom: 40px;
}

.materials-label {
    display: inline-block;
    margin-bottom: 12px;
    padding: 8px 16px;
    border-radius: 999px;
    background: #e8f0ff;
    color: #2f6fed;
    font-size: 13px;
    font-weight: 800;
}

.materials-header h1 {
    font-size: 42px;
    font-weight: 800;
    color: #111827;
    margin: 0;
}

.materials-admin-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.materials-upload-btn {
    height: 42px;
    padding: 0 18px;
    border: none;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
    transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.materials-upload-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(37, 99, 235, 0.24);
}

.materials-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 24px;
}

.materials-toolbar-no-filter {
    justify-content: flex-end;
}

.materials-toolbar-no-filter .materials-admin-bar {
    margin-left: auto;
}

.materials-filter-panel {
    display: grid;
    gap: 14px;
    margin-bottom: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.materials-filter-group {
    display: grid;
    grid-template-columns: 82px 1fr;
    gap: 14px;
    align-items: start;
}

.materials-filter-group-all {
    grid-template-columns: 1fr;
}

.materials-tabs.materials-subject-tabs {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 0;
    align-items: stretch;
    overflow: hidden;
    padding: 5px;
    border: 1px solid #d7e1f1;
    border-radius: 14px;
    background: #f1f5fb;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 10px 26px rgba(15, 23, 42, 0.06);
}

.materials-filter-group h2 {
    margin: 7px 0 0;
    color: #111827;
    font-size: 15px;
    font-weight: 900;
}

.materials-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.materials-tab {
    border: none;
    background: #e8edf5;
    color: #4b5563;
    min-width: 82px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.materials-tab:hover {
    background: #dbeafe;
    color: #2563eb;
}

.materials-tab.active {
    background: #dbeafe;
    color: #2563eb;
}

.materials-search {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.materials-search input {
    flex: 1;
    height: 46px;
    border: 1px solid #d5dbe5;
    border-radius: 12px;
    background: #fff;
    padding: 0 14px;
    font-size: 14px;
    outline: none;
}

.materials-search button {
    height: 46px;
    padding: 0 18px;
    border: none;
    border-radius: 12px;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.materials-board {
    background: #fff;
    border: 1px solid #e7ebf2;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.05);
}

.materials-item {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #eef2f7;
}

.materials-subject-tabs .materials-tab {
    min-width: 86px;
    height: 40px;
    border-radius: 10px;
    border-right: 0;
    background: transparent;
    color: #48617f;
    font-weight: 800;
}

.materials-subject-tabs .materials-tab:hover,
.materials-subject-tabs .materials-tab.active {
    background: #ffffff;
    color: #0f3f8f;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.materials-item:last-child {
    border-bottom: none;
}

.materials-item-link {
    display: grid;
    flex: 1;
    grid-template-columns: 170px minmax(0, 1fr) 120px 140px;
    gap: 16px;
    align-items: center;
    padding: 14px 22px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s ease;
    min-width: 0;
}

.materials-item-link:hover {
    background: #f8fbff;
}

.materials-category-col {
    display: flex;
    align-items: center;
    min-width: 0;
}

.materials-category-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.materials-category-chip-elementary {
    background: #eef4ff;
    color: #2563eb;
}

.materials-category-chip-middle {
    background: #edf9f4;
    color: #0f766e;
}

.materials-category-chip-high {
    background: #fff5eb;
    color: #c2410c;
}

.materials-main h3 {
    margin: 0 0 6px;
    font-size: 17px;
    line-height: 1.35;
    color: #111827;
    font-weight: 800;
    word-break: break-word;
}

.materials-meta {
    display: flex;
    gap: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #6b7280;
}

.materials-author,
.materials-date {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}

.materials-empty {
    padding: 60px 20px;
    text-align: center;
    font-size: 16px;
    color: #6b7280;
}

.materials-order-controls {
    width: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-shrink: 0;
    border-right: 1px solid #eef2f7;
    background: #fbfdff;
}

.materials-slot-handle {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    cursor: grab;
    position: relative;
}

.materials-slot-handle::before {
    content: "";
    position: absolute;
    inset: 6px;
    background-image: radial-gradient(#94a3b8 1.4px, transparent 1.4px);
    background-size: 7px 7px;
}

.materials-slot-arrow {
    width: 24px;
    height: 18px;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
}

.materials-slot-arrow::before {
    content: "";
    position: absolute;
    left: 7px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

.materials-slot-arrow-up::before {
    top: 4px;
    border-bottom: 7px solid #94a3b8;
}

.materials-slot-arrow-down::before {
    top: 7px;
    border-top: 7px solid #94a3b8;
}

.materials-slot-arrow:hover::before {
    border-bottom-color: #2563eb;
    border-top-color: #2563eb;
}

.materials-slot-arrow:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.materials-slot-placeholder {
    width: 26px;
    height: 64px;
    opacity: 0;
}

.materials-item.dragging {
    opacity: 0.55;
}

.materials-item.drag-over {
    box-shadow: inset 0 2px 0 #2563eb;
}

.materials-order-status {
    padding: 10px 18px;
    border-top: 1px solid #eef2f7;
    background: #fbfdff;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

.materials-order-status[data-state="saving"] {
    color: #2563eb;
}

.materials-order-status[data-state="saved"] {
    color: #15803d;
}

.materials-order-status[data-state="error"] {
    color: #dc2626;
}

.materials-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.materials-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.materials-modal-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 12%, rgba(59, 130, 246, 0.22), transparent 34%),
        rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(6px);
}

.materials-modal-dialog {
    position: relative;
    width: min(720px, calc(100% - 32px));
    margin: 0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 34px 95px rgba(15, 23, 42, 0.28);
    max-height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
}

.materials-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 26px 30px 24px;
    border-bottom: 1px solid #e8eef7;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.96) 100%),
        radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.08), transparent 36%);
}

.materials-modal-label {
    display: inline-block;
    margin: 0 0 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #e8f0ff;
    color: #2563eb;
    font-size: 12px;
    font-weight: 800;
}

.materials-modal-header h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.25;
    font-weight: 800;
    color: #111827;
}

.materials-modal-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f1f5fb;
    color: #2563eb;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.materials-modal-close:hover {
    background: #e4edfb;
    transform: translateY(-1px);
}

.materials-modal-body {
    padding: 28px 30px 30px;
    overflow-y: auto;
    flex: 1;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 44%);
}

.materials-detail-view {
    display: grid;
    gap: 18px;
}

.materials-upload-layout {
    display: grid;
    gap: 18px;
}

.materials-upload-split-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.materials-upload-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.materials-upload-field label {
    font-size: 14px;
    font-weight: 800;
    color: #334155;
}

.materials-upload-field input,
.materials-upload-field select,
.materials-upload-field textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #d5dbe5;
    border-radius: 14px;
    background: #fff;
    font-size: 14px;
    box-sizing: border-box;
    outline: none;
}

.materials-upload-field textarea {
    resize: vertical;
    min-height: 120px;
}

.materials-upload-field input:focus,
.materials-upload-field select:focus,
.materials-upload-field textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.materials-file-placeholder {
    min-height: 120px;
    border: 1.5px dashed #bfd4f6;
    border-radius: 18px;
    background: #f8fbff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.materials-file-placeholder:hover {
    border-color: #7fb1f5;
    background: #f3f8ff;
}

.materials-file-placeholder.dragover {
    border-color: #2563eb;
    background: #eaf2ff;
    transform: scale(1.01);
}

.materials-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.materials-primary-btn,
.materials-secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.materials-primary-btn {
    border: none;
    background: #2563eb;
    color: #fff;
}

.materials-primary-btn:disabled {
    background: #bfd4f6;
    color: #edf4ff;
    cursor: not-allowed;
}

.materials-secondary-btn {
    border: 1px solid #d5dbe5;
    background: #fff;
    color: #475569;
}

.materials-icon-btn {
    gap: 6px;
}

.materials-icon-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.materials-danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 46px;
    padding: 0 18px;
    border: none;
    border-radius: 12px;
    background: #ef4444;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.materials-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.materials-inline-form {
    margin: 0;
}

.materials-detail-dialog {
    width: min(1040px, calc(100% - 40px));
}

.materials-detail-header-main {
    min-width: 0;
    flex: 1;
}

.materials-detail-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-width: 0;
}

.materials-detail-title-row {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.materials-detail-title-row h2 {
    min-width: 0;
    color: #06152b;
    font-size: 30px;
    font-weight: 950;
    letter-spacing: 0;
    word-break: break-word;
}

.materials-detail-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: #536b8c;
    font-size: 14px;
    font-weight: 800;
    justify-content: flex-end;
}

.materials-detail-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, #edf5ff, #e8f0ff);
    color: #2563eb;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
    flex-shrink: 0;
}

.materials-detail-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.materials-detail-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.materials-like-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 44px;
    padding: 0 15px;
    border: 1px solid #d7e1ef;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    color: #334155;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.materials-like-btn span:first-child {
    color: #ef4444;
    font-size: 18px;
    line-height: 1;
}

.materials-like-btn:hover,
.materials-like-btn.active {
    border-color: #fecaca;
    background: #fff5f5;
    color: #dc2626;
}

.materials-like-btn:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
}

.materials-detail-section {
    margin-bottom: 0;
    padding: 20px;
    border: 1px solid #dfe9f7;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.04);
}

.materials-detail-section h3 {
    margin: 0 0 12px;
    font-size: 15px;
    color: #0f172a;
    font-weight: 900;
}

.materials-detail-section p {
    margin: 0;
    line-height: 1.7;
    color: #1f3654;
    white-space: pre-wrap;
    word-break: break-word;
}

.materials-detail-description-section {
    min-height: 72px;
    padding: 26px 24px;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.materials-detail-description-section p {
    color: #0f2744;
    font-size: 16px;
    font-weight: 750;
    line-height: 1.75;
}

.materials-detail-file-section {
    padding: 0 20px 20px;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.materials-detail-primary-panel {
    position: relative;
    display: grid;
    gap: 0;
    overflow: hidden;
    border: 1px solid #cfe0f6;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 251, 255, 0.96) 100%),
        radial-gradient(circle at 4% 0%, rgba(37, 99, 235, 0.12), transparent 32%);
    box-shadow: 0 22px 54px rgba(15, 23, 42, 0.08);
}

.materials-detail-primary-panel::before {
    content: "";
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #60a5fa, #93c5fd);
}

.materials-preview-wrap {
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    overflow: hidden;
    background: #f8fbff;
}

.materials-preview-frame {
    width: 100%;
    height: 520px;
    border: none;
    display: block;
    background: #fff;
}

.materials-detail-actions {
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}

.materials-edit-form {
    margin-top: 4px;
}

.materials-file-list,
.materials-download-actions,
.materials-current-files {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.materials-file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.materials-file-preview-trigger {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid #cfe0f6;
    border-radius: 16px;
    background: #ffffff;
    color: #23405f;
    font-size: 14px;
    font-weight: 800;
    word-break: break-word;
    cursor: pointer;
    text-align: left;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.materials-file-preview-trigger:hover {
    border-color: #bfd3f0;
    background: #f8fbff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}

.materials-file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(180deg, #eef6ff, #e8f0ff);
    color: #2563eb;
    flex-shrink: 0;
}

.materials-file-link-label {
    min-width: 0;
    color: #0f172a;
    font-size: 15px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.materials-file-link-help {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    margin-left: 16px;
}

.materials-file-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #dbe7fb;
    border-radius: 12px;
    background: #ffffff;
    color: #496783;
    font-size: 12px;
    font-weight: 900;
    flex-shrink: 0;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.materials-file-download-btn:hover {
    border-color: #9fc1ff;
    background: #eff6ff;
    color: #2563eb;
    transform: translateY(-1px);
}

.materials-comment-section {
    margin-top: 0;
    padding: 18px 20px 20px;
    border-color: #e7edf6;
    border-radius: 18px;
    background: rgba(248, 251, 255, 0.72);
    box-shadow: none;
}

.materials-comment-section h3 {
    margin-bottom: 12px;
    color: #667085;
    font-size: 13px;
    font-weight: 700;
}

.materials-preview-image {
    display: none;
    width: 100%;
    max-height: 620px;
    object-fit: contain;
    background: #fff;
}

.materials-preview-text {
    display: none;
    margin: 0;
    padding: 24px;
    min-height: 220px;
    max-height: 620px;
    overflow: auto;
    background: #fff;
    color: #334155;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, "Courier New", monospace;
}

.materials-comment-form {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 14px;
}

.materials-comment-form.login-required {
    min-height: 50px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 8px 7px 16px;
    border: 1px solid #d8e3f2;
    border-radius: 14px;
    background: #fff;
    box-sizing: border-box;
}

.materials-comment-form textarea {
    width: 100%;
    height: 50px;
    min-height: 50px;
    padding: 13px 64px 13px 16px;
    border: 1px solid #d8e3f2;
    border-radius: 14px;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 400;
    resize: none;
    min-height: 52px;
    line-height: 1.4;
    overflow: hidden;
    box-sizing: border-box;
    outline: none;
}

.materials-comment-form textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.materials-comment-actions {
    position: absolute;
    right: 8px;
    top: 8px;
    display: flex;
    justify-content: flex-end;
}

.materials-comment-form.login-required .materials-comment-actions {
    position: static;
    flex: 0 0 auto;
}

.materials-comment-submit-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid #d8e3f2;
    background: #f8fafc;
    color: #64748b;
    box-shadow: none;
}

.materials-comment-submit-btn:hover {
    background: #eef2f7;
    color: #334155;
}

.materials-comment-submit-btn svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.materials-comment-form.login-required .materials-comment-help {
    margin: 0;
    color: #c5ccd6;
    font-size: 13px;
    font-weight: 400;
    line-height: normal;
}

.materials-comment-login-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 34px;
    padding: 0 13px;
    border: 1px solid #cfe0f6;
    border-radius: 12px;
    background: linear-gradient(180deg, #fbfdff 0%, #f2f7ff 100%);
    color: #3d628f;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.08);
}

.materials-comment-login-link::before {
    content: "";
    width: 13px;
    height: 13px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4M10 17l5-5-5-5M15 12H3' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4M10 17l5-5-5-5M15 12H3' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.materials-comment-login-link:hover {
    border-color: #b8d1f2;
    background: #eef5ff;
    color: #245a98;
}

.materials-comment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 310px;
    overflow: auto;
    padding-right: 2px;
}

.materials-comment-item {
    padding: 11px 14px;
    border: 1px solid #e5edf7;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: none;
}

.materials-comment-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 5px;
    color: #667085;
    font-size: 12px;
    font-weight: 400;
}

.materials-comment-meta-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.materials-comment-author {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.materials-comment-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #dbe4f0;
    background: #fff;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.materials-comment-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e9eff8;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

.materials-comment-head strong {
    color: #27364a;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.materials-comment-item p {
    margin: 0;
    color: #334155;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 400;
}

.materials-comment-actions-row {
    display: inline-flex;
    float: right;
    justify-content: flex-end;
    gap: 5px;
    margin: -24px 0 0 12px;
}

.materials-comment-actions-row .materials-secondary-btn,
.materials-comment-actions-row .materials-danger-btn {
    height: 28px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
}

.materials-comment-actions-row .materials-icon-btn svg {
    width: 14px;
    height: 14px;
}

.materials-comment-edit-box {
    display: none;
    margin-top: 8px;
}

.materials-comment-item.editing .materials-comment-content,
.materials-comment-item.editing .materials-comment-actions-row {
    display: none;
}

.materials-comment-item.editing .materials-comment-edit-box {
    display: block;
}

.materials-comment-edit-input {
    width: 100%;
    min-height: 72px;
    padding: 12px 14px;
    border: 1px solid #cfdcf0;
    border-radius: 13px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    color: #334155;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
}

.materials-comment-edit-input:focus {
    border-color: #8fb7ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), 0 12px 24px rgba(15, 23, 42, 0.05);
}

.materials-comment-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 9px;
}

.materials-comment-edit-actions .materials-secondary-btn,
.materials-comment-edit-actions .materials-primary-btn {
    height: 32px;
    padding: 0 11px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
}

.materials-comment-edit-actions .materials-secondary-btn {
    border-color: #d8e3f2;
    background: #ffffff;
    color: #475569;
}

.materials-comment-edit-actions .materials-primary-btn {
    border: 1px solid #bfdbfe;
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.materials-comment-edit-actions .materials-primary-btn:hover {
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
}

.materials-comment-edit-actions .materials-icon-btn svg {
    width: 14px;
    height: 14px;
}

.materials-comment-empty {
    padding: 18px;
    border: 1px dashed #d9e3f0;
    border-radius: 16px;
    text-align: center;
    color: #64748b;
    background: #fbfdff;
}

.materials-current-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #f8fbff;
}

.materials-current-file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.materials-current-file-info strong {
    font-size: 14px;
    color: #0f172a;
}

.materials-current-file-info span {
    color: #64748b;
    word-break: break-all;
}

.materials-file-delete-btn {
    flex-shrink: 0;
    height: 38px;
    padding: 0 14px;
    border: none;
    border-radius: 10px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 900px) {
    .materials-item {
        align-items: stretch;
    }

    .materials-item-link {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px 16px;
    }

    .materials-order-controls {
        width: 44px;
    }

    .materials-author,
    .materials-date {
        justify-content: flex-start;
        font-size: 14px;
    }

    .materials-header h1 {
        font-size: 32px;
    }

    .materials-category-chip {
        min-height: 36px;
        padding: 0 14px;
        font-size: 14px;
    }

    .materials-main h3 {
        font-size: 16px;
    }

    .materials-search {
        flex-direction: column;
    }

    .materials-filter-panel {
        padding: 14px;
    }

    .materials-filter-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .materials-filter-group h2 {
        margin-top: 0;
    }

    .materials-admin-bar {
        justify-content: stretch;
    }

    .materials-upload-btn {
        width: 100%;
    }

    .materials-modal-dialog {
        width: 100%;
        margin: 0;
        max-height: calc(100vh - 24px);
    }

    .materials-modal-header,
    .materials-modal-body {
        padding-left: 20px;
        padding-right: 20px;
    }

    .materials-modal-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .materials-detail-title-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .materials-detail-header-meta {
        justify-content: flex-start;
    }

    .materials-detail-header-actions,
    .materials-detail-top-actions {
        width: 100%;
        justify-content: space-between;
    }

    .materials-modal-actions {
        flex-direction: column;
    }

    .materials-upload-split-row {
        grid-template-columns: 1fr;
    }

    .materials-primary-btn,
    .materials-secondary-btn,
    .materials-danger-btn {
        width: 100%;
    }

    .materials-detail-top-actions .materials-like-btn,
    .materials-detail-top-actions .materials-secondary-btn,
    .materials-detail-top-actions .materials-danger-btn,
    .materials-comment-submit-btn,
    .materials-comment-actions-row .materials-secondary-btn,
    .materials-comment-actions-row .materials-danger-btn,
    .materials-comment-edit-actions .materials-secondary-btn,
    .materials-comment-edit-actions .materials-primary-btn {
        width: auto;
    }

    .materials-inline-form {
        width: 100%;
    }

    .materials-detail-top-actions .materials-inline-form {
        width: auto;
    }

    .materials-file-card {
        align-items: center;
        flex-direction: row;
    }

    .materials-comment-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .materials-comment-meta-actions {
        width: 100%;
        justify-content: space-between;
    }

    .materials-file-preview-trigger {
        align-items: center;
        flex-direction: row;
        gap: 10px;
    }

    .materials-file-link-help {
        margin-left: 0;
    }

    .materials-file-download-btn {
        width: 42px;
        min-width: 42px;
    }

    .materials-preview-frame {
        height: 420px;
    }

    .materials-preview-image,
    .materials-preview-text {
        max-height: 420px;
    }

    .materials-comment-actions {
        justify-content: stretch;
    }

    .materials-current-file {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Board-style materials list */
.materials-page {
    padding: 64px 20px 80px;
    background: #ffffff;
    color: #102033;
}

.materials-container {
    max-width: 980px;
}

.materials-header {
    margin-bottom: 64px;
}

.materials-label {
    display: none;
}

.materials-header h1 {
    margin: 0;
    color: #102033;
    font-size: 28px;
    font-weight: 900;
    text-align: center;
}

.materials-admin-bar {
    margin: -30px 0 28px;
}

.materials-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    padding: 0 16px 0 14px;
    border: 1px solid #1f6feb;
    border-radius: 9px;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
    font-size: 13px;
    line-height: 1;
    letter-spacing: 0;
}

.materials-upload-btn::before {
    content: "";
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3Cpath d='M20 16.5v2.5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-2.5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3Cpath d='M20 16.5v2.5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-2.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.materials-upload-btn:hover {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.26);
}

.materials-upload-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18), 0 10px 22px rgba(37, 99, 235, 0.22);
}

.materials-filter-panel {
    display: block;
    margin-bottom: 34px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.materials-filter-group {
    display: block;
    margin-bottom: 10px;
}

.materials-grade-group[hidden] {
    display: none;
}

.materials-grade-group {
    margin-top: -2px;
}

.materials-filter-group h2 {
    display: none;
}

.materials-tabs {
    gap: 12px;
}

.materials-grade-tabs {
    padding-left: 0;
}

.materials-tab {
    min-width: 0;
    height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    background: transparent;
    color: #44546a;
    font-size: 14px;
    font-weight: 900;
}

.materials-grade-tab {
    height: 34px;
    font-size: 13px;
}

.materials-tab:hover,
.materials-tab.active {
    background: #eef6ff;
    color: #2f80ed;
}

.materials-search {
    position: relative;
    display: block;
    width: 100%;
    max-width: 586px;
    margin-bottom: 20px;
}

.materials-search input {
    width: 100%;
    height: 40px;
    padding: 0 50px 0 14px;
    border: 1px solid #c9ced6;
    border-radius: 4px;
    color: #102033;
    font-size: 16px;
}

.materials-search input::placeholder {
    color: #b9c0ca;
}

.materials-search button {
    position: absolute;
    top: 0;
    right: 0;
    width: 48px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #566273;
    font-size: 0;
}

.materials-search button::before {
    content: "⌕";
    font-size: 28px;
    line-height: 1;
}

.materials-board {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.materials-board-body {
    display: block;
}

.materials-item {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #dfe4ea;
    background: #ffffff;
}

.materials-item-link {
    position: relative;
    grid-template-columns: minmax(0, 1fr) 132px;
    grid-template-rows: auto 1fr;
    gap: 7px 22px;
    min-height: 108px;
    padding: 12px 16px;
}

.materials-item-link:hover {
    background: #fbfdff;
}

.materials-category-col {
    position: static;
    display: flex;
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
}

.materials-category-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    margin-bottom: 7px;
    padding: 0 9px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.materials-category-chip-elementary,
.materials-category-chip-middle,
.materials-category-chip-high {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.materials-main {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    padding-top: 0;
}

.materials-main h3 {
    margin: 0 0 8px;
    color: #102033;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.42;
}

.materials-meta {
    align-items: center;
    gap: 10px;
    color: #344054;
    font-size: 13px;
    font-weight: 400;
}

.materials-meta span {
    color: #344054;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.2;
    white-space: nowrap;
}

.materials-list-side {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 9px;
    color: #36526f;
    font-size: 14px;
    font-weight: 400;
}

.materials-author-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.materials-list-author-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #d7dee9;
    border-radius: 999px;
    background: #e9eff8;
    color: #52657e;
    font-size: 14px;
    font-weight: 900;
    flex-shrink: 0;
}

.materials-list-author-name {
    color: #36526f;
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
}

.materials-list-side time {
    color: #36526f;
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
}

.materials-order-controls {
    width: 44px;
    border-right: 0;
    background: transparent;
}

.materials-order-status {
    border-top: 0;
    background: transparent;
}

.materials-empty {
    padding: 60px 20px;
    color: #64748b;
}

.materials-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}

.materials-pagination[hidden] {
    display: none;
}

.materials-page-btn,
.materials-page-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #102033;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
}

.materials-page-btn.active {
    background: #eeeeee;
}

.materials-page-arrow {
    color: #98a2b3;
    font-size: 28px;
    font-weight: 300;
}

.materials-page-arrow:disabled {
    opacity: 0.45;
    cursor: default;
}

.materials-page-btn:not(.active):hover,
.materials-page-arrow:not(:disabled):hover {
    background: #f4f6f8;
}

.materials-item .materials-order-controls {
    width: 36px;
    border-right: 0;
    background: transparent;
    opacity: 0;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.materials-item:hover .materials-order-controls,
.materials-item.dragging .materials-order-controls {
    opacity: 1;
}

.materials-item:hover .materials-order-controls {
    transform: translateX(-2px);
}

.materials-slot-arrow {
    display: none;
}

.materials-slot-handle {
    width: 28px;
    height: 32px;
    border-radius: 999px;
}

.materials-slot-handle::before {
    inset: 7px 8px;
    background-image: radial-gradient(#94a3b8 1.6px, transparent 1.7px);
    background-size: 6px 6px;
}

.materials-slot-handle:hover {
    background: #eff6ff;
}

.materials-slot-handle:hover::before {
    background-image: radial-gradient(#2563eb 1.6px, transparent 1.7px);
}

@media (max-width: 900px) {
    .materials-page {
        padding: 46px 16px 70px;
    }

    .materials-header {
        margin-bottom: 42px;
    }

    .materials-header h1 {
        font-size: 25px;
    }

    .materials-filter-panel {
        margin-bottom: 26px;
    }

    .materials-tabs {
        gap: 8px;
    }

    .materials-item-link {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 6px;
        padding: 14px 4px;
    }

    .materials-category-col,
    .materials-main,
    .materials-list-side {
        grid-column: 1;
        grid-row: auto;
    }

    .materials-list-side {
        align-items: flex-start;
        gap: 6px;
    }
}
