:root {
    --bg: #dae4f0;
    --panel: #f5f8fd;
    --panel-strong: #ffffff;
    --line: #bfd0e3;
    --line-strong: #6f8db7;
    --nav-a: #3d6098;
    --nav-b: #213d6d;
    --accent: #eed8a3;
    --accent-deep: #c89a41;
    --text: #24344e;
    --muted: #667891;
    --danger: #9b3d31;
    --shadow: 0 14px 34px rgba(22, 44, 84, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    font-family: "Segoe UI", "Apple SD Gothic Neo", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 25%),
        linear-gradient(180deg, #d6e0ee 0%, var(--bg) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
p {
    margin: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 14px 22px 12px;
    color: #f7fbff;
    background: linear-gradient(180deg, var(--nav-a) 0%, var(--nav-b) 100%);
    border-bottom: 1px solid #1a3358;
}

.eyebrow {
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.topbar h1 {
    font-size: 28px;
    font-weight: 800;
}

.topnav {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    align-items: center;
}

.topnav-link,
.primary-button,
.ghost-button,
.table-link,
.table-danger {
    transition: 0.15s ease;
    border-radius: 10px;
}

.topnav-link {
    padding: 8px 14px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.topnav-gear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 21px;
    line-height: 1;
    margin-left: auto;
}

.topnav-link.is-active {
    color: #6f4b07;
    background: linear-gradient(180deg, #fff8e8 0%, #ecd094 100%);
    border-color: #d7b66e;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.layout {
    padding: 14px;
}

.card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), var(--panel));
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.content {
    display: grid;
    gap: 14px;
}

.section-card {
    padding: 16px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
    margin-bottom: 14px;
}

.holiday-section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: start;
}

.holiday-section-head .calendar-nav {
    justify-self: end;
}

.centered-period-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: start;
}

.centered-period-head .calendar-nav {
    justify-self: end;
}

.section-head h2 {
    margin-bottom: 4px;
    font-size: 22px;
    color: #28476f;
}

.section-head p,
.meta,
.placeholder p {
    color: var(--muted);
}

.toolbar-row,
.filter-grid,
.editor-grid {
    display: grid;
    gap: 10px;
}

.toolbar-row {
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 120px 120px 120px;
    align-items: end;
    margin-bottom: 14px;
}

.toolbar-row-short {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 120px 120px;
}

.toolbar-spacer {
    min-height: 1px;
}

.filter-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 140px 140px;
    margin-bottom: 18px;
}

.editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.toolbar-field {
    min-width: 0;
}

.toolbar-row .inline-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-row .inline-field span {
    flex: 0 0 auto;
    min-width: 28px;
}

.toolbar-row .inline-field input {
    flex: 1 1 auto;
}

label {
    display: grid;
    gap: 6px;
    color: #36547d;
    font-weight: 700;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid #c7d3e3;
    border-radius: 12px;
}

textarea {
    resize: vertical;
}

.primary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    font-weight: 800;
    cursor: pointer;
}

