:root {
  --bg: #f7f4ee;
  --panel: #fffdf8;
  --panel-soft: #f1f5ef;
  --text: #263238;
  --muted: #748079;
  --line: #d9d2c6;
  --line-strong: #bfb5a6;
  --accent: #5f8f86;
  --accent-2: #8fb7ad;
  --focus: #4f7f77;
  --focus-soft: #e8f0ed;
  --highlight: #fff3cf;
  --warning: #c89445;
  --danger: #b96b5f;
  --good: #6b9b74;
  --shadow: 0 14px 34px rgba(55, 66, 59, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #fffdf8 0, var(--bg) 260px, #fbfaf5 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.side-toggle {
  position: fixed;
  left: 0;
  top: 50%;
  z-index: 120;
  width: 20px;
  height: 42px;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 7px 7px 0;
  background: var(--panel);
  color: var(--accent);
  font-size: 13px;
  box-shadow: 0 5px 14px rgba(55, 66, 59, .12);
  opacity: .92;
}

body.side-collapsed .app-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

body.side-collapsed .side {
  padding: 0;
  overflow: hidden;
  border-right: 0;
}

body.side-collapsed .side > * {
  display: none;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  overflow: auto;
  background: linear-gradient(180deg, #fffdf8 0, #f4f0e8 100%);
  border-right: 1px solid var(--line);
}

.brand {
  position: relative;
  display: grid;
  gap: 5px;
  padding: 6px 2px 18px;
  border-bottom: 1px solid var(--line);
}

.brand strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1.15;
}

.brand span,
.side-block label,
.top p,
.top span,
.muted {
  color: var(--muted);
}

.side-block {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.side-block label {
  font-size: 13px;
}

select,
input,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  background: var(--panel);
  color: var(--text);
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(95, 143, 134, 0.18);
  outline: 0;
}

textarea {
  min-height: 86px;
  padding: 10px 11px;
  line-height: 1.55;
  resize: vertical;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 9px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.segmented button {
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--accent);
  color: #fffdf8;
}

.side-nav {
  display: grid;
  gap: 7px;
  margin-top: 18px;
}

.nav-main,
.ghost,
.actions button,
.small-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 0 12px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-group.open {
  padding: 5px;
  border: 1px solid #cdded8;
  border-radius: 10px;
  background: #f3f7f4;
}

.nav-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  width: 100%;
}

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

.nav-main i {
  width: 14px;
  color: #748079;
  font-style: normal;
}

.nav-main em,
.nav-product-main em {
  flex: 0 0 auto;
  border: 1px solid #bfd8d1;
  border-radius: 999px;
  padding: 3px 7px;
  background: #fffdf8;
  color: #4d7757;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.nav-main.active {
  background: #eaf2ed;
  border-color: #bfd8d1;
  color: #4d7757;
  font-weight: 700;
}

.nav-children {
  display: grid;
  gap: 5px;
  padding: 6px 0 6px 16px;
  border-left: 3px solid #8ec4e8;
  margin-left: 12px;
  background: linear-gradient(90deg, rgba(22, 119, 210, 0.08), transparent 55%);
}

.nav-children button {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #314256;
  padding: 0 10px;
  text-align: left;
}

.nav-children button:hover {
  background: #eaf2ed;
}

.nav-children button.active,
.nav-product.active > button {
  border-color: #bfd8d1;
  background: #eaf2ed;
  color: #4d7757;
  font-weight: 800;
}

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

.product-first-nav {
  display: grid;
  gap: 8px;
}

.nav-product-first.open {
  padding: 5px;
  border: 1px solid #cdded8;
  border-radius: 10px;
  background: #f3f7f4;
}

.nav-product-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: #fffdf8;
  color: var(--text);
  padding: 0 10px;
  font-size: 14px;
  text-align: left;
}

.nav-product-main span {
  display: inline-block;
  width: 14px;
  color: #748079;
}

.nav-product-main strong {
  flex: 1;
  font-size: inherit;
}

.nav-product.active > .nav-product-main {
  border-color: #bfd8d1;
  background: #eaf2ed;
  color: #4d7757;
  font-weight: 800;
}

.product-first-main {
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  font-weight: 900;
}

.product-first-main.single span {
  width: 0;
}

.product-nav-sections {
  display: grid;
  gap: 5px;
  padding: 6px 0 4px 18px;
  border-left: 3px solid #8ec4e8;
  margin-left: 14px;
  background: linear-gradient(90deg, rgba(22, 119, 210, 0.08), transparent 58%);
}

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

.nav-section-button {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.76);
  color: #314256;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.nav-section-button:hover,
.nav-section-button.active {
  border-color: #bfd8d1;
  background: #eaf2ed;
  color: #4d7757;
}

.nav-tables {
  display: grid;
  gap: 3px;
  padding: 1px 0 2px 24px;
  border-left: 2px solid #bddcff;
  margin-left: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.nav-tables button {
  min-height: 25px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  padding: 0 8px;
  font-size: 13px;
  color: #748079;
  text-align: left;
}

.product-first-tables {
  padding-left: 18px;
  margin-left: 10px;
  border-left-color: #cbd9d3;
  background: rgba(255, 255, 255, 0.46);
}

.ruitan-table-scroll {
  max-height: calc(100vh - 260px);
}

.ruitan-fill-table {
  min-width: 1140px;
  table-layout: fixed;
}

.ruitan-fill-table th,
.ruitan-fill-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px 7px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.28;
}

.ruitan-fill-table th {
  height: 62px;
  background: #4f9388;
  color: #fffdf8;
  font-size: 14px;
  font-weight: 900;
  white-space: normal;
}

.ruitan-fill-table td {
  background: #fffdf8;
  height: 36px;
}

.ruitan-fill-table .table-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 24px;
  border: 1px solid #c8dcd4;
  border-radius: 6px;
  background: #fffdf8;
  color: var(--text);
  text-align: center;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.ruitan-fill-table td:first-child {
  padding-left: 9px;
  padding-right: 9px;
}

.ruitan-fill-table td:first-child .table-input {
  min-width: 74px;
  padding-left: 6px;
  padding-right: 6px;
}

.ruitan-fill-table .ruitan-textarea {
  min-height: 26px;
  max-height: 44px;
  padding: 3px 6px;
  resize: none;
  text-align: center;
  line-height: 1.35;
}

.ruitan-fill-table .ruitan-textarea.is-filled {
  border-color: #3f7e58;
  background: #d7f0dd;
  color: #183f2a;
}

.ruitan-content-button {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d4cabd;
  border-radius: 7px;
  padding: 6px 8px;
  background: #fffdf8;
  color: #6f665d;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  cursor: pointer;
}

.ruitan-content-button:empty::after {
  content: "";
}

.ruitan-content-button.is-filled {
  border-color: #3f7e58;
  background: #d7f0dd;
  color: #183f2a;
}

