:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
  --line: #d8dee8;
  --line-soft: #edf1f6;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #e8f0ff;
  --danger: #b91c1c;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.topbar {
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.topbar span {
  margin-left: 10px;
  color: var(--muted);
  font-size: 13px;
}

.topbar nav {
  display: flex;
  gap: 18px;
}

.layout {
  max-width: 1180px;
  margin: 28px auto;
  padding: 0 20px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 22px;
  width: min(1440px, calc(100vw - 40px));
  margin: 28px auto;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 78px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.sidebar-title {
  display: grid;
  gap: 4px;
  padding-bottom: 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-title span {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-title strong {
  font-size: 17px;
}

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

.admin-sidebar a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

.admin-sidebar a:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.admin-sidebar a.is-active {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.admin-content {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.install-shell {
  max-width: 760px;
  margin: 28px auto;
  padding: 0 20px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.stats article {
  padding: 18px;
}

.stats span {
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.stats strong {
  font-size: 30px;
}

.panel {
  padding: 22px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.panel h2 {
  margin: 0 0 18px;
  font-size: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.panel h1 {
  margin: 0 0 18px;
}

.stack-form {
  display: grid;
  gap: 14px;
}

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

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

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

.filter-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.inline-form,
.task-form {
  display: grid;
  grid-template-columns: 120px minmax(90px, 1fr) minmax(180px, 1.5fr) auto;
  gap: 8px;
  align-items: center;
}

.task-form {
  grid-template-columns: 120px minmax(220px, 1.4fr) minmax(160px, 1fr) auto;
}

.mini-form {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto;
  gap: 8px;
}

.compact-form button {
  align-self: end;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.check-row input {
  width: auto;
  height: auto;
}

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

input,
select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
}

button {
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  height: 40px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 600;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

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

.button-secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.button-secondary:hover {
  background: var(--panel-soft);
}

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

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

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

th {
  color: var(--muted);
  font-weight: 600;
  background: var(--panel-soft);
  white-space: nowrap;
}

tbody tr:hover {
  background: #f8fbff;
}

.status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e0ecff;
  color: #1d4ed8;
}

.empty {
  color: var(--muted);
  text-align: center;
}

code {
  font-family: Consolas, monospace;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 5px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(420px, calc(100vw - 32px));
}

.login-panel {
  padding: 30px;
}

.login-panel h1 {
  margin: 0 0 8px;
}

.login-panel p {
  margin: 0 0 22px;
  color: var(--muted);
}

.login-panel form {
  display: grid;
  gap: 14px;
}

.alert {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.notice.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.notice.danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--danger);
}

.pager {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  margin-top: 14px;
}

.pager a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 14px;
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    gap: 12px;
    padding: 14px 18px;
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar span {
    display: block;
    margin: 4px 0 0;
  }

  .admin-shell {
    grid-template-columns: 1fr;
    width: min(100vw - 28px, 1180px);
    margin: 18px auto;
    gap: 16px;
  }

  .admin-sidebar {
    position: static;
  }

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

  table {
    min-width: 640px;
  }

  .stats,
  .settings-form,
  .grid-2,
  .compact-form,
  .filter-form,
  .inline-form,
  .mini-form,
  .task-form {
    grid-template-columns: 1fr;
  }
}
