:root {
  --bg: #f4f5f6;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --line: #e3e6e8;
  --line-strong: #ced3d6;
  --text: #202426;
  --muted: #6d7478;
  --subtle: #92999d;
  --accent: #eb6548;
  --accent-dark: #ca4c32;
  --accent-soft: #fff0ec;
  --teal: #167c72;
  --teal-soft: #e7f4f1;
  --amber: #a86409;
  --amber-soft: #fff5df;
  --red: #b5423c;
  --red-soft: #fff0ef;
  --blue: #38679b;
  --blue-soft: #edf4fb;
  --shadow: 0 10px 30px rgb(27 31 33 / 9%);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-width: 1120px; background: var(--bg); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #de765f; outline-offset: 2px; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; gap: 26px; padding: 0 22px; background: #24292b; color: white; border-bottom: 1px solid #121617; }
.brand-block { display: flex; align-items: center; gap: 10px; width: 212px; flex: 0 0 212px; }
.brand-mark { width: 30px; height: 30px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 6px; background: var(--accent); border-radius: 6px; }
.brand-mark span { width: 4px; background: white; border-radius: 1px; }
.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; }
.brand-name { font-size: 15px; font-weight: 700; line-height: 1.1; }
.brand-subtitle { font-size: 10px; color: #aeb6b9; margin-top: 3px; }
.week-control { display: flex; align-items: center; gap: 4px; }
.week-label { color: #f8fafb; background: transparent; border: 0; min-width: 138px; font-size: 14px; font-weight: 650; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar .quiet-button { color: #e9edef; background: #303638; border-color: #474e51; }
.topbar .quiet-button:hover { background: #3a4144; }
.topbar .icon-button { color: white; border-color: transparent; }
.topbar .count-badge { background: #596164; color: white; }

.icon-button { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; }
.icon-button:hover { background: rgb(255 255 255 / 8%); }
.quiet-button, .primary-button, .publish-button, .small-primary { min-height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: white; color: var(--text); font-size: 12px; font-weight: 650; white-space: nowrap; }
.quiet-button:hover { background: var(--surface-2); }
.primary-button { color: white; border-color: var(--accent); background: var(--accent); }
.primary-button:hover { background: var(--accent-dark); }
.publish-button { color: #24292b; border-color: #ffd46a; background: #ffd46a; }
.publish-button:hover { background: #f4c54f; }
.button-spark { margin-right: 5px; }
.count-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: 10px; }

.control-strip { height: 57px; display: flex; align-items: center; gap: 10px; padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.field { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.field select { height: 32px; min-width: 110px; padding: 0 28px 0 9px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--text); font-size: 12px; }
.scheme-field select { min-width: 142px; }
.filter-divider { height: 24px; width: 1px; background: var(--line); margin: 0 4px; }
.status-copy { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #25a18e; box-shadow: 0 0 0 3px var(--teal-soft); }
.control-spacer { flex: 1; }
.segmented { display: flex; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.segment { min-width: 74px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 11px; }
.segment.active { color: var(--text); background: white; box-shadow: 0 1px 3px rgb(0 0 0 / 8%); font-weight: 650; }

.metric-strip { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); height: 92px; padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.metric-cell { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 10px 24px; border-right: 1px solid var(--line); }
.metric-cell:first-child { padding-left: 0; }
.metric-cell:last-child { border-right: 0; }
.metric-label { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.metric-cell strong { font-size: 24px; letter-spacing: 0; line-height: 1; }
.metric-unit { color: var(--muted); font-size: 11px; margin-left: 2px; }
.metric-note { margin-top: 6px; color: var(--muted); font-size: 10px; }
.metric-note.positive { color: var(--teal); }
.warning-cell strong { color: var(--amber); }
.micro-progress { position: absolute; left: 0; right: 24px; bottom: 0; height: 3px; background: #edf0f1; }
.micro-progress i { display: block; width: 0; height: 100%; background: var(--teal); transition: width .4s ease; }

.workspace { min-height: calc(100vh - 213px); display: grid; grid-template-columns: 242px minmax(650px, 1fr) 310px; background: var(--surface); }
.panel-section { min-width: 0; border-right: 1px solid var(--line); background: var(--surface); }
.panel-section:last-child { border-right: 0; }
.anchor-panel, .insight-panel { height: calc(100vh - 213px); overflow: hidden; }
.section-heading { min-height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.section-heading h1, .section-heading h2 { margin: 0; font-size: 14px; letter-spacing: 0; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.add-button { font-size: 18px; }
.search-box { height: 32px; display: flex; align-items: center; gap: 6px; margin: 10px 12px 8px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--subtle); background: var(--surface-2); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; }
.anchor-filter-row { display: flex; gap: 12px; padding: 0 12px 8px; border-bottom: 1px solid var(--line); }
.text-filter { padding: 2px 0; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 10px; }
.text-filter.active { color: var(--accent-dark); border-color: var(--accent); font-weight: 650; }
.rest-summary { border-bottom: 1px solid var(--line); }
.rest-roster { padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fffaf0; }
.rest-roster.compact { padding: 8px 12px; }
.rest-roster-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rest-roster-title strong { color: #69491f; font-size: 10px; }
.rest-roster-title span { color: #9b7951; font-size: 8px; }
.rest-roster-actions { display: flex; gap: 6px; margin-left: auto; }
.rest-action { padding: 0; border: 0; color: #8a5c2b; background: transparent; font-size: 8px; }
.rest-action.clear { color: #a34f43; }
.rest-roster-names { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rest-chip { padding: 3px 6px; border: 1px solid #ecdcbf; border-radius: 4px; color: #69491f; background: #fff; font-size: 9px; font-weight: 650; }
.rest-empty { color: #9b7951; font-size: 9px; }
.rest-unavailable { width: 100%; margin-top: 2px; color: #a46442; font-size: 8px; }
.anchor-list { height: calc(100% - 191px); overflow: auto; }
.anchor-item { padding: 11px 12px; border-bottom: 1px solid #edf0f1; cursor: pointer; }
.anchor-item:hover { background: #fafbfb; }
.anchor-main { display: flex; align-items: center; gap: 9px; }
.avatar { width: 31px; height: 31px; flex: 0 0 31px; display: grid; place-items: center; border-radius: 7px; color: #274046; background: #d8ebeb; font-size: 11px; font-weight: 750; }
.avatar.c1 { color: #61402e; background: #f5e4d8; }
.avatar.c2 { color: #375035; background: #deebd9; }
.avatar.c3 { color: #3d4261; background: #e4e5f4; }
.anchor-copy { min-width: 0; flex: 1; }
.anchor-name-row { display: flex; align-items: center; gap: 5px; }
.anchor-name { font-size: 12px; font-weight: 700; }
.level-tag { padding: 1px 4px; border-radius: 3px; background: var(--surface-2); color: var(--muted); font-size: 8px; }
.anchor-meta { margin-top: 3px; color: var(--muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hour-row { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.hour-bar { height: 4px; flex: 1; overflow: hidden; border-radius: 2px; background: #ebeeef; }
.hour-bar i { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.hour-bar i.near { background: #d18a25; }
.hour-count { width: 47px; text-align: right; color: var(--muted); font-size: 9px; }
.capacity-note { margin-top: 6px; color: var(--teal); font-size: 9px; }
.capacity-note.busy { color: var(--amber); }

.schedule-panel { height: calc(100vh - 213px); display: flex; flex-direction: column; overflow: hidden; }
.schedule-heading { flex: 0 0 66px; padding-left: 16px; padding-right: 16px; }
.legend { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 9px; }
.legend > span { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; }
.legend-dot.auto { background: var(--teal); }
.legend-dot.manual { background: var(--accent); }
.legend-lock { color: var(--muted); font-size: 10px; }
.calendar-scroll { flex: 1; overflow: auto; background: #f7f8f8; }
.calendar-grid { min-width: 840px; display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); min-height: 100%; }
.day-column { min-width: 0; border-right: 1px solid var(--line); background: #f9fafa; transition: background .15s ease; }
.day-column:last-child { border-right: 0; }
.day-column.drag-over { background: #edf7f4; }
.day-head { position: sticky; top: 0; z-index: 2; height: 51px; display: flex; align-items: center; justify-content: center; gap: 5px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 96%); }
.day-head strong { font-size: 11px; }
.day-head span { color: var(--muted); font-size: 9px; }
.day-head.today strong { color: var(--accent-dark); }
.day-head.today::after { content: ""; position: absolute; bottom: 0; left: 30%; right: 30%; height: 2px; background: var(--accent); }
.day-content { min-height: 520px; padding: 8px; }
.empty-day { display: grid; place-items: center; min-height: 150px; color: var(--subtle); font-size: 10px; border: 1px dashed var(--line-strong); border-radius: 6px; }
.shift-card { position: relative; min-height: 84px; margin-bottom: 7px; padding: 8px 8px 7px 10px; border: 1px solid #d6e8e4; border-left: 3px solid var(--teal); border-radius: 6px; background: white; box-shadow: 0 1px 2px rgb(24 43 40 / 4%); cursor: grab; }
.shift-card.manual { border-color: #f2d5cc; border-left-color: var(--accent); }
.shift-card.locked { cursor: pointer; background: #fafbfb; }
.shift-card:hover { border-color: #8bbeb5; box-shadow: 0 3px 10px rgb(24 43 40 / 9%); }
.shift-card.dragging { opacity: .45; }
.shift-topline { display: flex; justify-content: space-between; gap: 5px; }
.shift-room { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.shift-source { color: var(--teal); font-size: 8px; white-space: nowrap; }
.shift-card.manual .shift-source { color: var(--accent-dark); }
.shift-time { margin-top: 5px; font-size: 12px; font-weight: 750; }
.shift-anchor { display: flex; align-items: center; gap: 5px; margin-top: 7px; }
.mini-avatar { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 4px; background: #e5eeee; color: #355450; font-size: 8px; font-weight: 700; }
.shift-anchor span { font-size: 10px; font-weight: 650; }
.shift-label { margin-left: auto; color: var(--muted); font-size: 8px !important; font-weight: 400 !important; }
.lock-mark { position: absolute; right: 7px; bottom: 7px; color: var(--muted); font-size: 9px; }
.schedule-footer { height: 32px; flex: 0 0 32px; display: flex; justify-content: space-between; align-items: center; padding: 0 14px; border-top: 1px solid var(--line); color: var(--muted); background: white; font-size: 9px; }

/* The room view mirrors the operator's timetable: time stays in the first column and each room gets a clear column. */
.calendar-grid.room-mode { display: block; min-width: 0; padding: 0 0 14px; background: #f6f8f8; }
.matrix-day { margin: 0 0 14px; border-bottom: 1px solid var(--line-strong); background: #fff; }
.matrix-day.today .matrix-day-title { box-shadow: inset 3px 0 0 var(--accent); }
.matrix-day-title { position: sticky; left: 0; z-index: 4; display: flex; align-items: baseline; gap: 10px; min-height: 42px; padding: 0 14px; border-bottom: 1px solid var(--line); background: #fff; }
.matrix-day-title strong { color: var(--text); font-size: 12px; }
.matrix-day-title span { color: var(--muted); font-size: 9px; }
.matrix-day > .rest-roster { border-bottom: 1px solid var(--line); }
.rest-edit-modal { width: min(520px, calc(100vw - 40px)); }
.rest-edit-body { max-height: min(58vh, 520px); overflow: auto; background: #fbfcfc; }
.rest-edit-list { border: 1px solid var(--line); background: white; }
.rest-edit-row { display: grid; grid-template-columns: 20px 1fr 1fr auto; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border-bottom: 1px solid #edf0f1; cursor: pointer; }
.rest-edit-row:last-child { border-bottom: 0; }
.rest-edit-row input { accent-color: var(--accent); }
.rest-edit-name { color: var(--text); font-size: 10px; font-weight: 700; }
.rest-edit-meta, .rest-edit-row em { color: var(--muted); font-size: 8px; font-style: normal; }
.rest-edit-row em { text-align: right; }
.rest-edit-row.unavailable { background: #f7f8f8; cursor: not-allowed; }
.room-matrix-scroll { overflow-x: auto; }
.room-matrix-grid { display: grid; grid-template-columns: 82px repeat(var(--room-count), minmax(172px, 1fr)); min-width: max(720px, calc(100% - 1px)); border-left: 1px solid var(--line); }
.matrix-corner, .matrix-room-head, .matrix-time, .matrix-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.matrix-corner { position: sticky; left: 0; z-index: 3; display: flex; align-items: center; padding: 0 10px; color: var(--muted); background: #f4f6f6; font-size: 9px; font-weight: 700; }
.matrix-room-head { position: sticky; top: 0; z-index: 2; min-height: 58px; padding: 10px 11px 8px; background: #fff8e8; }
.matrix-room-head strong { display: block; overflow: hidden; color: #63421f; font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.matrix-room-head span { display: block; margin-top: 5px; color: #96754f; font-size: 8px; }
.matrix-time { position: sticky; left: 0; z-index: 1; display: flex; flex-direction: column; justify-content: center; min-height: 76px; padding: 8px 9px; color: #384b4d; background: #f7f9f9; font-size: 10px; font-weight: 750; }
.matrix-time small { margin-top: 4px; color: var(--muted); font-size: 8px; font-weight: 500; }
.matrix-cell { min-height: 76px; padding: 6px; background: #fff; vertical-align: top; }
.matrix-empty { display: grid; min-height: 62px; place-items: center; color: #c1cacc; font-size: 12px; }
.matrix-shift { position: relative; display: flex; min-height: 62px; flex-direction: column; justify-content: center; gap: 3px; margin: 0 0 4px; padding: 7px 8px; border: 1px solid #b9dcd5; border-left: 3px solid var(--teal); border-radius: 4px; background: #f2fbf8; cursor: grab; }
.matrix-shift:last-child { margin-bottom: 0; }
.matrix-shift:hover { border-color: #6eafa3; box-shadow: 0 2px 8px rgb(24 43 40 / 10%); }
.matrix-shift.manual { border-color: #efc2b5; border-left-color: var(--accent); background: #fff7f4; }
.matrix-shift.locked { cursor: pointer; background: #f6f8f8; }
.matrix-shift.dragging { opacity: .45; }
.matrix-shift strong { overflow: hidden; color: #1f3f3c; font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.matrix-shift span { color: #355a56; font-size: 10px; font-weight: 700; }
.matrix-shift small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.matrix-lock { position: absolute; top: 6px; right: 6px; color: var(--muted); font-size: 9px; font-style: normal; }

.insight-panel { border-left: 0; }
.insight-tabs { height: 50px; display: flex; align-items: flex-end; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.insight-tab { position: relative; height: 42px; padding: 0; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 11px; }
.insight-tab.active { color: var(--text); border-color: var(--accent); font-weight: 700; }
.insight-tab span { display: inline-grid; place-items: center; min-width: 17px; height: 17px; margin-left: 3px; border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: 8px; }
.tab-content { display: none; height: calc(100% - 50px); overflow: auto; }
.tab-content.active { display: block; }
.health-block { padding: 15px 14px 13px; border-bottom: 1px solid var(--line); }
.health-header { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }
.health-header strong { color: var(--teal); font-size: 16px; }
.health-track { height: 5px; margin-top: 9px; border-radius: 3px; overflow: hidden; background: #e9edee; }
.health-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--teal); transition: width .4s ease; }
.health-block p { margin: 8px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.conflict-toolbar, .rule-list-header { height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--accent-dark); font-size: 9px; }
.conflict-item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.conflict-kicker { display: flex; align-items: center; justify-content: space-between; color: var(--red); font-size: 9px; }
.severity { display: inline-flex; align-items: center; gap: 5px; }
.severity::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.conflict-item.medium .severity { color: var(--amber); }
.conflict-item.medium .severity::before { background: var(--amber); }
.conflict-item h3 { margin: 7px 0 5px; font-size: 11px; line-height: 1.45; }
.conflict-item p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.suggestion-box { margin-top: 8px; padding: 7px 8px; border-radius: 5px; background: var(--amber-soft); color: #7e570f; font-size: 9px; line-height: 1.45; }
.all-good { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 10px; line-height: 1.7; }
.good-mark { width: 32px; height: 32px; display: grid; place-items: center; margin: 0 auto 10px; border-radius: 50%; color: white; background: var(--teal); font-size: 17px; }

.natural-rule-box { margin: 12px; padding: 10px; border: 1px solid #eed1c9; border-radius: 6px; background: var(--accent-soft); }
.natural-rule-box label { display: block; font-size: 10px; font-weight: 700; }
.natural-rule-box textarea { width: 100%; margin-top: 7px; padding: 7px; resize: vertical; border: 1px solid #e5c4ba; border-radius: 5px; background: white; color: var(--text); font-size: 10px; line-height: 1.5; }
.natural-rule-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; color: var(--muted); font-size: 8px; }
.small-primary { min-height: 27px; padding: 0 8px; border-color: var(--accent); color: white; background: var(--accent); font-size: 9px; }
.rule-item { padding: 11px 14px; border-bottom: 1px solid var(--line); }
.rule-head { display: flex; align-items: flex-start; gap: 7px; }
.rule-type { flex: 0 0 auto; padding: 2px 5px; border-radius: 3px; color: var(--red); background: var(--red-soft); font-size: 8px; }
.rule-type.soft { color: var(--blue); background: var(--blue-soft); }
.rule-name { flex: 1; min-width: 0; font-size: 10px; font-weight: 700; line-height: 1.4; }
.rule-description { margin: 6px 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.rule-meta { display: flex; justify-content: space-between; color: var(--subtle); font-size: 8px; }
.switch { position: relative; width: 30px; height: 17px; flex: 0 0 30px; border: 0; border-radius: 9px; background: #c9ced0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: white; transition: transform .18s; }
.switch.on { background: var(--teal); }
.switch.on::after { transform: translateX(13px); }

.modal { width: min(480px, calc(100vw - 40px)); padding: 0; border: 0; border-radius: 8px; box-shadow: var(--shadow); }
.modal::backdrop { background: rgb(22 26 28 / 45%); backdrop-filter: blur(2px); }
.modal form { margin: 0; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 3px 0 0; font-size: 17px; }
.eyebrow { color: var(--accent-dark); font-size: 9px; font-weight: 750; }
.modal-body { padding: 15px 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.modal-error { margin: 10px 20px 0; padding: 8px 10px; border: 1px solid #e2b4aa; border-radius: 5px; color: #8e3e35; background: #fff1ee; font-size: 10px; line-height: 1.45; }
.modal-error[hidden] { display: none; }
.radio-row { display: flex; gap: 10px; padding: 10px; margin-bottom: 7px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.radio-row:has(input:checked) { border-color: #e9a796; background: var(--accent-soft); }
.radio-row input { accent-color: var(--accent); }
.radio-row span { display: flex; flex-direction: column; gap: 4px; }
.radio-row strong { font-size: 11px; }
.radio-row small { color: var(--muted); font-size: 9px; }
.solver-summary { margin-top: 12px; padding: 10px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 9px; }
.solver-summary ol { display: flex; gap: 18px; margin: 7px 0 0; padding-left: 18px; }
.shift-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shift-fact { padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.shift-fact span { display: block; color: var(--muted); font-size: 9px; }
.shift-fact strong { display: block; margin-top: 4px; font-size: 11px; }
.shift-edit-note { margin-bottom: 13px; padding: 9px 10px; border: 1px solid #d6e8e4; border-radius: 5px; color: #285c55; background: var(--teal-soft); font-size: 9px; line-height: 1.45; }
.shift-edit-note.locked-note { border-color: #ead8bf; color: #795b2b; background: #fff7e8; }
.shift-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 12px; }
.shift-edit-grid .form-field input, .shift-edit-grid .form-field select { min-height: 33px; }
.shift-duration-preview { display: flex; min-height: 33px; flex-direction: column; justify-content: center; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); }
.shift-duration-preview span { color: var(--muted); font-size: 8px; }
.shift-duration-preview strong { margin-top: 3px; color: var(--text); font-size: 11px; }
.shift-facts-compact { margin-top: 14px; }
.explanation { margin-top: 14px; padding: 10px; border-radius: 6px; background: var(--teal-soft); color: #285c55; font-size: 10px; line-height: 1.55; }
.rule-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 9px; }
.form-field.wide, .rule-config.wide { grid-column: 1 / -1; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 34px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--text); background: white; font-size: 11px; }
.form-field textarea { resize: vertical; line-height: 1.45; }
.rule-config { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.rule-config[hidden] { display: none; }
.qualification-grid { grid-template-columns: repeat(2, 1fr); }

.master-data-modal { width: min(900px, calc(100vw - 40px)); }
.master-data-body { max-height: min(70vh, 680px); overflow: auto; background: #fbfcfc; }
.data-editor-note { margin-bottom: 14px; padding: 9px 10px; border: 1px solid #d6e8e4; border-radius: 6px; color: #285c55; background: var(--teal-soft); font-size: 10px; line-height: 1.5; }
.data-section { border: 1px solid var(--line); background: white; }
.data-section + .data-section { margin-top: 14px; }
.data-section-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.data-section-head h3 { margin: 0; font-size: 12px; }
.data-section-head p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.data-section-actions { display: flex; align-items: center; gap: 10px; }
.data-section-head > span, .data-section-actions > span { color: var(--muted); font-size: 9px; }
.data-section-actions .link-button:disabled { color: var(--subtle); cursor: not-allowed; }
.master-data-table-wrap { overflow-x: auto; }
.master-data-table { width: 100%; min-width: 650px; border-collapse: collapse; table-layout: fixed; }
.master-data-table th { padding: 8px 10px; color: var(--muted); background: var(--surface-2); text-align: left; font-size: 9px; font-weight: 650; }
.master-data-table td { padding: 8px 10px; border-top: 1px solid #edf0f1; color: var(--text); font-size: 10px; vertical-align: middle; }
.master-data-table th:first-child, .master-data-table td:first-child { width: 22%; }
.master-data-table th:nth-child(2), .master-data-table td:nth-child(2) { width: 22%; }
.master-data-table th:nth-child(3), .master-data-table td:nth-child(3), .master-data-table th:nth-child(4), .master-data-table td:nth-child(4), .master-data-table th:nth-child(5), .master-data-table td:nth-child(5) { width: 15%; }
.master-data-table th:last-child, .master-data-table td:last-child { width: 11%; }
.master-data-table input { width: 100%; height: 30px; padding: 5px 7px; border: 1px solid var(--line-strong); border-radius: 4px; background: white; color: var(--text); font-size: 10px; }
.master-data-table input:focus { border-color: #dc8a76; }
.master-anchor-id { font-weight: 700; }
.master-anchor-meta { margin-top: 3px; color: var(--muted); font-size: 8px; }
.row-remove { padding: 0; border: 0; background: transparent; color: var(--accent-dark); font-size: 9px; }
.row-fixed { color: var(--subtle); font-size: 8px; }
.room-data-table th:first-child, .room-data-table td:first-child { width: 18%; }
.room-data-table th:nth-child(2), .room-data-table td:nth-child(2) { width: 22%; }
.room-data-table th:nth-child(3), .room-data-table td:nth-child(3) { width: 48%; }
.room-data-table th:last-child, .room-data-table td:last-child { width: 12%; }
.room-code { display: inline-grid; min-width: 24px; height: 22px; place-items: center; border-radius: 4px; color: #285c55; background: var(--teal-soft); font-size: 10px; font-weight: 750; }
.room-slot-editor { padding: 10px; }
.room-slot-card { border: 1px solid var(--line); background: var(--surface-2); }
.room-slot-card + .room-slot-card { margin-top: 10px; }
.room-slot-card-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-bottom: 1px solid var(--line); background: white; }
.room-slot-card-head strong { font-size: 10px; }
.room-slot-card-head span { color: var(--muted); font-size: 8px; }
.room-slot-card-head .link-button { margin-left: auto; }
.room-slot-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr .8fr .7fr; gap: 7px; align-items: center; padding: 6px 10px; }
.room-slot-grid + .room-slot-grid { border-top: 1px solid #e9edef; }
.room-slot-grid-head { color: var(--muted); font-size: 8px; }
.room-slot-grid input { width: 100%; height: 28px; padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: white; color: var(--text); font-size: 10px; }
.room-slot-index { color: var(--text); font-size: 9px; }
.room-slot-empty { padding: 12px 10px; color: var(--subtle); font-size: 9px; }

.popover { position: fixed; z-index: 20; top: 58px; right: 140px; width: 310px; max-height: 440px; overflow: auto; border: 1px solid var(--line); border-radius: 7px; background: white; box-shadow: var(--shadow); }
.popover-header { display: flex; justify-content: space-between; align-items: baseline; padding: 12px; border-bottom: 1px solid var(--line); }
.popover-header strong { font-size: 11px; }
.popover-header span { color: var(--muted); font-size: 8px; }
.version-row { display: flex; gap: 9px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.version-dot { width: 8px; height: 8px; flex: 0 0 8px; margin-top: 3px; border-radius: 50%; background: var(--teal); }
.version-copy { min-width: 0; flex: 1; }
.version-copy strong { display: block; font-size: 10px; }
.version-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.restore-button { align-self: center; border: 0; background: transparent; color: var(--accent-dark); font-size: 9px; }
.export-popover { right: 230px; width: 150px; padding: 5px; }
.export-popover button { width: 100%; padding: 8px 9px; border: 0; border-radius: 4px; background: white; text-align: left; color: var(--text); font-size: 10px; }
.export-popover button:hover { background: var(--surface-2); }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 22px; max-width: 420px; padding: 10px 14px; border-radius: 6px; color: white; background: #293033; box-shadow: var(--shadow); font-size: 11px; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #943d38; }
.loading-layer { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; background: rgb(242 244 245 / 76%); backdrop-filter: blur(2px); }
.loading-layer[hidden] { display: none; }
.solver-loader { width: 250px; display: flex; flex-direction: column; align-items: center; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: var(--shadow); }
.solver-loader i { width: 28px; height: 28px; margin-bottom: 12px; border: 3px solid #f5c3b7; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.solver-loader strong { font-size: 12px; }
.solver-loader span { margin-top: 6px; color: var(--muted); font-size: 9px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1280px) {
  body { min-width: 980px; }
  .workspace { grid-template-columns: 220px minmax(560px, 1fr) 280px; }
  .topbar { gap: 12px; }
  .brand-block { width: 178px; flex-basis: 178px; }
  .top-actions #versionButton { display: none; }
  .metric-cell { padding-right: 14px; padding-left: 14px; }
}

@media print {
  body { min-width: 0; background: white; }
  .topbar, .control-strip, .anchor-panel, .insight-panel, .schedule-footer { display: none !important; }
  .metric-strip { height: 70px; padding: 0; }
  .workspace { display: block; min-height: 0; }
  .schedule-panel { height: auto; border: 0; }
  .calendar-scroll { overflow: visible; }
  .calendar-grid { min-width: 0; }
  .day-content { min-height: 0; padding: 4px; }
  .shift-card { break-inside: avoid; box-shadow: none; }
}
