:root {
  --bg: #f6f7fb;
  --bg-2: #eef2f7;
  --card: rgba(255, 255, 255, 0.92);
  --card-strong: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(148, 163, 184, 0.3);
  --line-strong: rgba(71, 85, 105, 0.22);
  --teal: #0f766e;
  --cyan: #0f4c81;
  --blue: #1d4ed8;
  --amber: #b45309;
  --red: #c2410c;
  --purple: #7c3aed;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 4px 14px rgba(15, 23, 42, 0.05);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, 0.08), transparent 24%),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.08), transparent 22%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
}

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

.app-shell {
  min-height: 100vh;
  max-width: 1520px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.brand-mark {
  min-width: 58px;
  height: 42px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.12), rgba(15, 118, 110, 0.1));
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-copy h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.brand-copy p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
  opacity: 1;
}

.tabs {
  display: flex;
  gap: 10px;
  padding: 18px 2px 0;
  background: transparent;
}

.tab {
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  padding: 10px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  transition: all 140ms ease;
}

.tab:hover {
  color: var(--ink);
  transform: translateY(-1px);
}

.tab.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, #1d4ed8 0%, #0f766e 100%);
}

.page {
  padding: 18px 0 0;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 16px 18px;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

.compact-card {
  padding: 12px 14px;
}

.schedule-header-grid {
  display: grid;
  grid-template-columns: 1.15fr 1.2fr 0.95fr;
  gap: 14px;
  margin-bottom: 10px;
  align-items: stretch;
}

.simplified-header {
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
}

.current-week-card {
  min-width: 0;
}

.header-card {
  margin-bottom: 0;
}

.header-heading {
  margin-bottom: 14px;
}

.header-card-body {
  display: grid;
  gap: 12px;
}

.header-card-stack {
  align-content: start;
}

.header-actions-grid {
  display: grid;
  gap: 12px;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-carryover-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(248,250,252,0.95), rgba(255,255,255,0.98));
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.inline-carryover-copy {
  min-width: 0;
}

.inline-carryover-bar strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  color: var(--blue);
}

.inline-carryover-bar p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.inline-carryover-bar.is-ready {
  border-color: rgba(22, 163, 74, 0.18);
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.88), rgba(250, 247, 241, 0.9));
}

.inline-carryover-bar.is-ready strong {
  color: #166534;
}

.inline-carryover-bar.is-warn {
  border-color: rgba(183, 72, 43, 0.2);
  background: linear-gradient(135deg, rgba(255, 247, 237, 0.92), rgba(250, 247, 241, 0.9));
}

.inline-carryover-bar.is-warn strong {
  color: #9a3412;
}

.history-strip-card {
  margin-top: 0;
}

.history-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px) auto;
  gap: 16px;
  align-items: end;
}

.history-strip-copy h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--ink);
}

.history-strip-copy p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.history-select {
  min-width: 0;
}

.toolbar-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right,
.editor-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.mini-field,
.field-block {
  display: grid;
  gap: 6px;
}

.mini-field span,
.field-block span,
.panel-heading p,
.status-text {
  font-size: 12px;
  color: var(--muted);
}

.mini-field input,
.mini-field select,
.field-block textarea,
.config-table input[type="text"],
.config-table select {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  background: var(--card-strong);
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.mini-field input:focus,
.mini-field select:focus,
.field-block textarea:focus,
.config-table input[type="text"]:focus,
.config-table select:focus {
  outline: none;
  border-color: rgba(29, 78, 216, 0.36);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.08);
}

.config-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.config-table td {
  vertical-align: middle;
}

.config-table tr.important-row td {
  background: rgba(42, 92, 125, 0.04);
}

.config-table tr.warn-row td {
  background: rgba(183, 72, 43, 0.06);
}

.warn-input {
  border-color: rgba(183, 72, 43, 0.45) !important;
  background: rgba(254, 242, 242, 0.92) !important;
}

.first-run-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.first-run-collapsed {
  padding-bottom: 14px;
}

.first-run-collapsed .panel-heading {
  margin-bottom: 10px;
}

