﻿:root {
  color-scheme: light;
  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --surface-strong: #edf1f5;
  --text: #17212b;
  --text-soft: #5f6d7a;
  --text-faint: #84919d;
  --line: #dfe5eb;
  --line-strong: #c8d1da;
  --nav: #132235;
  --nav-soft: #1d3047;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --green: #138a5b;
  --green-soft: #e7f7f0;
  --orange: #b9650a;
  --orange-soft: #fff3df;
  --red: #c73737;
  --red-soft: #fdecec;
  --purple: #7552b8;
  --purple-soft: #f0ebfb;
  --cyan: #167e92;
  --cyan-soft: #e5f6f8;
  --shadow: 0 8px 24px rgba(26, 42, 58, 0.07);
  --shadow-strong: 0 18px 50px rgba(15, 29, 43, 0.18);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

svg {
  display: block;
}

.app-shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: 228px;
  height: 100vh;
  padding: 20px 14px;
  color: #eef5fb;
  background: var(--nav);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 6px 22px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: #0e2942;
  background: #9fd2ff;
  font-size: 18px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0;
}

.brand span {
  margin-top: 2px;
  color: #9fb0c1;
  font-size: 12px;
}

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  color: #b9c7d5;
  background: transparent;
  text-align: left;
  transition: color 160ms ease, background 160ms ease;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  color: #ffffff;
  background: var(--nav-soft);
}

.nav-item.active::before {
  position: absolute;
  left: 0;
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: #7fc2ff;
  content: "";
}

.nav-item svg {
  width: 17px;
  height: 17px;
}

.nav-count {
  min-width: 22px;
  height: 20px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 10px;
  color: #ffd6d6;
  background: rgba(199, 55, 55, 0.3);
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}

.sidebar-status {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: auto;
  padding: 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #91a4b8;
  font-size: 12px;
}

.status-line strong {
  color: #e6eef6;
  font-weight: 600;
}

.status-ok {
  color: #78e1b2 !important;
}

.main-content {
  min-width: 0;
  padding: 22px 24px 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 3px;
  font-size: 16px;
  line-height: 1.35;
}

.topbar-actions,
.surface-actions,
.toolbar-meta,
.rules-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  font-weight: 600;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.btn:hover {
  border-color: #aeb9c4;
  background: #fbfcfd;
}

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

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  border-color: #0f5fcf;
  color: #ffffff;
  background: #176bdc;
}

.btn-primary:hover {
  border-color: #0e56bd;
  background: #0f5fcf;
}

.btn-danger-ghost {
  border-color: rgba(199, 55, 55, 0.3);
  color: #a92525;
  background: rgba(255, 255, 255, 0.7);
}

.icon-btn {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text-soft);
  background: var(--surface);
}

.icon-btn:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-soft);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 13px 14px;
  border: 1px solid #efc1c1;
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  color: #7f2020;
  background: var(--red-soft);
}

.alert-banner > svg {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
}

.alert-banner div {
  flex: 1;
}

.alert-banner strong,
.alert-banner p {
  display: block;
  margin: 0;
}

.alert-banner p {
  margin-top: 2px;
  color: #9b3535;
  font-size: 13px;
}

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

.kpi-card {
  min-width: 0;
  padding: 15px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 3px 12px rgba(26, 42, 58, 0.035);
}

.kpi-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
}

.kpi-heading svg {
  width: 17px;
  height: 17px;
  color: #708090;
}

