:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-soft: #eef4ff;
    --ink: #1d2733;
    --muted: #667085;
    --line: #d9e2ef;
    --blue: #2563eb;
    --blue-dark: #1e40af;
    --gold: #f2b705;
    --green: #138a63;
    --red: #c24135;
    --shadow: 0 18px 45px rgba(22, 34, 51, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    overflow: hidden; /* Prevent body scroll to enforce flex layout */
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.09), transparent 34%),
        linear-gradient(315deg, rgba(242, 183, 5, 0.11), transparent 30%),
        var(--bg);
    font-family: "Segoe UI", Arial, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 72px;
    padding: 16px clamp(18px, 4vw, 52px);
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--green));
    border-radius: 8px;
    font-weight: 800;
}

.admin-shell .side-head .brand-mark {
    color: transparent !important;
    font-size: 0 !important;
    background: url('/assets/platolink-circle-logo.png') center / contain no-repeat !important;
    border-radius: 0;
    filter:
        drop-shadow(0 12px 14px rgba(6, 15, 32, 0.42))
        drop-shadow(0 4px 7px rgba(15, 23, 42, 0.32))
        drop-shadow(0 -1px 3px rgba(15, 23, 42, 0.18));
    transform-origin: center;
    animation: cabinetBrandMarkQuarterTurn 120s infinite;
}

@keyframes cabinetBrandMarkQuarterTurn {
    0%, 23.75% { transform: rotate(0deg); }
    25%, 48.75% { transform: rotate(90deg); }
    50%, 73.75% { transform: rotate(180deg); }
    75%, 98.75% { transform: rotate(270deg); }
    100% { transform: rotate(360deg); }
}

.brand span:last-child {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    margin-top: 2px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    color: var(--blue-dark);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    font-weight: 650;
}

.topbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.main {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 42px 0 56px;
}

.hero {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 28px;
    align-items: stretch;
}

.hero-copy {
    padding: 34px 0;
}

.eyebrow {
    color: var(--green);
    font-size: 14px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0;
}

h1, h2, h3 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    margin-top: 12px;
    font-size: clamp(36px, 5vw, 64px);
    line-height: 1;
}

.page-title {
    margin-top: 0;
    font-size: 32px;
    line-height: 1.15;
}

.teacher-main {
    width: min(1320px, calc(100% - 36px));
}

.admin-data-main {
    width: min(1500px, calc(100% - 28px));
}

.lead {
    max-width: 620px;
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.6;
}

.entry-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.entry-card {
    min-height: 330px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 26px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.entry-card.student {
    border-top: 6px solid var(--blue);
}

.entry-card.teacher {
    border-top: 6px solid var(--gold);
}

.entry-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--blue-dark);
    font-size: 30px;
}

.entry-card h2 {
    margin-top: 22px;
    font-size: 30px;
}

.entry-card p {
    color: var(--muted);
    line-height: 1.55;
}

.portal-panel {
    margin-top: 28px;
    padding: 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.portal-filters {
    margin-bottom: 18px;
}

.portal-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.admin-data-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}

.admin-data-shell.menu-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
}

.admin-tab-menu {
    min-height: 520px;
    overflow: hidden;
    transition: opacity 0.16s ease;
}

.admin-data-shell.menu-collapsed .admin-tab-menu {
    opacity: 0;
    padding: 0;
    border: 0;
}

.admin-table-area {
    position: relative;
    min-width: 0;
}

.table-menu-toggle {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
}

.admin-table-toolbar {
    min-height: 48px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-left: 48px;
    margin-bottom: 12px;
}

.admin-table-toolbar h2 {
    font-size: 22px;
}

.excel-wrap {
    max-height: 68vh;
    overflow: auto;
    border: 1px solid #b9c6d8;
    border-radius: 6px;
    background: #ffffff;
}

.excel-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.excel-table th,
.excel-table td {
    height: 26px;
    padding: 3px 6px;
    border-right: 1px solid #d7dee9;
    border-bottom: 1px solid #d7dee9;
    background: #ffffff;
    vertical-align: middle;
    line-height: 1.2;
}