.primary-button {
    color: #34527d;
    border: 1px solid #c4d3e8;
    background: linear-gradient(180deg, #fafcff 0%, #eef4fd 100%);
}

.ghost-button {
    color: #34527d;
    border: 1px solid #c4d3e8;
    background: linear-gradient(180deg, #fafcff 0%, #eef4fd 100%);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #cbd6e6;
    border-radius: 14px;
    background: var(--panel-strong);
}

table {
    width: 100%;
    min-width: 960px;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 8px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    border-right: 1px solid #e3ebf5;
    border-bottom: 1px solid #dbe5f0;
}

th:last-child,
td:last-child {
    border-right: none;
}

thead th {
    color: #486587;
    font-size: 12px;
    background: #f1f5fb;
}

tbody tr:nth-child(even) {
    background: rgba(236, 242, 250, 0.55);
}

.note-cell {
    max-width: 120px;
}

.ellipsis-text {
    display: inline-block;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.row-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.row-actions form {
    margin: 0;
}

.table-link,
.table-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 10px;
    font-weight: 700;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
}

.primary-button:hover,
.ghost-button:hover,
.table-link:hover,
.table-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(52, 82, 125, 0.14);
}

.primary-button:active,
.ghost-button:active,
.table-link:active,
.table-danger:active {
    transform: translateY(1px) scale(0.985);
    box-shadow: inset 0 2px 6px rgba(36, 52, 78, 0.12);
}

.table-link {
    color: #34527d;
    background: linear-gradient(180deg, #fafcff 0%, #eef4fd 100%);
    border-color: #c4d3e8;
}

.table-danger {
    color: #34527d;
    background: linear-gradient(180deg, #fafcff 0%, #eef4fd 100%);
    border-color: #c4d3e8;
}

.empty-row {
    color: var(--muted);
}

.schedule-empty-state {
    padding: 20px 14px;
    text-align: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px dashed #c7d6e7;
    border-radius: 14px;
}

.meta {
    margin-top: 10px;
}

.alert {
    margin-bottom: 12px;
    padding: 12px 14px;
    font-weight: 700;
    color: #93382e;
    background: #fff5f2;
    border: 1px solid #efc3bb;
    border-radius: 14px;
}

.full-span {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-start;
}

.schedule-form-actions {
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
}

.schedule-form-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.schedule-delete-button {
    min-height: 38px;
}

.modal {
    width: min(880px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    margin: auto;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), var(--panel));
    box-shadow: 0 28px 56px rgba(14, 31, 59, 0.28);
}

.modal .section-head {
    margin-bottom: 18px;
}

.modal::backdrop {
    background: rgba(20, 33, 56, 0.45);
    backdrop-filter: blur(2px);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
    margin-bottom: 14px;
}

.modal-head h2 {
    margin-bottom: 4px;
    font-size: 22px;
    color: #28476f;
}

.modal-head p {
    color: var(--muted);
}

.modal-close {
    min-width: 88px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.placeholder {
    min-height: 176px;
    display: grid;
    align-content: center;
    gap: 10px;
}

.schedule-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 14px;
}

.schedule-students,
.schedule-editor {
    min-height: 100%;
}

.settlement-students {
    position: sticky;
    top: 14px;
    align-self: start;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 28px);
    min-height: calc(100vh - 28px);
}

.settlement-students .section-head,
.settlement-students .schedule-student-tools {
    flex: 0 0 auto;
}

.schedule-student-list {
    display: grid;
    gap: 6px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}

.settlement-students .schedule-student-list {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
}

.schedule-student-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    align-items: stretch;
}

.schedule-student-links {
    display: flex;
    gap: 6px;
}

.schedule-student-links form {
    margin: 0;
}

.schedule-student-tools {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.schedule-student-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
}

.schedule-student-submit,
.schedule-student-reset {
    min-height: 34px;
    white-space: nowrap;
}

.schedule-student-meta {
    font-size: 11px;
    color: var(--muted);
}

.schedule-student-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #c9d6e7;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f3f7fc 100%);
}

.schedule-student-item strong {
    min-width: 0;
    flex: 1 1 auto;
    color: #2f4f7b;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-student-item span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.schedule-student-item.is-active {
    border-color: #d3b061;
    background: linear-gradient(180deg, #fff8eb 0%, #f1dfb6 100%);
    box-shadow: 0 10px 20px rgba(200, 154, 65, 0.16);
}

.schedule-student-manage-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border: 1px solid #c9d6e7;
    border-radius: 999px;
    background: #f7fbff;
    color: #486996;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    font-style: italic;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.schedule-form {
    display: grid;
    gap: 14px;
}

.schedule-selected-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 14px;
    color: #355277;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.schedule-selected-highlight {
    color: #6f4b07;
}

.schedule-slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.schedule-slot-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid #c9d6e7;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fd 100%);
}