.ruitan-fill-table .ruitan-filter-head {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.ruitan-fill-table .ruitan-filter-head span {
  font-size: 13px;
  line-height: 1.2;
}

.ruitan-fill-table .ruitan-filter-head label {
  width: 100%;
}

.ruitan-fill-table .ruitan-filter-head select {
  width: 100%;
  min-height: 25px;
  border: 1px solid rgba(255, 253, 248, .72);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-align-last: center;
  padding: 0 4px;
}

.ruitan-fill-table .row-action-cell {
  width: 76px;
  min-width: 76px;
  max-width: 76px;
  padding: 4px;
}

.ruitan-fill-table td.active-row input,
.ruitan-fill-table td.active-row textarea,
.ruitan-fill-table td.active-row select,
.ruitan-fill-table td.active-col input,
.ruitan-fill-table td.active-col textarea,
.ruitan-fill-table td.active-col select,
.ruitan-fill-table td.active-cell input,
.ruitan-fill-table td.active-cell textarea,
.ruitan-fill-table td.active-cell select,
.ruitan-fill-table td.active-label input,
.ruitan-fill-table td.active-label textarea,
.ruitan-fill-table td.active-label select {
  background: #fff8d7;
  color: var(--text);
  border-color: #8f7d35;
  box-shadow: inset 0 0 0 1px rgba(143, 125, 53, .16);
}

.ruitan-fill-table td.active-row .ruitan-textarea.is-filled,
.ruitan-fill-table td.active-col .ruitan-textarea.is-filled,
.ruitan-fill-table td.active-cell .ruitan-textarea.is-filled,
.ruitan-fill-table td.active-label .ruitan-textarea.is-filled {
  border-color: #3f7e58;
  background: #d7f0dd;
  color: #183f2a;
}

.ruitan-fill-table input:focus,
.ruitan-fill-table textarea:focus,
.ruitan-fill-table select:focus {
  outline: 2px solid #2f7d72;
  outline-offset: 1px;
  color: var(--text);
}

.nav-tables button:hover,
.nav-tables button.active {
  background: #eaf2ed;
  color: #4d7757;
  font-weight: 800;
}

.side-foot {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.side-foot a {
  color: var(--accent-2);
  text-decoration: none;
  font-size: 14px;
}

.main {
  min-width: 0;
  padding: 8px 10px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.top p,
.top h1,
.top span {
  margin: 0;
}

.top > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.top p {
  flex: 0 0 auto;
  font-size: 13px;
}

.top h1 {
  margin: 0;
  color: #263238;
  font-size: 18px;
  white-space: nowrap;
}

.top span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.actions button {
  min-height: 32px;
  padding: 0 12px;
}

.actions button:first-child {
  background: var(--accent);
  border-color: var(--accent);
  color: #fffdf8;
}

.content {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

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

.kpi,
.panel,
.customer-card,
.task-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kpi {
  padding: 16px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.panel {
  overflow: hidden;
}

.panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf8 0, #f5f0e8 100%);
}

.panel h2,
.panel h3 {
  margin: 0;
}

.panel h2 {
  font-size: 18px;
}

.panel h3 {
  font-size: 16px;
}

.panel-body {
  padding: 16px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 14px;
}

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

.management-hero {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.management-metric {
  display: grid;
  gap: 6px;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf8;
}

.management-metric span,
.management-metric small,
.product-summary span,
.product-summary small,
.staff-progress-card small {
  color: var(--muted);
}

.management-metric strong {
  color: #263238;
  font-size: 30px;
  line-height: 1;
}

.management-metric.good {
  border-color: #c7dccd;
  background: #f4f8f3;
}

.management-metric.warn {
  border-color: #dfc58e;
  background: #fff8ec;
}

.management-metric.bad {
  border-color: #d8b8ad;
  background: #fff8f1;
}

.management-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  gap: 14px;
}

.product-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.product-summary {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf8;
}

.product-summary > div:first-child,
.summary-rate,
.staff-progress-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-summary strong {
  display: block;
  color: #263238;
  font-size: 18px;
}

.summary-rate b {
  color: #5f7f9b;
  font-size: 24px;
}

.staff-board,
.focus-list,
.issue-list {
  display: grid;
  gap: 10px;
}

.staff-progress-card,
.focus-item,
.issue-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffdf8;
}

.staff-progress-card {
  align-items: stretch;
}

.rank {
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #eaf2ed;
  color: #4d7757;
  font-weight: 900;
}

.staff-progress-main {
  display: grid;
  flex: 1;
  gap: 7px;
}

.staff-progress-main > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.staff-progress-main b.good,
.staff-progress-main b.warn,
.staff-progress-main b.bad {
  justify-self: start;
}

.bar i.good {
  background: #6b9b74;
}

.bar i.warn {
  background: #c89445;
}

.bar i.bad {
  background: #bd7b6d;
}

.focus-item strong,
.issue-card strong {
  display: block;
  color: #263238;
}

.focus-item span {
  display: inline-block;
  margin-top: 6px;
  color: #5f8f86;
  font-weight: 800;
}

.focus-item p,
.issue-card p,
.monthly-summary p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.issue-card.warn {
  border-color: #dfc58e;
  background: #fff6e8;
}

.issue-card.bad {
  border-color: #e2b7ad;
  background: #fff1ed;
}

.monthly-summary {
  display: grid;
  gap: 12px;
}

.compact-charts {
  display: grid;
  gap: 10px;
}

.compact-charts details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.compact-charts summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 900;
}

.compact-charts summary span {
  color: var(--muted);
  font-weight: 700;
}

.compact-chart-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.product-tabs,
.table-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f5fafb;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.source-head.compact {
  min-height: 54px;
}

.source-head-simple {
  justify-content: space-between;
}

.source-title-inline {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 0 0 auto;
  min-width: auto;
}

.source-title-inline h2 {
  margin: 0;
  font-size: 17px;
  white-space: nowrap;
}

.source-title-inline span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.switch-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
}

.switch-group > span {
  padding-left: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.table-group {
  margin-left: 4px;
}

.switch-group .product-tabs,
.switch-group .table-tabs {
  gap: 4px;
}

.product-tabs button,
.table-tabs button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
  padding: 0 12px;
}

.product-tabs button.active,
.table-tabs button.active {
  color: #fffdf8;
  border-color: var(--accent-2);
  background: var(--accent-2);
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid .span-3 {
  grid-column: span 3;
}

.upgrade-workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: calc(100vh - 190px);
}

.compact-scroll {
  max-height: calc(100vh - 280px);
}

.upgrade-split {
  display: grid;
  grid-template-columns: minmax(640px, .95fr) minmax(560px, 1.05fr);
  min-height: calc(100vh - 190px);
}

.upgrade-overview-side {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #f5f0e8;
}

.upgrade-list {
  border-right: 1px solid var(--line);
  background: #f5f0e8;
  min-width: 0;
}

.upgrade-list-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f5f0e8;
}

.upgrade-table-actions {
  display: flex;
  gap: 8px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.upgrade-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fffdf8;
}

.upgrade-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.upgrade-cards {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 250px);
  overflow: auto;
  padding: 12px;
}

.upgrade-card {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fffdf8;
  text-align: left;
}

.upgrade-card.active {
  border-color: #a5b4fc;
  background: #eaf2ed;
}

.upgrade-card strong {
  color: #263238;
}

.upgrade-card span,
.upgrade-card small {
  color: var(--muted);
}

.upgrade-detail {
  min-width: 0;
  overflow: auto;
  padding: 16px;
}

.upgrade-overview-table {
  min-width: 1420px;
  font-size: 13px;
}

.upgrade-overview-table.compact {
  min-width: 1180px;
}

.upgrade-overview-table th {
  height: 42px;
  padding: 7px 8px;
  white-space: nowrap;
}

.upgrade-overview-table td {
  padding: 7px 8px;
  white-space: nowrap;
}

.upgrade-overview-table tr {
  cursor: pointer;
}

.upgrade-overview-table tr.active td {
  background: #e8f0ed;
  box-shadow: inset 0 1px 0 #7fa89f, inset 0 -1px 0 #7fa89f;
}

.upgrade-sheet {
  display: grid;
  min-height: calc(100vh - 215px);
  grid-template-rows: minmax(0, 1fr);
}

.upgrade-sheet-scroll {
  max-height: calc(100vh - 252px);
  padding-right: 8px;
}

.upgrade-sheet-table {
  min-width: 1970px;
  table-layout: fixed;
  font-size: 14px;
  isolation: isolate;
}

.upgrade-sheet-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 44px;
  padding: 5px 6px;
  background: #5f8f86;
  color: #fffdf8;
  white-space: normal;
  line-height: 1.2;
}