.first-run-collapsed .first-run-summary {
  margin-bottom: 0;
}

.first-run-body.hidden {
  display: none;
}

.first-run-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.first-run-chips span {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(42, 92, 125, 0.08);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.first-run-ok,
.first-run-warn {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
}

.first-run-ok {
  background: rgba(22, 163, 74, 0.09);
  color: #166534;
}

.first-run-warn {
  background: rgba(183, 72, 43, 0.09);
  color: #8f2f1a;
}

.inline-shift-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(42, 92, 125, 0.08);
  color: var(--ink);
}

.shift-button-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.warn-input-shell {
  padding: 6px;
  border-radius: 14px;
  background: rgba(254, 242, 242, 0.92);
  box-shadow: inset 0 0 0 1px rgba(183, 72, 43, 0.3);
}

.shift-choice {
  border: 1px solid rgba(42, 92, 125, 0.12);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.shift-choice:hover {
  transform: translateY(-1px);
}

.shift-choice.active {
  box-shadow: 0 10px 18px rgba(55, 37, 24, 0.12);
  border-color: transparent;
}

.shift-choice.choice-empty {
  color: var(--muted);
}

.shift-choice.choice-empty.active {
  background: rgba(95, 108, 120, 0.14);
  color: #475569;
}

.shift-choice.shift-ban.active {
  background: rgba(168, 85, 247, 0.16);
  color: #7e22ce;
}

.shift-choice.shift-a1.active {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
}

.shift-choice.shift-a2.active {
  background: rgba(20, 184, 166, 0.16);
  color: #0f766e;
}

.shift-choice.shift-agy.active,
.shift-choice.shift-gy.active {
  background: rgba(124, 58, 237, 0.16);
  color: #6d28d9;
}

.shift-choice.shift-monitor.active {
  background: rgba(14, 165, 233, 0.16);
  color: #0369a1;
}

.shift-choice.shift-mobile.active {
  background: rgba(249, 115, 22, 0.16);
  color: #c2410c;
}

.shift-choice.shift-p1.active {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.shift-choice.shift-n.active {
  background: rgba(99, 102, 241, 0.16);
  color: #4338ca;
}

.shift-choice.shift-p2.active {
  background: rgba(239, 68, 68, 0.16);
  color: #b91c1c;
}

.shift-choice.shift-qi.active {
  background: rgba(236, 72, 153, 0.16);
  color: #be185d;
}

.shift-choice.shift-rest.active,
.shift-choice.shift-leave.active {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}

.impact-strong {
  color: #8f2f1a;
  font-weight: 700;
}

.impact-soft {
  color: #2a5c7d;
  font-weight: 700;
}

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

.roster-name-input {
  min-width: 90px;
}

.pref-picker {
  position: relative;
  min-width: 210px;
}

.pref-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 140ms ease;
}

.pref-chip.active {
  color: white;
  background: linear-gradient(135deg, #2a5c7d, #4e7fa0);
  border-color: transparent;
  box-shadow: 0 10px 18px rgba(42, 92, 125, 0.18);
}

.pref-trigger {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  min-height: 44px;
}

.pref-trigger.empty {
  color: var(--muted);
}

.pref-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 12;
  width: 260px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.98);
  border: 1px solid rgba(42, 92, 125, 0.12);
  box-shadow: 0 20px 44px rgba(55, 37, 24, 0.16);
  backdrop-filter: blur(12px);
}

.pref-popover-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pref-popover-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.pref-mini {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #2a5c7d, #4e7fa0);
}

.field-block textarea {
  min-height: 110px;
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 12px;
  resize: vertical;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

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

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8 0%, #0f766e 100%);
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.2);
}

.btn-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  box-shadow: 0 10px 24px rgba(194, 65, 12, 0.18);
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(29, 78, 216, 0.08);
  color: var(--blue);
}

.rest-limit-row,
.stack,
.json-grid,
.summary-grid {
  display: grid;
  gap: 8px;
}

.rest-limit-row {
  grid-template-columns: repeat(7, minmax(70px, 1fr));
}

