:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "Segoe UI", Arial, sans-serif;
  background: #eef2f6;
  color: #1f2937;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.hidden {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 72px 16px;
}

.auth-panel {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

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

.sidebar {
  background: #111827;
  color: #f8fafc;
  padding: 18px 14px;
}

.brand {
  display: grid;
  gap: 4px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 12px;
}

.brand strong {
  font-size: 16px;
}

.brand span {
  color: #cbd5e1;
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  padding: 10px 12px;
  border-radius: 6px;
}

.side-nav button.active,
.side-nav button:hover {
  background: #2563eb;
  color: #fff;
}

.workspace {
  padding: 18px 20px 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

h2 {
  margin: 0 0 12px;
  font-size: 17px;
}

p {
  margin: 4px 0 0;
  color: #64748b;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar,
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.editor,
.table-wrap {
  background: #fff;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.editor.static {
  max-width: 820px;
}

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

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

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  font: inherit;
  padding: 8px 10px;
}

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

textarea.large {
  min-height: 300px;
}

button {
  border: 1px solid #2563eb;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

button.ghost {
  background: #fff;
  color: #2563eb;
}

button.danger {
  border-color: #dc2626;
  background: #dc2626;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e2e8f0;
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
}

td.actions-cell {
  width: 180px;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  min-width: 42px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: #e2e8f0;
  color: #334155;
}

.badge.on {
  background: #dcfce7;
  color: #166534;
}

.badge.off {
  background: #fee2e2;
  color: #991b1b;
}

.muted {
  color: #64748b;
}

.status {
  min-height: 24px;
  color: #0f766e;
}

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

  .sidebar {
    position: static;
  }

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

  .topbar,
  .grid.two {
    grid-template-columns: 1fr;
    display: grid;
  }
}