.schedule-slot-card h3 {
    margin: 0;
    color: #32537f;
    font-size: 15px;
}

.calendar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.section-title-inline {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.section-title-inline h2 {
    margin: 0;
}

.schedule-scope-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-right: 4px;
    white-space: nowrap;
    color: #526983;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.schedule-scope-toggle input {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: #4d6e98;
    position: relative;
    top: -0.5px;
}

.holiday-month-label,
.period-label {
    justify-self: center;
    color: #28476f;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
}

.weekly-calendar {
    display: grid;
    gap: 10px;
}

.weekly-weekdays,
.weekly-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.55fr) repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.weekly-weekdays > div {
    display: grid;
    gap: 3px;
    padding: 4px 6px;
    color: #35547c;
    border: 1px solid #d9e3f0;
    border-radius: 14px;
    background: #f3f7fc;
}

.weekly-day-head {
    width: 100%;
    position: relative;
    display: grid;
    justify-items: center;
    align-items: center;
    min-height: 30px;
}

.weekly-day-label {
    display: grid;
    justify-items: center;
    gap: 1px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: translateY(5px);
}

.weekly-weekday-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.weekly-holiday-badge {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    border: 1px solid #e7d2b1;
    border-radius: 999px;
    background: #fff6e8;
    color: #5a4011;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    padding: 5px 8px;
}

.weekly-weekdays .weekly-holiday-badge,
.weekly-weekdays .is-sunday .weekly-holiday-badge,
.weekly-weekdays .is-saturday .weekly-holiday-badge,
.weekly-weekdays .is-official-holiday .weekly-holiday-badge {
    color: #5a4011;
}