.kpi-card > strong {
  display: block;
  margin-top: 9px;
  font-size: 24px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi-card > small {
  display: block;
  min-height: 18px;
  margin-top: 7px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-panel {
  animation: panel-in 180ms ease;
}

@keyframes panel-in {
  from {
    opacity: 0.4;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.toolbar-main {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-soft);
  font-size: 12px;
}

.input,
.textarea {
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  outline: none;
}

.input {
  min-height: 38px;
  padding: 0 10px;
}

.textarea {
  width: 100%;
  min-height: 106px;
  padding: 9px 10px;
  resize: vertical;
}

.input:focus,
.textarea:focus {
  border-color: #6aa8f4;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.11);
}

.toolbar-meta {
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.toolbar-meta b {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.normal {
  background: var(--blue);
}

.legend-dot.special {
  background: var(--purple);
}

.legend-dot.parttime {
  background: var(--orange);
}

.daily-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 284px;
  align-items: start;
  gap: 14px;
}

.schedule-surface,
.alerts-surface,
.timeline-surface,
.rules-surface,
.side-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 3px 12px rgba(26, 42, 58, 0.035);
}

.schedule-surface,
.alerts-surface,
.timeline-surface {
  min-width: 0;
  overflow: hidden;
}

.timeline-surface {
  margin-bottom: 14px;
}

.timeline-heading {
  min-height: 60px;
}

.heading-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.timeline-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.timeline-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-block {
  display: inline-block;
  width: 13px;
  height: 9px;
  border-radius: 3px;
}

.legend-block.normal {
  background: #477ecb;
}

.legend-block.special {
  background: #8062bd;
}

.legend-block.parttime {
  background: #c98228;
}

.timeline-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.timeline-board {
  padding-bottom: 4px;
}

.timeline-header-row,
.timeline-body-row {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
}

.timeline-header-row {
  border-top: 1px solid var(--line);
}

.timeline-corner,
.timeline-time-axis,
.timeline-room-head,
.timeline-room-column {
  min-width: 0;
}

.timeline-corner {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 8px 5px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
}

.timeline-room-heads {
  display: grid;
  grid-template-columns: repeat(var(--room-count), minmax(0, 1fr));
  background: #f8fafc;
}

.timeline-room-head {
  display: flex;
  min-width: 0;
  min-height: 58px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 3px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.timeline-room-head strong,
.timeline-room-head span,
.timeline-room-head em {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-room-head strong {
  color: var(--text);
  font-size: 11px;
}

.timeline-room-head span {
  color: var(--text-faint);
  font-size: 9px;
}

.timeline-room-head em {
  color: var(--blue);
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
}

.timeline-room-head.disabled strong,
.timeline-room-head.disabled span,
.timeline-room-head.disabled em {
  color: var(--text-faint);
}

.timeline-body-row {
  position: relative;
}

.timeline-time-axis {
  position: sticky;
  left: 0;
  z-index: 4;
  height: var(--timeline-height);
  border-right: 1px solid var(--line);
  background-color: #fbfcfd;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(132, 145, 157, 0.20) 0,
    rgba(132, 145, 157, 0.20) 1px,
    transparent 1px,
    transparent var(--hour-px)
  );
}

.timeline-time-mark {
  position: absolute;
  right: 8px;
  color: var(--text-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  transform: translateY(-50%);
  white-space: nowrap;
}

.timeline-time-mark.hour-range {
  font-weight: 600;
}

.timeline-time-mark.start {
  transform: translateY(0);
}

.timeline-time-mark.end {
  transform: translateY(-100%);
}

.timeline-room-grid {
  display: grid;
  height: var(--timeline-height);
  grid-template-columns: repeat(var(--room-count), minmax(0, 1fr));
}

.timeline-room-column {
  position: relative;
  min-width: 0;
  border-right: 1px solid var(--line);
  background-color: #ffffff;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(132, 145, 157, 0.18) 0,
    rgba(132, 145, 157, 0.18) 1px,
    transparent 1px,
    transparent var(--hour-px)
  );
}

.timeline-room-column:nth-child(2n) {
  background-color: #fcfdfe;
}

.timeline-room-column.disabled {
  background-color: #fafbfc;
}

.timeline-room-head.disabled,
.timeline-room-column.disabled {
  background-color: #f7f9fb;
}

.timeline-hour-table {
  border-bottom: 1px solid var(--line);
}

.timeline-hour-row {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  min-height: 34px;
}

.timeline-hour-label {
  position: sticky;
  left: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
  background: #fbfcfd;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline-hour-cells {
  display: grid;
  grid-template-columns: repeat(var(--room-count), minmax(0, 1fr));
}

.timeline-hour-cell {
  display: flex;
  min-width: 0;
  min-height: 34px;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 1px;
  padding: 2px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.timeline-hour-cell:nth-child(2n) {
  background: #fcfdfe;
}

.timeline-hour-cell.disabled {
  background: #f8fafc;
}

.hour-cell-item {
  display: flex;
  min-width: 0;
  min-height: 18px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  overflow: hidden;
  padding: 1px 2px;
  border: 0;
  border-radius: 3px;
  color: #ffffff;
  font: inherit;
  text-align: center;
}

.hour-cell-item.normal {
  background: #477ecb;
}

.hour-cell-item.special {
  background: #8062bd;
}

.hour-cell-item.parttime {
  background: #c98228;
}

.hour-cell-item.dimmed {
  opacity: 0.24;
}

.hour-cell-item strong {
  min-width: 0;
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  text-overflow: clip;
  white-space: nowrap;
}

.hour-cell-item small {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.86);
  font-size: 7px;
  font-variant-numeric: tabular-nums;
}

.hour-cell-empty {
  color: var(--text-faint);
  font-size: 9px;
  text-align: center;
}

.timeline-block {
  position: absolute;
  left: 4px;
  right: 4px;
  z-index: 2;
  display: flex;
  min-height: 24px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
  padding: 3px 4px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(17, 31, 45, 0.09);
  font: inherit;
  cursor: pointer;
  text-align: center;
}

.timeline-block.hour-slice {
  border-color: rgba(255, 255, 255, 0.55);
}

.timeline-block.normal {
  background: #477ecb;
}

.timeline-block.special {
  background: #8062bd;
}

.timeline-block.parttime {
  background: #c98228;
}

.timeline-block.dimmed {
  opacity: 0.26;
}

.timeline-block:hover {
  z-index: 4;
  filter: brightness(0.93);
}

.timeline-block strong {
  overflow: hidden;
  max-width: 100%;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: clip;
  white-space: nowrap;
}

.timeline-block small {
  overflow: hidden;
  max-width: 100%;
  color: rgba(255, 255, 255, 0.86);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-block.narrow {
  padding: 2px 3px;
}

.timeline-block.narrow small {
  display: none;
}

.timeline-block.micro {
  min-height: 14px;
  padding: 1px 2px;
}

.timeline-block.micro strong {
  font-size: 9px;
}

.timeline-block.micro small {
  display: none;
}

.timeline-empty {
  display: grid;
  min-height: 240px;
  place-items: center;
  color: var(--text-faint);
  font-size: 12px;
}

.surface-heading {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.surface-heading h2,
.surface-heading p {
  margin-bottom: 0;
}

.surface-heading p {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 12px;
}

.status-chip {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip.success {
  color: #0f7049;
  background: var(--green-soft);
}

.status-chip.warning {
  color: #9c570a;
  background: var(--orange-soft);
}

.status-chip.danger {
  color: #a92b2b;
  background: var(--red-soft);
}

.status-chip.neutral {
  color: var(--text-soft);
  background: var(--surface-strong);
}

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

.schedule-table,
.week-table,
.room-rule-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

.schedule-table {
  min-width: 1060px;
}

.schedule-table th,
.schedule-table td,
.week-table th,
.week-table td,
.room-rule-table th,
.room-rule-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.schedule-table th,
.week-table th,
.room-rule-table th {
  color: var(--text-soft);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.schedule-table tbody tr:hover {
  background: #fafcff;
}

.schedule-table tbody tr.row-warning {
  background: #fffafa;
}

.schedule-table tbody tr.row-special {
  background: #fcfaff;
}

.schedule-table tbody tr.row-parttime {
  background: #fffaf1;
}

.schedule-surface.compact .schedule-table td,
.schedule-surface.compact .schedule-table th {
  padding-top: 7px;
  padding-bottom: 7px;
}

.room-cell strong,
.room-cell span {
  display: block;
}

.room-cell span {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 11px;
}

.time-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.person-cell {
  font-weight: 700;
  white-space: nowrap;
}

.type-badge,
.source-badge,
.warning-badge,
.rest-badge {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.type-badge.normal {
  color: #2255a4;
  background: var(--blue-soft);
}

.type-badge.special {
  color: #6342a7;
  background: var(--purple-soft);
}

.type-badge.parttime {
  color: #965608;
  background: var(--orange-soft);
}

.source-badge {
  color: #176c84;
  background: var(--cyan-soft);
}

.warning-badge {
  color: #a92b2b;
  background: var(--red-soft);
}

.rest-badge {
  color: #586774;
  background: var(--surface-strong);
}

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

.hours-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hours-cell small {
  display: block;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 400;
}

.text-end {
  text-align: right !important;
}

.text-center {
  text-align: center !important;
}

.row-action {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--blue);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.row-action:hover {
  border-color: #a8c9f4;
  background: var(--blue-soft);
}

.row-action.danger {
  color: var(--red);
}

.row-action.danger:hover {
  border-color: #e7b9b9;
  background: var(--red-soft);
}

.daily-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-section {
  padding: 15px;
}

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

.side-heading h2 {
  margin: 0;
}

.side-heading > span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.side-heading > svg {
  width: 18px;
  height: 18px;
  color: var(--green);
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--surface-strong);
}

.progress-value {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 180ms ease;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 13px;
}

.mini-stats div {
  padding: 8px 4px;
  text-align: center;
}

.mini-stats span,
.mini-stats strong {
  display: block;
}

.mini-stats span {
  color: var(--text-faint);
  font-size: 11px;
}

.mini-stats strong {
  margin-top: 2px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.text-btn {
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.roster-list {
  display: flex;
  max-height: 318px;
  flex-direction: column;
  overflow-y: auto;
  padding-right: 2px;
}

.roster-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  border-bottom: 1px solid var(--line);
}

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

.avatar {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #32526f;
  background: #e8eef4;
  font-size: 11px;
  font-weight: 800;
}

.avatar.special {
  color: #6242a0;
  background: var(--purple-soft);
}

.avatar.parttime {
  color: #9a5a0d;
  background: var(--orange-soft);
}

.roster-name {
  min-width: 0;
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-status {
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
}

.roster-status.rest {
  color: var(--text-faint);
}

.side-notes ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.side-notes li {
  position: relative;
  padding-left: 17px;
  color: var(--text-soft);
  font-size: 12px;
}

.side-notes li::before {
  position: absolute;
  top: 7px;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  content: "";
}

.side-notes li.warning {
  color: #99580f;
}

.side-notes li.warning::before {
  background: var(--orange);
}

.side-notes li.danger {
  color: var(--red);
}

.side-notes li.danger::before {
  background: var(--red);
}

.week-pager {
  display: flex;
  align-items: center;
  gap: 6px;
}

.week-range {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  font-weight: 700;
}

.toolbar-note {
  padding-bottom: 8px;
  color: var(--text-soft);
  font-size: 12px;
}

.weekly-surface {
  overflow: hidden;
}

.week-table {
  min-width: 1200px;
}

.week-table th,
.week-table td {
  padding: 9px 8px;
}

.week-table th:first-child,
.week-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 126px;
  background: var(--surface);
}

.week-table thead th:first-child {
  z-index: 3;
  background: #f8fafc;
}

.week-person {
  display: flex;
  align-items: center;
  gap: 8px;
}

.week-person strong,
.week-person span {
  display: block;
}

.week-person span {
  margin-top: 1px;
  color: var(--text-faint);
  font-size: 11px;
}

.week-shift {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.week-shift strong {
  color: var(--text);
  font-size: 12px;
}

.week-shift span {
  color: var(--text-soft);
}

.week-shift.abnormal strong,
.week-total.abnormal {
  color: var(--red);
}

.week-rest {
  color: var(--text-faint);
  font-size: 12px;
}

.week-total {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.week-day-head {
  text-align: center !important;
}

.week-day-head small {
  display: block;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 500;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.check-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.segment {
  min-height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 5px;
  color: var(--text-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.segment.active {
  color: #ffffff;
  background: #21364e;
}

.alert-list {
  display: flex;
  flex-direction: column;
}

.alert-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

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

.alert-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
}

.alert-icon svg {
  width: 17px;
  height: 17px;
}

.alert-icon.critical {
  color: var(--red);
  background: var(--red-soft);
}

.alert-icon.warning {
  color: var(--orange);
  background: var(--orange-soft);
}

.alert-icon.info {
  color: var(--blue);
  background: var(--blue-soft);
}

.alert-copy strong,
.alert-copy span {
  display: block;
}

.alert-copy strong {
  font-size: 14px;
}

.alert-copy p {
  margin: 3px 0 0;
  color: var(--text-soft);
  font-size: 12px;
}

.alert-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}

.alert-meta time {
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
}

.rules-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rules-surface {
  overflow: hidden;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.rule-type-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 0;
}

.rule-type-heading h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.rule-type-heading .legend-dot {
  width: 10px;
  height: 10px;
}

.rule-type-group + .rule-type-group {
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

.locked-rules {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-top: 14px;
}

.rule-field,
.pool-field,
.form-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.input-suffix {
  position: relative;
}

.input-suffix .input {
  width: 100%;
  padding-right: 54px;
}

.input-suffix em {
  position: absolute;
  top: 50%;
  right: 11px;
  color: var(--text-faint);
  font-size: 12px;
  font-style: normal;
  transform: translateY(-50%);
}

.lock-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: 14px;
  color: #536474;
  background: var(--surface-strong);
  font-size: 12px;
  font-weight: 700;
}

.lock-chip svg {
  width: 14px;
  height: 14px;
}

.pool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.pool-field > span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.pool-field b {
  color: var(--text);
}

.room-rules-surface .table-responsive {
  max-height: 520px;
  overflow: auto;
}

.room-rule-table {
  min-width: 980px;
}

.room-rule-table .input {
  min-height: 34px;
}

.room-rule-table th:first-child,
.room-rule-table td:first-child {
  width: 58px;
  text-align: center;
}

.room-rule-table input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
}

.rest-rules-surface .table-responsive {
  max-height: 560px;
  overflow: auto;
}

.rest-week-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.rest-matrix-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.rest-matrix-table th,
.rest-matrix-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.rest-matrix-table th {
  color: var(--text-soft);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
}

.rest-matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.rest-matrix-table tbody tr:hover {
  background: #fafcff;
}

.rest-matrix-table > thead > tr:first-child > th:first-child,
.rest-matrix-table > tbody > tr > td:first-child {
  width: 190px;
}

.rest-matrix-table > thead > tr:first-child > th:nth-child(2),
.rest-matrix-table > tbody > tr > td:nth-child(2) {
  width: 82px;
}

.rest-matrix-table > tfoot > tr > td:first-child {
  width: 272px;
}

.rest-date-head {
  min-width: 74px;
  padding: 8px 5px;
  text-align: center;
  border-left: 1px solid var(--line);
}

.rest-date-head .input {
  display: block;
  width: 118px;
  min-height: 32px;
  margin: 0 auto;
}

.rest-date-head small {
  display: block;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 600;
}

.rest-hour-head {
  min-width: 42px;
  padding: 7px 3px !important;
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.rest-hour-head.next-day {
  color: #a86b28;
  background: #fff8ed;
}

.rest-host-cell {
  min-width: 154px;
  white-space: nowrap;
}

.rest-host-cell .legend-dot {
  vertical-align: middle;
  margin-right: 7px;
}

.rest-host-input {
  width: 142px;
  min-height: 32px;
  vertical-align: middle;
}

.rest-slot-td {
  padding: 2px !important;
}

.rest-check-cell {
  position: relative;
  display: inline-flex;
  min-width: 40px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  color: var(--text-faint);
  background: #ffffff;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.rest-check-cell.active {
  border-style: solid;
  border-color: #e6a4a4;
  color: #a82f2f;
  background: var(--red-soft);
  font-weight: 800;
}

.rest-check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.rest-check-text {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.rest-hour-count {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rest-day-count {
  display: inline-flex;
  min-width: 26px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--text-soft);
  background: var(--surface-strong);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.rest-day-count.critical {
  color: #a82f2f;
  background: var(--red-soft);
}

.rest-rule-hint {
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  background: #fbfcfd;
  font-size: 11px;
}

.empty-table-cell {
  padding: 24px 16px !important;
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
}

.rules-actions {
  justify-content: flex-end;
  padding-top: 2px;
}

.edit-dialog {
  width: min(520px, calc(100vw - 30px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-strong);
}

.edit-dialog::backdrop {
  background: rgba(9, 20, 33, 0.5);
  backdrop-filter: blur(2px);
}

.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px;
}

.dialog-header {
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin-bottom: 0;
}

.dialog-body {
  padding: 18px;
}

.dialog-context {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: 12px;
}

.dialog-context strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.validation-preview {
  margin-top: 15px;
  padding: 10px 12px;
  border-radius: 7px;
  color: #23684f;
  background: var(--green-soft);
  font-size: 12px;
}

.validation-preview.warning {
  color: #98570d;
  background: var(--orange-soft);
}

.validation-preview.danger {
  color: #9f2929;
  background: var(--red-soft);
}

.dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 11px 13px;
  border: 1px solid #bdd9cc;
  border-radius: 7px;
  color: #1f6148;
  background: #effaf5;
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in 180ms ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 188px minmax(0, 1fr);
  }

  .sidebar {
    width: 188px;
  }

  .daily-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .daily-side {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pool-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    padding: 13px;
  }

  .brand {
    padding-bottom: 12px;
  }

  .main-nav {
    flex-direction: row;
    overflow-x: auto;
  }

  .nav-item {
    flex: 0 0 auto;
    padding: 0 11px;
  }

  .nav-item.active::before,
  .sidebar-status {
    display: none;
  }

  .main-content {
    padding: 17px 14px 30px;
  }

  .topbar,
  .section-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

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

  .daily-side,
  .rule-grid {
    grid-template-columns: 1fr;
  }

  .alert-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .alert-meta {
    grid-column: 2;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card > small {
    white-space: normal;
  }

  .topbar-actions .btn {
    flex: 1 1 calc(50% - 6px);
  }

  .topbar-actions .btn-primary {
    flex-basis: 100%;
  }

  .field-inline {
    width: 100%;
  }

  .field-inline .input {
    width: 100%;
  }

  .surface-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .timeline-legend {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .heading-line {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .segmented-control {
    width: 100%;
    overflow-x: auto;
  }

  .segment {
    flex: 1 0 auto;
  }

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

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

@media print {
  .sidebar,
  .topbar-actions,
  .section-toolbar,
  .daily-side,
  .row-action,
  .alert-banner .btn {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main-content {
    padding: 0;
  }

  .schedule-surface,
  .alerts-surface,
  .timeline-surface,
  .rules-surface {
    border: 0;
    box-shadow: none;
  }
}