.excel-table tr.warning-row > td,
.modern-table tr.warning-row > td,
.data-table tr.warning-row > td {
    background: var(--warning-row-color, #fffbeb) !important;
}

.excel-table tr.warning-row > .excel-row-head,
.data-view-table tr.warning-row > .excel-row-head {
    background: var(--warning-row-color, #fffbeb) !important;
}

.modern-table tr.warning-row:hover > td,
.excel-table tr.warning-row:hover > td,
.data-table tr.warning-row:hover > td {
    background: var(--warning-row-color, #fffbeb) !important;
}

.excel-table td {
    max-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.excel-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.excel-row-head {
    color: #344054;
    background: #edf2f7 !important;
    font-weight: 700;
    text-align: center;
}

.excel-row-head {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 38px !important;
    width: 38px;
}

.row-number-col {
    width: 38px;
}

.excel-field-head {
    position: relative;
    min-width: 72px;
    background: #f7fafc !important;
    font-weight: 750;
    user-select: none;
}

.admin-shell .excel-wrap {
    max-height: none;
}

#admin-table-wrap .table-container {
    min-height: 100%;
    height: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    background: #ffffff;
}

.admin-excel-head-inner {
    min-height: 44px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 2px 4px 2px 6px;
    text-align: left;
}

.admin-excel-head-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    line-height: 1.2;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.admin-table-filter-btn {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: transparent;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    flex: 0 0 18px;
    justify-self: end;
}

.data-view-wrap .table-container {
    min-height: 100%;
    height: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: auto;
}

.data-view-table thead th,
#admin-table-wrap .excel-table thead th,
.modern-table thead th {
    position: sticky;
    top: 0;
    z-index: 8;
}

.data-view-table .excel-row-head {
    position: static;
    left: auto;
}

.data-view-table td.excel-cell.editable {
    cursor: cell;
    outline: none;
}

.data-view-table td.excel-cell.editable:focus,
.data-view-table td.excel-cell.bulk-selected {
    box-shadow: inset 0 0 0 2px #2563eb;
    background: #eff6ff;
}

.data-view-actions-cell {
    position: sticky;
    left: 0;
    z-index: 4;
    overflow: visible !important;
}

.data-row-actions {
    position: relative;
    display: inline-flex;
}

.data-row-actions summary {
    width: 26px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    list-style: none;
}

.data-row-actions summary::-webkit-details-marker {
    display: none;
}

.data-row-actions summary svg {
    width: 15px;
    height: 15px;
}

.data-row-actions-menu {
    position: absolute;
    top: 28px;
    left: 0;
    z-index: 20;
    min-width: 150px;
    padding: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 14px 28px -18px rgba(15, 23, 42, 0.55);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.data-row-actions-menu button {
    width: 100%;
    border: 0;
    background: transparent;
    color: #0f172a;
    min-height: 30px;
    padding: 0 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    text-align: left;
}

.data-row-actions-menu button:hover {
    background: #f1f5f9;
}

.data-row-actions-menu button.danger {
    color: #dc2626;
}

.data-row-actions-menu button svg {
    width: 14px;
    height: 14px;
}

.data-row-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.data-row-form input,
.data-row-form select,
.data-row-form textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 13px;
    background: #ffffff;
    color: #0f172a;
}

.data-row-form input[readonly],
.data-row-form textarea[readonly],
.data-row-form select:disabled {
    background: #f8fafc;
    color: #475569;
}

.admin-table-filter-btn svg {
    width: 12px;
    height: 12px;
}

.excel-field-head.has-filter .admin-table-filter-btn {
    color: var(--blue);
    background: #e8f1ff;
}

.excel-table th.has-filter,
.modern-table th.has-filter,
.data-table th.has-filter,
.data-view-table th.has-filter,
.excel-table th.filter-active-column,
.modern-table th.filter-active-column,
.data-table th.filter-active-column,
.data-view-table th.filter-active-column {
    background: var(--blue) !important;
    color: #ffffff !important;
}

.excel-table th.has-filter .admin-excel-head-text,
.modern-table th.has-filter .header-content,
.data-table th.has-filter .admin-excel-head-text,
.data-table th.has-filter .header-content,
.data-view-table th.has-filter .admin-excel-head-text,
.data-view-table th.has-filter .header-content,
.excel-table th.filter-active-column .admin-excel-head-text,
.modern-table th.filter-active-column .header-content,
.data-table th.filter-active-column .admin-excel-head-text,
.data-table th.filter-active-column .header-content,
.data-view-table th.filter-active-column .admin-excel-head-text,
.data-view-table th.filter-active-column .header-content {
    color: #ffffff !important;
}

.excel-table th.has-filter .admin-table-filter-btn,
.modern-table th.has-filter .teacher-table-filter-btn,
.data-table th.has-filter .admin-table-filter-btn,
.data-table th.has-filter .teacher-table-filter-btn,
.data-view-table th.has-filter .admin-table-filter-btn,
.data-view-table th.has-filter .teacher-table-filter-btn,
.excel-table th.filter-active-column .admin-table-filter-btn,
.modern-table th.filter-active-column .teacher-table-filter-btn,
.data-table th.filter-active-column .admin-table-filter-btn,
.data-table th.filter-active-column .teacher-table-filter-btn,
.data-view-table th.filter-active-column .admin-table-filter-btn,
.data-view-table th.filter-active-column .teacher-table-filter-btn {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.18);
}

.excel-table td.filter-active-column,
.modern-table td.filter-active-column,
.data-table td.filter-active-column,
.data-view-table td.filter-active-column {
    background: #ffedd5 !important;
}

.excel-table tr.warning-row > td.filter-active-column,
.modern-table tr.warning-row > td.filter-active-column,
.data-table tr.warning-row > td.filter-active-column,
.excel-table tr.warning-row > td,
.modern-table tr.warning-row > td,
.data-table tr.warning-row > td,
.data-view-table tr.warning-row > .excel-row-head {
    background: var(--warning-row-color, #fffbeb) !important;
}

.admin-table-filter-popover {
    position: absolute;
    z-index: 999999;
    width: 280px;
    padding: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.2), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.admin-filter-sort-row,
.admin-filter-actions {
    display: flex;
    gap: 4px;
}

.admin-filter-sort-row {
    padding: 6px 8px;
    border-bottom: 1px solid #e2e8f0;
}

.admin-filter-body {
    padding: 8px;
}

.admin-filter-sort-row .button,
.admin-filter-actions .button {
    flex: 1;
    height: 24px;
    min-height: 24px;
    padding: 2px 4px;
    font-size: 11px;
    line-height: 1;
}

.admin-filter-actions .button {
    height: 22px;
    min-height: 22px;
    font-size: 10px;
}

.admin-table-filter-popover .filter-search {
    width: 100%;
    margin-bottom: 8px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.admin-table-filter-popover .filter-list {
    max-height: 250px;
    overflow-y: auto;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    text-align: left;
}

.admin-filter-option {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 400;
    cursor: pointer;
}

.admin-filter-option input {
    width: 12px;
    height: 12px;
    min-width: 12px;
    min-height: 12px;
    margin: 0;
}

.admin-columns-settings {
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    color: #475569;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
}

.admin-columns-settings:hover {
    color: var(--blue);
    background: #f8fbff;
}

.admin-columns-settings svg {
    width: 18px;
    height: 18px;
}

.admin-columns-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 70px 24px 24px;
    background: rgba(15, 23, 42, 0.25);
    z-index: 20000;
}

.admin-columns-card {
    width: min(360px, calc(100vw - 32px));
    max-height: min(640px, calc(100vh - 96px));
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.admin-columns-head {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.admin-columns-head h3 {
    font-size: 15px;
    margin: 0;
}

.admin-columns-close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.admin-columns-close:hover {
    background: #f1f5f9;
}

.admin-columns-actions {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}

.admin-columns-actions .button {
    flex: 1;
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

.admin-columns-list {
    display: grid;
    gap: 2px;
    padding: 8px;
    overflow-y: auto;
}

.admin-column-option {
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    color: #1e293b;
    font-size: 13px;
    cursor: pointer;
}

.admin-column-option:hover {
    background: #f8fafc;
}

.admin-column-option input {
    width: 16px;
    min-height: 16px;
    height: 16px;
    margin: 0;
}

.excel-cell {
    min-width: 72px;
    outline: 0;
    white-space: normal;
    overflow: hidden;
    overflow-wrap: normal;
    word-break: normal;
    user-select: none;
    vertical-align: top;
}

.excel-cell br {
    display: none;
}

.excel-cell div,
.excel-cell p {
    margin: 0;
}

.excel-cell .table-cell-text,
.modern-table .table-cell-text,
.teacher-table .table-cell-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    line-height: 1.25;
    max-height: 3.75em;
}

.modern-table td,
.teacher-table td {
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    vertical-align: top;
}

.excel-field-head,
.modern-table th,
.teacher-table th {
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}

.admin-excel-head-text,
.modern-table th span,
.teacher-table th span {
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    line-height: 1.15;
}

.excel-cell:focus {
    box-shadow: inset 0 0 0 2px var(--green);
    background: #f7fffb;
}

.excel-cell.selected {
    background: #e8f1ff;
    box-shadow: inset 0 0 0 1px #2563eb;
}

.column-resizer {
    position: absolute;
    top: 0;
    right: -3px;
    width: 7px;
    height: 100%;
    cursor: col-resize;
    z-index: 4;
}

.column-resizer:hover {
    background: rgba(37, 99, 235, 0.28);
}

.portal-menu {
    display: grid;
    gap: 8px;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.portal-menu-item {
    min-height: 42px;
    padding: 0 12px;
    text-align: left;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.portal-menu-item.active {
    color: #ffffff;
    background: var(--blue);
}

.portal-content {
    min-width: 0;
}

.portal-table-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.data-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.data-table th {
    color: #344054;
    background: #f8fafc;
    font-size: 13px;
}

.data-table td {
    color: var(--muted);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #431e24;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.button:hover {
    background: #5a2930;
}

.button:disabled,
button:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.button.is-saving,
button.is-saving {
    pointer-events: none;
}

.button.is-saving::before,
button.is-saving::before {
    content: "";
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 999px;
    animation: save-spinner 0.7s linear infinite;
}

@keyframes save-spinner {
    to { transform: rotate(360deg); }
}

.button.secondary {
    background: #ffffff;
    color: var(--blue-dark);
    border-color: var(--line);
}

.button.danger {
    background: var(--red);
}

.button.icon {
    width: 42px;
    padding: 0;
    font-size: 24px;
}

.admin-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
}

.sidebar {
    align-self: start;
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.tab-button {
    width: 100%;
    min-height: 44px;
    margin: 3px 0;
    padding: 0 12px;
    text-align: left;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.tab-button.active {
    color: #ffffff;
    background: var(--blue);
}

.workspace {
    min-width: 0;
}

.section {
    margin-bottom: 20px;
    padding: 22px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-header p {
    margin: 7px 0 0;
    color: var(--muted);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    color: var(--ink);
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}

textarea {
    min-height: 78px;
    resize: vertical;
}

.column-builder {
    display: grid;
    grid-template-columns: minmax(150px, 1.2fr) minmax(150px, 1fr) 96px minmax(140px, 1fr) minmax(140px, 1fr) 42px;
    gap: 10px;
    align-items: end;
}

.checkbox-line {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
    font-weight: 650;
}

.checkbox-line input {
    width: 18px;
    min-height: 18px;
}

.columns-list, .tabs-list {
    display: grid;
    gap: 10px;
}

.column-row, .saved-tab {
    display: grid;
    gap: 10px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.column-row {
    grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) auto auto;
    align-items: center;
}

.saved-tab {
    grid-template-columns: minmax(0, 1fr) auto;
}

.meta {
    color: var(--muted);
    font-size: 13px;
}

.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.pill {
    padding: 5px 9px;
    color: #344054;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.status {
    min-height: 24px;
    margin-top: 14px;
    color: var(--green);
    font-weight: 700;
}

.status.error {
    color: var(--red);
}

.hidden {
    display: none !important;
}

@keyframes pulse-highlight {
    0% { box-shadow: 0 0 0 0 rgba(238, 215, 179, 0.8); }
    70% { box-shadow: 0 0 0 10px rgba(238, 215, 179, 0); }
    100% { box-shadow: 0 0 0 0 rgba(238, 215, 179, 0); }
}

.required-next {
    animation: pulse-highlight 1.5s infinite ease-in-out;
    border-color: #eed7b3 !important;
    outline: none;
    z-index: 1;
}

/* Hide number input arrows (spinners) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

.admin-shell {
    height: 100vh;
    overflow: hidden;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    background:
        radial-gradient(circle at 18% 18%, rgba(56, 189, 248, 0.12), transparent 28%),
        radial-gradient(circle at 82% 12%, rgba(30, 99, 255, 0.10), transparent 26%),
        linear-gradient(135deg, #f8fbff 0%, #ffffff 44%, #f4f8ff 100%);
}

.admin-shell.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
}

.admin-shell .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    align-self: stretch;
    padding: 16px 12px;
    background: linear-gradient(180deg, #334a68ff 0%, #2f4665 50%, #193f7a 100%);
    color: #ffffff;
    border: 0;
    border-radius: 0;
    box-shadow: 12px 0 28px rgba(15, 23, 42, 0.24);
    transition: width 0.2s ease, padding 0.2s ease, transform 0.2s ease;
}

.admin-shell.sidebar-collapsed .sidebar {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    transform: translateX(-100%);
}

.side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 4px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}

.nav-toggle {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    color: #ffffff;
    background: rgba(255,255,255,0.1);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    transition: all 0.2s;
}

#open-sidebar {
    color: #081b5a;
    background: #ffffff;
    border: 1px solid var(--line);
    margin-right: 15px;
}

#open-sidebar:hover {
    background: #f1f5f9;
}

.workload-open-sidebar {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 90000;
    color: #081b5a;
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

.workload-open-sidebar:hover {
    background: #f1f5f9;
}

.sidebar .portal-menu-item {
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    border: 0;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
    font-size: 14px;
    width: calc(100% - 20px);
    margin: 0 10px;
    display: block;
}

.sidebar .portal-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar .portal-menu-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-weight: 600;
}

.admin-tab-lock-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-left: 8px;
    margin-right: -6px;
    border-radius: 8px;
    flex: 0 0 26px;
    position: relative;
    z-index: 2;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease, color .18s ease;
}

.admin-tab-lock-toggle svg {
    width: 16px;
    height: 16px;
}

.admin-tab-lock-toggle.unlocked {
    color: #a3e635; /* салатовий (light green) */
}

.admin-tab-lock-toggle.locked {
    color: #38bdf8; /* голубий (light blue) */
}

.admin-tab-lock-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.06);
}

.admin-shell .tab-button {
    color: rgba(255,255,255,0.8);
}

.admin-shell .tab-button.active {
    background: rgba(255,255,255,0.15);
    color: #ffffff;
}

.admin-shell .tab-button:hover:not(.active) {
    background: rgba(255,255,255,0.05);
}

.admin-shell .side-head h3 {
    color: #ffffff;
}

.admin-shell .sidebar .portal-menu-item,
.admin-shell .sidebar .tab-button {
    position: relative;
    overflow: hidden;
    transform-origin: left center;
    transition:
        color 0.22s ease,
        background 0.22s ease,
        transform 0.22s ease,
        font-size 0.22s ease,
        text-shadow 0.22s ease;
}

.admin-shell .sidebar .portal-menu-item::before,
.admin-shell .sidebar .tab-button::before {
    content: "";
    position: absolute;
    inset: 3px auto 3px -55%;
    width: 52%;
    border-radius: inherit;
    background:
        linear-gradient(100deg,
            transparent 0%,
            rgba(255, 255, 255, 0.10) 28%,
            rgba(255, 255, 255, 0.36) 50%,
            rgba(255, 255, 255, 0.10) 72%,
            transparent 100%);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.22);
    opacity: 0;
    pointer-events: none;
    transform: skewX(-14deg);
}

.admin-shell .sidebar .portal-menu-item:hover,
.admin-shell .sidebar .portal-menu-item.active,
.admin-shell .sidebar .tab-button:hover,
.admin-shell .sidebar .tab-button.active {
    transform: scale(1.025);
    font-size: 14.5px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.28);
}

.admin-shell .sidebar .portal-menu-item:hover::before,
.admin-shell .sidebar .portal-menu-item.active::before,
.admin-shell .sidebar .tab-button:hover::before,
.admin-shell .sidebar .tab-button.active::before {
    animation: menu-glass-sweep 1.15s ease both;
    opacity: 1;
}

@keyframes menu-glass-sweep {
    0% {
        left: -55%;
        opacity: 0;
    }
    18% {
        opacity: 1;
    }
    100% {
        left: 112%;
        opacity: 0;
    }
}

.admin-main {
    min-width: 0;
    display: flex;
    border-radius: 8px;
}

.column-row {
    grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) auto auto;
    align-items: center;
}

.saved-tab {
    grid-template-columns: minmax(0, 1fr) auto;
}

.meta {
    color: var(--muted);
    font-size: 13px;
}

.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.pill {
    padding: 5px 9px;
    color: #344054;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.status {
    min-height: 24px;
    margin-top: 14px;
    color: var(--green);
    font-weight: 700;
}

.status.error {
    color: var(--red);
}

.hidden {
    display: none !important;
}

@keyframes pulse-highlight {
    0% { box-shadow: 0 0 0 0 rgba(238, 215, 179, 0.8); }
    70% { box-shadow: 0 0 0 10px rgba(238, 215, 179, 0); }
    100% { box-shadow: 0 0 0 0 rgba(238, 215, 179, 0); }
}

.required-next {
    animation: pulse-highlight 1.5s infinite ease-in-out;
    border-color: #eed7b3 !important;
    outline: none;
    z-index: 1;
}

/* Hide number input arrows (spinners) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

.admin-shell {
    height: 100vh;
    overflow: hidden;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    background:
        radial-gradient(circle at 18% 18%, rgba(56, 189, 248, 0.12), transparent 28%),
        radial-gradient(circle at 82% 12%, rgba(30, 99, 255, 0.10), transparent 26%),
        linear-gradient(135deg, #f8fbff 0%, #ffffff 44%, #f4f8ff 100%);
}

.admin-shell.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
}

.admin-shell .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    align-self: stretch;
    padding: 16px 12px;
    background: linear-gradient(180deg, #334a68ff 0%, #2f4665 50%, #193f7a 100%);
    color: #ffffff;
    border: 0;
    border-radius: 0;
    box-shadow: 12px 0 28px rgba(15, 23, 42, 0.24);
    transition: width 0.2s ease, padding 0.2s ease, transform 0.2s ease;
}

.admin-shell.sidebar-collapsed .sidebar {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    transform: translateX(-100%);
}

.side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 4px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}

.nav-toggle {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    color: #ffffff;
    background: rgba(255,255,255,0.1);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    transition: all 0.2s;
}

#open-sidebar {
    color: #081b5a;
    background: #ffffff;
    border: 1px solid var(--line);
    margin-right: 15px;
}

#open-sidebar:hover {
    background: #f1f5f9;
}

.sidebar .portal-menu-item {
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    border: 0;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
    font-size: 14px;
    width: calc(100% - 20px);
    margin: 0 10px;
    display: block;
}

.sidebar .portal-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar .portal-menu-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-weight: 600;
}

.admin-shell .tab-button {
    color: rgba(255,255,255,0.8);
}

.admin-shell .tab-button.active {
    background: rgba(255,255,255,0.15);
    color: #ffffff;
}

.admin-shell .tab-button:hover:not(.active) {
    background: rgba(255,255,255,0.05);
}

.admin-shell .side-head h3 {
    color: #ffffff;
}

.admin-shell .sidebar .portal-menu-item,
.admin-shell .sidebar .tab-button {
    position: relative;
    overflow: hidden;
    transform-origin: left center;
    transition:
        color 0.22s ease,
        background 0.22s ease,
        transform 0.22s ease,
        font-size 0.22s ease,
        text-shadow 0.22s ease;
}

.admin-shell .sidebar .portal-menu-item::before,
.admin-shell .sidebar .tab-button::before {
    content: "";
    position: absolute;
    inset: 3px auto 3px -55%;
    width: 52%;
    border-radius: inherit;
    background:
        linear-gradient(100deg,
            transparent 0%,
            rgba(255, 255, 255, 0.10) 28%,
            rgba(255, 255, 255, 0.36) 50%,
            rgba(255, 255, 255, 0.10) 72%,
            transparent 100%);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.22);
    opacity: 0;
    pointer-events: none;
    transform: skewX(-14deg);
}

.admin-shell .sidebar .portal-menu-item:hover,
.admin-shell .sidebar .portal-menu-item.active,
.admin-shell .sidebar .tab-button:hover,
.admin-shell .sidebar .tab-button.active {
    transform: scale(1.025);
    font-size: 14.5px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.28);
}

.admin-shell .sidebar .portal-menu-item:hover::before,
.admin-shell .sidebar .portal-menu-item.active::before,
.admin-shell .sidebar .tab-button:hover::before,
.admin-shell .sidebar .tab-button.active::before {
    animation: menu-glass-sweep 1.15s ease both;
    opacity: 1;
}

@keyframes menu-glass-sweep {
    0% {
        left: -55%;
        opacity: 0;
    }
    18% {
        opacity: 1;
    }
    100% {
        left: 112%;
        opacity: 0;
    }
}

.admin-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.admin-topbar {
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 28px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.admin-topbar h1 {
    margin: 0;
    font-size: 22px;
}

.admin-topbar p {
    margin: 4px 0 0;
    color: var(--muted);
}

.admin-main .workspace {
    width: min(1480px, calc(100% - 32px));
    margin: 0 auto;
    padding: 16px 0 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.admin-main .section {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.admin-main .section-header {
    padding: 0 0 16px;
    border-bottom: 1px solid var(--line);
}

.subsection {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.subsection .section-header {
    border-bottom: 0;
    padding-bottom: 10px;
}

.admin-main .form-grid {
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(220px, 1.2fr);
    gap: 10px;
}

.admin-main .column-builder {
    grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 0.9fr) 92px minmax(150px, 1fr) minmax(150px, 1fr) 42px;
    gap: 8px;
    align-items: end;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.admin-main #options-field {
    margin-top: 12px;
}

.columns-list {
    margin: 8px 0 16px;
}

.admin-shell .data-table {
    font-size: 12px;
}

.admin-shell .data-table th,
.admin-shell .data-table td {
    padding: 7px 9px;
    line-height: 1.25;
    vertical-align: middle;
}

.admin-shell .data-table input {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
}

.admin-shell .table-container {
    margin: 12px 0;
    border-radius: 8px;
}

.admin-main .column-builder {
    margin-bottom: 8px;
}

.column-item.compact {
    display: grid;
    grid-template-columns: 26px minmax(154px, 1fr) minmax(120px, 1fr) 42px;
    gap: 10px;
    align-items: center;
    padding: 7px 8px;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
    transition: opacity 0.2s, border-color 0.2s, transform 0.2s;
}

.column-item.compact.dragging {
    opacity: 0.45;
    border-color: #3b82f6;
}

.column-item.compact.drag-over-top {
    border-top: 2.5px solid #3b82f6 !important;
    margin-top: 0;
}

.column-item.compact.drag-over-bottom {
    border-bottom: 2.5px solid #3b82f6 !important;
}

.template-field-row.dragging {
    opacity: 0.45;
    border-color: #3b82f6 !important;
}

.template-field-row.drag-over-top {
    border-top: 2.5px solid #3b82f6 !important;
}

.template-field-row.drag-over-bottom {
    border-bottom: 2.5px solid #3b82f6 !important;
}

.column-item.compact .record-actions {
    justify-self: end;
}

.column-item.compact .col-info {
    min-width: 0;
}

.column-item.compact .col-name {
    display: block;
    overflow: hidden;
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.column-item.compact .col-meta,
.column-item.compact .col-extra {
    overflow: hidden;
    color: #64748b;
    font-size: 11px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-row {
    padding: 10px 0 16px;
    color: var(--muted);
}

.column-row.editable {
    grid-template-columns: minmax(150px, 1.2fr) minmax(150px, 1fr) 120px minmax(150px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
    align-items: end;
    padding: 10px 0;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
}

.page-item-builder.compact {
    padding: 6px 8px !important;
    margin-bottom: 4px !important;
    border-radius: 7px !important;
    background: #f8fafc;
    border: 1px solid var(--line);
}

.page-builder-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.page-builder-toolbar .status {
    margin: 0;
    font-size: 12px;
}

.page-tab-filter-bar {
    display: grid;
    grid-template-columns: minmax(160px, 0.8fr) minmax(220px, 1fr) minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    margin: 0 0 12px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.page-tab-filter-bar .field {
    margin: 0;
}

.page-tab-filter-bar .button {
    min-height: 36px;
    height: 36px;
}

#page-builder-panel {
    gap: 18px;
}

#page-builder-panel #page-tab-form {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
}

#page-builder-panel .page-tab-list-section {
    flex: 0 0 auto;
    margin-top: 0;
}

#student-blocks-section {
    clear: both;
}

.student-block-builder,
.student-block-field {
    position: relative;
    z-index: 0;
}

.page-item-grid {
    display: grid;
    grid-template-columns: 32px 58px 58px minmax(150px, 0.85fr) minmax(260px, 1.5fr) 150px 116px;
    gap: 8px;
    align-items: center;
}

.page-item-grid-student {
    grid-template-columns: 58px 84px minmax(190px, 1fr) minmax(220px, 1.2fr) 150px 116px 34px;
}

.page-item-order {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-top: 12px;
}

.page-item-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-top: 12px;
    border-radius: 6px;
    color: #94a3b8;
    cursor: grab;
    font-size: 16px;
    line-height: 1;
    user-select: none;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.page-item-drag-handle:hover {
    color: #475569;
    background: #e2e8f0;
}

.page-item-drag-handle:active {
    cursor: grabbing;
}

.page-item-builder.compact.dragging {
    opacity: 0.45;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.18);
    border-color: #93c5fd !important;
    background: #eff6ff !important;
}

.page-item-builder.compact.drag-over-top {
    border-top: 2.5px solid #3b82f6 !important;
    margin-top: 0;
}

.page-item-builder.compact.drag-over-bottom {
    border-bottom: 2.5px solid #3b82f6 !important;
}

.page-item-builder.compact .page-item-move {
    width: 26px;
    height: 26px;
    min-height: 26px;
    padding: 0;
    border-radius: 6px;
}

.page-item-builder.compact .page-item-move svg {
    width: 15px;
    height: 15px;
}

.page-item-builder.compact .page-item-move:disabled {
    opacity: 0.35;
    cursor: default;
}

.page-item-builder.compact .compact-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    margin: 0;
    font-size: 11px;
    font-weight: 800;
    color: #334155;
    cursor: pointer;
}

.admin-main #workload-panel,
.admin-main #workload-panel .workload-section {
    width: 100%;
    max-width: none;
}

.page-item-builder.compact .compact-check .item-active + span,
.page-item-builder.compact .compact-check .item-editable + span {
    font-size: 0;
}

.page-item-builder.compact .compact-check .item-active + span::after {
    content: "Показ";
    font-size: 11px;
}

.page-item-builder.compact .compact-check .item-editable + span::after {
    content: "Ред.";
    font-size: 11px;
}

.page-item-source {
    min-width: 0;
}

.page-item-source span,
.page-item-builder.compact label {
    display: block;
    margin: 0 0 2px;
    font-size: 10px;
    font-weight: 800;
    color: #64748b;
}

.page-item-source strong {
    display: block;
    overflow: hidden;
    color: #0f172a;
    font-size: 13px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-item-builder.compact input,
.page-item-builder.compact select {
    width: 100%;
    height: 30px;
    min-height: 30px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.page-item-builder.compact .compact-check input {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    margin: 0;
}

.page-item-builder.compact .field {
    min-width: 0;
    margin: 0;
}

.page-item-builder.compact .appearance-config-btn {
    height: 30px;
    margin: 12px 0 0;
    padding: 0 10px;
    font-size: 11px;
    white-space: nowrap;
}

.page-item-builder.compact .page-item-delete {
    width: 30px;
    height: 30px;
    min-height: 30px;
    margin-top: 12px;
    padding: 0;
    color: #ef4444;
    background: #fff;
    border-color: #fecaca;
    box-shadow: none;
}

@media (max-width: 1100px) {
    .page-tab-filter-bar {
        grid-template-columns: 1fr 1fr;
    }

    .page-item-grid {
        grid-template-columns: 32px 58px 58px minmax(140px, 1fr) minmax(220px, 1.3fr);
    }

    .page-item-grid-student {
        grid-template-columns: 58px 84px minmax(150px, 1fr) minmax(190px, 1.2fr);
    }

    .page-item-mode,
    .page-item-builder.compact .appearance-config-btn {
        grid-column: span 2;
    }
}

.page-item-row {
    grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) minmax(180px, 1fr) auto !important;
}

.checkbox-line.compact {
    align-self: center;
}

.saved-tab {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 16px 0;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
}

.saved-tab h3 {
    font-size: 18px;
}

@media (max-width: 980px) {
    .page-tab-filter-bar {
        grid-template-columns: 1fr;
    }

    .hero, .admin-layout, .entry-grid, .portal-layout, .admin-data-shell {
        grid-template-columns: 1fr;
    }

    .admin-data-shell.menu-collapsed {
        grid-template-columns: 1fr;
    }

    .form-grid, .column-builder, .admin-main .form-grid, .admin-main .column-builder, .column-row.editable {
        grid-template-columns: 1fr;
    }

    .saved-tab, .column-row {
        grid-template-columns: 1fr;
    }

    /* Force single-column layout on mobile regardless of collapsed state */
    .admin-shell,
    .admin-shell.sidebar-collapsed {
        grid-template-columns: 1fr !important;
    }

    /* Mobile sidebar: fixed overlay panel, hidden by default */
    .admin-shell .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 200;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    /* Show sidebar when mobile-open */
    .admin-shell.sidebar-mobile-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    }

    /* Collapsed class has no extra effect on mobile (handled by mobile-open) */
    .admin-shell.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    .admin-shell.sidebar-mobile-open.sidebar-collapsed .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    }

    /* Overlay backdrop */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 199;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        animation: fadeInOverlay 0.22s ease;
    }

    .admin-shell.sidebar-mobile-open .sidebar-overlay,
    .admin-shell.sidebar-mobile-open ~ .sidebar-overlay,
    .sidebar-overlay.visible {
        display: block;
    }

    @keyframes fadeInOverlay {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}
