:root {
    --bg: #eef1f5;
    --surface: #ffffff;
    --line: #cfd6df;
    --line-dark: #aeb8c4;
    --text: #1f2933;
    --muted: #667085;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #15803d;
    --header: #f8fafc;
    --shadow: 0 12px 30px rgba(31, 41, 51, 0.12);
    --control-panel-height: 230px;
    font-family: "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-header {
    height: 58px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 18px;
    background: #263241;
    color: #fff;
    border-bottom: 1px solid #17202b;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 210px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: #3b82f6;
    font-weight: 700;
}

.brand-block small {
    display: block;
    color: #cbd5e1;
    margin-top: 2px;
    font-size: 12px;
}

.top-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
}

.top-tabs a,
.ghost-link {
    padding: 9px 12px;
    border-radius: 5px;
    color: #e5e7eb;
    white-space: nowrap;
}

.header-button {
    border: 0;
    background: transparent;
}

.top-tabs a.active,
.top-tabs a:hover,
.ghost-link:hover {
    background: rgba(255, 255, 255, 0.12);
}

.workspace-shell {
    height: calc(100vh - 58px);
    display: grid;
    grid-template-rows: 44px 68px minmax(0, 1fr) 8px var(--control-panel-height);
    overflow: hidden;
}

.module-tabs,
.command-bar,
.control-panel {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.module-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 0;
    background: #ffffff;
}

.module-tabs button {
    height: 36px;
    border: 0;
    background: transparent;
    padding: 0 14px;
    border-radius: 7px 7px 0 0;
    color: #334155;
}

.module-tabs button:hover {
    background: #e8edf3;
}

.module-tabs button.active {
    background: #eef4ff;
    color: #1d4ed8;
    font-weight: 700;
    box-shadow: inset 0 -2px 0 #2563eb;
}

.command-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    overflow-x: auto;
    background: #f8fafc;
}

.command-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100%;
}

.command-panel[hidden] {
    display: none;
}

.command-field {
    min-width: 150px;
    display: grid;
    align-content: center;
    gap: 4px;
    font-size: 12px;
}

.tool-button,
.primary-button,
.danger-button,
.command-bar select,
.command-bar input,
.inline-form input,
.inline-form select,
.stack-form input,
.form-grid input,
.form-grid select {
    height: 34px;
    border: 1px solid var(--line-dark);
    border-radius: 5px;
    background: #fff;
    padding: 0 10px;
    color: var(--text);
}

.tool-button,
.primary-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tool-button.primary,
.primary-button {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.command-button {
    min-height: 38px;
    border: 1px solid #c4d0df;
    border-radius: 6px;
    background: #fff;
    color: #111827;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
}

.command-button:hover {
    background: #eef4ff;
    border-color: #8fb4ff;
}

.command-button.primary {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
    font-weight: 700;
}

.command-button.danger-lite {
    border-color: #fecaca;
    background: #fff1f2;
    color: #991b1b;
}

.command-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    border-radius: 4px;
    background: #93c5fd;
}

