:root {
  --bg: #efe6d7;
  --bg-alt: #f7f1e7;
  --panel: rgba(255, 251, 245, 0.92);
  --panel-strong: #fffaf2;
  --line: rgba(143, 122, 93, 0.22);
  --text: #241e19;
  --muted: #6a5c4f;
  --accent: #0f6d57;
  --accent-soft: rgba(15, 109, 87, 0.12);
  --accent-strong: #0b4d3d;
  --danger: #b24336;
  --danger-soft: rgba(178, 67, 54, 0.12);
  --warn: #9f6a05;
  --warn-soft: rgba(159, 106, 5, 0.14);
  --shadow-lg: 0 28px 70px rgba(36, 30, 25, 0.12);
  --shadow-sm: 0 14px 30px rgba(36, 30, 25, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Bahnschrift", "Aptos", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 109, 87, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(178, 67, 54, 0.08), transparent 24%),
    linear-gradient(180deg, #f9f3e7 0%, var(--bg) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  width: min(1840px, calc(100% - 32px));
  margin: 18px auto 30px;
}

.sidebar,
.panel,
.page-hero {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}

.sidebar {
  position: static;
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 249, 240, 0.96) 0%, rgba(247, 238, 223, 0.95) 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 0;
  flex-shrink: 0;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, #0f6d57 0%, #093f33 100%);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: var(--shadow-sm);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.nav-link {
  padding: 10px 14px;
  border-radius: 16px;
  color: var(--muted);
  transition: transform 140ms ease, background 140ms ease, color 140ms ease;
  white-space: nowrap;
}

.nav-link:hover {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.sidebar-note {
  display: none;
}

.sidebar-note p + p {
  margin-top: 8px;
}

.content {
  min-width: 0;
}

.content > section + section {
  margin-top: 28px;
}

.page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 28px 30px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(140deg, rgba(255, 251, 245, 0.95) 0%, rgba(243, 235, 223, 0.96) 100%);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 4vw, 46px);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 24px;
  line-height: 1.05;
}

h3 {
  font-size: 18px;
}

.subtitle {
  margin-top: 14px;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-grid,
.content-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric-grid + .panel {
  margin-top: 30px;
}

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

.panel {
  padding: 24px;
  border-radius: var(--radius-xl);
  background: var(--panel);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.shortcut-card,
.summary-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-sm);
}

.metric-card {
  padding: 18px;
}

.metric-card small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 30px;
  letter-spacing: -0.03em;
}

.shortcut-grid,
.summary-list {
  display: grid;
  gap: 14px;
}

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

.shortcut-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  transition: transform 150ms ease, border-color 150ms ease;
}

.shortcut-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 109, 87, 0.35);
}

.shortcut-card strong {
  font-size: 18px;
}

.shortcut-card span {
  color: var(--muted);
  line-height: 1.6;
}

.summary-card {
  padding: 16px 18px;
}

.summary-card strong {
  display: block;
  margin-bottom: 6px;
}

.summary-card p,
.summary-card span {
  color: var(--muted);
  line-height: 1.55;
}

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

.toolbar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.toolbar-grid.compact {
  grid-template-columns: minmax(220px, 320px);
}

.runs-filter-grid {
  grid-template-columns: minmax(220px, 320px) auto;
}

.toolbar-inline-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.toolbar-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions {
  min-width: 0;
}

.task-form label,
.import-layout,
.stack-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 16px;
}

.stack-actions {
  justify-content: space-between;
}

.control-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
}

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

.filter-fields {
  grid-template-columns: 220px minmax(0, 1fr);
}

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

.control-fields label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

.filter-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.runs-filter-card {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
}

.filter-card .control-actions {
  align-self: end;
  justify-content: flex-end;
}

.task-template-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.task-template-card .control-actions {
  justify-content: flex-end;
}

.helper-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input,
select {
  min-height: 46px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15, 109, 87, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 109, 87, 0.08);
  background: #fff;
}

textarea {
  min-height: 168px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 15px;
  padding: 10px 13px;
  background: #e6dccf;
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

button.primary {
  background: linear-gradient(145deg, #0f6d57 0%, #0a4b3b 100%);
  color: #fff;
}

button.danger {
  background: linear-gradient(145deg, #b24336 0%, #8d2f25 100%);
  color: #fff;
}

.hero-actions button,
.control-actions button,
.toolbar-inline-actions button,
.stack-actions button {
  width: auto;
  min-width: 0;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.56);
}

.table-wrap button,
.pager button,
.row-actions button {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.2;
}

.nowrap {
  white-space: nowrap;
}

.inline-combo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(143, 122, 93, 0.15);
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(246, 239, 229, 0.98);
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  vertical-align: middle;
}

.status-online,
.status-success,
.status-completed,
.status-active,
.status-idle {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-running,
.status-queued,
.status-stopping,
.status-busy {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-offline,
.status-failed,
.status-stopped,
.status-unlock_failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--muted);
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pager-info {
  color: var(--muted);
  font-size: 14px;
}

.pager-actions {
  display: flex;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(36, 30, 25, 0.92);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-panel {
  width: min(460px, 100%);
  padding: 34px 32px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.96) 0%, rgba(247, 238, 223, 0.96) 100%);
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.login-brand strong {
  display: block;
  font-size: 22px;
}

.login-brand p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.login-form label {
  display: grid;
  gap: 8px;
}

.login-form span {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.login-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}

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

  .sidebar {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav {
    margin-left: 0;
  }
}

@media (max-width: 980px) {
  .page-hero,
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .two-up,
  .shortcut-grid,
  .import-layout,
  .task-form,
  .toolbar-grid,
  .toolbar-grid.compact,
  .control-card,
  .control-fields {
    grid-template-columns: 1fr;
  }

  .filter-card,
  .runs-filter-card {
    grid-template-columns: 1fr;
  }

  .nav {
    width: 100%;
  }

  .toolbar-inline-actions,
  .task-template-card .control-actions {
    justify-content: flex-start;
  }
}