/* Table Filters */
.table-filters input {
    width: 100%;
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #ffffff;
}

.table-filters th {
    padding: 8px 14px !important;
    background: #f1f5f9 !important;
}

/* Actions Dropdown */
.actions-dropdown {
    position: relative;
    display: inline-block;
}

.actions-menu {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 99999;
    min-width: 160px;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.actions-dropdown.active {
    z-index: 99999;
}
.actions-dropdown.active .actions-menu {
    display: flex;
}

.menu-item {
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: transparent;
    border: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s ease;
}

.menu-item:hover {
    background: var(--panel-soft);
}

.menu-item.danger {
    color: var(--red);
}

.menu-item.danger:hover {
    background: #fff1f1;
}

.actions-toggle {
    min-width: 90px;
    justify-content: space-between !important;
}

.actions-toggle::after {
    content: "▼";
    font-size: 10px;
    margin-left: 8px;
    opacity: 0.6;
}

.data-table tr:hover td {
    background: #fcfdfe;
}

.data-table tr.unit-faculty-row td {
    background: #f8fafc;
    font-weight: 600;
}

.row-actions {
    position: relative;
    display: inline-flex;
    justify-content: center;
}

.action-trigger {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 7px;
    cursor: pointer;
}

.action-trigger.with-label {
    width: auto;
    min-width: 66px;
    gap: 6px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
}

.action-trigger:hover,
.row-actions.open .action-trigger {
    color: var(--blue);
    border-color: #bfd0ee;
    background: #f8fbff;
}

.action-menu {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    z-index: 60;
    min-width: 156px;
    padding: 5px;
    display: none;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
}

.row-actions.open .action-menu {
    display: grid;
    gap: 2px;
}

.row-actions.drop-up .action-menu {
    top: auto;
    bottom: calc(100% + 5px);
}

.row-actions.lockable-field-actions .action-menu {
    position: fixed;
    top: var(--lockable-menu-top, 0);
    left: var(--lockable-menu-left, 0);
    right: auto !important;
    bottom: auto !important;
    z-index: 100000;
}

.action-menu-item {
    min-height: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    color: #243042;
    background: transparent;
    border: 0;
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
}

.action-menu-item:hover {
    background: #f1f5f9;
}

.action-menu-item svg,
.action-trigger svg {
    width: 16px;
    height: 16px;
}

.compact-list {
    gap: 0;
}

.compact-record {
    display: grid;
    grid-template-columns: minmax(210px, 1.3fr) minmax(180px, 1fr) minmax(220px, 1.15fr) 54px;
    gap: 10px;
    align-items: center;
    min-height: 42px;
    padding: 7px 10px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.compact-record-head {
    min-height: 34px;
    color: #475569;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px 8px 0 0;
    font-size: 12px;
    font-weight: 800;
}

.compact-record:not(.compact-record-head):hover {
    background: #fcfdfe;
}

.compact-record .record-title {
    min-width: 0;
    font-weight: 750;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-record .record-title span {
    margin-left: 6px;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
}

.compact-record .record-meta {
    min-width: 0;
    color: #475569;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-record .record-actions {
    justify-self: end;
}

.compact-record.dragging {
    opacity: .62;
}

.compact-record.drag-over-top {
    box-shadow: inset 0 2px 0 #2563eb;
}

.compact-record.drag-over-bottom {
    box-shadow: inset 0 -2px 0 #2563eb;
}

.page-tab-drag-handle {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #94a3b8;
    cursor: grab;
}

.compact-record:active .page-tab-drag-handle {
    cursor: grabbing;
}

/* Modern Web Table (matches latest screenshot) */
.table-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: visible;
    margin: 12px 0 0 0;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    color: #334155;
    min-width: 1200px;
}

.modern-table th {
    background: #f8fafc;
    padding: 14px 16px;
    text-align: left;
    font-weight: 700;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    white-space: normal;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modern-table th .header-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-icon {
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
}

.modern-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    vertical-align: middle;
    height: 90px; /* Matching the height from screenshot */
}

.modern-table tr:last-child td {
    border-bottom: none;
}

.modern-table td:last-child, .modern-table th:last-child {
    border-right: none;
}

.modern-table tr:hover {
    background: #f8fbff;
}

/* Alignments */
.cell-center { text-align: center; }
.cell-left { text-align: left; }

/* Components in Table */
.modern-table a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dotted #4f46e5;
}

.modern-table a:hover {
    border-bottom-style: solid;
}

.table-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #334155;
    outline: none;
    cursor: pointer;
}

