:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #f0f4f8;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --blue: #1d5fd0;
  --blue-dark: #164aa3;
  --green: #147d64;
  --amber: #b45f06;
  --red: #b42318;
  --shadow: 0 10px 30px rgba(21, 31, 46, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 249, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  min-width: 220px;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 19px;
  font-weight: 750;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
}

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

.tab {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

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

.connection {
  display: flex;
  min-width: 210px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.dot.online {
  background: var(--green);
}

.page {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px 28px 44px;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.title-block h1 {
  margin: 0;
  font-size: 25px;
}

.title-block p {
  max-width: 820px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

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

.button.primary:hover {
  background: var(--blue-dark);
}

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

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

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

.grid.two {
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  min-height: 94px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 760;
}

.metric-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 720;
}

.panel-body {
  padding: 16px;
}

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

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

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 95, 208, 0.12);
}

.table-wrap {
  overflow: auto;
  border-radius: 8px;
}

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

.summary-table {
  min-width: 1380px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #344054;
  font-weight: 720;
}

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

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

.status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue-dark);
  font-size: 12px;
  white-space: nowrap;
}

.status-pill.done {
  background: #ecfdf3;
  color: var(--green);
}

.status-pill.warn {
  background: #fff7ed;
  color: var(--amber);
}

.entry-list {
  display: grid;
  gap: 10px;
}

.entry-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 150px 150px minmax(180px, 0.8fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.entry-title {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.entry-title strong {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.entry-title small {
  color: var(--muted);
  line-height: 1.45;
}

.entry-row input {
  min-width: 0;
}

.admin-lock {
  display: grid;
  max-width: 480px;
  gap: 12px;
}

.notice {
  padding: 12px 14px;
  border: 1px solid #b8d7ff;
  border-radius: 8px;
  background: #eef6ff;
  color: #16436f;
  font-size: 13px;
  line-height: 1.55;
}

.notice.warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #7c2d12;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.link-button {
  padding: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
}

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

@media (max-width: 980px) {
  .topbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .tabs {
    overflow-x: auto;
  }

  .connection {
    justify-content: flex-start;
  }

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

  .actions {
    justify-content: flex-start;
  }

  .metrics,
  .grid.two,
  .form-grid,
  .form-grid.compact {
    grid-template-columns: 1fr;
  }

  .entry-row {
    grid-template-columns: 1fr;
  }

  .page {
    padding: 18px 14px 32px;
  }
}
