:root {
  --bg: #0a0a0e;
  --surface: #16161d;
  --surface-2: #1e1e27;
  --ink: #f1f0f5;
  --ink-dim: #86838f;
  --rule: rgba(241, 240, 245, 0.1);
  --primary: #ff4436;
  --primary-ink: #ff6a52;
  --accent: #c9973f;
  --accent-ink: #d9ad5c;
  --danger: #e5484d;
  --success: #35c98c;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 未登录时的简单顶部条 + 居中卡片布局（当前登录后台已经换成营销站里的 auth 页面，这两块保留给旧路径兜底） */
.topbar {
  display: flex;
  align-items: center;
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

.auth-wrap {
  max-width: 380px;
  margin: 3rem auto 0;
  padding: 0 1.5rem;
}

.shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 1.4rem 1rem;
}

.brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.6rem;
  margin-bottom: 1.6rem;
}
.brand .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--primary);
  display: inline-block;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}

.sidebar-footer {
  border-top: 1px solid var(--rule);
  padding: 1rem 0.6rem 0;
  margin-top: 1rem;
  font-size: 0.85rem;
}
.sidebar-footer .muted {
  display: block;
  margin-bottom: 0.7rem;
  word-break: break-all;
}
.sidebar-footer button {
  width: 100%;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.wrap {
  width: 100%;
  margin: 0;
  padding: 2rem 2.2rem 5rem;
}

@media (max-width: 720px) {
  .shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }
}

h1 {
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
}

.card {
  background: var(--surface);
  border-radius: 4px;
  padding: 1.6rem 1.7rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--rule);
}

h2 {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 1.1rem;
  letter-spacing: -0.005em;
}

h3 {
  font-weight: 600;
  font-size: 0.92rem;
  margin: 1.4rem 0 0.7rem;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-dim);
  font-weight: 500;
  margin-bottom: 0.9rem;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 0.92rem;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color 0.15s ease;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

small {
  color: var(--ink-dim);
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.6rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--primary);
  color: #0a0a0e;
  transition: opacity 0.15s ease, transform 0.05s ease;
}
button:hover {
  opacity: 0.9;
}
button:active {
  transform: scale(0.98);
}
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button.secondary.active {
  background: var(--primary);
  color: #0a0a0e;
  border-color: var(--primary);
}

button.secondary {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--rule);
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
}
button.danger:hover {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
}

.inline-form {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
  align-items: flex-start;
}
.inline-form input,
.inline-form select {
  margin-top: 0;
  width: auto;
  flex: 1;
  min-width: 140px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

th,
td {
  text-align: left;
  vertical-align: middle;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--rule);
}

th {
  color: var(--ink-dim);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td.num,
th.num {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.message {
  font-size: 0.85rem;
  min-height: 1.2em;
  margin: 0.5rem 0 0;
}
.message.error {
  color: var(--danger);
}
.message.ok {
  color: var(--success);
}

.pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.pill.on {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
}
.pill.off {
  background: color-mix(in srgb, var(--ink-dim) 18%, transparent);
  color: var(--ink-dim);
}
.pill.warn {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent-ink);
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.row-actions button {
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
}
.row-actions input {
  margin-top: 0;
  padding: 0.35rem 0.5rem;
}

.stat {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.hint {
  font-size: 0.82rem;
  color: var(--ink-dim);
  background: var(--surface-2);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
}

.divider {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 1.4rem 0;
}

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

a {
  color: var(--primary-ink);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}
.side-nav a {
  text-decoration: none;
  color: var(--ink-dim);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.6rem 0.7rem;
  border-radius: 4px;
}
.side-nav a:hover {
  background: var(--surface-2);
}
.side-nav a.active {
  background: var(--primary);
  color: #0a0a0e;
}