.table-select:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.table-icon {
    font-size: 20px;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.table-icon.success { color: #10b981; }
.table-icon.primary { color: #3b82f6; }

.teacher-table {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
    font-size: 12px;
}

.teacher-table th {
    padding: 7px 8px;
    min-width: 84px;
    white-space: normal;
    line-height: 1.18;
    vertical-align: middle;
}

.teacher-table td {
    min-width: 84px;
}

.teacher-table th.mode-compact-icon,
.teacher-table td.mode-compact-icon {
    width: 64px;
    min-width: 64px;
    max-width: 70px;
}

.teacher-table td.mode-upload {
    position: relative;
    overflow: visible;
    z-index: 15;
}

.teacher-table td.mode-upload .action-menu {
    z-index: 9999;
}

.teacher-table tr.teacher-row-needs-action > td {
    background: #fef9c3 !important;
}

.teacher-table tr.teacher-row-needs-action:hover > td {
    background: #fef3a5 !important;
}

@keyframes teacher-template-cell-pulse {
    0%, 100% {
        background-color: #f5f3ff;
        box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.35);
    }
    50% {
        background-color: #ede9fe;
        box-shadow: inset 0 0 0 2px rgba(124, 58, 237, 0.62);
    }
}

.teacher-table td.teacher-template-cell-attention,
.teacher-table tr.teacher-row-needs-action > td.teacher-template-cell-attention {
    animation: teacher-template-cell-pulse 1.25s ease-in-out infinite !important;
    background: #f5f3ff !important;
}

.teacher-table th.mode-name,
.teacher-table td.mode-name {
    min-width: 122px;
}

.teacher-table th.teacher-sticky-student-name,
.teacher-table td.teacher-sticky-student-name {
    position: sticky;
    left: 0;
    background: #ffffff;
    box-shadow: 3px 0 6px -4px rgba(15, 23, 42, 0.5);
}

.teacher-table th.teacher-sticky-student-name {
    z-index: 12;
    background: #f8fafc;
}

.teacher-table td.teacher-sticky-student-name {
    z-index: 9;
}

.teacher-table tr:hover > td.teacher-sticky-student-name {
    background: #f8fafc;
}

.teacher-table th .header-content {
    min-height: 42px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18px;
    gap: 5px;
    align-items: center;
}

.teacher-table th .header-content span {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.teacher-table-filter-btn {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: transparent;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    justify-self: end;
}

.admin-shell .excel-table .admin-excel-head-inner,
.teacher-table th .header-content {
    position: relative;
    display: block !important;
    min-height: 42px;
    padding-right: 24px !important;
}

.admin-shell .excel-table .admin-excel-head-text,
.teacher-table th .header-content > span {
    width: 100%;
    max-width: 100%;
    padding-right: 0;
    box-sizing: border-box;
}

.admin-shell .excel-table .admin-table-filter-btn,
.teacher-table .teacher-table-filter-btn {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    z-index: 2;
}

#admin-table-wrap .admin-excel-head-inner,
.teacher-table th .header-content {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, auto) 20px;
    align-items: start;
    justify-items: stretch;
    gap: 3px;
    min-height: 56px;
    padding: 4px 6px !important;
}

#admin-table-wrap .admin-excel-head-text,
.teacher-table th .header-content > span {
    grid-row: 1;
    min-width: 0;
}

#admin-table-wrap .admin-table-filter-btn,
.teacher-table .teacher-table-filter-btn {
    position: static;
    grid-row: 2;
    justify-self: center;
    align-self: center;
    transform: none;
}

.teacher-table td {
    height: 42px;
    padding: 5px 7px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.teacher-table .table-cell-text,
.admin-shell .excel-table .table-cell-text {
    display: -webkit-box !important;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 3.6em;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.admin-shell .excel-table {
    width: max-content;
    min-width: 100%;
    font-size: 12px;
}

.admin-shell .excel-table th,
.admin-shell .excel-table td {
    height: 42px;
    min-width: 84px;
    padding: 4px 6px;
    line-height: 1.2;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.admin-shell .excel-table th.mode-compact-icon,
.admin-shell .excel-table td.mode-compact-icon {
    width: 64px;
    min-width: 64px;
    max-width: 70px;
}

.admin-shell .excel-table th.mode-name,
.admin-shell .excel-table td.mode-name {
    min-width: 132px;
}

#admin-table-wrap .excel-table th.admin-sticky-student-name,
#admin-table-wrap .excel-table td.admin-sticky-student-name {
    position: sticky;
    left: var(--admin-sticky-student-left, 38px);
    background: #ffffff;
    box-shadow: 3px 0 6px -4px rgba(15, 23, 42, 0.5);
}

#admin-table-wrap .excel-table th.admin-sticky-student-name {
    z-index: 10;
    background: #f8fafc;
}

#admin-table-wrap .excel-table td.admin-sticky-student-name {
    z-index: 4;
}

#admin-table-wrap .excel-table tr:hover > td.admin-sticky-student-name {
    background: #f8fafc;
}

.admin-shell .excel-table td {
    max-width: none;
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
}

.admin-shell .admin-excel-head-inner {
    min-height: 42px;
}

#admin-table-wrap .admin-excel-head-inner,
.teacher-table th .header-content {
    min-height: 56px;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, auto) 20px;
    gap: 3px;
    padding: 4px 6px !important;
}