.rest-limit-chip {
  background: rgba(248, 250, 252, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 8px;
}

.rest-limit-title {
  display: grid;
  gap: 2px;
}

.rest-limit-chip strong {
  display: block;
  color: var(--teal);
  font-size: 13px;
}

.rest-limit-title small {
  font-size: 10px;
  color: var(--muted);
}

.chip-controls {
  display: flex;
  justify-content: center;
  align-items: center;
}

.compact-stepper {
  gap: 8px;
}

.chip-controls button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-strong);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
}

.chip-controls span {
  min-width: 34px;
  font-weight: 800;
  font-size: 24px;
  color: var(--blue);
}

.status-board-card {
  padding: 14px 16px;
}

.status-board-list {
  display: grid;
  gap: 10px;
}

.status-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 600;
}

.status-item-more {
  text-align: center;
  font-size: 12px;
}

.status-info {
  background: rgba(29, 78, 216, 0.06);
  border-color: rgba(29, 78, 216, 0.12);
  color: #1e3a8a;
}

.status-success {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.14);
  color: #166534;
}

.status-warn {
  background: rgba(234, 88, 12, 0.08);
  border-color: rgba(234, 88, 12, 0.14);
  color: #9a3412;
}

.status-muted {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.14);
  color: #475569;
}

.status-action {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.28);
  color: #1d4ed8;
  font-weight: 600;
}

.status-error {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
  color: #b91c1c;
  font-weight: 600;
}

.hidden {
  display: none;
}

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

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.panel-heading p {
  margin: 2px 0 0;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
}

.debug-card {
  border: 1px dashed #cbd5e1;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  font-size: 12px;
}

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

thead th {
  background: linear-gradient(180deg, rgba(248,250,252,0.98), rgba(241,245,249,0.96));
  color: #334155;
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 2;
}

.summary-table thead th,
.stats-table thead th {
  background: linear-gradient(180deg, rgba(219,234,254,0.72), rgba(248,250,252,0.96));
}

.name-col {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  background: rgba(255, 255, 255, 0.98);
  white-space: nowrap;
  min-width: 108px;
  font-weight: 800;
}

.schedule-row:nth-child(even) .name-col,
.schedule-row:nth-child(even) .name-col::before {
  background: rgba(248, 250, 252, 0.98);
}

.schedule-row:nth-child(even) td {
  background: rgba(248, 250, 252, 0.72);
}

.name-tags {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
}

.mini-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 9px;
  font-weight: 700;
}

.mini-tag.office {
  background: rgba(123, 92, 158, 0.12);
  color: #7b5c9e;
}

.mini-tag.backup {
  background: rgba(42, 92, 125, 0.12);
  color: #2a5c7d;
}

.mini-tag.agy {
  background: rgba(123, 92, 158, 0.12);
  color: #7b5c9e;
}

.mini-tag.new {
  background: rgba(182, 106, 34, 0.14);
  color: var(--amber);
}

.mini-tag.no-night {
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
}

.day-head small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: #94a3b8;
  font-weight: 500;
}

.shift-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-size: 11px;
  font-weight: 800;
}

.schedule-cell {
  position: relative;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.schedule-cell.is-up .popover,
.popover.popover-up {
  top: auto;
  bottom: calc(100% + 2px);
}

.schedule-cell:hover {
  background: rgba(29, 78, 216, 0.04);
  border-radius: 14px;
}

.schedule-cell.active {
  outline: 2px solid rgba(29, 78, 216, 0.28);
  outline-offset: -2px;
  border-radius: 14px;
}

.schedule-cell.locked {
  background: rgba(42, 92, 125, 0.08);
}

.schedule-cell.cell-leave {
  background: rgba(95, 108, 120, 0.12);
}

.schedule-cell.cell-conflict {
  background: rgba(183, 72, 43, 0.09);
}

.cell-inner {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 26px;
}

.oncall-mark {
  font-size: 13px;
  font-weight: 900;
}

.oncall-mark.oc2 {
  color: #16a34a;
}

.oncall-mark.oc3 {
  color: #dc2626;
}

.lock-mark {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 9px;
  color: #d97706;
}

.conflict-mark {
  position: absolute;
  top: 2px;
  left: 4px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: white;
  background: #b7482b;
}

.popover {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 236px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.16);
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 12px;
  backdrop-filter: blur(14px);
}