.upgrade-sheet-table thead tr:nth-child(2) th {
  top: 44px;
  height: 32px;
  background: #6f9d94;
  font-size: 13px;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.upgrade-sheet-table th.fixed-head-rowspan,
.upgrade-sheet-table th.plain-head-rowspan,
.upgrade-sheet-table th.rowspan-head {
  height: 76px;
  vertical-align: middle;
}

.upgrade-sheet-table .week-group-title {
  background: #5a897f;
  border-left: 2px solid #b8d2cb;
  border-right: 2px solid #b8d2cb;
}

.upgrade-sheet-table .week-group-title span {
  display: inline-block;
  margin: 0 4px;
}

.upgrade-sheet-table th span {
  display: block;
  word-break: keep-all;
  overflow-wrap: normal;
  text-align: center;
}

.upgrade-sheet-table .head-stack {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  height: 100%;
}

.upgrade-sheet-table .filter-head {
  padding: 4px 5px;
}

.upgrade-sheet-table .filter-head .head-stack > span {
  font-size: 13px;
}

.upgrade-sheet-table .filter-head label {
  display: block;
  width: 100%;
}

.upgrade-sheet-table .filter-head select {
  width: 100%;
  min-height: 28px;
  border: 1px solid rgba(255, 253, 248, .65);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-align-last: center;
  padding: 0 4px;
}

.upgrade-sheet-table th .date-range-label {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.upgrade-sheet-table th .status-label {
  margin-top: 2px;
  color: rgba(255, 253, 248, 0.82);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.upgrade-sheet-table td {
  position: relative;
  z-index: 1;
  height: 38px;
  padding: 4px 5px;
}

.upgrade-sheet-table input,
.upgrade-sheet-table select {
  min-height: 30px;
  height: 30px;
  border-radius: 7px;
  padding: 0 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.upgrade-sheet-table td.numeric-col input,
.upgrade-sheet-table td.actual-week-col input {
  padding: 0 5px;
}

.upgrade-sheet-table .calc-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 7px;
  background: #eaf2ed;
  color: #426f64;
  font-size: 14px;
  font-weight: 800;
}

.upgrade-sheet-table .fixed-cell-text {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  width: 100%;
  border: 1px solid #d8ccbb;
  border-radius: 7px;
  background: #fffdf8;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
  white-space: normal;
  word-break: keep-all;
}

.upgrade-sheet-table .fixed-cell-input {
  position: relative;
  z-index: 3;
  width: 100%;
  padding: 0 4px;
  background: #fffdf8;
  border-color: #d8ccbb;
  font-weight: 900;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.detail-status-control {
  display: grid;
  grid-template-columns: minmax(64px, 1fr);
  gap: 5px;
  align-items: center;
}

.detail-status-button {
  min-height: 30px;
  border: 1px solid #d4cabd;
  border-radius: 7px;
  padding: 0 5px;
  width: 100%;
  background: #f4efe6;
  color: #80776a;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-status-control.is-on .detail-status-button {
  border-color: #3f7e58;
  background: #d7f0dd;
  color: #173c25;
  box-shadow: inset 0 0 0 1px rgba(63, 126, 88, .28), 0 1px 3px rgba(61, 96, 70, .14);
}

.detail-status-control.needs-detail .detail-status-button {
  border-color: #3f7e58;
  background: #d7f0dd;
  color: #173c25;
  box-shadow: inset 0 0 0 1px rgba(63, 126, 88, .28), 0 1px 3px rgba(61, 96, 70, .14);
}

.detail-status-control.has-detail .detail-status-button {
  border-color: #3f7e58;
  background: #d7f0dd;
  color: #173c25;
  min-height: 34px;
  padding: 4px 6px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  line-height: 1.35;
  box-shadow: inset 0 0 0 1px rgba(63, 126, 88, .28), 0 1px 3px rgba(61, 96, 70, .14);
}

.academic-work-button {
  min-height: 32px;
  width: 100%;
  border: 1px solid #d4cabd;
  border-radius: 7px;
  padding: 4px 6px;
  background: #fffdf8;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}

.academic-work-button.is-done {
  border-color: #3f7e58;
  background: #d7f0dd;
  color: #173c25;
  box-shadow: inset 0 0 0 1px rgba(63, 126, 88, .28), 0 1px 3px rgba(61, 96, 70, .14);
}

.academic-work-button.is-none {
  color: #8d8375;
}

.upgrade-sheet-table thead tr:first-child th:nth-child(2),
.upgrade-sheet-table td:nth-child(2) {
  position: sticky;
  left: 0;
  z-index: 80;
}

.upgrade-sheet-table thead tr:first-child th:nth-child(3),
.upgrade-sheet-table td:nth-child(3) {
  position: sticky;
  left: 76px;
  z-index: 80;
}

.upgrade-sheet-table thead tr:first-child th:nth-child(4),
.upgrade-sheet-table td:nth-child(4) {
  position: sticky;
  left: 204px;
  z-index: 80;
}

.upgrade-sheet-table thead tr:first-child th:nth-child(5),
.upgrade-sheet-table td:nth-child(5) {
  position: sticky;
  left: 310px;
  z-index: 80;
}

.upgrade-sheet-table td:nth-child(2),
.upgrade-sheet-table td:nth-child(3),
.upgrade-sheet-table td:nth-child(4),
.upgrade-sheet-table td:nth-child(5) {
  background: #f5f0e8;
  font-weight: 700;
  background-clip: padding-box;
}

.upgrade-sheet-table td:nth-child(2) > *,
.upgrade-sheet-table td:nth-child(3) > *,
.upgrade-sheet-table td:nth-child(4) > *,
.upgrade-sheet-table td:nth-child(5) > * {
  position: relative;
  z-index: 2;
}

.upgrade-sheet-table td:nth-child(2)::before,
.upgrade-sheet-table td:nth-child(3)::before,
.upgrade-sheet-table td:nth-child(4)::before,
.upgrade-sheet-table td:nth-child(5)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #f5f0e8;
  pointer-events: none;
}

.upgrade-sheet-table thead tr:first-child th:nth-child(5),
.upgrade-sheet-table td:nth-child(5) {
  box-shadow: 7px 0 10px -8px rgba(55, 66, 59, .42);
}

.upgrade-sheet-table thead tr:first-child th:nth-child(2),
.upgrade-sheet-table thead tr:first-child th:nth-child(3),
.upgrade-sheet-table thead tr:first-child th:nth-child(4),
.upgrade-sheet-table thead tr:first-child th:nth-child(5) {
  background: #5f8f86;
  z-index: 100;
}

.upgrade-sheet-table thead tr:first-child th:nth-child(5)::after {
  content: "";
  position: absolute;
  top: 0;
  right: -10px;
  bottom: 0;
  width: 10px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(95, 143, 134, .95), rgba(95, 143, 134, 0));
}

.upgrade-sheet-table th.week-group-start,
.upgrade-sheet-table td.week-group-start,
.upgrade-sheet-table th.week-group-single,
.upgrade-sheet-table td.week-group-single {
  border-left: 2px solid #b8d2cb;
}

.upgrade-sheet-table th.week-group-end,
.upgrade-sheet-table td.week-group-end,
.upgrade-sheet-table th.week-group-single,
.upgrade-sheet-table td.week-group-single {
  border-right: 2px solid #b8d2cb;
}

.upgrade-sheet-table th.week-group-start,
.upgrade-sheet-table th.week-group-mid,
.upgrade-sheet-table th.week-group-end,
.upgrade-sheet-table th.week-group-single {
  background: #6f9d94;
}

.upgrade-sheet-table td.week-group-start,
.upgrade-sheet-table td.week-group-mid,
.upgrade-sheet-table td.week-group-end,
.upgrade-sheet-table td.week-group-single {
  background: #f7f2e9;
}

.upgrade-sheet-table td.future-week-cell {
  background: #efebe3;
  opacity: .7;
}

.upgrade-sheet-table td.future-week-cell input,
.upgrade-sheet-table td.future-week-cell button,
.upgrade-sheet-table td.future-week-cell select {
  cursor: not-allowed;
  background: #e8e2d8;
  color: #7a7168;
}

.upgrade-sheet-table td.has-work-cell input {
  border-color: #3f7e58;
  background: #d7f0dd;
  color: #173c25;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(63, 126, 88, .28), 0 1px 3px rgba(61, 96, 70, .14);
}

.upgrade-sheet-table td.no-work-cell input::placeholder {
  color: #8d8375;
  font-weight: 800;
}

.upgrade-sheet-table tr:nth-child(even) td.week-group-start,
.upgrade-sheet-table tr:nth-child(even) td.week-group-mid,
.upgrade-sheet-table tr:nth-child(even) td.week-group-end,
.upgrade-sheet-table tr:nth-child(even) td.week-group-single {
  background: #f0eadf;
}

.upgrade-sheet-table th:last-child,
.upgrade-sheet-table td:last-child {
  width: 128px;
  min-width: 128px;
  white-space: nowrap;
  text-align: center;
}

.upgrade-sheet-table .row-action-cell {
  width: 128px;
  padding: 4px 6px;
}

.upgrade-detail-form {
  display: grid;
  gap: 16px;
}

.upgrade-detail-form section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf8;
}

.upgrade-detail-form h3 {
  margin: 0 0 12px;
  color: #263238;
}

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

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

.quarter-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.quarter-card strong {
  color: #5f8f86;
  font-size: 18px;
}

.quarter-card label,
.week-action-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.week-action-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.week-action-grid textarea {
  min-height: 88px;
  resize: vertical;
}

.future-week-action {
  opacity: .55;
}

.future-week-action textarea {
  cursor: not-allowed;
  background: #eef2f5;
}

.upgrade-save-row {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 12px 0 0;
  background: linear-gradient(transparent, #fffdf8 35%);
}

.primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #fffdf8;
}

.table-scroll {
  position: relative;
  overflow: auto;
  max-height: calc(100vh - 126px);
  border-top: 1px solid var(--line);
  cursor: grab;
  scrollbar-gutter: stable both-edges;
  touch-action: pan-x pan-y;
  user-select: none;
  -webkit-overflow-scrolling: touch;
}

.table-scroll.dragging {
  cursor: grabbing;
}

.table-scroll.dragging input,
.table-scroll.dragging textarea,
.table-scroll.dragging select,
.table-scroll.dragging button,
.table-scroll.dragging [contenteditable="true"] {
  cursor: grabbing;
  pointer-events: none;
  user-select: none;
}

.table-scroll input,
.table-scroll textarea,
.table-scroll select,
.table-scroll button,
.table-scroll [contenteditable="true"] {
  cursor: auto;
  user-select: text;
}

table {
  width: 100%;
  min-width: 1100px;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  background: #fffdf8;
}

caption {
  display: none;
}

.source-table {
  margin-bottom: 22px;
  table-layout: fixed;
}

.source-table td {
  padding: 8px 10px;
}

.source-table input,
.source-table textarea,
.source-table button,
.source-table .calc-cell,
.source-table .readonly-name-list {
  text-align: center;
}

.source-table input,
.source-table textarea,
.source-table .calc-cell {
  font-weight: 700;
}

.source-table-visit {
  table-layout: fixed;
  min-width: 980px;
}

.source-table-visit td {
  height: 48px;
  padding: 6px 8px;
  box-sizing: border-box;
}

.source-table-visit input,
.source-table-visit textarea {
  min-height: 32px;
  border-radius: 7px;
  padding: 0 8px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #263238;
}

.source-table-visit td > input,
.source-table-visit td > textarea {
  width: 100%;
}

.source-table-visit .name-list-cell textarea {
  min-height: 32px;
  height: 32px;
  padding: 6px 8px;
  line-height: 1.35;
  resize: vertical;
}

.source-table-visit .calc-cell {
  font-size: 15px;
  font-weight: 700;
  color: #4d7757;
}

.source-table-meeting input,
.source-table-meeting textarea,
.source-table-meeting .name-list-button,
.source-table-meeting .calc-cell {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}

.source-table-meeting td > input,
.source-table-meeting td > textarea {
  width: 100%;
}

.source-table-meeting .name-list-cell textarea {
  min-height: 36px;
  height: 36px;
  padding: 7px 9px;
  line-height: 1.35;
  resize: vertical;
}

th,
td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 11px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.45;
}

.source-table th {
  min-width: 82px;
  height: 66px;
  padding: 8px 10px;
  line-height: 1.25;
  white-space: normal;
}

.source-table th span {
  display: block;
}

.source-table .week-head {
  white-space: normal;
}

.source-table .week-head span {
  display: block;
  white-space: nowrap;
}

.source-table .week-head span:first-child {
  font-size: 16px;
}

.source-table .week-head span:last-child {
  font-size: 14px;
}

.source-table .future-week-head {
  background: #5b7fa3;
  color: rgba(255,255,255,.72);
}

.source-table th:first-child,
.source-table td:first-child {
  min-width: 118px;
  width: 128px;
  max-width: 150px;
  white-space: nowrap;
}

.source-table td:first-child input {
  min-width: 96px;
  width: 108px;
  text-align: center;
}

.source-table-ice th:first-child,
.source-table-ice td:first-child,
.source-table-meeting th:first-child,
.source-table-meeting td:first-child {
  min-width: 112px;
  width: 116px;
  max-width: 116px;
}

.source-table-ice td:first-child input,
.source-table-meeting td:first-child input {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 0 6px;
  box-sizing: border-box;
}

.source-table th:nth-child(2),
.source-table td:nth-child(2) {
  min-width: 74px;
  width: 82px;
}

.source-table th:nth-child(3),
.source-table td:nth-child(3),
.source-table th:nth-child(4),
.source-table td:nth-child(4),
.source-table th:nth-child(5),
.source-table td:nth-child(5),
.source-table th:nth-child(6),
.source-table td:nth-child(6),
.source-table th:nth-child(7),
.source-table td:nth-child(7),
.source-table th:nth-child(8),
.source-table td:nth-child(8) {
  min-width: 92px;
  width: 92px;
}

.source-table .week-head,
.source-table .week-number-cell,
.source-table .week-name-cell {
  min-width: 126px !important;
  width: 126px !important;
  max-width: 126px !important;
}

.source-table .week-number-cell,
.source-table .week-name-cell {
  padding: 6px 8px;
}

.source-table-deep-hospital th:first-child,
.source-table-deep-hospital td:first-child {
  min-width: 88px;
  width: 88px;
  max-width: 88px;
}

.source-table-deep-hospital th:nth-child(2),
.source-table-deep-hospital td:nth-child(2) {
  min-width: 136px;
  width: 136px;
  max-width: 136px;
}

.source-table-deep-hospital td:first-child input,
.source-table-deep-hospital td:nth-child(2) input {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.source-table-visit th:nth-child(2),
.source-table-visit td:nth-child(2) {
  min-width: 118px;
  width: 126px;
  max-width: 126px;
}

.source-table-visit td:nth-child(2) input {
  min-width: 0;
  width: 100%;
  text-align: center;
}

.source-table-visit th:first-child,
.source-table-visit td:first-child {
  min-width: 112px;
  width: 116px;
  max-width: 116px;
}

.source-table-visit td:first-child input {
  min-width: 0;
  width: 100%;
  padding: 0 5px;
}

.source-table-visit th:nth-child(6),
.source-table-visit td:nth-child(6),
.source-table-visit th:nth-child(7),
.source-table-visit td:nth-child(7),
.source-table-visit th:nth-child(8),
.source-table-visit td:nth-child(8),
.source-table-visit th:nth-child(9),
.source-table-visit td:nth-child(9) {
  min-width: 82px;
  width: 82px;
  max-width: 82px;
}

.source-table-visit th:nth-child(10),
.source-table-visit td:nth-child(10) {
  min-width: 138px;
  width: 150px;
  max-width: 150px;
}

.source-table-visit .issue-cell,
.source-table-visit .control-head {
  min-width: 54px;
  width: 58px;
  max-width: 58px;
}

.source-table-visit .issue-pill {
  max-width: 68px;
  padding: 0 6px;
}

.source-table-visit .issue-pill span {
  display: none;
}

.source-table-visit .merged-owner-cell,
.source-table-visit .visit-owner-merged {
  background: #eaf7ff;
}

.source-table-visit .visit-owner-merged {
  position: sticky;
  left: 0;
  z-index: 26;
  vertical-align: middle;
}

.source-table-visit th:first-child {
  z-index: 36;
}

.source-table-visit tbody .visit-owner-merged {
  z-index: 26;
}

.source-table-visit tbody tr:not(.total-row) td:first-child:not(.visit-owner-merged) {
  position: static;
  left: auto;
  z-index: auto;
}

.source-table-visit .owner-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: calc(100% - 8px);
  min-height: 100%;
  margin: 0 auto;
}

.source-table-visit .owner-center input {
  min-height: 28px;
  height: 28px;
}

.source-table-visit .visit-group-end td {
  border-bottom: 2px solid #a5b4fc;
}

.mini-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 6px;
  border: 1px solid #bfd8d1;
  border-radius: 999px;
  background: #eaf2ed;
  color: #4d7757;
  font-size: 11px;
  font-weight: 900;
}

