:root {
  --canvas: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #172431;
  --muted: #6a7784;
  --subtle: #8e9aa5;
  --line: #dfe5ea;
  --line-strong: #c9d2da;
  --navy: #162c3f;
  --navy-soft: #213d53;
  --teal: #157c78;
  --teal-soft: #e5f3f1;
  --coral: #bd5a50;
  --coral-soft: #faeae7;
  --amber: #a97022;
  --amber-soft: #fff3dc;
  --blue: #3d6f9d;
  --blue-soft: #eaf1f8;
  --green: #43815f;
  --green-soft: #e9f5ec;
  --shadow: 0 10px 28px rgba(22, 44, 63, 0.055);
  --radius: 7px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font: 14px/1.5 "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(21, 124, 120, 0.22);
  outline-offset: 1px;
}

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

.sidebar {
  position: fixed;
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: 248px;
  min-height: 100vh;
  padding: 24px 16px 18px;
  color: #d6e0e6;
  background: var(--navy);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 10px 30px;
}

.brand-mark {
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #ffffff;
  background: var(--teal);
  border-radius: 9px;
  font-size: 17px;
  font-weight: 700;
}

.brand-name {
  color: #ffffff;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
}

.brand-caption {
  margin-top: 1px;
  color: #8fa7b6;
  font-size: 11px;
}

.main-nav {
  display: grid;
  gap: 4px;
}

.nav-item,
.sidebar-link,
.backup-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 6px;
  color: #a9bbc6;
  background: transparent;
  text-align: left;
  transition: color 160ms ease, background 160ms ease;
}

.nav-item:hover,
.sidebar-link:hover,
.backup-link:hover {
  color: #ffffff;
  background: var(--navy-soft);
}

.nav-item.active {
  color: #ffffff;
  background: #255064;
  box-shadow: inset 3px 0 0 #5cc0b7;
}

.nav-icon {
  display: inline-grid;
  flex: 0 0 20px;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #8bc4c0;
  font-size: 13px;
  font-weight: 700;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  color: #ffffff;
}

.sidebar-bottom {
  display: grid;
  gap: 5px;
  margin-top: auto;
}

.local-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px 14px;
  color: #8fa7b6;
  font-size: 11px;
}

.status-dot,
.class-chip-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5fc0a7;
  box-shadow: 0 0 0 3px rgba(95, 192, 167, 0.14);
}

.sidebar-link {
  color: #a9bbc6;
}

.backup-link {
  color: #8fc5c0;
  font-size: 12px;
}