.admin-shell .admin-excel-head-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: normal;
    hyphens: none;
    line-height: 1.15;
}

#admin-table-wrap .admin-excel-head-inner,
.teacher-table th .header-content {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 4px 6px !important;
    text-align: center;
    cursor: pointer;
}

#admin-table-wrap .admin-excel-head-text,
.teacher-table th .header-content > span {
    text-align: center;
    margin: 0 auto;
}

#admin-table-wrap .admin-table-filter-btn,
.teacher-table .teacher-table-filter-btn {
    display: none !important;
}

#admin-table-wrap {
    overflow: auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#admin-table-wrap .table-container {
    overflow: auto;
    flex: 1;
    min-height: 0;
}

#admin-table-wrap .admin-row-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

#admin-table-wrap .admin-row-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 12px;
}

#admin-table-wrap .admin-row-add-btn svg {
    width: 16px;
    height: 16px;
}

#admin-table-wrap .admin-managed-row-number-col,
#admin-table-wrap .admin-managed-row-head {
    min-width: 64px !important;
    width: 64px !important;
}

#admin-table-wrap .admin-managed-row-head-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 54px;
}

#admin-table-wrap .admin-row-delete-btn {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #dc2626;
    background: transparent;
    cursor: pointer;
}

#admin-table-wrap .admin-row-delete-btn:hover {
    border-color: #fecaca;
    background: #fef2f2;
}

