:root {
  --ink: #17202a;
  --muted: #6b7280;
  --line: #e6eaf0;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --nav: #1f2b33;
  --blue: #2f7df6;
  --green: #54bf61;
  --red: #e85b5b;
  --violet: #7367bd;
  --cyan: #57b5dc;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}

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

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

.entry-shell,
.user-shell,
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(47, 125, 246, 0.13), transparent 34%),
    linear-gradient(315deg, rgba(84, 191, 97, 0.14), transparent 32%),
    var(--bg);
}

.entry-panel,
.status-panel,
.login-panel {
  width: min(760px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 42px;
  box-shadow: 0 18px 46px rgba(20, 38, 65, 0.08);
}

.hidden {
  display: none !important;
}

.login-panel {
  display: grid;
  gap: 16px;
  max-width: 460px;
}

.login-panel h1 {
  margin-bottom: 4px;
  font-size: 30px;
}

.form-msg {
  min-height: 22px;
  margin: 0;
  color: var(--red);
}

.brand-mark,
.logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #17263a;
  border-radius: 8px;
  font-size: 24px;
  font-weight: 700;
}

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

h1,
h2,
p {
  margin-top: 0;
}

.entry-panel h1,
.status-panel h1 {
  margin-bottom: 16px;
  font-size: 34px;
}

.entry-copy {
  max-width: 560px;
  color: var(--muted);
  line-height: 1.8;
}

.entry-actions,
.modal-actions,
.filter-actions,
.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-action,
.secondary-action,
.primary-btn,
.plain-btn,
.ghost-link,
.icon-btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  padding: 0 16px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  background: #fff;
}

.primary-action,
.primary-btn {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.secondary-action,
.ghost-link {
  color: var(--blue);
}

.icon-btn {
  width: 38px;
  padding: 0;
  font-size: 18px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 64px 1fr;
}

.sidebar {
  background: var(--nav);
  color: #fff;
  padding: 10px 8px;
}

.sidebar .logo {
  width: 48px;
  height: 48px;
  background: #142131;
}

.side-nav {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.side-nav a {
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #c9d3dc;
}

.side-nav a.active,
.side-nav a:hover {
  background: #5577df;
  color: #fff;
}

.workspace {
  min-width: 0;
  padding: 22px 24px 32px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.merchant-name {
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.metric {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-bottom: 4px;
  font-size: 20px;
}

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

.metric-red .metric-icon {
  background: var(--red);
}

.metric-violet .metric-icon {
  background: var(--violet);
}

.metric-blue .metric-icon {
  background: var(--cyan);
}

.metric-green .metric-icon {
  background: var(--green);
}

.filter-band,
.table-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.deploy-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px 24px;
}

.deploy-form h2 {
  margin: 0;
  font-size: 20px;
}

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

.site-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.site-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.site-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filter-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px 24px;
  padding: 22px;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: #2e3640;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d8dee8;
  border-radius: 4px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 125, 246, 0.12);
}

.filter-actions {
  align-self: end;
}

.table-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 16px 18px 10px;
}

.toolbar-search {
  width: min(280px, 100%);
  margin-left: auto;
}

.total-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #394150;
  background: #fafbfc;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 14px 16px;
  border-top: 1px solid #eef1f5;
  text-align: left;
  white-space: nowrap;
}

th {
  font-weight: 700;
  background: #fbfcfe;
}

tbody tr:nth-child(even) {
  background: #fafafa;
}

.linkish {
  color: #4e87ff;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.status-paying {
  color: #ef9d2f;
}

.status-success {
  color: #2fac66;
}

.status-expired {
  color: #8791a1;
}

.change-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(47, 125, 246, 0.25);
  border-radius: 5px;
  color: var(--blue);
  background: #edf4ff;
  cursor: pointer;
}

.danger-btn {
  color: #d34040;
  border-color: rgba(211, 64, 64, 0.25);
  background: #fff1f1;
}

.status-select {
  min-width: 92px;
  padding: 6px 8px;
  border-radius: 5px;
  font-weight: 700;
}

.modal {
  width: min(520px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(20, 38, 65, 0.24);
}

.modal::backdrop {
  background: rgba(9, 18, 28, 0.42);
}

.modal form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.modal-head h2 {
  margin: 0;
}

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

.query-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 18px;
}

.result-box {
  min-height: 180px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

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

.result-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.result-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.readonly-tip {
  margin: 14px 0 0;
  color: var(--muted);
}

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

@media (max-width: 1080px) {
  .metric-grid,
  .filter-band,
  .deploy-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

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

  .sidebar {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .side-nav {
    display: flex;
    margin-top: 0;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    gap: 14px;
    flex-direction: column;
  }

  .metric-grid,
  .filter-band,
  .deploy-form,
  .result-grid,
  .query-row {
    grid-template-columns: 1fr;
  }

  .table-toolbar {
    flex-wrap: wrap;
  }

  .toolbar-search {
    margin-left: 0;
  }

  .entry-panel,
  .status-panel {
    padding: 26px;
  }
}