.command-icon.undo,
.command-icon.redo { border-radius: 50%; background: #cbd5e1; }
.command-icon.auto { background: #f59e0b; }
.command-icon.verify { background: #22c55e; }
.command-icon.reset { background: #ef4444; }
.command-icon.school { background: #64748b; }
.command-icon.lesson,
.command-icon.subject { background: #60a5fa; }
.command-icon.teacher { background: #111827; }
.command-icon.class,
.command-icon.users { background: #fb7185; }
.command-icon.room { background: #a78bfa; }
.command-icon.clock { background: #14b8a6; }
.command-icon.export,
.command-icon.backup,
.command-icon.save { background: #3b82f6; }
.command-icon.chart { background: #84cc16; }
.command-icon.help,
.command-icon.map { background: #f97316; }
.command-icon.calendar { background: #0f766e; }
.command-icon.relation {
    background:
        radial-gradient(circle at 20% 20%, #4aa3ff 0 2px, transparent 3px),
        radial-gradient(circle at 72% 20%, #f47d7d 0 2px, transparent 3px),
        radial-gradient(circle at 48% 48%, #55c776 0 2px, transparent 3px),
        radial-gradient(circle at 22% 76%, #8b7cf6 0 2px, transparent 3px),
        radial-gradient(circle at 78% 76%, #f6c453 0 2px, transparent 3px),
        #eef2f7;
}

.tool-button.primary:hover,
.primary-button:hover {
    background: var(--primary-dark);
}

.danger-button {
    border-color: #fecaca;
    background: #fff1f2;
    color: #b91c1c;
}

.compact {
    height: 30px;
    padding: 0 10px;
}

.toggle-filter,
.check-line {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.toggle-filter input,
.check-line input {
    width: 16px;
    height: 16px;
}

.grid-stage {
    min-height: 0;
    overflow: auto;
    background: #e4e9ef;
    display: flex;
}

.schedule-grid {
    display: grid;
    min-width: 1000px;
    width: max-content;
    --period-width: 98px;
    --row-height: 68px;
    grid-auto-rows: var(--row-height);
}

.view-rail {
    position: sticky;
    left: 0;
    z-index: 16;
    flex: 0 0 18px;
    background: #d9e2ec;
    border-right: 1px solid #b8c4d2;
    display: flex;
    flex-direction: column;
    align-self: stretch;
}

.view-rail button {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    height: 76px;
    width: 18px;
    border: 0;
    border-bottom: 1px solid #1f2937;
    background: #eef2f7;
    color: #111;
    padding: 3px 0;
    font-size: 12px;
}

.view-rail button.active {
    background: #ffffff;
    color: #1d4ed8;
    font-weight: 700;
}

.grid-corner,
.day-header,
.period-header,
.row-header,
.grid-cell {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.grid-corner,
.day-header,
.period-header {
    position: sticky;
    top: 0;
    z-index: 6;
    background: var(--header);
}

.grid-corner {
    left: 0;
    z-index: 9;
    display: grid;
    place-items: center;
    min-width: 176px;
    font-weight: 700;
    border-left: 1px solid var(--line);
}

.day-header {
    height: 34px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
    border-top: 1px solid var(--line);
}

.period-header {
    top: 34px;
    height: 42px;
    display: grid;
    place-items: center;
    text-align: center;
    font-size: 12px;
    color: #475569;
}

.row-header {
    position: sticky;
    left: 0;
    z-index: 4;
    min-width: 176px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px;
    font-weight: 700;
}

.row-header.highlight,
.grid-cell.highlight {
    background: #fff7ed;
}

.row-color,
.swatch {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    flex: 0 0 auto;
}

.swatch {
    display: inline-block;
    margin-right: 7px;
    vertical-align: -2px;
}

.grid-cell {
    width: var(--period-width);
    min-height: var(--row-height);
    background: #fff;
    padding: 4px;
    position: relative;
}

.grid-cell.drop-target {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background: #eff6ff;
}

.lesson-card {
    width: 100%;
    min-height: 36px;
    display: grid;
    align-content: center;
    gap: 2px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: #17202b;
    padding: 5px 6px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
    user-select: none;
}

.lesson-card + .lesson-card {
    margin-top: 4px;
}

.lesson-card strong,
.lesson-card span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lesson-card strong {
    font-size: 13px;
    line-height: 1;
}

.lesson-card span {
    font-size: 11px;
    line-height: 1;
}

.lesson-card.locked {
    border-style: dashed;
}

.lesson-card.conflict {
    border: 2px solid var(--danger);
}

.lesson-card.half {
    width: calc(50% - 2px);
    display: inline-grid;
}

.panel-resizer {
    height: 8px;
    cursor: row-resize;
    background: linear-gradient(#d7dde5, #c5ced9);
    border-top: 1px solid #b8c4d2;
    border-bottom: 1px solid #aeb8c4;
    position: relative;
}

.panel-resizer::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 2px;
    width: 54px;
    height: 3px;
    border-top: 1px solid #7b8794;
    border-bottom: 1px solid #7b8794;
    transform: translateX(-50%);
}

.control-panel {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 270px;
    gap: 0;
    min-height: 0;
    background: #fff;
    border-top: 1px solid var(--line-dark);
}

.detail-pane,
.unplaced-pane,
.preview-pane {
    min-width: 0;
    padding: 12px;
    border-right: 1px solid var(--line);
    overflow: auto;
}

.detail-pane h2,
.unplaced-pane h2,
.preview-pane h2,
.data-section h2 {
    margin: 0 0 10px;
    font-size: 15px;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.segmented {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 5px;
    overflow: hidden;
}

.segmented button {
    height: 28px;
    border: 0;
    background: #fff;
    padding: 0 9px;
}

.segmented button.active {
    background: #e8edf3;
    font-weight: 600;
}

.unplaced-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(46px, 58px));
    gap: 3px;
}

.unplaced-list.drop-target {
    outline: 2px solid #1d4ed8;
    background: #e8eef8;
}

.mini-grid {
    display: grid;
    gap: 4px;
    font-size: 12px;
}

.mini-slot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid #e5e7eb;
    padding: 4px 0;
}

.context-menu {
    position: fixed;
    z-index: 30;
    min-width: 170px;
    padding: 5px;
    border: 1px solid var(--line-dark);
    background: #fff;
    box-shadow: var(--shadow);
    border-radius: 6px;
}

.context-menu button {
    width: 100%;
    height: 30px;
    text-align: left;
    border: 0;
    border-radius: 4px;
    background: transparent;
    padding: 0 9px;
}

.context-menu button:hover {
    background: #eef2f7;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 40;
    padding: 11px 14px;
    border-radius: 6px;
    color: #fff;
    background: #1f2937;
    box-shadow: var(--shadow);
}

.toast.error {
    background: var(--danger);
}

.toast.success {
    background: var(--success);
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.24);
    display: grid;
    place-items: center;
}

.app-modal[hidden] {
    display: none;
}

.modal-window {
    background: #fff;
    border: 1px solid #8a8f99;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.relation-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    display: grid;
    grid-template-rows: 28px minmax(0, 1fr);
}

.modal-titlebar {
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #475f66;
    color: #fff;
    padding: 0 9px;
    font-size: 13px;
}

.modal-titlebar button {
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 22px;
    line-height: 1;
}

.schedules-window {
    width: min(860px, calc(100vw - 36px));
    min-height: 430px;
    display: grid;
    grid-template-rows: 28px minmax(0, 1fr);
}

.schedules-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    min-height: 0;
}

.schedules-list-pane {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    background: #f8fafc;
    border-right: 1px solid var(--line);
    min-width: 0;
}

.schedules-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid #dbe3ec;
}

.schedules-head h2 {
    margin: 0;
    font-size: 22px;
}

.schedules-head p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.schedule-list {
    padding: 12px;
    overflow: auto;
}

.schedule-row {
    width: 100%;
    min-height: 58px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border: 1px solid #d8e0ea;
    background: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: left;
    color: var(--text);
    margin-bottom: 8px;
}

.schedule-row:hover,
.schedule-row.active {
    border-color: #60a5fa;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}

.schedule-row.active {
    background: #eff6ff;
}

.schedule-row strong,
.schedule-row span {
    display: block;
}

.schedule-row span {
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}

.schedule-row .schedule-pill {
    display: inline-block;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 4px 8px;
    font-size: 12px;
    margin-top: 0;
    white-space: nowrap;
}

.schedule-create-pane {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 18px;
    background: #fff;
}

.schedule-form {
    display: grid;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.schedule-form label {
    display: grid;
    gap: 6px;
    color: #334155;
}

.schedule-form input[type="text"] {
    height: 36px;
    border: 1px solid #b8c4d3;
    border-radius: 6px;
    padding: 0 10px;
}

.schedule-choice-group {
    display: grid;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    padding: 10px;
}

.schedule-choice-group label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.relations-layout {
    min-height: 0;
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
}

.relations-list-pane {
    border-right: 1px solid #c4c9d0;
    background: #f7f7f7;
    display: grid;
    grid-template-rows: 82px 42px minmax(0, 1fr);
    min-width: 0;
}

.relation-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #d6d8dc;
}

.relation-head h2 {
    margin: 0;
    font-size: 22px;
}

.relation-actions {
    display: flex;
    gap: 18px;
    align-items: center;
    padding: 4px 14px;
    border-bottom: 1px solid #d6d8dc;
}

.circle-action {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    line-height: 1;
}

.circle-action.add { background: #4bc45f; }
.circle-action.edit { background: #f3cf62; color: #334155; }
.circle-action.delete { background: #f08080; }

.relations-table {
    font-size: 12px;
}

.relations-table tr {
    cursor: pointer;
}

.relations-table tr.selected-row,
.relations-table tr:hover {
    background: #e7f6c2;
}

.relation-warning {
    color: #dc2626;
    font-weight: 700;
    padding-right: 7px;
}

.relation-editor {
    min-height: 0;
    display: grid;
    grid-template-columns: 260px 260px minmax(360px, 1fr);
    grid-template-rows: minmax(0, 1fr) 46px;
    gap: 10px;
    padding: 16px 14px 0;
    overflow: visible;
}

.relation-step {
    display: grid;
    align-content: start;
    gap: 10px;
    border-right: 1px dashed #d6d8dc;
    padding-right: 10px;
}

.relation-step.wide {
    border-right: 0;
}

.relation-step h3 {
    margin: 0;
    font-size: 28px;
    font-weight: 400;
}

.relation-step label {
    display: grid;
    gap: 6px;
}

.relation-step select,
.relation-step input:not([type="checkbox"]) {
    min-height: 28px;
    border: 1px solid #c4c9d0;
    padding: 3px 6px;
}

.flat-button {
    min-height: 30px;
    border: 1px solid #d2d6dc;
    background: #f6f7f9;
    padding: 4px 10px;
}

.relation-options {
    display: grid;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px dashed #d6d8dc;
    border-bottom: 1px dashed #d6d8dc;
}

.relation-options label {
    display: block;
}

.number-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.relation-time-map {
    display: grid;
    gap: 3px;
    padding: 6px;
    background: #d4ffff;
    max-width: 360px;
}

.time-map-row {
    display: grid;
    grid-template-columns: 72px repeat(12, 18px);
    gap: 2px;
    align-items: center;
}

.time-map-row strong {
    font-size: 10px;
}

.time-map-cell {
    width: 18px;
    height: 13px;
    border: 1px solid #aeb2b8;
    background: #fff;
    display: block;
}

.time-map-cell input {
    position: absolute;
    opacity: 0;
}

.time-map-cell span {
    display: block;
    width: 100%;
    height: 100%;
}

.time-map-cell input:checked + span {
    background: #0b36ff;
}

.modal-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 8px;
    align-items: center;
    border-top: 1px solid #d6d8dc;
    padding: 8px 0;
}

.confirm-button {
    min-height: 30px;
    border: 1px solid #40a34c;
    background: #47b54f;
    color: #fff;
    padding: 4px 14px;
}

.entity-window {
    width: min(1040px, calc(100vw - 56px));
    height: min(680px, calc(100vh - 56px));
    display: grid;
    grid-template-rows: 34px minmax(0, 1fr);
    border-radius: 8px;
    overflow: hidden;
}

.entity-layout {
    min-height: 0;
    display: grid;
    grid-template-columns: 176px minmax(0, 1fr);
    background: #f8fafc;
}

.entity-nav {
    padding: 12px;
    border-right: 1px solid #d8e0ea;
    background: #eef3f8;
    display: grid;
    align-content: start;
    gap: 8px;
}

.entity-nav button {
    min-height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    text-align: left;
}

.entity-nav button.active,
.entity-nav button:hover {
    border-color: #60a5fa;
    background: #eff6ff;
    color: #1d4ed8;
}

.entity-main {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: 54px minmax(0, 1fr) 48px;
    background: #fff;
}

.entity-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #d8e0ea;
}

.entity-toolbar input {
    width: min(320px, 35vw);
    height: 32px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    padding: 0 10px;
}

.entity-table-wrap {
    min-height: 0;
    overflow: auto;
}

.entity-table {
    font-size: 13px;
}

.entity-table tr {
    cursor: pointer;
}

.entity-table tbody tr:hover,
.entity-table tbody tr.selected-row {
    background: #e7f0ff;
}

.timeoff-preview {
    width: max-content;
    min-width: 64px;
    min-height: 32px;
    display: inline-grid;
    gap: 1px;
    border: 1px solid #0f172a;
    border-radius: 2px;
    background: #111827;
    padding: 2px;
    vertical-align: middle;
}

.timeoff-preview:hover {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.timeoff-preview-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 5px;
    gap: 1px;
}

.timeoff-preview span span {
    width: 5px;
    height: 5px;
    border: 1px solid rgba(0, 0, 0, 0.24);
}

.timeoff-preview .available {
    background: #39ff14;
}

.timeoff-preview .blocked {
    background: #ff1f1f;
}

.timeoff-preview .empty {
    background: #4b5563;
}

.entity-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-top: 1px solid #d8e0ea;
    padding: 8px 12px;
}

.entity-edit-window {
    width: min(560px, calc(100vw - 56px));
    display: grid;
    grid-template-rows: 34px auto 48px;
    border-radius: 8px;
    overflow: hidden;
}

.entity-form-fields {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.entity-form-fields label {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.entity-form-fields input,
.entity-form-fields select {
    min-height: 32px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    padding: 0 8px;
}

.entity-form-fields input[type="color"] {
    width: 62px;
    padding: 2px;
}

.entity-check {
    grid-template-columns: 160px auto !important;
}

.entity-form-actions {
    padding: 8px 12px;
}

.timeoff-window {
    width: min(980px, calc(100vw - 56px));
    display: grid;
    grid-template-rows: 34px auto;
    border-radius: 8px;
    overflow: hidden;
}

.timeoff-editor-body {
    padding: 18px;
    background: #fff;
}

.modal-timeoff-table {
    min-width: min(820px, calc(100vw - 110px));
}

.timeoff-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.login-shell,
.install-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #e8edf3;
}

.login-panel,
.install-panel {
    width: min(760px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.login-panel {
    width: min(430px, 100%);
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
}

h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.muted {
    color: var(--muted);
}

.alert {
    padding: 11px 12px;
    border-radius: 6px;
    margin: 14px 0;
}

.alert.success {
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
}

.alert.danger {
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fecaca;
}

.stack-form,
.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stack-form label,
.form-grid label {
    display: grid;
    gap: 6px;
    font-weight: 600;
}

.form-grid .check-line,
.form-grid button {
    grid-column: 1 / -1;
}

.content-page {
    padding: 22px;
    max-width: 1280px;
    margin: 0 auto;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.data-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.data-tabs a {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 8px 10px;
}

.data-section {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
}

.original-page {
    max-width: none;
}

.original-list tr.selected-row {
    background: #e4f4bf;
}

.tool-link {
    color: #1d4ed8;
    text-decoration: underline;
}

.availability-bar {
    font-family: Consolas, monospace;
    color: #00b050;
    background: #111;
    font-size: 10px;
    letter-spacing: 0;
    padding: 1px 2px;
}

.timeoff-wrap {
    overflow: auto;
    border: 1px solid #8a8f99;
}

.timeoff-table {
    width: max-content;
    min-width: 720px;
}

.timeoff-table th,
.timeoff-table td {
    border: 1px solid #8a8f99;
    padding: 0;
    height: 24px;
    min-width: 42px;
    text-align: center;
    background: #d0d0d3;
    color: #111;
}

.timeoff-table th {
    background: #c0c0c4;
    font-size: 11px;
    text-transform: none;
}

.timeoff-table td.available {
    background: #42f05a;
}

.timeoff-table td.blocked {
    background: #c7c7ca;
}

.timeoff-table label {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

.timeoff-table input {
    position: absolute;
    opacity: 0;
}

.timeoff-table span {
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.calendar-form {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.calendar-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.period-time-editor {
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
}

.period-time-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #d8e0ea;
    background: #fff;
}

.period-time-wrap {
    overflow: auto;
}

.period-time-table {
    min-width: 1120px;
    width: max-content;
}

.period-time-table th,
.period-time-table td {
    border: 1px solid #d8e0ea;
    padding: 7px;
    vertical-align: top;
}

.period-time-table thead th {
    text-align: center;
    background: #eef4ff;
    color: #1e3a8a;
}

.period-time-table tbody th {
    min-width: 120px;
    background: #fff;
    color: #0f172a;
    text-transform: none;
    font-size: 13px;
}

.period-time-table td {
    min-width: 82px;
    background: #fff;
}

.period-time-table label {
    display: grid;
    gap: 3px;
    font-size: 11px;
    color: var(--muted);
}

.period-time-table label + label {
    margin-top: 6px;
}

.period-time-table input[type="time"] {
    width: 100%;
    min-width: 68px;
    height: 28px;
    border: 1px solid #b8c4d3;
    border-radius: 5px;
    padding: 0 4px;
    color: var(--text);
}

.lesson-form select {
    min-width: 150px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    border-bottom: 1px solid #e5e7eb;
    padding: 8px;
    text-align: left;
}

th {
    background: #f8fafc;
    font-size: 12px;
    text-transform: uppercase;
    color: #475569;
}

.report-band {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.report-band div {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.report-band strong {
    display: block;
    font-size: 28px;
}

.report-band span {
    color: var(--muted);
}

@media (max-width: 820px) {
    .app-header {
        height: auto;
        min-height: 30px;
        flex-wrap: wrap;
        padding: 10px;
    }

    .workspace-shell {
        height: auto;
        min-height: calc(100vh - 30px);
        grid-template-rows: auto auto 62vh auto;
    }

    .command-bar,
    .module-tabs {
        flex-wrap: wrap;
    }

    .control-panel {
        grid-template-columns: 1fr;
    }

    .schedules-body {
        grid-template-columns: 1fr;
    }

    .schedules-list-pane {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .form-grid,
    .report-band {
        grid-template-columns: 1fr;
    }
}

@media print {
    .app-header,
    .module-tabs,
    .command-bar,
    .control-panel,
    .data-tabs,
    button {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .workspace-shell {
        display: block;
        height: auto;
    }

    .grid-stage {
        overflow: visible;
    }
}