.weekly-day-actions {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 1px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.weekly-attendance-button {
    border: 1px solid #d7e0eb;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #365783;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    padding: 4px 7px;
    cursor: pointer;
}

.weekly-attendance-button.is-present {
    color: #2e7d32;
}

.weekly-attendance-button.is-clear {
    color: #8a5a39;
}

.weekly-attendance-button:hover {
    background: #ffffff;
    border-color: #b8cade;
}

.weekly-weekdays strong {
    font-size: 13px;
}

.weekly-weekdays span {
    font-size: 10px;
    color: var(--muted);
}

.weekly-weekdays .is-sunday strong,
.weekly-weekdays .is-sunday span {
    color: #c44b45;
}

.weekly-weekdays .is-saturday strong,
.weekly-weekdays .is-saturday span {
    color: #3f6fc6;
}

.weekly-weekdays .is-official-holiday strong,
.weekly-weekdays .is-official-holiday span {
    color: #c44b45;
}

.weekly-weekdays .is-today {
    border: 2px solid #e29b3e;
    box-shadow: 0 0 0 2px rgba(226, 155, 62, 0.14);
    background: #f3f7fc;
}

.weekly-column {
    display: grid;
    align-content: start;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    position: relative;
    padding: 8px 8px 38px;
    min-height: 108px;
    border: 1px solid #ccd8e8;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fd 100%);
}

.weekly-column.is-drop-target,
.monthly-cell.is-drop-target,
.calendar-entry.is-drop-target {
    border-color: #7f9ec9;
    box-shadow: 0 0 0 2px rgba(90, 130, 201, 0.18);
    background: linear-gradient(180deg, #f2f7ff 0%, #dce8fb 100%);
}

.weekly-column.is-today {
    border: 2px solid #e29b3e;
    box-shadow: 0 0 0 2px rgba(226, 155, 62, 0.14);
}

.weekly-column.is-holiday,
.monthly-cell.is-holiday {
    background: linear-gradient(180deg, #fffdf8 0%, #fff4ea 100%);
}

.calendar-holiday-label {
    display: block;
    margin-top: 2px;
    font-size: 9px;
    font-style: normal;
    font-weight: 700;
    color: #8b6f49;
    text-align: center;
}

.calendar-holiday-label.is-official,
.calendar-holiday-banner.is-official {
    color: #c44b45;
}

.calendar-holiday-banner {
    margin-bottom: 4px;
    color: #8b6f49;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
}

.calendar-date-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-bottom: 6px;
}

.calendar-entry {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 4px 6px;
    text-align: left;
    border: 1px solid #d8c38e;
    border-radius: 12px;
    background: linear-gradient(180deg, #fffaf0 0%, #f3e2bc 100%);
    line-height: 1.05;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.calendar-entry[draggable="true"] {
    cursor: grab;
}

.calendar-entry.is-dragging {
    opacity: 0.55;
    cursor: grabbing;
}

.calendar-entry-time {
    color: #7a5b1e;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.calendar-entry-name {
    min-width: 0;
    flex: 1 1 auto;
    color: #5a4011;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attendance-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.attendance-dot.is-present {
    background: #31a453;
}

.attendance-dot.is-absent {
    background: #d4564a;
}

.calendar-entry.is-selected-student {
    border-color: #7a9fdc;
    background: linear-gradient(180deg, #eef5ff 0%, #cfe0fb 100%);
    box-shadow: 0 0 0 1px rgba(90, 130, 201, 0.18);
}

.calendar-entry.is-selected-student .calendar-entry-time {
    color: #345b9f;
}

.calendar-entry.is-selected-student .calendar-entry-name {
    color: #1f4278;
}

.calendar-entry.compact {
    gap: 3px;
    padding: 3px 5px;
}

.calendar-entry.compact .calendar-entry-name {
    font-size: 9px;
}

.calendar-entry.compact .calendar-entry-time {
    font-size: 8px;
}

.schedule-entry-modal {
    width: min(520px, calc(100vw - 32px));
}

.attendance-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.attendance-radio-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #cbd8e9;
    border-radius: 999px;
    background: #f7faff;
    cursor: pointer;
}

.attendance-radio-item input {
    display: none;
}

.attendance-radio-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #b8c5d6;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.attendance-radio-item em {
    font-style: normal;
    font-weight: 700;
    color: #48627f;
}

.attendance-radio-item.is-present .attendance-radio-dot {
    background: #31a453;
}

.attendance-radio-item.is-absent .attendance-radio-dot {
    background: #d4564a;
}

.attendance-radio-item.is-neutral .attendance-radio-dot {
    background: #9aa9bc;
}

.attendance-radio-item:has(input:checked) {
    border-color: #7f9ec9;
    background: #eaf2ff;
    box-shadow: 0 0 0 2px rgba(90, 130, 201, 0.14);
}

.calendar-empty {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 12px;
}

.calendar-create-button {
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    border: 1px dashed #bfd0e8;
    border-radius: 999px;
    background: #f7fbff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: start;
    cursor: pointer;
    color: #466795;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
}

.calendar-entry-list {
    display: grid;
    gap: 4px;
    grid-column: 1 / -1;
}

.monthly-calendar {
    display: grid;
    gap: 10px;
}

.monthly-weekdays,
.monthly-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.55fr) repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.monthly-weekdays div {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 6px 6px;
    text-align: center;
    color: #35547c;
    font-size: 14px;
    font-weight: 800;
    border: 1px solid #ccd8e8;
    border-radius: 14px;
    background: #edf3fb;
}

.monthly-weekdays .is-sunday {
    color: #c44b45 !important;
}

.monthly-weekdays .is-saturday {
    color: #3f6fc6 !important;
}

.monthly-weekdays .is-official-holiday {
    color: #c44b45 !important;
}

.monthly-cell.is-drop-target .monthly-date {
    color: #254a82;
}

.monthly-cell {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 94px;
    position: relative;
    padding: 6px 6px 38px;
    border: 1px solid #ccd8e8;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f6f9fd 100%);
}

.monthly-cell.is-muted {
    opacity: 0.55;
}

.monthly-cell.is-today {
    border: 2px solid #e29b3e;
    box-shadow: 0 0 0 2px rgba(226, 155, 62, 0.14);
}

.monthly-date {
    margin-bottom: 4px;
    color: #35547c;
    font-size: 11px;
    font-weight: 800;
}

.monthly-date.is-holiday,
.monthly-cell.is-official-holiday .monthly-date {
    color: #c44b45 !important;
}

.monthly-cell.is-sunday .monthly-date,
.monthly-date.is-sunday {
    color: #c44b45 !important;
}

.monthly-cell.is-saturday .monthly-date,
.monthly-date.is-saturday {
    color: #3f6fc6 !important;
}

.monthly-entries {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.holiday-form {
    display: grid;
    gap: 12px;
}

#holiday-management-panel {
    overflow-anchor: none;
}

.holiday-calendar .meta {
    margin-bottom: 0;
}

.holiday-cell {
    gap: 6px;
}

.holiday-cell-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 8px;
}

.holiday-date-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.holiday-details {
    display: flex;
    align-items: center;
    align-content: start;
    gap: 6px;
    flex-wrap: wrap;
}

.holiday-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    color: #526983;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.holiday-toggle input {
    margin: 0;
    width: 18px;
    height: 18px;
    accent-color: #4d6e98;
    position: relative;
    top: -0.5px;
}

