:root {
  --brand-blue: #1677ff;
  --brand-blue-hover: #4096ff;
  --brand-blue-soft: #eaf3ff;
  --text-primary: #1f2329;
  --text-secondary: #646a73;
  --text-tertiary: #8f959e;
  --border: #e5e6eb;
  --border-strong: #c9cdd4;
  --page-bg: #f5f7fa;
  --content-bg: #ffffff;
  --info-bg: #f2f7ff;
  --info-border: #bcd6ff;
  --error: #f04438;
  --success: #22a06b;
  --shadow-float: 0 8px 24px rgba(31, 35, 41, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 1120px;
  color: var(--text-primary);
  background: var(--page-bg);
  font: 400 14px/1.5 "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
label,
select {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 6px;
  background: var(--brand-blue);
}

.brand-cube {
  position: relative;
  display: block;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  transform: rotate(30deg) skew(-5deg, -5deg);
}

.brand-cube::before,
.brand-cube::after {
  position: absolute;
  content: "";
  background: #fff;
}

.brand-cube::before {
  top: 8px;
  left: -2px;
  width: 20px;
  height: 2px;
}

.brand-cube::after {
  top: -2px;
  left: 8px;
  width: 2px;
  height: 20px;
}

.brand-name {
  white-space: nowrap;
  font-size: 19px;
  font-weight: 600;
}

.global-nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 6px;
  margin-left: 24px;
}

.nav-item {
  position: relative;
  padding: 0 14px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--brand-blue);
  background: #f7faff;
}

.nav-item.active {
  color: var(--brand-blue);
}

.nav-item.active::after {
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--brand-blue);
  content: "";
}

.nav-menu {
  color: var(--text-secondary);
}

.mode-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 3px;
  border-radius: 6px;
  background: #f4f6f9;
  color: var(--text-tertiary);
  font-weight: 500;
}

.mode-switch span {
  padding: 6px 10px;
  white-space: nowrap;
}

.mode-switch .mode-active {
  border: 1px solid #d8e7ff;
  border-radius: 4px;
  color: var(--brand-blue);
  background: #fff;
}

.avatar {
  display: grid;
  width: 30px;
  height: 30px;
  margin-left: 18px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #4e5969;
  font-size: 12px;
  font-weight: 500;
}

.page-shell {
  width: calc(100% - 24px);
  margin: 12px auto 28px;
}

.page-content {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--content-bg);
}

.play-info-title {
  position: relative;
  height: 48px;
  padding: 13px 24px 0 34px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 500;
}

.play-info-title::before {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: 24px;
  width: 3px;
  background: var(--brand-blue);
  content: "";
}

.form-panel {
  min-width: 0;
}

.form-section {
  padding: 44px 84px 18px;
  scroll-margin-top: 68px;
}

.section-title {
  position: relative;
  margin: 0 0 22px;
  padding-left: 13px;
  font-size: 17px;
  font-weight: 600;
  line-height: 24px;
}

.section-title::before {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--brand-blue);
  content: "";
}

.form-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 820px);
  align-items: start;
  margin-bottom: 20px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-label {
  padding: 7px 18px 0 0;
  color: #4e5969;
  text-align: right;
  font-weight: 500;
}

.form-label.required::before {
  margin-right: 5px;
  color: var(--error);
  content: "*";
}

.form-control {
  min-width: 0;
}

.form-control-wide {
  max-width: 640px;
}

.form-control-expand {
  max-width: none;
}

input,
select {
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text-primary);
  background: #fff;
  outline: none;
}

input {
  padding: 0 11px;
}

select {
  width: 100%;
  padding: 0 34px 0 11px;
}

input:hover,
select:hover {
  border-color: #8f959e;
}

input:focus,
select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.12);
}

input[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 2px rgba(240, 68, 56, 0.08);
}

.field-help {
  margin: 6px 0 0;
  color: var(--text-tertiary);
  font-size: 12px;
}

.field-help a {
  color: var(--brand-blue);
  text-decoration: none;
}

.date-range {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 28px minmax(210px, 1fr);
  align-items: center;
  max-width: 540px;
}

.range-separator {
  color: var(--text-tertiary);
  text-align: center;
}

.radio-group {
  display: flex;
  align-items: center;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  gap: 28px;
}

.radio-option,
.availability-option {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.radio-option input[type="radio"],
.availability-option > input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.radio-ui {
  position: relative;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 1px solid #b8bdc5;
  border-radius: 50%;
  background: #fff;
}

input[type="radio"]:checked + .radio-ui {
  border: 5px solid var(--brand-blue);
}

.preheat-toggle-row {
  margin-bottom: 16px;
}

.conditional-fields {
  margin: 0 0 20px;
  padding: 0;
}

.conditional-fields[hidden] {
  display: none;
}

.conditional-fields .form-row {
  margin-bottom: 12px;
}

.datetime-input {
  width: 254px;
}

.info-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 820px;
  margin-left: 180px;
  padding: 8px 10px;
  border-left: 3px solid #8bb9ff;
  color: #35506f;
  background: #f7faff;
  font-size: 13px;
}