#admin-table-wrap .admin-row-delete-btn svg {
    width: 14px;
    height: 14px;
}

.teacher-table .table-icon {
    width: 26px;
    height: 26px;
    font-size: 17px;
}

.teacher-table .table-icon svg,
.teacher-table .button svg {
    width: 16px;
    height: 16px;
}

.teacher-table .button.small,
.teacher-table .button.secondary.small {
    width: 26px !important;
    height: 26px !important;
    min-height: 26px;
    padding: 3px !important;
}

.teacher-table .table-select {
    min-height: 28px;
    padding: 4px 6px;
    font-size: 12px;
}

.status {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 10px;
    display: inline-block;
}
.status.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.status.success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* Premium Floating Chat System */
.chat-message-send-error {
    color: #dc2626;
}
.chat-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000002;
    border: none;
    outline: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-widget-btn:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.5), 0 4px 8px rgba(0, 0, 0, 0.15);
}

.chat-widget-btn:active {
    transform: scale(0.95);
}

.chat-widget-btn svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

.chat-widget-btn.active svg {
    transform: rotate(90deg);
}

.chat-widget-btn.has-unread svg {
    animation: chat-unread-blink 1s ease-in-out infinite;
}

@keyframes chat-unread-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.25;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-widget-btn.has-unread svg {
        animation: none;
    }
}

.chat-widget-btn-inline-only {
    display: none;
}

.chat-inline-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
}

.chat-inline-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-inline-button {
    position: relative;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    background: #f8fafc;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    vertical-align: middle;
}

.chat-inline-button:hover {
    color: var(--blue);
    border-color: #93c5fd;
    background: #eff6ff;
}

.chat-inline-button.has-conversation:not(.has-unread) {
    color: #ffffff !important;
    border-color: #1e4f8a !important;
    background: #1e4f8a !important;
    animation: none;
    box-shadow: none;
}

.chat-inline-button.has-conversation:not(.has-unread) svg,
.chat-inline-button.has-conversation:not(.has-unread) svg * {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

.chat-inline-button.has-unread {
    color: #ffffff;
    background: #1e4f8a !important;
    border-color: #1e4f8a !important;
    animation: pulse-blue 1.6s infinite;
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.58);
}

.chat-inline-button.has-unread svg {
    animation: chat-unread-blink 1s ease-in-out infinite;
}

.chat-inline-button.is-disabled {
    cursor: default;
    opacity: 0.55;
}

.chat-inline-button svg {
    width: 14px;
    height: 14px;
}

.chat-inline-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #1d4ed8;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    align-items: center;
    justify-content: center;
    border: 1px solid #ffffff;
}

.chat-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--red);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(194, 65, 53, 0.4);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(194, 65, 53, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(194, 65, 53, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(194, 65, 53, 0);
    }
}

@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.58);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.chat-choice-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    overflow: auto;
}

.chat-choice-button {
    width: 100%;
    border: 1px solid #dbe4ef;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    display: grid;
    grid-template-columns: 42px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    text-align: left;
    cursor: pointer;
}

.chat-choice-button:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.chat-choice-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #e0f2fe;
    color: var(--blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-choice-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-choice-text strong,
.chat-choice-text small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-choice-text small {
    color: #64748b;
    font-size: 12px;
}

.chat-widget-drawer {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 820px;
    height: 600px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 120px);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    display: flex;
    overflow: hidden;
    z-index: 1000001;
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.chat-widget-drawer.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.chat-widget-drawer-inline {
    width: 520px;
}

.chat-widget-drawer-inline .chat-sidebar {
    display: none;
}

.chat-widget-drawer-inline .chat-main-window {
    width: 100%;
}

.chat-sidebar {
    width: 280px;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    background: rgba(248, 250, 252, 0.4);
}

.chat-sidebar-header {
    padding: 18px;
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-close-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
}

.chat-close-btn:hover {
    color: var(--ink);
}

.chat-contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    border: 1px solid transparent;
    background: transparent;
    text-align: left;
    font: inherit;
}

.chat-contact-item:hover {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.chat-contact-item.active {
    background: var(--panel-soft);
    border: 1px solid rgba(37, 99, 235, 0.15);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: var(--blue-dark);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6);
}

.chat-avatar.dept {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: var(--green);
}

.chat-avatar.supervisor {
    background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
    color: #854d0e;
}

.chat-contact-info {
    flex: 1;
    min-width: 0;
}

.chat-contact-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-contact-role {
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-contact-scope {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.25;
    color: var(--muted);
    white-space: normal;
}

.chat-contact-unread {
    background: var(--red);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.chat-main-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.chat-window-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.5);
}

.chat-window-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
}

.chat-window-subtitle {
    font-size: 11px;
    color: var(--muted);
    margin-top: 1px;
}

@media (prefers-reduced-motion: reduce) {
    .chat-inline-button.has-unread,
    .chat-inline-button.has-unread svg {
        animation: none;
    }
}

.chat-mobile-back-btn {
    display: none;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--ink);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 38px;
}

.chat-messages-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.3);
}

.chat-message-row {
    display: flex;
    width: 100%;
}

.chat-message-row.incoming {
    justify-content: flex-start;
}

.chat-message-row.outgoing {
    justify-content: flex-end;
}

.chat-message-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.45;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    animation: fadeInUp 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message-row.incoming .chat-message-bubble {
    background: rgba(255, 255, 255, 0.95);
    color: var(--ink);
    border-top-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-message-row.outgoing .chat-message-bubble {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.chat-message-meta {
    font-size: 9px;
    margin-top: 5px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
}

.chat-message-row.incoming .chat-message-meta {
    color: var(--muted);
}

.chat-message-row.outgoing .chat-message-meta {
    color: rgba(255, 255, 255, 0.7);
}

.chat-message-delete {
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    background: rgba(255, 255, 255, 0.14);
    cursor: pointer;
    opacity: 0.78;
    transition: opacity 0.18s ease, background 0.18s ease;
}

.chat-message-delete:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.24);
}

.chat-message-delete svg {
    display: block;
}

.chat-quick-replies {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
}

.chat-quick-replies::-webkit-scrollbar {
    height: 4px;
}

.chat-quick-replies::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.chat-reply-chip {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(37, 99, 235, 0.15);
    color: var(--blue);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-reply-chip:hover {
    background: var(--blue);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

.chat-input-bar {
    padding: 12px 18px 18px;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.65);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
}

.chat-input-wrapper input {
    width: 100%;
    height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    color: var(--ink);
    outline: none;
    transition: all 0.2s ease;
}

.chat-input-wrapper input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background: #ffffff;
}

.chat-send-btn {
    height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
    color: #ffffff;
    border: none;
    outline: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.chat-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
}

.chat-send-btn:active {
    transform: translateY(0);
}

.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: var(--muted);
}

.chat-empty-state svg {
    width: 48px;
    height: 48px;
    stroke: rgba(0, 0, 0, 0.15);
    margin-bottom: 12px;
}

.chat-empty-state h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 6px 0;
}

.chat-empty-state p {
    font-size: 12px;
    margin: 0;
    max-width: 240px;
}

.chat-muted {
    padding: 24px 18px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.chat-error {
    color: var(--red);
}

/* Custom Scrollbar for Chat */
.chat-messages-scroll::-webkit-scrollbar,
.chat-contacts-list::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-scroll::-webkit-scrollbar-track,
.chat-contacts-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages-scroll::-webkit-scrollbar-thumb,
.chat-contacts-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.chat-messages-scroll::-webkit-scrollbar-thumb:hover,
.chat-contacts-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .student-deadlines-card {
        padding: 10px !important;
    }

    .student-deadlines-timeline {
        grid-template-columns: 1fr !important;
    }

    .student-deadline-item {
        align-items: flex-start !important;
        gap: 4px 10px !important;
        min-width: 0 !important;
    }

    .student-deadline-label {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        min-width: 0 !important;
        line-height: 1.25 !important;
    }

    .student-deadline-value {
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        text-align: right !important;
        max-width: 48% !important;
        line-height: 1.25 !important;
    }

    .chat-widget-drawer {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }
    
    .chat-widget-btn {
        bottom: 16px;
        right: 16px;
    }
    
    .chat-sidebar {
        display: none;
    }
    
    .chat-sidebar.mobile-open {
        display: flex;
        width: 100%;
    }
    
    .chat-main-window.mobile-hidden {
        display: none;
    }

    .chat-mobile-back-btn {
        display: inline-flex;
    }
}

/* Sticky Headers */
.data-table thead,
.data-table th, .compact-record-head {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8fafc;
}





.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
    padding-bottom: 36px;
}