.popover-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.popover-grid button {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  padding: 8px 4px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  background: rgba(248, 250, 252, 0.92);
}

.popover-grid button.selected {
  transform: translateY(-1px);
  font-weight: 900;
}

.popover-actions {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.popover-actions button {
  border: none;
  border-radius: 10px;
  padding: 7px 4px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.popover-actions .oc-btn {
  background: rgba(42, 92, 125, 0.08);
  color: var(--blue);
}

.oncall-toggle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.toggle-btn {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.92);
  color: var(--muted);
  padding: 8px 4px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.toggle-btn.selected {
  color: white;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  border-color: transparent;
}

.toggle-btn.selected-oc2 {
  background: linear-gradient(135deg, #2f9d57, #16a34a);
}

.toggle-btn.selected-oc3 {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.popover-actions .lock-btn {
  background: rgba(183, 72, 43, 0.08);
  color: #8f2f1a;
}

.popover-actions .leave-btn {
  background: rgba(183, 72, 43, 0.1);
  color: #b7482b;
}

.popover-actions .leave-btn.active {
  background: rgba(183, 72, 43, 0.16);
  box-shadow: inset 0 0 0 1px rgba(183, 72, 43, 0.18);
}

.popover-actions .close-btn {
  background: rgba(95, 108, 120, 0.12);
  color: var(--muted);
}

.stat-bad {
  color: #8f2f1a;
  background: rgba(183, 72, 43, 0.08);
}

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

.field-block.wide {
  grid-column: span 2;
}

.micro-copy {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.compact-check {
  margin-top: 18px;
  white-space: nowrap;
}

.summary-table td.warn,
.stats-table td.warn {
  background: #fef2f2;
  color: var(--red);
}

.monthly-summary-strip {
  margin-bottom: 12px;
}

.monthly-quota-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 12px;
  font-size: 13px;
}

.monthly-month-label {
  font-weight: 600;
  color: var(--blue);
}

.monthly-quota-info {
  color: var(--text);
}

.monthly-workweeks-hint {
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
}

.monthly-mini-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.btn-xs {
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: white;
  cursor: pointer;
  color: var(--blue);
  line-height: 1.6;
}

.btn-xs:hover {
  background: rgba(99, 102, 241, 0.08);
}

.btn-xs.btn-secondary {
  color: var(--muted);
  border-color: rgba(0, 0, 0, 0.12);
}

.monthly-mini-card {
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(250,247,241,0.9));
  border: 1px solid rgba(42, 92, 125, 0.08);
}

.monthly-mini-card span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.monthly-mini-card strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  color: var(--blue);
  font-family: "STSong", "Songti SC", serif;
}

.rules-card {
  max-width: 760px;
}

.rule-box {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 8px;
}

.rule-box strong {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
}

.rules-params {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin: 8px 0 14px;
  display: grid;
  gap: 12px;
}

.rules-params-heading h3 {
  margin: 0 0 2px;
  font-size: 1rem;
  color: var(--blue);
}

.rules-params-heading p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted, #64748b);
}

.rules-param-block {
  display: grid;
  gap: 8px;
}

.rules-param-label strong {
  color: var(--blue);
}

.rules-param-label small {
  display: block;
  color: var(--text-muted, #64748b);
  font-size: 0.78rem;
}

.rules-allowance-stepper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.rules-allowance-value {
  min-width: 56px;
  text-align: center;
}

@media (max-width: 980px) {
  .schedule-header-grid,
  .summary-strip,
  .monthly-summary-strip,
  .rest-limit-row,
  .editor-grid,
  .json-grid {
    grid-template-columns: 1fr;
  }

  .history-strip {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .field-block.wide {
    grid-column: auto;
  }

  .toolbar-card {
    align-items: stretch;
  }
}