.source-table-visit .row-action-cell {
  vertical-align: middle;
}

.visit-week-input {
  min-width: 58px;
  width: 58px;
  max-width: 58px;
  min-height: 30px;
  padding: 0 8px;
  text-align: center;
  font-weight: 700;
  color: #263238;
}

.future-week-cell {
  background: #f4f7f9;
}

.future-week-cell input,
.future-week-cell button {
  cursor: not-allowed;
  opacity: .45;
  background: #eef2f5 !important;
  color: #6f7b83 !important;
}

.name-list-cell textarea {
  min-width: 140px;
  min-height: 34px;
  height: 36px;
  white-space: normal;
  line-height: 1.35;
  padding: 6px 8px;
  resize: vertical;
}

.source-table .empty-head {
  background: #eef3f7;
  color: transparent;
}

.source-table .control-head,
.source-table .row-action-head {
  min-width: 70px;
  width: 76px;
  max-width: 76px;
}

.source-table .issue-cell,
.source-table .row-action-cell {
  min-width: 46px;
  width: 76px;
  max-width: 76px;
  padding: 5px;
}

.row-action-cell {
  white-space: nowrap;
}

.row-action-cell .icon-button + .icon-button {
  margin-left: 4px;
}

.source-table .remark-head,
.source-table .name-list-cell {
  min-width: 150px;
  width: 170px;
  max-width: 210px;
}

