:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #657085;
  --line: #e6e9f0;
  --brand: #2f7cf6;
  --brand-dark: #185fd0;
  --success: #18a675;
  --warning: #f59f00;
  --danger: #e5484d;
  --shadow: 0 14px 40px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

body {
  min-height: 100%;
  margin: 0;
}

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 5vw, 40px);
  border-bottom: 1px solid rgba(230, 233, 240, 0.9);
  background: rgba(246, 247, 251, 0.92);
  backdrop-filter: blur(14px);
}

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

h1 {
  margin-top: 4px;
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.15;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 17px;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.status-pill.ok {
  color: var(--success);
  border-color: rgba(24, 166, 117, 0.2);
  background: #edfbf6;
}

.status-pill.error {
  color: var(--danger);
  border-color: rgba(229, 72, 77, 0.2);
  background: #fff1f1;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 4vw, 36px) 48px;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.04);
}

.tab {
  min-width: max-content;
  padding: 11px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: var(--brand);
  color: #fff;
}

.panel {
  display: none;
  margin-top: 18px;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel.active {
  display: block;
}

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

.grid {
  display: grid;
  gap: 14px;
}

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

.metric-card,
.form-card,
.list-card,
.info-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 116px;
  padding: 18px;
}

.metric-card span,
.metric-card small,
label {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  font-size: 26px;
  line-height: 1.1;
}

.info-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 16px;
  color: var(--muted);
  line-height: 1.65;
}

.primary-btn,
.ghost-btn {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  font-weight: 800;
}

.primary-btn {
  padding: 0 18px;
  background: var(--brand);
  color: #fff;
}

.primary-btn:hover {
  background: var(--brand-dark);
}

.ghost-btn {
  padding: 0 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.form-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

textarea,
input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(47, 124, 246, 0.65);
  box-shadow: 0 0 0 4px rgba(47, 124, 246, 0.1);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.form-grid.compact {
  max-width: 520px;
}

.field {
  display: grid;
  gap: 7px;
}

.full {
  align-self: end;
}

.result-box {
  min-height: 150px;
  margin: 16px 0 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #101828;
  color: #e6edf7;
  padding: 16px;
  white-space: pre-wrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.list-card {
  padding: 16px;
}

.list-card h3 {
  margin-bottom: 12px;
}

.list-empty,
.list-item {
  color: var(--muted);
  font-size: 14px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
}

.badge {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 14px;
  background: #101828;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-pill {
    justify-content: flex-start;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .ghost-btn,
  .primary-btn {
    width: 100%;
  }
}
