:root {
  color-scheme: light;
  --red: #f2393f;
  --red-dark: #e02d37;
  --text: #20242a;
  --muted: #7a838d;
  --line: #edf0f3;
  --bg: #ffffff;
  --soft: #f7f8fa;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.calendar-app {
  width: min(960px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(16, 24, 40, 0.04);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(120deg, #ff8754 0%, var(--red) 62%, #ff2733 100%);
  color: #fff;
}

.header-row {
  display: grid;
  grid-template-columns: 48px 1fr 64px;
  align-items: center;
  height: 54px;
  padding: 0 12px;
}

.header-row h1 {
  margin: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
}

#backButton,
#refreshButton {
  border: 0;
  background: transparent;
  color: #fff;
}

#backButton {
  font-size: 42px;
  line-height: 1;
}

#refreshButton {
  font-size: 14px;
  font-weight: 700;
}

.live-status {
  min-height: 20px;
  padding: 0 16px 8px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-status[data-state="error"] {
  color: #fff2c7;
}

.stage-tabs {
  position: sticky;
  top: 82px;
  z-index: 25;
  display: flex;
  gap: 30px;
  overflow-x: auto;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  scrollbar-width: none;
}

.stage-tabs::-webkit-scrollbar {
  display: none;
}

.stage-tab {
  position: relative;
  flex: 0 0 auto;
  height: 50px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #30343a;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.stage-tab.active {
  color: #111318;
}

.stage-tab.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 34px;
  height: 4px;
  border-radius: 99px;
  background: var(--red);
  transform: translateX(-50%);
}

.quick-filters,
.search-line {
  display: grid;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

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

.quick-filters label {
  display: block;
}

.search-line {
  grid-template-columns: 1fr 68px;
}

input,
select,
.search-line button {
  height: 36px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--text);
  font-weight: 600;
}

input,
select {
  width: 100%;
  padding: 0 9px;
}

.search-line button {
  background: #fff;
  font-weight: 700;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 8px solid var(--soft);
  background: #fff;
}

.summary-strip button {
  display: grid;
  gap: 3px;
  padding: 9px 6px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: inherit;
  text-align: center;
  cursor: pointer;
}

.summary-strip button:hover {
  background: #fff6f6;
}

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

.summary-strip strong {
  font-size: 20px;
}

.list-title {
  position: sticky;
  left: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 6px;
  min-width: min(960px, 100vw);
  background: #fff;
}

.list-title strong {
  font-size: 19px;
}

.list-title span {
  color: var(--muted);
  font-size: 13px;
}

.list-card {
  overflow: hidden;
  border-top: 8px solid var(--soft);
}

.table-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

.table-head,
.stock-row {
  display: grid;
  grid-template-columns: var(--table-template);
  width: max-content;
  min-width: 100%;
  column-gap: 0;
  align-items: center;
  padding: 0;
}

.table-head {
  position: sticky;
  top: 0;
  z-index: 8;
  height: 44px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.table-head span,
.stock-row > div {
  min-width: 0;
  padding: 0 8px;
  text-align: left;
}

.table-head span:first-child,
.stock-row > div:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
  padding-left: 12px;
  padding-right: 6px;
}

.table-head span:first-child {
  z-index: 9;
}

.stock-row {
  min-height: 72px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.stock-row:first-child {
  border-top: 0;
}

.stock-row:hover {
  background: #fffafa;
}

.stock-row > div {
  color: #22262c;
  font-size: 15px;
  line-height: 1.45;
}

.stock-row > div:not(.sticky-name) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-cell {
  display: grid;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.name-cell strong {
  display: block;
  overflow: hidden;
  font-size: 16px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-cell span {
  display: block;
  overflow: hidden;
  color: #7e858d;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-cell em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 3px;
  border: 1px solid #d9bfd0;
  border-radius: 4px;
  color: #9a6a88;
  font-style: normal;
  font-size: 12px;
}

.empty-state {
  padding: 34px 16px;
  color: var(--muted);
  text-align: center;
}

.detail-page {
  background: #fff;
}

.detail-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--line);
}

.detail-hero div {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.detail-hero strong {
  overflow: hidden;
  font-size: 25px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-hero span {
  color: #7a838d;
  font-size: 21px;
}

.detail-hero a {
  flex: 0 0 auto;
  color: #1777c8;
  font-size: 17px;
  text-decoration: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.kv {
  display: grid;
  grid-template-columns: minmax(88px, 0.86fr) minmax(0, 1fr);
  gap: 10px;
  min-height: 36px;
  align-items: center;
}

.kv span {
  color: #7a838d;
  font-size: 15px;
}

.kv strong {
  overflow: hidden;
  color: #252930;
  font-size: 16px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-card {
  padding: 22px 16px 16px;
  border-bottom: 1px solid var(--line);
}

.progress-line {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.progress-line::before {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 50%;
  height: 2px;
  background: #ef5350;
  transform: translateY(-50%);
}

.progress-line span {
  z-index: 1;
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--red);
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.progress-steps div {
  display: grid;
  gap: 5px;
}

.progress-steps strong {
  color: #69737e;
  font-size: 15px;
  font-weight: 600;
}

.progress-steps span {
  color: #252930;
  font-size: 14px;
}

.business-card {
  border-top: 8px solid var(--soft);
  padding: 18px 16px 28px;
}

.section-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
  text-align: center;
}

.section-tabs strong,
.section-tabs button {
  position: relative;
  border: 0;
  background: transparent;
  color: #20242a;
  font-size: 20px;
  font-weight: 700;
}

.section-tabs strong::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 34px;
  height: 4px;
  border-radius: 99px;
  background: var(--red);
  transform: translateX(-50%);
}

.business-card p {
  margin: 0;
  color: #252930;
  font-size: 18px;
  line-height: 1.7;
  text-align: justify;
}

@media (max-width: 700px) {
  .calendar-app {
    width: 100%;
  }

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

@media (max-width: 430px) {
  .header-row {
    height: 54px;
  }

  .header-row h1 {
    font-size: 19px;
  }

  .stage-tabs {
    top: 82px;
    gap: 30px;
  }

  .quick-filters {
    padding: 8px 12px;
  }

  .search-line {
    padding: 8px 12px;
  }

  .table-head,
  .stock-row {
    column-gap: 0;
    padding: 0;
  }

  .table-head {
    font-size: 14px;
  }

  .stock-row {
    min-height: 74px;
  }

  .name-cell strong {
    font-size: 16px;
  }

  .name-cell span {
    font-size: 14px;
  }

  .stock-row > div {
    font-size: 14px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .detail-hero strong {
    font-size: 24px;
  }

  .detail-hero span {
    font-size: 20px;
  }

  .business-card p {
    font-size: 17px;
  }
}