th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #5f8f86;
  color: #fffdf8;
  font-weight: 800;
}

td:first-child,
th:first-child {
  position: sticky;
  left: 0;
  z-index: 25;
}

td:first-child {
  background: var(--panel);
  font-weight: 700;
  white-space: nowrap;
}

th:first-child {
  z-index: 35;
}

.upgrade-sheet-table thead tr:first-child th:nth-child(1) {
  left: auto;
  z-index: 4;
}

.upgrade-sheet-table td:nth-child(1) {
  position: relative;
  left: auto;
  z-index: 1;
}

td.active-row,
th.active-row {
  background: var(--highlight) !important;
}

td.active-col,
th.active-col {
  background: var(--highlight) !important;
}

th.active-row,
th.active-col,
th.active-cell {
  color: var(--text) !important;
}

th.active-row .status-label,
th.active-col .status-label,
th.active-cell .status-label {
  color: var(--text) !important;
}

td.active-cell,
th.active-cell {
  position: relative;
  z-index: 40;
  background: var(--highlight) !important;
  outline: 3px solid var(--focus);
  outline-offset: -2px;
  box-shadow: none;
}

th.active-head {
  background: var(--focus) !important;
  color: #fffdf8;
  font-weight: 900;
  box-shadow: none;
}

td.active-label {
  position: relative;
  z-index: 30;
  background: var(--highlight) !important;
  color: var(--text);
  font-weight: 900;
  box-shadow: inset 4px 0 0 var(--focus), inset 0 0 0 1px rgba(44, 117, 97, .28);
}

th.active-head {
  color: #fffdf8 !important;
  border-color: #2f5f58 !important;
  box-shadow: inset 0 0 0 2px rgba(255, 253, 248, .58);
}

th.active-head span,
th.active-head .head-stack,
th.active-head .status-label {
  color: #fffdf8 !important;
}

th.active-cell {
  outline: 0;
  background: var(--focus) !important;
  color: #fffdf8 !important;
}

tr.total-row td.active-row,
tr.total-row td.active-col,
tr.total-row td.active-cell,
tr.total-row td.active-label {
  background: #6c9088 !important;
  color: #fffdf8 !important;
}

tr.total-row td.active-cell {
  outline: 0;
}

td.active-row input,
td.active-row textarea,
td.active-row select,
td.active-row .detail-status-button,
td.active-row .academic-work-button,
td.active-row .fixed-cell-text,
td.active-row .fixed-cell-input,
td.active-row .calc-cell,
td.active-col input,
td.active-col textarea,
td.active-col select,
td.active-col .detail-status-button,
td.active-col .academic-work-button,
td.active-col .fixed-cell-text,
td.active-col .fixed-cell-input,
td.active-col .calc-cell {
  background: var(--highlight) !important;
}

td.active-cell input,
td.active-cell textarea,
td.active-cell select,
td.active-cell .detail-status-button,
td.active-cell .academic-work-button,
td.active-cell .fixed-cell-text,
td.active-cell .fixed-cell-input,
td.active-cell .calc-cell,
td.active-label input,
td.active-label textarea,
td.active-label select,
td.active-label .detail-status-button,
td.active-label .academic-work-button,
td.active-label .fixed-cell-text,
td.active-label .fixed-cell-input,
td.active-label .calc-cell {
  border-color: var(--focus) !important;
  background: var(--highlight) !important;
  color: var(--text) !important;
  box-shadow: inset 0 0 0 1px rgba(44, 117, 97, .2) !important;
  outline: none;
  outline-offset: 0;
}

td.active-row input,
td.active-col input,
td.active-cell input,
td.active-label input,
td.active-row textarea,
td.active-col textarea,
td.active-cell textarea,
td.active-label textarea,
td.active-row select,
td.active-col select,
td.active-cell select,
td.active-label select,
td.active-row button,
td.active-col button,
td.active-cell button,
td.active-label button,
td.active-row .detail-status-control,
td.active-col .detail-status-control,
td.active-cell .detail-status-control,
td.active-label .detail-status-control,
td.active-row .academic-work-button,
td.active-col .academic-work-button,
td.active-cell .academic-work-button,
td.active-label .academic-work-button,
td.active-row .ruitan-content-button,
td.active-col .ruitan-content-button,
td.active-cell .ruitan-content-button,
td.active-label .ruitan-content-button,
td.active-row .name-list-button,
td.active-col .name-list-button,
td.active-cell .name-list-button,
td.active-label .name-list-button,
td.active-row .readonly-name-list,
td.active-col .readonly-name-list,
td.active-cell .readonly-name-list,
td.active-label .readonly-name-list,
td.active-row .week-count,
td.active-col .week-count,
td.active-cell .week-count,
td.active-label .week-count,
td.active-row .calc-cell,
td.active-col .calc-cell,
td.active-cell .calc-cell,
td.active-label .calc-cell {
  position: relative;
  z-index: 2;
}

.source-table td.active-label:first-child input,
.source-table-meeting td.active-label:first-child input {
  min-width: 88px;
  width: calc(100% - 8px);
}

td.active-row .detail-status-control.is-on .detail-status-button,
td.active-row .detail-status-control.has-detail .detail-status-button,
td.active-row .academic-work-button.is-done,
td.active-col .detail-status-control.is-on .detail-status-button,
td.active-col .detail-status-control.has-detail .detail-status-button,
td.active-col .academic-work-button.is-done,
td.active-cell .detail-status-control.is-on .detail-status-button,
td.active-cell .detail-status-control.has-detail .detail-status-button,
td.active-cell .academic-work-button.is-done,
td.active-label .detail-status-control.is-on .detail-status-button,
td.active-label .detail-status-control.has-detail .detail-status-button,
td.active-label .academic-work-button.is-done {
  border-color: #3f7e58 !important;
  background: #d7f0dd !important;
  color: #173c25 !important;
}

