:root {
  color-scheme: dark;
  --bg: #111410;
  --surface: #191d17;
  --surface-strong: #20261e;
  --surface-soft: #151913;
  --ink: #f1eadf;
  --muted: #a9aa9e;
  --line: #31382e;
  --accent: #d79a35;
  --accent-strong: #f0ba5c;
  --green: #67c98f;
  --red: #e26d5c;
  --blue: #78a6d6;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.36);
  --radius: 8px;
  --font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(215, 154, 53, 0.16), transparent 34rem),
    linear-gradient(180deg, #171b14 0%, var(--bg) 30rem);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: min(1840px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  margin-bottom: 18px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: #191207;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 10px 34px rgba(215, 154, 53, 0.28);
}

h1,
h2,
p {
  margin: 0;
}

.topbar h1 {
  font-size: 23px;
  line-height: 1.15;
}

.topbar p,
.panel-heading p,
.metric-label,
small {
  color: var(--muted);
}

.topbar p {
  margin-top: 4px;
  font-size: 14px;
}

.topbar-actions,
.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(680px, 1fr) 340px;
  gap: 14px;
  align-items: start;
}

.rail,
.control-plane,
.activity-panel {
  min-width: 0;
}

.rail,
.activity-panel,
.command-surface,
.editor-panel,
.schedule-panel,
.status-strip {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.rail,
.activity-panel {
  border-radius: var(--radius);
  overflow: hidden;
}

.rail-section + .rail-section {
  border-top: 1px solid var(--line);
}

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

.panel-heading {
  padding: 18px;
}

.panel-heading.compact {
  min-height: 62px;
  padding: 14px 16px;
}

.section-heading h2,
.panel-heading h2 {
  font-size: 16px;
}

.section-heading span,
.target-line {
  color: var(--muted);
  font-size: 13px;
}

.target-line {
  overflow-wrap: anywhere;
}

.account-list,
.agent-list,
.activity-list,
.schedule-list {
  display: grid;
}

.account-item,
.agent-item,
.activity-item,
.schedule-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.account-item,
.agent-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  transition: background 160ms ease, transform 160ms ease;
}

.account-item:hover,
.agent-item:hover,
.account-item.is-active {
  background: var(--surface-strong);
}

.account-item.is-active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.item-row,
.chip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chip-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.item-title {
  font-weight: 800;
}

.item-subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chip.good {
  border-color: color-mix(in srgb, var(--green) 60%, var(--line));
  color: var(--green);
}

.chip.warn {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  color: var(--accent-strong);
}

.chip.bad {
  border-color: color-mix(in srgb, var(--red) 60%, var(--line));
  color: var(--red);
}

.control-plane {
  display: grid;
  gap: 14px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-radius: var(--radius);
  overflow: hidden;
  animation: rise 280ms ease both;
}

.status-strip > div {
  display: grid;
  gap: 5px;
  padding: 16px;
  background: var(--surface-soft);
}

.status-strip strong {
  overflow: hidden;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-label {
  font-size: 12px;
}

.command-surface,
.editor-panel,
.schedule-panel {
  border-radius: var(--radius);
  overflow: hidden;
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.command-button {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 0;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
  padding: 16px;
  transition: background 160ms ease, transform 160ms ease;
}

.command-button:hover {
  background: var(--surface-strong);
  transform: translateY(-1px);
}

.command-button span {
  font-size: 18px;
  font-weight: 850;
}

.command-button.run span {
  color: var(--green);
}

.command-button.pause span,
.command-button.warn span {
  color: var(--accent-strong);
}

.command-button.danger span {
  color: var(--red);
}

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

.form-grid,
.schedule-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

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

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

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10140f;
  color: var(--ink);
  outline: none;
  padding: 9px 10px;
  transition: border-color 160ms ease, background 160ms ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #151a13;
}

.toggle-row {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
}

.toggle-row input {
  min-height: 18px;
}

.weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday-grid button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10140f;
  color: var(--muted);
}

.weekday-grid button.is-active {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: rgba(215, 154, 53, 0.12);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 13px;
  border: 1px solid transparent;
  color: var(--ink);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary-button {
  background: var(--accent);
  color: #181007;
  font-weight: 800;
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface-strong);
}

.ghost-button,
.icon-button {
  border-color: var(--line);
  background: transparent;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.schedule-list {
  border-top: 1px solid var(--line);
}

.schedule-item,
.activity-item {
  display: grid;
  gap: 8px;
  padding: 13px 16px;
}

.activity-item {
  animation: fadeIn 180ms ease both;
}

.activity-item strong,
.schedule-item strong {
  font-size: 14px;
}

.activity-item p,
.schedule-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.empty-state {
  padding: 18px 16px;
  color: var(--muted);
  font-size: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  min-width: min(420px, calc(100% - 32px));
  transform: translate(-50%, 20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  padding: 12px 14px;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .activity-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 920px) {
  .app-shell {
    width: min(calc(100% - 20px), 720px);
  }

  .topbar,
  .workspace,
  .detail-grid,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

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

@media (max-width: 560px) {
  .command-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .panel-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .target-line {
    width: 100%;
  }

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