.workload-section {
    padding: 0;
    min-height: calc(100vh - 80px);
    overflow: hidden;
}

.workload-frame {
    width: 100%;
    min-height: calc(100vh - 80px);
    border: 0;
    display: block;
    background: #fff;
}

section:has(.table-container) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

@keyframes student-block-complete-pop {
    0% {
        transform: scale(0.985);
        box-shadow: 0 4px 10px -12px rgba(2, 132, 199, 0.4);
    }
    55% {
        transform: scale(1.01);
        box-shadow: 0 18px 42px -26px rgba(2, 132, 199, 0.95);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 12px 28px -24px rgba(2, 132, 199, 0.8);
    }
}

/* ── OVERLAY LOADER ── */
.loader-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(37, 99, 235, 0.12), transparent 34%),
    radial-gradient(circle at 78% 80%, rgba(20, 184, 166, 0.13), transparent 32%),
    rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  overflow: hidden;
}
.loader-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-network-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  opacity: 0.58;
}

.loader-overlay.transition-loader {
  background: rgba(248, 250, 252, 0.38);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.loader-overlay.transition-loader .loader-network-canvas,
.loader-overlay.transition-loader .loader-bg-glow,
.loader-overlay.transition-loader .progress-wrapper {
  display: none;
}

.loader-overlay.transition-loader .logo-wrapper {
  margin-bottom: 18px;
  filter:
    drop-shadow(0 18px 26px rgba(15, 23, 42, 0.26))
    drop-shadow(0 8px 14px rgba(30, 99, 255, 0.18));
}

.loader-overlay.transition-loader .loader-svg-logo {
  width: 240px;
  filter: none;
}

.loader-overlay.transition-loader.active .loader-svg-logo .svg-letter {
  animation: none;
  fill: #1e293b;
}

.loader-overlay.transition-loader .loader-mark-wrapper {
  width: 82px;
  height: 82px;
  filter:
    drop-shadow(0 18px 26px rgba(15, 23, 42, 0.3))
    drop-shadow(0 7px 13px rgba(30, 99, 255, 0.22));
}

.loader-overlay.transition-loader .loader-spinning-mark {
  width: 66px;
  height: 66px;
  filter:
    drop-shadow(0 14px 14px rgba(15, 23, 42, 0.25))
    drop-shadow(0 5px 8px rgba(30, 99, 255, 0.2));
}

/* Blurred glow background */
.loader-bg-glow {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.24;
}
.glow-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(42px);
}
.glow-blob:nth-child(1) {
  width: 500px; height: 500px;
  background: rgba(30, 99, 255, 0.18);
  top: -100px; left: -120px;
  animation-delay: 0s;
}
.glow-blob:nth-child(2) {
  width: 420px; height: 420px;
  background: rgba(56, 189, 248, 0.22);
  bottom: -80px; right: -80px;
  animation-delay: 1.5s;
}
.glow-blob:nth-child(3) {
  width: 320px; height: 320px;
  background: rgba(124, 58, 237, 0.15);
  top: 40%; left: 55%;
  animation-delay: 3s;
}
@keyframes blobDrift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.1); }
}

/* ── LOGO SVG WRAPPER ── */
.logo-wrapper {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 34px;
}

.loader-svg-logo {
  width: 300px;
  height: auto;
  overflow: visible;
  /* slow zoom effect */
  filter: none;
}

.loader-svg-logo .svg-letter {
  fill: #1e293b;
  transform-origin: center;
  transform-box: fill-box;
  transition: none;
}

.loader-overlay.active .loader-svg-logo .svg-letter {
  animation: loaderLetterColor 2.4s ease-in-out var(--delay, 0s) infinite;
}

@keyframes loaderLetterColor {
  0%, 100% { fill: #1e293b; }
  22% { fill: var(--loader-color, #1e63ff); }
  46% { fill: #1e293b; }
}

.loader-mark-wrapper {
  position: relative;
  z-index: 2;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.22s ease both;
}

.loader-spinning-mark {
  width: 84px;
  height: 84px;
  object-fit: contain;
  transform-origin: center;
  filter:
    drop-shadow(0 18px 18px rgba(15, 23, 42, 0.22))
    drop-shadow(0 6px 8px rgba(30, 99, 255, 0.18))
    drop-shadow(0 -2px 5px rgba(255, 255, 255, 0.72));
  animation: loaderMarkSpinSmooth 3.6s cubic-bezier(.45, 0, .2, 1) infinite;
}

@keyframes loaderMarkSpinSmooth {
  0% { transform: translateY(0) scale(1) rotate(0deg); }
  25% { transform: translateY(-3px) scale(1.035) rotate(90deg); }
  50% { transform: translateY(0) scale(1) rotate(180deg); }
  75% { transform: translateY(-3px) scale(1.035) rotate(270deg); }
  100% { transform: translateY(0) scale(1) rotate(360deg); }
}

/* ── PROGRESS BAR ── */
.progress-wrapper {
  width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: 'Inter', sans-serif;
  animation: fadeIn 0.22s ease both;
}
.progress-track {
  width: 100%;
  height: 4px;
  background: rgba(148, 163, 184, 0.25);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}
.progress-bar {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, #38bdf8, #1e63ff);
  width: 0%;
}
@keyframes progressFill {
  0%   { width: 0%; }
  40%  { width: 60%; }
  70%  { width: 80%; }
  90%  { width: 93%; }
  100% { width: 100%; }
}
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.progress-label {
  font-size: 13px;
  color: #64748b;
  letter-spacing: 1px;
  font-weight: 600;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Compact table filters */
.table-filter-popover,
.admin-table-filter-popover {
  width: 220px !important;
  max-width: min(220px, calc(100vw - 24px)) !important;
  padding: 6px !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18) !important;
  font-size: 11px !important;
}

.table-filter-popover .admin-filter-sort-row,
.table-filter-popover .admin-filter-actions,
.admin-table-filter-popover .admin-filter-sort-row,
.admin-table-filter-popover .admin-filter-actions {
  gap: 4px !important;
  padding: 0 !important;
  margin: 0 0 5px !important;
  border: 0 !important;
}

.table-filter-popover .button,
.admin-table-filter-popover .button,
.table-filter-popover button,
.admin-table-filter-popover button {
  min-height: 22px !important;
  height: 22px !important;
  padding: 0 7px !important;
  border-radius: 6px !important;
  font-size: 10px !important;
  line-height: 1 !important;
}

.table-filter-popover .admin-filter-body,
.admin-table-filter-popover .admin-filter-body {
  padding: 0 !important;
}

.table-filter-popover > div[style*="display:flex"],
.admin-table-filter-popover > div[style*="display:flex"] {
  gap: 4px !important;
  margin-bottom: 5px !important;
}

.table-filter-popover .filter-search,
.admin-table-filter-popover .filter-search {
  height: 24px !important;
  min-height: 24px !important;
  margin: 0 0 5px !important;
  padding: 0 7px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
}

.table-filter-popover .filter-list,
.admin-table-filter-popover .filter-list {
  max-height: 165px !important;
  margin-top: 4px !important;
  gap: 1px !important;
  font-size: 11px !important;
  overflow: auto !important;
}

.table-filter-popover .admin-filter-option,
.admin-table-filter-popover .admin-filter-option,
.table-filter-popover label,
.admin-table-filter-popover label {
  min-height: 20px !important;
  padding: 1px 2px !important;
  gap: 5px !important;
  font-size: 11px !important;
  line-height: 1.15 !important;
  font-weight: 600 !important;
}

.table-filter-popover input[type="checkbox"],
.admin-table-filter-popover input[type="checkbox"] {
  width: 13px !important;
  height: 13px !important;
  min-width: 13px !important;
  min-height: 13px !important;
  flex: 0 0 13px !important;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: #1e7f91;
}

.table-filter-popover::-webkit-scrollbar,
.admin-table-filter-popover::-webkit-scrollbar,
.table-filter-popover *::-webkit-scrollbar,
.admin-table-filter-popover *::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

/* Student Cards View */
.student-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    padding: 16px;
    background: transparent;
}

.student-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.student-card-main {
    position: relative;
    min-height: 64px;
    display: flex;
    align-items: center;
}

.student-card-summary {
    flex: 1 1 auto;
    min-width: 0;
}

.teacher-card-blocks-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.teacher-card-data-block {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    padding: 8px 10px;
    min-width: 0;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.teacher-card-data-block h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}

.teacher-card-data-block h4 span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teacher-card-data-block h4 i {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    color: #64748b;
    transition: transform 0.18s ease;
}

.teacher-card-block-fields {
    display: none;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.teacher-card-data-block:hover,
.teacher-card-data-block:focus {
    background: #ffffff;
    border-color: #bfdbfe;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    outline: none;
}

.teacher-card-data-block.is-open {
    grid-column: 1 / -1;
    background: #ffffff;
    border-color: #bfdbfe;
}

.teacher-card-data-block.is-open h4 i {
    transform: rotate(180deg);
}

.teacher-card-data-block.is-open .teacher-card-block-fields {
    display: grid;
}

.teacher-card-block-field {
    display: grid;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    color: #334155;
    font-size: 12px;
    line-height: 1.3;
    min-width: 0;
}

.teacher-card-block-label {
    color: #64748b;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.teacher-card-block-value {
    color: #0f172a;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

.teacher-card-block-field-icon {
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    padding: 7px 8px;
}

.teacher-card-block-field-icon i {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.teacher-card-block-field-icon span {
    min-width: 0;
    color: #1e293b;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.teacher-window-modal-overlay {
    padding: 16px;
    box-sizing: border-box;
}

.teacher-window-modal-card {
    background: #fff;
    width: min(760px, 100%);
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    padding: 18px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
}

.teacher-window-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex: 0 0 auto;
}

.teacher-window-modal-header h3 {
    margin: 0;
    min-width: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teacher-window-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
    padding-right: 5px;
}

.teacher-window-modal-footer {
    margin-top: 14px;
    text-align: right;
    flex: 0 0 auto;
}

.student-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #bae6fd;
}

.student-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 4px 0;
}

.student-card-field {
    font-size: 13px;
    color: var(--muted);
    display: flex;
    gap: 6px;
}

.student-card-field strong {
    color: #475569;
    font-weight: 600;
    min-width: 80px;
}

.student-card-field span {
    color: var(--ink);
    flex: 1;
    word-break: break-word;
}

/* Student Card Modal */
.student-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fade-in 0.2s ease-out;
}

.student-modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.student-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--ink);
}

