:root {
  --bg: #f5f1e9;
  --sidebar: #e8e0d2;
  --surface: #fffdf8;
  --line: #d8d0c2;
  --text: #28241f;
  --muted: #70685c;
  --green: #1b7f5a;
  --ink: #22313d;
  --red: #b8433e;
  --amber: #b87322;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  height: 38px;
  padding: 0 14px;
  color: white;
  background: var(--green);
  border: 1px solid #0f6042;
  border-radius: 8px;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

.hidden {
  display: none !important;
}

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

.login-box {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(37, 31, 24, 0.14);
}

.brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand.compact {
  grid-template-columns: 42px minmax(0, 1fr);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff8ed;
  font-weight: 800;
  background: var(--ink);
  border-radius: 8px;
}

.compact .brand-mark {
  width: 42px;
  height: 42px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
}

h2 {
  margin-top: 4px;
  font-size: 28px;
}

.brand p,
.eyebrow,
.hint,
.message {
  color: var(--muted);
  font-size: 13px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0 10px;
  color: var(--text);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

input:focus,
select:focus {
  border-color: #8f8372;
  outline: 2px solid rgba(27, 127, 90, 0.14);
}

.dashboard {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: 24px 18px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}

.tabs {
  display: grid;
  align-content: start;
  gap: 8px;
}

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

.tabs button {
  justify-content: start;
  width: 100%;
  text-align: left;
}

.tabs button.active,
.tabs button:hover {
  background: var(--surface);
  border-color: #c3b8a8;
}

.ghost,
.secondary {
  background: var(--surface);
  border-color: var(--line);
}

.content {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
  padding: 26px;
}

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

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

.summary-item,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-item {
  min-height: 96px;
  padding: 18px;
}

.summary-item span {
  color: var(--muted);
  font-size: 13px;
}

.summary-item strong {
  display: block;
  margin-top: 12px;
  font-size: 28px;
}

.tab-page {
  min-width: 0;
}

.form-row,
.node-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.form-row {
  grid-template-columns: 1.2fr 1fr 0.8fr 0.8fr auto;
}

.node-form {
  grid-template-columns: 1fr 0.7fr 1.2fr 0.6fr;
}

.node-form button {
  grid-column: 4;
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  color: var(--muted);
  font-weight: 700;
  background: #faf6ef;
}

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

td code {
  display: inline-block;
  max-width: 520px;
  overflow: hidden;
  color: #3b332c;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: var(--green);
  background: #e6f4ed;
  border-radius: 999px;
}

.status.pending {
  color: var(--amber);
  background: #fff3dc;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 220px;
  max-width: 420px;
  padding: 12px 14px;
  color: white;
  background: var(--ink);
  border-radius: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.18s ease;
}

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

@media (max-width: 1080px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .form-row button,
  .node-form button {
    grid-column: auto;
  }
}