.info-note p {
  margin: 0;
}

.info-note strong {
  font-weight: 600;
}

.info-icon {
  display: grid;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--brand-blue);
  font-size: 11px;
  font-weight: 600;
}

.availability-row {
  margin-bottom: 2px;
}

.availability-options {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  border: 0;
  gap: 12px;
}

.availability-option {
  position: relative;
  min-height: 36px;
  gap: 0;
}

.availability-option > .radio-ui {
  margin-right: 8px;
}

.availability-option.is-disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.58;
}

.number-input {
  width: 72px;
  margin: 0 8px;
}

.option-help {
  margin-left: 10px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.availability-option-immediate .datetime-input {
  margin: 0 8px 0 12px;
}

.preheat-availability-help {
  margin-top: 8px;
}

.availability-option-fixed {
  align-items: flex-start;
  padding-top: 1px;
}

.availability-option-fixed > .radio-ui {
  margin-top: 9px;
}

.availability-option-fixed > span:nth-of-type(2) {
  padding-top: 7px;
}

.fixed-time-fields {
  display: grid;
  grid-template-columns: 254px 28px 254px;
  align-items: start;
  margin-left: 12px;
}

.fixed-time-fields > .range-separator {
  padding-top: 7px;
}

.field-error {
  margin: 5px 0 0;
  color: var(--error);
  font-size: 12px;
}

.field-error[hidden] {
  display: none;
}

.input-with-count {
  position: relative;
}

.input-with-count input {
  width: 100%;
  padding-right: 58px;
}

.input-with-count span {
  position: absolute;
  top: 7px;
  right: 10px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.table-form-row {
  grid-template-columns: 180px minmax(0, 1fr);
}

.template-table-wrap {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.template-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.template-table th,
.template-table td {
  height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}

.template-table th {
  color: #4e5969;
  background: #f7f8fa;
  font-weight: 500;
}

.template-table tr:last-child td {
  border-bottom: 0;
}

.link-button {
  padding: 0;
  border: 0;
  color: var(--brand-blue);
  background: transparent;
  cursor: pointer;
  font-weight: 500;
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 14px 84px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.action-group {
  display: flex;
  gap: 10px;
}

.button {
  height: 36px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

.button-primary {
  color: #fff;
  border-color: var(--brand-blue);
  background: var(--brand-blue);
}

.button-primary:hover {
  border-color: var(--brand-blue-hover);
  background: var(--brand-blue-hover);
}

.button-secondary {
  color: var(--brand-blue);
  border-color: #94bdff;
  background: #fff;
}

.button-secondary:hover {
  background: #f5f9ff;
}

.button-quiet {
  color: var(--text-secondary);
  border-color: var(--border-strong);
  background: #fff;
}

.button-quiet:hover {
  color: var(--text-primary);
  border-color: #8f959e;
}

.utility-rail {
  position: fixed;
  z-index: 25;
  top: 38%;
  right: 12px;
  display: flex;
  width: 58px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow-float);
}

.utility-rail button {
  display: flex;
  height: 56px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
}

.utility-rail button:last-child {
  border-bottom: 0;
}

.utility-rail button:hover {
  color: var(--brand-blue);
  background: #f7faff;
}

.utility-rail button span:first-child {
  font-size: 18px;
}

.toast {
  position: fixed;
  z-index: 50;
  top: 78px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  padding: 11px 16px;
  border: 1px solid #a7e1c5;
  border-radius: 5px;
  color: #176b47;
  background: #f0fbf6;
  box-shadow: var(--shadow-float);
  transform: translateX(-50%);
}

.toast[hidden] {
  display: none;
}

.toast-check {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--success);
  font-size: 11px;
  font-weight: 600;
}

@media (max-width: 1280px) {
  .global-nav {
    margin-left: 14px;
  }

  .nav-item {
    padding: 0 9px;
  }

  .page-shell {
    width: calc(100% - 20px);
  }

  .form-section {
    padding-right: 54px;
    padding-left: 54px;
  }

  .form-row {
    grid-template-columns: 164px minmax(0, 760px);
  }

  .info-note {
    margin-left: 164px;
  }

  .fixed-time-fields {
    grid-template-columns: 226px 24px 226px;
  }

  .datetime-input {
    width: 226px;
  }
}