td.active-cell .detail-status-control.is-on .detail-status-button,
td.active-cell .detail-status-control.has-detail .detail-status-button,
td.active-cell .academic-work-button.is-done,
td.active-label .detail-status-control.is-on .detail-status-button,
td.active-label .detail-status-control.has-detail .detail-status-button,
td.active-label .academic-work-button.is-done {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.upgrade-sheet-table td.active-row:nth-child(2)::before,
.upgrade-sheet-table td.active-row:nth-child(3)::before,
.upgrade-sheet-table td.active-row:nth-child(4)::before,
.upgrade-sheet-table td.active-row:nth-child(5)::before,
.upgrade-sheet-table td.active-col:nth-child(2)::before,
.upgrade-sheet-table td.active-col:nth-child(3)::before,
.upgrade-sheet-table td.active-col:nth-child(4)::before,
.upgrade-sheet-table td.active-col:nth-child(5)::before,
.upgrade-sheet-table td.active-cell:nth-child(2)::before,
.upgrade-sheet-table td.active-cell:nth-child(3)::before,
.upgrade-sheet-table td.active-cell:nth-child(4)::before,
.upgrade-sheet-table td.active-cell:nth-child(5)::before,
.upgrade-sheet-table td.active-label:nth-child(2)::before,
.upgrade-sheet-table td.active-label:nth-child(3)::before,
.upgrade-sheet-table td.active-label:nth-child(4)::before,
.upgrade-sheet-table td.active-label:nth-child(5)::before {
  background: var(--highlight) !important;
}

.cell-guide {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 8px 0 6px;
  padding: 0 12px;
  border: 1px solid #cbd8d0;
  border-radius: 8px;
  background: #eaf2ed;
  color: #4d7757;
  font-size: 13px;
  font-weight: 800;
}

tbody tr:nth-child(even) td {
  background: #f8faf7;
}

tbody tr:nth-child(even) td:first-child {
  background: #f8faf7;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eaf2ed;
  color: #5d6f94;
  font-size: 13px;
  font-weight: 700;
}

.chip.good {
  background: #edf6ee;
  color: var(--good);
}

.chip.warn {
  background: #fff3df;
  color: var(--warning);
}

.chip.bad {
  background: #fff5f1;
  color: var(--danger);
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece8;
  margin-top: 7px;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5f8f86, #9dbfb4);
}

.calc-cell {
  display: inline-flex;
  min-width: 56px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #eaf2ed;
  color: #4d7757;
  font-weight: 800;
}

.total-row td {
  background: #6c9088 !important;
  color: #fffdf8;
  font-weight: 900;
}

.total-row .calc-cell {
  background: transparent;
  color: #fffdf8;
  border: 0;
}

.total-row input,
.total-row textarea,
.total-row select,
.total-row button,
.total-row .week-count,
.total-row .name-list-button,
.total-row .readonly-name-list {
  background: rgba(255, 253, 248, .22) !important;
  border-color: rgba(255, 253, 248, .58) !important;
  color: #fffdf8 !important;
  font-weight: 900;
}

.total-row .week-count,
.total-row .week-number {
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

.total-row td.active-row input,
.total-row td.active-row textarea,
.total-row td.active-row select,
.total-row td.active-row button,
.total-row td.active-row .week-count,
.total-row td.active-row .name-list-button,
.total-row td.active-row .readonly-name-list,
.total-row td.active-row .calc-cell,
.total-row td.active-col input,
.total-row td.active-col textarea,
.total-row td.active-col select,
.total-row td.active-col button,
.total-row td.active-col .week-count,
.total-row td.active-col .name-list-button,
.total-row td.active-col .readonly-name-list,
.total-row td.active-col .calc-cell,
.total-row td.active-cell input,
.total-row td.active-cell textarea,
.total-row td.active-cell select,
.total-row td.active-cell button,
.total-row td.active-cell .week-count,
.total-row td.active-cell .name-list-button,
.total-row td.active-cell .readonly-name-list,
.total-row td.active-cell .calc-cell,
.total-row td.active-label .calc-cell {
  background: transparent !important;
  border-color: transparent !important;
  color: #fffdf8 !important;
  box-shadow: none !important;
}

.total-row input::placeholder,
.total-row textarea::placeholder {
  color: rgba(255, 253, 248, .72);
}

.week-count {
  min-width: 64px;
  width: 64px;
  min-height: 34px;
  border: 1px solid #d5e5df;
  border-radius: 8px;
  background: #fffdf8;
  color: #4d7757;
  font-weight: 800;
}

.week-blank {
  border-color: #d5e5df;
  background: #fffdf8;
  color: #4d7757;
}

.week-none {
  border-color: #d7e0ea;
  background: #f2f4f1;
  color: #748079;
}

.week-done,
.week-number {
  border-color: #bfd8d1;
  background: #eaf2ed;
  color: #4d7757;
}

.name-button-cell {
  min-width: 170px;
  width: 180px;
}

.name-list-button {
  display: block;
  width: 100%;
  min-height: 36px;
  overflow: visible;
  border: 1px solid #d5e5df;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fffdf8;
  color: #4d7757;
  line-height: 1.4;
  text-align: center;
  font-weight: 800;
  white-space: normal;
}

.readonly-name-list {
  display: block;
  width: 100%;
  min-height: 34px;
  overflow: visible;
  border: 1px solid #d6e8fb;
  border-radius: 8px;
  padding: 6px 8px;
  background: #eaf2ed;
  color: #4d7757;
  line-height: 1.4;
  text-align: center;
  font-weight: 800;
  white-space: normal;
}

.week-number {
  width: 64px;
  min-height: 34px;
  text-align: center;
  font-weight: 800;
  color: #4d7757;
}

.week-count:empty::after {
  content: "";
}

.week-hidden-input,
.name-hidden-input {
  display: none;
}

.dialog-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

#weekNameEditor {
  min-height: 220px;
}

.name-list-view {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.name-list-view span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf2ed;
  color: #4d7757;
  font-weight: 700;
}

.tag-editor {
  display: grid;
  gap: 10px;
}

.tag-editor textarea {
  min-height: 96px;
  line-height: 1.5;
  text-decoration: none;
}

.tag-editor textarea:disabled {
  cursor: not-allowed;
  background: #f2f4f1;
  color: #748079;
  opacity: .75;
}

.tag-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.tag-list:empty::before {
  content: "暂无名单";
  color: #8a7d6b;
  font-weight: 700;
}

.tag-list.disabled {
  opacity: .55;
  background: #f2f4f1;
}

.tag-add-row input:disabled,
.tag-add-row button:disabled {
  cursor: not-allowed;
  opacity: .55;
  background: #f2f4f1;
  color: #748079;
}

.tag-list span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 8px 0 10px;
  border-radius: 999px;
  background: #eaf2ed;
  color: #4d7757;
  font-weight: 800;
}

.tag-list button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: #bfd8d1;
  color: #4d7757;
  line-height: 1;
}

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

.customer-card,
.task-card {
  padding: 14px;
}

.customer-card strong,
.task-card strong {
  display: block;
  margin-bottom: 7px;
}

.customer-card p,
.task-card p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.wide-cell {
  min-width: 220px;
  max-width: 360px;
  text-align: left;
  white-space: normal;
}

.instruction-panel article,
.instruction-grid article {
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-soft);
}

.instruction-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.instruction-edit-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.instruction-grid h3 {
  margin: 0 0 9px;
}

.instruction-section {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
}

.instruction-section:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.instruction-section strong {
  display: block;
  color: #5f7f9b;
  font-size: 15px;
  margin-bottom: 5px;
}

.instruction-edit-section textarea {
  min-height: 92px;
  margin-top: 6px;
  line-height: 1.55;
}

.instruction-save-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.instruction-grid p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.small-button {
  min-height: 32px;
  font-size: 13px;
}

.table-actions {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fffdf8;
  border-bottom: 1px solid var(--line);
}

.table-actions strong {
  margin-right: 6px;
  font-size: 17px;
  font-weight: 900;
}

.icon-button,
.issue-dot {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--muted);
  font-weight: 800;
}