.student-modal-close {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

.student-modal-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.student-modal-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.student-modal-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.student-modal-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.student-modal-value {
    font-size: 15px;
    color: var(--ink);
    word-break: break-word;
}

@media (max-width: 980px) {
    .student-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }

    .student-card {
        border-radius: 12px !important;
        padding: 14px !important;
        min-height: 0 !important;
    }

    .student-card-main {
        min-height: 0;
        align-items: flex-start;
        padding-right: 0;
    }

    .student-card-summary {
        padding-right: 0 !important;
    }

    .student-card-chat-action {
        position: static !important;
        transform: none !important;
        margin-top: 10px;
        align-self: flex-start;
    }

    .student-card-main > div[style*="position: absolute"][style*="width: 64px"] {
        position: static !important;
        transform: none !important;
        width: 54px !important;
        height: 54px !important;
        margin-left: 10px;
        flex: 0 0 54px;
    }

    .teacher-card-blocks-preview {
        gap: 8px;
        margin-top: 12px;
    }

    .teacher-card-data-block {
        padding: 9px;
    }

    .teacher-card-block-field {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .teacher-card-block-value {
        text-align: left;
    }

    .teacher-window-modal-overlay {
        align-items: stretch !important;
        justify-content: center !important;
        padding: 10px;
    }

    .teacher-window-modal-card {
        width: 100%;
        max-height: calc(100dvh - 20px);
        padding: 12px;
        border-radius: 12px;
    }

    .teacher-window-modal-header {
        margin-bottom: 10px;
    }

    .teacher-window-modal-header h3 {
        font-size: 16px;
        white-space: normal;
        line-height: 1.25;
    }

    .teacher-window-modal-body {
        max-height: none;
        padding-right: 0;
    }

    .teacher-window-modal-body .modern-table,
    .teacher-window-modal-body .modern-table tbody,
    .teacher-window-modal-body .modern-table tr,
    .teacher-window-modal-body .modern-table td {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
    }

    .teacher-window-modal-body .modern-table td {
        text-align: left !important;
        padding: 7px 0 !important;
        border-right: 0 !important;
    }

    .teacher-window-modal-footer {
        text-align: stretch;
    }

    .teacher-window-modal-footer .button {
        width: 100%;
    }

    #teacher-student-modal {
        align-items: flex-end !important;
    }

    #teacher-student-modal > div {
        width: 100% !important;
        max-width: none !important;
        max-height: 92vh !important;
        border-radius: 18px 18px 0 0 !important;
    }

    #teacher-student-modal-body {
        padding: 14px !important;
    }
}

@keyframes pulse-orange {
    0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(249, 115, 22, 0); }
    100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

@keyframes plato-icon-pending-blink {
    0%, 100% {
        opacity: 1;
        filter: drop-shadow(0 0 0 rgba(249, 115, 22, 0));
    }
    50% {
        opacity: 0.35;
        filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.75));
    }
}

img.plato-icon-pending,
img[data-plato-icon-variant="orange"] {
    animation: plato-icon-pending-blink 1.25s ease-in-out infinite;
}

body.administrator-cabinet img.plato-icon-pending,
body.administrator-cabinet img[data-plato-icon-variant="orange"] {
    animation: none !important;
    opacity: 1;
    filter: none;
}

/* Teacher file attention is controlled explicitly by teacher.js. An orange
   review status (for example, "revision requested") must not blink by itself. */
body.teacher-cabinet img.plato-icon-pending,
body.teacher-cabinet img[data-plato-icon-variant="orange"] {
    animation: none !important;
    opacity: 1;
    filter: none;
}


@keyframes teacher-document-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.teacher-document-icon-blink {
    animation: teacher-document-blink 1.25s ease-in-out infinite;
    color: #f97316 !important;
}
.teacher-document-icon-blink svg, .teacher-document-icon-blink i {
    color: #f97316 !important;
}
/* Active Telegram bot subscriptions in administrator user tables. */
.excel-table tbody tr.telegram-linked-row > th,
.excel-table tbody tr.telegram-linked-row > td,
table tbody tr.telegram-linked-row > th,
table tbody tr.telegram-linked-row > td {
    background-color: #e0f2fe !important;
}

.excel-table tbody tr.telegram-linked-row:hover > th,
.excel-table tbody tr.telegram-linked-row:hover > td,
table tbody tr.telegram-linked-row:hover > th,
table tbody tr.telegram-linked-row:hover > td {
    background-color: #bae6fd !important;
}
/* Information cards in the “Актуальне” workspace. */
.actual-info-shell { padding: 18px; }
.actual-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.actual-info-card { position: relative; aspect-ratio: 1 / 1; min-height: 280px; padding: 22px; border: 1px solid var(--actual-border, #dbe4ee); border-radius: 18px; background: var(--actual-bg, #f8fafc); overflow: hidden; box-shadow: 0 8px 24px rgba(15, 23, 42, .06); display: block; cursor: pointer; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, filter .22s ease; }
.actual-info-card:hover { transform: translateY(-6px); border-color: var(--actual-color, #496c9b); box-shadow: 0 18px 38px rgba(15, 23, 42, .14); filter: saturate(1.04); }
.actual-info-card:active { transform: translateY(-2px) scale(.992); box-shadow: 0 10px 24px rgba(15, 23, 42, .12); }
.actual-info-card:focus-visible { outline: 3px solid color-mix(in srgb, var(--actual-color, #496c9b) 42%, white); outline-offset: 3px; }
.actual-info-card:hover .actual-info-card__icon { transform: scale(var(--actual-icon-scale, 1)) translateY(-3px); }
.actual-info-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-right: 19%; }
.actual-info-card__topic { color: var(--actual-color, #496c9b); background: rgba(255,255,255,.72); border-radius: 999px; padding: 5px 10px; font-size: 11px; line-height: 1.2; font-weight: 800; text-transform: uppercase; }
.actual-info-card__date { color: var(--actual-color, #496c9b); font-size: 12px; font-weight: 700; white-space: nowrap; }
.actual-info-card__title { position: relative; z-index: 1; width: 100%; max-width: 100%; margin: 28px 0 12px; color: #172033; font-size: 18px; line-height: 1.25; transition: max-width .18s ease; }
.actual-info-card__excerpt { position: relative; z-index: 1; width: 100%; max-width: 100%; max-height: 92px; margin-bottom: 52px; color: #475569; font-size: 12px; line-height: 1.6; overflow: clip; }
.actual-info-card__icon { float: right; position: relative; z-index: 0; width: 43%; height: calc(100% - 48px); margin: 0 -2px 0 12px; object-fit: contain; object-position: right bottom; shape-outside: polygon(0 31%, 100% 31%, 100% 100%, 0 100%); shape-margin: 10px; transform: scale(var(--actual-icon-scale, 1)); transition: transform .25s ease; }
.actual-info-card__more { position: absolute; z-index: 3; left: 22px; bottom: 22px; padding: 4px 12px 4px 0; border: 0; background: var(--actual-bg, #f8fafc); color: var(--actual-color, #496c9b); font: inherit; font-weight: 800; cursor: pointer; }
.actual-info-modal { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 20px; background: rgba(15,23,42,.52); }
.actual-info-modal__dialog { width: min(680px, 100%); max-height: 86vh; overflow: auto; padding: 28px; border-radius: 18px; background: #fff; box-shadow: 0 28px 70px rgba(15,23,42,.3); }
.actual-info-modal__title { font-size: 18px !important; }
.actual-info-modal__content, .actual-info-modal__content * { font-size: 12px !important; }
@media (max-width: 1050px) { .actual-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .actual-info-shell { padding: 10px 0; } .actual-info-grid { grid-template-columns: 1fr; } .actual-info-card { min-height: 300px; } .actual-info-card__icon { width: 40%; height: 55%; } }