.main-content {
  width: calc(100% - 248px);
  min-width: 0;
  margin-left: 248px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  min-height: 116px;
  padding: 28px 42px 23px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.date-line {
  margin-bottom: 3px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 650;
}

.page-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.class-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.class-chip-dot {
  background: var(--teal);
  box-shadow: none;
}

.workspace {
  max-width: 1460px;
  padding: 32px 42px 48px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 650;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button-primary {
  color: #ffffff;
  background: var(--teal);
}

.button-primary:hover {
  background: #126d69;
}

.button-secondary {
  color: var(--navy);
  border-color: var(--line-strong);
  background: var(--surface);
}

.button-secondary:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.button-ghost {
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}

.button-ghost:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.button-danger {
  color: var(--coral);
  border-color: #efc8c3;
  background: var(--coral-soft);
}

.button-small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.button-symbol {
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
}

.page-toolbar,
.panel-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.page-toolbar {
  margin-bottom: 22px;
}

.page-toolbar h2,
.section-heading h2,
.panel-heading h3 {
  margin: 0;
  color: var(--ink);
}

.page-toolbar h2 {
  font-size: 18px;
}

.section-heading h2 {
  font-size: 16px;
}

.panel-heading h3 {
  font-size: 15px;
}

.heading-note,
.panel-note {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.toolbar-actions,
.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.layout-controls {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.layout-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.layout-controls input {
  width: 58px;
  min-width: 58px;
  min-height: 30px;
  padding: 4px 7px;
}

.search-box {
  position: relative;
  min-width: 220px;
}

.search-box input {
  width: 100%;
  padding-left: 33px;
}

.search-mark {
  position: absolute;
  top: 9px;
  left: 12px;
  color: var(--subtle);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface);
}

input::placeholder,
textarea::placeholder {
  color: #a1adb6;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input[type="date"] {
  min-width: 142px;
}

input[type="number"] {
  min-width: 84px;
}

select {
  cursor: pointer;
}

.dashboard-grid {
  display: grid;
  gap: 20px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  min-height: 112px;
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 12px;
}

.kpi-value {
  color: var(--ink);
  font-size: 28px;
  font-weight: 720;
  line-height: 1;
}

.kpi-unit {
  color: var(--muted);
  font-size: 12px;
}

.kpi-meta {
  margin-top: 9px;
  color: var(--subtle);
  font-size: 11px;
}

.kpi-card.alert .kpi-value {
  color: var(--coral);
}

.kpi-card.teal .kpi-value {
  color: var(--teal);
}

.kpi-card.amber .kpi-value {
  color: var(--amber);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 20px;
}

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

.stack {
  display: grid;
  gap: 20px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  min-height: 60px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-body {
  padding: 17px 18px;
}

.panel-body.flush {
  padding: 0;
}

.panel-heading .button {
  flex: 0 0 auto;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface-soft);
  text-align: left;
}

.quick-action:hover {
  border-color: #9fcfc9;
  color: var(--teal);
  background: var(--teal-soft);
}

.quick-action-mark {
  display: grid;
  flex: 0 0 24px;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--teal);
  border-radius: 4px;
  background: #d4ebe8;
  font-weight: 700;
}

.metric-list,
.activity-list,
.task-list {
  display: grid;
  gap: 9px;
}

.metric-line,
.task-line,
.activity-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-label,
.task-title,
.activity-main {
  min-width: 0;
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.metric-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.metric-mark.late {
  background: var(--amber);
}

.metric-mark.leave {
  background: var(--blue);
}

.metric-mark.absent {
  background: var(--coral);
}

.metric-count {
  color: var(--ink);
  font-weight: 700;
}

.mini-progress {
  height: 6px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 4px;
  background: #edf1f3;
}

.mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.task-line {
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid #edf0f2;
}

.task-line:last-child {
  border-bottom: 0;
}

.task-title {
  color: var(--ink);
  font-weight: 600;
}

.task-date,
.activity-date {
  color: var(--subtle);
  font-size: 11px;
  white-space: nowrap;
}

.task-date.overdue {
  color: var(--coral);
  font-weight: 650;
}

.activity-line {
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid #edf0f2;
}

.activity-line:last-child {
  border-bottom: 0;
}

.activity-main {
  display: flex;
  gap: 9px;
}

.activity-bullet {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--teal);
}

.activity-bullet.coral {
  background: var(--coral);
}

.activity-bullet.amber {
  background: var(--amber);
}

.activity-text strong {
  font-weight: 650;
}

.activity-text p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 135px;
  padding: 18px;
  color: var(--subtle);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.empty-state p {
  margin: 0;
  font-size: 12px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #edf0f2;
  color: var(--ink);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

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

.data-table .muted-cell {
  color: var(--muted);
}

.data-table .actions-cell {
  width: 150px;
  text-align: right;
  white-space: nowrap;
}

.action-link {
  padding: 3px 5px;
  border: 0;
  color: var(--teal);
  background: transparent;
  font-size: 12px;
}

.action-link:hover {
  text-decoration: underline;
}

.action-link.danger {
  color: var(--coral);
}

.name-cell {
  font-weight: 650;
}

.name-cell small {
  display: block;
  margin-top: 1px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 400;
}

.tag,
.status-badge,
.priority-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.tag {
  color: var(--teal);
  background: var(--teal-soft);
}

.status-badge.present,
.status-badge.done,
.status-badge.praise {
  color: var(--green);
  background: var(--green-soft);
}

.status-badge.late,
.priority-badge.high {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-badge.leave,
.status-badge.info,
.priority-badge.normal {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-badge.absent,
.status-badge.criticism {
  color: var(--coral);
  background: var(--coral-soft);
}

.status-badge.open,
.priority-badge.low {
  color: var(--muted);
  background: #eef1f3;
}

.status-select {
  min-width: 100px;
  min-height: 31px;
  padding-top: 4px;
  padding-bottom: 4px;
}

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

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 31px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
}

.summary-chip strong {
  color: var(--ink);
}

.summary-chip.alert strong {
  color: var(--coral);
}

.inline-note {
  min-width: 150px;
  min-height: 31px;
  padding: 5px 8px;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 14px;
}

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

.form-field {
  display: grid;
  gap: 6px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.required {
  color: var(--coral);
}

.form-help {
  color: var(--subtle);
  font-size: 11px;
}

.form-section-title {
  grid-column: 1 / -1;
  padding-top: 3px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.form-section-title:first-child {
  padding-top: 0;
  border-top: 0;
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid #cfe7e4;
  border-radius: 5px;
  color: #276964;
  background: #eff9f7;
  font-size: 12px;
}

.callout.warning {
  border-color: #f0d7ad;
  color: #8d611e;
  background: #fff8ea;
}

.callout strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
}

.score-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.exam-list {
  display: grid;
  gap: 8px;
}

.exam-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}

.exam-item:hover {
  border-color: #a9d4d0;
  background: #fbfefe;
}

.exam-item.selected {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: inset 3px 0 0 var(--teal);
}

.exam-item strong {
  font-size: 13px;
}

.exam-item span {
  color: var(--muted);
  font-size: 11px;
}

.exam-average {
  margin-top: 3px;
  color: var(--teal) !important;
  font-weight: 650;
}

.score-input {
  width: 94px;
  min-width: 94px;
  min-height: 30px;
  padding: 4px 8px;
}

.arrangement-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.seat-stage {
  overflow-x: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef3f4;

}
.teacher-front {
  max-width: 360px;
  margin: 18px auto 0;
  padding: 6px 14px;
  border: 1px solid #c7d9da;
  border-radius: 4px;
  color: #527577;
  background: #e1ecec;
  font-size: 11px;
  text-align: center;
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(var(--seat-cols, 10), minmax(62px, 1fr));
  min-width: max-content;
  gap: 8px;
}

.seat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 73px;
  padding: 8px;
  border: 1px dashed #b9c9cd;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.78);
  transition: border-color 150ms ease, background 150ms ease;
}

.seat:hover,
.seat.drag-over {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.seat.blocked {
  border-style: solid;
  border-color: #c6d0d5;
  background: #e7ecef;
}

.seat.blocked .seat-number,
.seat-blocked {
  color: var(--subtle);
  font-size: 11px;
}

.seat-blocked {
  display: block;
  margin-top: auto;
  font-weight: 650;
  text-align: center;
}

.seat-number {
  color: var(--subtle);
  font-size: 10px;
}

.seat-student {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-student[draggable="true"] {
  cursor: grab;
}

.seat-student[draggable="true"]:active {
  cursor: grabbing;
}
.seat-student.dragging,
.student-chip.dragging {
  opacity: 0.45;
}

.seat-student.drag-selected,
.student-chip.drag-selected {
  padding: 3px 5px;
  border: 1px solid #8bc9c4;
  border-radius: 4px;
  color: var(--teal);
  background: var(--teal-soft);
  outline: 2px solid rgba(21, 124, 120, 0.16);
}

.seat-student,
.student-chip {
  user-select: none;
}

.seat-student.empty {
  color: #b5c0c6;
  font-weight: 400;
}

.pool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 260px;
  overflow: auto;
}

.student-chip {
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
  cursor: grab;
}

.student-chip:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.pool-empty {
  width: 100%;
  padding: 9px 0;
  color: var(--subtle);
  font-size: 12px;
}

.duty-list {
  display: grid;
  gap: 8px;
}

.duty-day {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
}

.duty-day strong {
  color: var(--teal);
  font-size: 12px;
}

.duty-day span {
  color: var(--muted);
  font-size: 12px;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 680px) minmax(250px, 1fr);
  gap: 20px;
  align-items: start;
}

.data-actions {
  display: grid;
  gap: 10px;
}

.data-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.data-action-row:last-child {
  border-bottom: 0;
}

.data-action-row strong {
  display: block;
  font-size: 13px;
}

.data-action-row span {
  color: var(--muted);
  font-size: 11px;
}

.modal {
  width: min(650px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(22, 44, 63, 0.24);
}

.modal::backdrop {
  background: rgba(16, 31, 43, 0.42);
}

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

.modal-kicker {
  margin-bottom: 3px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.modal-body {
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  padding: 22px 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.toast-region {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 32px));
}

.toast {
  padding: 11px 14px;
  border: 1px solid #cde5e2;
  border-radius: 5px;
  color: #276964;
  background: #eff9f7;
  box-shadow: var(--shadow);
  font-size: 12px;
}

.toast.error {
  border-color: #efc8c3;
  color: #93483f;
  background: #fff3f0;
}

.loading-state {
  display: grid;
  place-items: center;
  min-height: 300px;
  color: var(--muted);
}

@media (max-width: 1240px) {
  .workspace,
  .topbar {
    padding-left: 28px;
    padding-right: 28px;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .seat-grid {
    grid-template-columns: repeat(var(--seat-cols, 10), minmax(62px, 1fr));
  }
}

@media (max-width: 1000px) {
  .sidebar {
    width: 82px;
    padding: 20px 11px 14px;
  }

  .brand-block {
    justify-content: center;
    padding: 0 0 24px;
  }

  .brand-block > div:last-child,
  .nav-item span:last-child,
  .sidebar-link span:last-child,
  .backup-link span:last-child,
  .local-indicator span:last-child {
    display: none;
  }

  .nav-item,
  .sidebar-link,
  .backup-link {
    justify-content: center;
    padding: 11px 7px;
  }

  .nav-item .nav-icon,
  .sidebar-link .nav-icon {
    flex: 0 0 22px;
  }

  .local-indicator {
    justify-content: center;
    padding: 10px 0 14px;
  }

  .main-content {
    width: calc(100% - 82px);
    margin-left: 82px;
  }

  .score-layout,
  .arrangement-layout,
  .settings-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
    padding-top: 22px;
    padding-bottom: 18px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .workspace,
  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }

  .content-grid,
  .content-grid.equal {
    grid-template-columns: 1fr;
  }

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

  .page-toolbar,
  .panel-heading,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-toolbar .toolbar-actions,
  .panel-heading .toolbar-actions {
    width: 100%;
  }

  .page-toolbar .button,
  .panel-heading .button {
    flex: 0 0 auto;
  }

  .search-box {
    flex: 1 1 100%;
    min-width: 180px;
  }

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

  .form-field.full,
  .form-section-title {
    grid-column: auto;
  }

  .seat-stage {
    padding: 12px;
  }

  .seat-grid {
    grid-template-columns: repeat(var(--seat-cols, 10), minmax(52px, 1fr));
    gap: 6px;
  }

  .seat {
    min-height: 66px;
    padding: 6px;
  }
}

@media (max-width: 480px) {
  .sidebar {
    position: static;
    width: 58px;
    padding-left: 7px;
    padding-right: 7px;
  }

  .main-content {
    width: calc(100% - 58px);
    margin-left: 0;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi-card {
    min-height: 100px;
    padding: 12px;
  }

  .kpi-value {
    font-size: 23px;
  }

  .topbar-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .topbar-actions .button {
    width: 100%;
  }

  .workspace {
    padding-top: 22px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .seat-grid {
    grid-template-columns: repeat(var(--seat-cols, 10), minmax(52px, 1fr));
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 17px;
    padding-right: 17px;
  }
}

/* ---------- 登录门（服务端部署新增） ---------- */

body.locked .app-shell {
  display: none;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--canvas);
}

.login-gate[hidden] {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 30px 28px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.login-card .brand-mark {
  margin: 0 auto 14px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 19px;
  letter-spacing: 0.02em;
}

.login-note {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.login-card .form-field {
  margin-bottom: 14px;
  text-align: left;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.login-error {
  min-height: 18px;
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 13px;
}

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

/* ---------- 布局工具类（替代内联 style，配合严格 CSP） ---------- */

.mt-9 { margin-top: 9px; }
.mt-14 { margin-top: 14px; }
.mt-17 { margin-top: 17px; }
.mt-18 { margin-top: 18px; }
.mb-20 { margin-bottom: 20px; }
.text-13 { font-size: 13px; }