.holiday-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.schedule-student-manage-link.is-closed {
    color: #255938;
    border-color: #7cc291;
    background: #eaf7ee;
}

.holiday-chip.is-custom {
    color: #7a5b1e;
    background: #f7ead1;
}

.holiday-date-delete-button {
    border: 1px solid #e3c9b1;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #8a5a39;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    padding: 3px 7px;
    cursor: pointer;
}

.holiday-date-delete-button:hover {
    background: #ffffff;
    border-color: #d2b18f;
}

.holiday-name {
    color: #6e5c44;
    font-size: 11px;
    line-height: 1.25;
}

.holiday-name.is-official {
    color: #c44b45;
}

.settlement-shell {
    align-items: start;
}

.settlement-content {
    min-width: 0;
}

.settlement-head {
    align-items: center;
}

.settlement-grid,
.settlement-metrics {
    display: grid;
    gap: 14px;
}

.settlement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
}

.settlement-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.settlement-metric-card {
    display: grid;
    gap: 6px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #d4dfec;
    border-radius: 16px;
}

.settlement-metric-card strong {
    font-size: 17px;
    color: #27486e;
}

.settlement-action-card {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.settlement-action-card form {
    display: flex;
    height: 100%;
    margin: 0;
}

.settlement-metric-label {
    color: #5c7390;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.settlement-metric-card.is-positive strong,
.settlement-balance-banner.is-positive {
    color: #2f6a43;
}

.settlement-metric-card.is-negative strong,
.settlement-balance-banner.is-negative {
    color: var(--danger);
}

.settlement-payment-form {
    margin-bottom: 12px;
}

.settlement-grid-card {
    display: flex;
    flex-direction: column;
}

.settlement-grid-card .section-head,
.settlement-grid-card .settlement-payment-form,
.settlement-grid-card .settlement-submeta {
    flex: 0 0 auto;
}

.settlement-table-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}

.settlement-table-wrap table {
    min-width: 0;
    table-layout: fixed;
}

.settlement-table-wrap th,
.settlement-table-wrap td {
    white-space: normal;
    word-break: keep-all;
}

.settlement-current-table th:nth-child(1),
.settlement-current-table td:nth-child(1) {
    width: 14%;
}

.settlement-current-table th:nth-child(2),
.settlement-current-table td:nth-child(2) {
    width: 34%;
}

.settlement-current-table th:nth-child(3),
.settlement-current-table td:nth-child(3) {
    width: 16%;
}

.settlement-current-table th:nth-child(4),
.settlement-current-table td:nth-child(4) {
    width: 16%;
}

.settlement-current-table th:nth-child(5),
.settlement-current-table td:nth-child(5) {
    width: 20%;
}

.settlement-next-table th:nth-child(1),
.settlement-next-table td:nth-child(1) {
    width: 16%;
}

.settlement-next-table th:nth-child(2),
.settlement-next-table td:nth-child(2) {
    width: 42%;
}

.settlement-next-table th:nth-child(3),
.settlement-next-table td:nth-child(3) {
    width: 20%;
}

.settlement-next-table th:nth-child(4),
.settlement-next-table td:nth-child(4) {
    width: 22%;
}

.settlement-submeta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-weight: 400;
}