.insert-row-button {
  display: inline-grid;
  place-items: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0;
  background: #fffdf8;
  color: var(--muted);
  font-weight: 900;
  font-size: 16px;
  line-height: 1;
}

.row-action-cell .insert-row-button + .icon-button {
  margin-left: 6px;
}

.issue-dot {
  border-color: #e2b7ad;
  background: #fff1ed;
  color: var(--danger);
}

.issue-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  border: 1px solid #e2b7ad;
  border-radius: 999px;
  padding: 0;
  background: #fff1ed;
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

.issue-pill b {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #b96b5f;
  color: #fffdf8;
  font-size: 11px;
}

.issue-cell {
  min-width: 46px;
  width: 52px;
  max-width: 52px;
  white-space: nowrap;
}

.archive-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
}

.archive-month {
  display: grid;
  gap: 4px;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffdf8;
  text-align: left;
}

.archive-month.active {
  border-color: var(--accent);
  background: #eaf2ed;
  color: #4d7757;
}

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

.danger-button {
  border-color: #e2b7ad;
  background: #fff1ed;
  color: var(--danger);
}

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

.chart-card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
}

.scoreboard-stack {
  display: grid;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.scoreboard-card {
  display: grid;
  grid-template-columns: 330px minmax(900px, max-content);
  gap: 14px;
  align-items: stretch;
  min-width: 1260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.scoreboard-note {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-height: 260px;
  border-right: 1px solid var(--line);
  padding-right: 12px;
}

.scoreboard-title-input {
  min-height: 36px;
  border: 1px solid #bfd8d1;
  background: #f8f7ff;
  color: #263238;
  font-size: 17px;
  font-weight: 900;
  text-align: left;
}

.scoreboard-note textarea {
  min-height: 190px;
  line-height: 1.6;
  resize: vertical;
}

.scoreboard-chart {
  min-width: 900px;
  overflow-x: auto;
  overflow-y: hidden;
}

.scoreboard-chart .chart-card {
  width: max-content;
  min-width: 900px;
  height: auto;
  border: 0;
  padding: 2px 4px 4px;
}

.chart-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.chart-card h3 {
  margin: 0;
  font-size: 19px;
}

svg {
  display: block;
  width: max-content;
  max-width: none;
}

.axis,
.grid-line {
  stroke: #b8c3d3;
  stroke-width: 1;
}

.grid-line {
  stroke-dasharray: 4 4;
}

.axis-label {
  fill: #748079;
  font-size: 16px;
}

.axis-label-strong {
  fill: #344458;
  font-weight: 800;
}

.axis-label-name {
  fill: #243244;
  font-size: 19px;
  font-weight: 900;
}

.axis-label-rate {
  fill: #6c5b13;
  font-size: 17px;
  font-weight: 800;
}

.chart-title-text {
  fill: #3d3d3d;
  font-size: 24px;
  font-weight: 900;
}

.visit-customer-label {
  fill: #4a4a4a;
  font-size: 16px;
  font-weight: 900;
}

.visit-mr-label {
  fill: #5c5c5c;
  font-size: 18px;
  font-weight: 900;
}

.visit-group-line {
  stroke: #cfcfcf;
  stroke-width: 1;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  color: #344458;
  font-size: 16px;
  font-weight: 800;
}

.legend i {
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.legend-bar {
  width: 28px;
  height: 12px;
  border-radius: 2px;
  background: var(--legend-color);
}

.legend-line {
  position: relative;
  width: 28px;
  height: 14px;
}

.legend-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  height: 3px;
  border-radius: 999px;
  background: var(--legend-color);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: none;
  padding: 12px 14px;
  border-radius: 8px;
  background: #263238;
  color: #fffdf8;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

.suggest-box {
  position: absolute;
  z-index: 120;
  display: none;
  max-height: 220px;
  overflow: auto;
  border: 1px solid #bfd8d1;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.suggest-box.show {
  display: grid;
}

.suggest-box button {
  min-height: 34px;
  border: 0;
  border-bottom: 1px solid #e2ece9;
  border-radius: 0;
  padding: 0 10px;
  background: #fffdf8;
  color: #263238;
  text-align: left;
  font-weight: 700;
}

.suggest-box button:hover {
  background: #eaf2ed;
  color: #4d7757;
}

dialog {
  width: min(1480px, calc(100vw - 12px));
  max-width: calc(100vw - 12px);
  max-height: calc(100vh - 12px);
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

dialog.preview-dialog {
  width: calc(100vw - 12px);
  height: calc(100vh - 12px);
  max-width: calc(100vw - 12px);
  max-height: calc(100vh - 12px);
  overflow: hidden;
}

dialog.compact-dialog {
  width: min(520px, calc(100vw - 24px));
}

dialog.report-source-dialog {
  width: min(1180px, calc(100vw - 24px));
}

.compact-dialog .dialog-card header,
.compact-dialog .dialog-card footer {
  padding: 10px 14px;
}

.compact-dialog #dialogBody {
  padding: 14px;
}

.detail-status-editor {
  display: grid;
  gap: 10px;
}

.dialog-card header,
.dialog-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

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

.preview-dialog .dialog-card footer {
  display: none;
}

.dialog-card h2 {
  margin: 0;
  font-size: 18px;
}

#dialogBody {
  padding: 16px;
}

.preview-dialog .dialog-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.preview-dialog .dialog-card header {
  z-index: 20;
  align-items: center;
  background: #fffdf8;
}

.preview-dialog #dialogBody {
  display: grid;
  min-height: 0;
  height: auto;
  grid-template-rows: minmax(0, 1fr);
  padding: 10px;
  overflow: hidden;
}

.preview-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
}

.preview-scroll-zone {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.preview-area {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: grab;
  scrollbar-gutter: stable both-edges;
  user-select: none;
  -webkit-overflow-scrolling: touch;
}

.preview-watermark {
  position: absolute;
  inset: -160px;
  z-index: 2;
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(9, 220px);
  grid-auto-rows: 96px;
  align-items: center;
  justify-items: center;
  gap: 22px 42px;
  color: rgba(28, 93, 76, 0.1);
  font-size: 20px;
  font-weight: 700;
  overflow: hidden;
  transform: rotate(-28deg);
  transform-origin: center;
  user-select: none;
}

.preview-watermark span {
  white-space: nowrap;
}

.preview-area.dragging {
  cursor: grabbing;
}

.preview-area .panel {
  position: relative;
  z-index: 1;
  border: 0;
  overflow: visible;
  width: max-content;
  min-width: 100%;
}

.preview-area .table-scroll,
.preview-area .source-scroll,
.preview-area .score-scroll,
.preview-area .ruitan-scroll {
  width: max-content;
  min-width: 100%;
  max-height: none;
  overflow: visible;
  border-top: 0;
}

.preview-area table {
  width: max-content;
  min-width: 100%;
}

.preview-area .row-action-head,
.preview-area .row-action-cell,
.preview-area .action-head,
.preview-area .remark-head,
.preview-area .name-list-cell,
.preview-area .preview-hidden-cell,
.preview-area .control-head,
.preview-area .issue-cell,
.preview-area .upgrade-table-actions,
.preview-area .table-toolbar,
.preview-area .table-actions button {
  display: none !important;
}

.preview-area input,
.preview-area textarea,
.preview-area select,
.preview-area button {
  pointer-events: none;
}

.preview-area input,
.preview-area textarea,
.preview-area select {
  background: #fffdf8;
}

.preview-area .upgrade-sheet-scroll {
  overflow: visible;
  max-height: none;
  contain: paint;
}

.preview-area th {
  top: 0;
}

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

  .side {
    position: static;
    height: auto;
  }

  .two-col,
  .three-col,
  .management-hero,
  .management-grid,
  .product-overview,
  .upgrade-workspace,
  .upgrade-split,
  .compact-form,
  .quarter-grid,
  .week-action-grid,
  .chart-grid,
  .customer-grid,
  .instruction-grid,
  .kpis {
    grid-template-columns: 1fr;
  }

  .top {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .scoreboard-card {
    grid-template-columns: 300px minmax(900px, max-content);
    min-width: 1220px;
  }
}

.report-table {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.report-table th,
.report-table td {
  min-width: 0;
  padding: 9px 12px;
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
}

.report-table td:first-child {
  text-align: left;
  white-space: nowrap;
  width: auto;
  min-width: 92px;
}

.report-table th:nth-child(n+2),
.report-table td:nth-child(n+2) {
  width: auto;
}

.report-table th:last-child,
.report-table td:last-child {
  min-width: 0;
}

.report-table .bar {
  width: 78px;
  margin: 4px auto 0;
}

.report-grid {
  align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(260px, max-content));
  justify-content: start;
}

.report-grid .panel {
  width: max-content;
  max-width: 100%;
}

.report-grid .panel-body {
  padding: 12px;
  overflow-x: auto;
}

.report-grid .panel header {
  min-height: 50px;
  padding: 12px;
}

.report-product-section {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid rgba(120, 105, 85, 0.16);
  border-radius: 10px;
  background: rgba(255, 252, 246, 0.55);
}

.report-product-section > header {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 12px;
  min-height: 0;
  padding: 0 2px;
  border: 0;
  background: transparent;
  margin-bottom: 2px;
}

.report-product-section > header h2 {
  font-size: 22px;
}

.report-search-panel {
  margin-bottom: 18px;
}

.report-nav-first {
  margin-bottom: 8px;
}

.report-workspace {
  display: grid;
  gap: 14px;
  align-items: start;
}

.report-workspace-side {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
}

.report-workspace-no-draft {
  grid-template-columns: minmax(0, 1fr);
}

.report-data-pane {
  min-width: 0;
}

.report-draft-pane {
  position: sticky;
  top: 58px;
  height: calc(100vh - 76px);
  max-height: calc(100vh - 76px);
  overflow: auto;
}

.report-draft-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  margin-bottom: 18px;
}

