:root {
  color-scheme: light;
  --bg: #f4f5ef;
  --panel: #fffdf6;
  --panel-border: #d7d1c4;
  --ink: #1d241c;
  --muted: #647067;
  --accent: #175d4a;
  --accent-strong: #0f4537;
  --warning: #b3522e;
  --line: #ece6d8;
  --cheapest: #edf8ef;
  --shadow: 0 12px 32px rgba(29, 36, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(23, 93, 74, 0.12), transparent 28%),
    linear-gradient(180deg, #faf8f1 0%, var(--bg) 100%);
}

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

.page-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
}

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

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
}

.hero-copy {
  max-width: 760px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.hero-side {
  display: grid;
  gap: 12px;
}

.hero-auth {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.auth-status {
  color: var(--muted);
  font-size: 13px;
}

.hero-stat,
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero-stat {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-stat span {
  color: var(--muted);
  font-size: 14px;
}

.hero-stat strong {
  font-size: 24px;
  line-height: 1.3;
}

.layout {
  display: grid;
  gap: 22px;
}

.login-panel {
  max-width: 520px;
  margin-bottom: 22px;
}

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

.panel {
  padding: 22px;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
}

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

.form-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  margin-bottom: 18px;
}

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

.stack-form,
.site-card,
.site-subpanel {
  display: grid;
  gap: 12px;
}

.form-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

label span,
.stack-form h3,
.history-grid h3 {
  display: block;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: #fff;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-check input {
  width: auto;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.secondary-button {
  background: #e7efe8;
  color: var(--accent-strong);
}

.ghost-button {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--panel-border);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 20px 0;
}

.import-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  cursor: pointer;
}

.import-label input {
  display: none;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

tbody td {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tbody tr.cheapest,
tbody tr.is-cheapest {
  background: var(--cheapest);
}

.table-link {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.table-link:hover {
  text-decoration: underline;
}

.table-link a,
.site-subpanel a {
  color: var(--accent);
  text-decoration: none;
}

.table-link a:hover,
.site-subpanel a:hover {
  text-decoration: underline;
}

.site-list {
  display: grid;
  gap: 16px;
}

.site-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.site-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.site-card h3 {
  margin: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f1ec;
  font-size: 12px;
  color: var(--muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-button {
  padding: 8px 12px;
  background: #f4f5ef;
  color: var(--ink);
}

.danger-button {
  background: #fff0eb;
  color: var(--warning);
}

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

.site-subpanel {
  padding: 14px;
  border-radius: 14px;
  background: #fbfaf4;
  border: 1px solid var(--line);
}

.site-subpanel ul,
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-subpanel li,
.history-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.entity-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.site-subpanel li:last-child,
.history-list li:last-child {
  border-bottom: 0;
}

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

.history-meta,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  padding: 18px;
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
  background: #faf8f1;
}

@media (max-width: 1100px) {
  .hero,
  .manager-grid,
  .history-grid,
  .subgrid {
    grid-template-columns: 1fr;
  }

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

  .entity-row,
  .form-heading {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 20px 14px 40px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-stat strong {
    font-size: 20px;
  }
}