.settlement-balance-banner {
    margin-bottom: 12px;
    padding: 11px 14px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid #d4dfec;
    border-radius: 14px;
    font-weight: 800;
}

.settlement-toggle-button {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    min-height: 100%;
    min-width: 110px;
    padding: 18px 16px 44px;
    text-align: center;
}

.settlement-toggle-button strong {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.1;
}

.settlement-toggle-button p {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 14px;
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--muted);
    font-weight: 400;
}

.settlement-toggle-button.is-closed {
    color: #255938;
    border-color: #7cc291;
    background: #eaf7ee;
}

.settlement-toggle-button.is-closed p {
    color: #4c745b;
}

.table-wrap.is-disabled {
    opacity: 0.72;
}

.settlement-locked-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(1px);
}

.settlement-locked-overlay::before {
    content: "이번달 정산이 완료되어 입력이 잠겨 있습니다.";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    text-align: center;
    color: #6f5a1a;
    background: #fff1a8;
    border: 1px solid #e7cf63;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(145, 122, 32, 0.16);
    font-size: 14px;
    font-weight: 800;
}

.settlement-payment-form input:disabled,
.settlement-payment-form button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.settlement-actions-row {
    align-items: center;
    justify-content: space-between;
}

.settlement-actions-row .primary-button {
    margin-left: auto;
}

.settlement-action-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.settlement-inline-status {
    font-weight: 400;
    color: #5c7390;
}

.settlement-inline-status.is-positive {
    color: #2f6a43;
}

.settlement-inline-status.is-negative {
    color: var(--danger);
}

.kakao-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 16px;
    color: #231f20;
    font-weight: 900;
    border: 1px solid #e0c200;
    border-radius: 12px;
    background: linear-gradient(180deg, #fee500 0%, #f7da00 100%);
    box-shadow: 0 8px 16px rgba(191, 159, 0, 0.22);
    cursor: pointer;
    transition: 0.15s ease;
}

.kakao-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(191, 159, 0, 0.28);
}

.kakao-button:active {
    transform: translateY(1px) scale(0.985);
    box-shadow: inset 0 2px 6px rgba(80, 68, 0, 0.15);
}

@media (max-width: 1100px) {
    .toolbar-row,
    .filter-grid,
    .editor-grid {
        grid-template-columns: 1fr;
    }

    .toolbar-row .inline-field {
        display: grid;
        gap: 8px;
    }

    .schedule-shell,
    .settlement-grid,
    .settlement-metrics,
    .weekly-weekdays,
    .weekly-grid,
    .monthly-weekdays,
    .monthly-grid {
        grid-template-columns: 1fr;
    }

    .weekly-column,
    .monthly-cell {
        min-height: 0;
    }

    .settlement-students {
        position: static;
        display: block;
        height: auto;
        min-height: 0;
    }

    .settlement-students .schedule-student-list {
        flex: none;
        height: auto;
        max-height: 360px;
    }

    .modal {
        width: calc(100vw - 20px);
        padding: 18px;
    }

    .modal-head,
    .modal-actions {
        flex-direction: column;
    }

    .holiday-section-head,
    .centered-period-head {
        grid-template-columns: 1fr;
    }

    .holiday-section-head .calendar-nav,
    .centered-period-head .calendar-nav,
    .holiday-month-label,
    .period-label {
        justify-self: start;
    }
}