.report-draft-panel .panel-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}

.report-draft-textarea {
  width: 100%;
  min-height: 0;
  height: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--text);
  font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 12px;
}

.report-draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

.report-workspace-side .report-draft-textarea {
  min-height: 0;
}

.monthly-report-preview {
  width: min(980px, max-content);
  min-width: 760px;
}

.monthly-report-preview pre {
  margin: 0;
  white-space: pre-wrap;
  font: 16px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.report-search-box {
  display: grid;
  max-width: 520px;
}

.report-search-box input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--text);
  font-size: 15px;
  padding: 8px 10px;
}

.report-search-results {
  margin-top: 12px;
  overflow-x: auto;
}

.report-search-table {
  min-width: 980px;
}

.report-search-table th,
.report-search-table td {
  white-space: normal;
}

.report-search-table th:nth-child(1),
.report-search-table td:nth-child(1),
.report-search-table th:nth-child(2),
.report-search-table td:nth-child(2),
.report-search-table th:nth-child(4),
.report-search-table td:nth-child(4),
.report-search-table th:nth-child(5),
.report-search-table td:nth-child(5) {
  width: 100px;
}

.report-section-grid .panel header {
  align-items: center;
}

.report-section-grid .panel header .muted {
  flex: 1;
}

.report-source-button {
  border: 1px solid rgba(45, 117, 104, 0.25);
  border-radius: 6px;
  background: rgba(45, 117, 104, 0.08);
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 8px;
  white-space: nowrap;
}

.report-source-button:hover {
  background: rgba(45, 117, 104, 0.14);
}

.report-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  justify-content: stretch;
  align-items: start;
  gap: 12px;
}

.report-section-grid .panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.report-section-grid .panel-body {
  overflow-x: auto;
}

.report-wide-panel {
  grid-column: 1 / -1;
}

.report-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.report-metric-card {
  display: grid;
  gap: 10px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid rgba(45, 117, 104, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 250, 246, 0.9));
}

.report-metric-card.empty {
  align-content: center;
}

.report-metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.report-metric-top h3,
.report-metric-card h3 {
  font-size: 16px;
  line-height: 1.25;
}

.report-metric-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.report-metric-values span {
  display: grid;
  gap: 2px;
  place-items: center;
  min-height: 44px;
  border-radius: 7px;
  background: rgba(45, 117, 104, 0.07);
}

.report-metric-values b {
  font-size: 20px;
}

.report-metric-values small {
  color: var(--muted);
  font-size: 12px;
}

.report-name-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 280px;
  max-width: 100%;
  white-space: normal;
}

.report-name-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  max-width: 100%;
  min-width: 126px;
  padding: 6px 9px;
  border: 1px solid rgba(45, 117, 104, 0.22);
  border-radius: 7px;
  background: rgba(89, 149, 135, 0.11);
  line-height: 1.25;
}

.report-name-pill strong {
  font-size: 15px;
  white-space: nowrap;
}

.report-name-pill small {
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

.report-names-cell {
  white-space: normal !important;
  min-width: 0 !important;
  width: auto !important;
}

.report-wide-panel .report-table {
  width: 100%;
  min-width: 100%;
}

.report-wide-panel .report-table th,
.report-wide-panel .report-table td {
  white-space: normal;
}

.report-wide-panel .report-names-cell {
  min-width: 0 !important;
}

.report-name-table th:first-child,
.report-name-table td:first-child {
  width: 128px;
  min-width: 128px;
  text-align: center;
}

.report-name-table th:nth-child(2),
.report-name-table td:nth-child(2) {
  width: auto;
}

.report-rank-table th:nth-child(1),
.report-rank-table td:nth-child(1) {
  width: 120px;
  min-width: 120px;
  text-align: center;
}

.report-rank-table th:nth-child(2),
.report-rank-table td:nth-child(2),
.report-rank-table th:nth-child(3),
.report-rank-table td:nth-child(3) {
  width: 120px;
  min-width: 120px;
}

.report-rank-table th:nth-child(4),
.report-rank-table td:nth-child(4) {
  width: auto;
  text-align: left;
}

.report-rank-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  white-space: normal;
}

.report-rank-details span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid rgba(45, 117, 104, 0.18);
  border-radius: 6px;
  background: rgba(45, 117, 104, 0.07);
  font-size: 12px;
}

.report-empty-state {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 92px;
  padding: 18px;
  border: 1px dashed rgba(45, 117, 104, 0.28);
  border-radius: 8px;
  background: rgba(45, 117, 104, 0.06);
  color: var(--muted);
  text-align: center;
}

.report-empty-state strong {
  color: var(--text);
  font-size: 16px;
}

.report-upgrade-table th:nth-child(1),
.report-upgrade-table td:nth-child(1),
.report-upgrade-table th:nth-child(5),
.report-upgrade-table td:nth-child(5),
.report-upgrade-table th:nth-child(6),
.report-upgrade-table td:nth-child(6),
.report-upgrade-table th:nth-child(7),
.report-upgrade-table td:nth-child(7),
.report-upgrade-table th:nth-child(8),
.report-upgrade-table td:nth-child(8) {
  width: 88px;
}

.report-source-view {
  display: grid;
  gap: 14px;
}

.report-source-view > p {
  margin: 0;
  color: var(--muted);
}

.report-source-block {
  display: grid;
  gap: 8px;
}

.report-source-block h3 {
  font-size: 15px;
}

.report-source-scroll {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-source-table {
  min-width: 760px;
}

.report-source-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.report-source-table td {
  white-space: normal;
}

.report-source-total td {
  background: rgba(238, 185, 91, 0.13);
  font-weight: 700;
}

.management-report {
  display: grid;
  gap: 12px;
}

.management-product-panel {
  width: max-content;
  max-width: 100%;
}

.management-report-table td:nth-child(2) {
  max-width: 520px;
  white-space: normal;
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .report-workspace-side {
    grid-template-columns: 1fr;
  }

  .report-draft-pane {
    position: static;
    height: auto;
    max-height: none;
  }

  .report-workspace-side .report-draft-textarea {
    min-height: 280px;
    height: 360px;
  }
}
