@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/inter-700.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/jbmono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/jbmono-500.woff2") format("woff2");
}

:root {
  color-scheme: dark;

  --bg: #08090b;
  --surface-1: #0e1013;
  --surface-2: #14171b;
  --surface-3: #1a1e23;
  --surface-4: #22262d;

  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);

  --text: #e9ebef;
  --text-dim: #b3b9c2;
  --muted: #a0a7b1;
  --faint: #9199a5;

  --accent: #8dd9da;
  --accent-soft: rgba(141, 217, 218, 0.1);
  --accent-line: #8dd9da;
  --violet: #b79bff;

  --ok: #3fcf8e;
  --ok-soft: rgba(63, 207, 142, 0.12);
  --warn: #e8b25c;
  --warn-soft: rgba(232, 178, 92, 0.12);
  --danger: #f0736a;
  --danger-soft: rgba(240, 115, 106, 0.12);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --shadow-key: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 2px rgba(0, 0, 0, 0.4);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

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

::selection {
  background: rgba(141, 217, 218, 0.24);
}

:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.01em;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  transform: translateY(-180%);
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--r-sm);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- 应用骨架 ---------- */

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

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 0 14px;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
}

.logo {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.rail-btn {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
  position: relative;
}

.rail-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.rail-btn.active {
  color: var(--text);
  background: var(--surface-3);
}

.rail-btn.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.rail-spacer {
  flex: 1;
}

.main {
  min-width: 0;
  padding: 40px 40px 64px;
  width: 100%;
}

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

.site-name {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .025em;
  color: var(--text-dim);
}

.page-title {
  font-size: 30px;
  font-weight: 640;
  letter-spacing: -0.028em;
  margin: 0 0 4px;
}

.page-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 10px 0 11px;
  width: 288px;
  min-width: 0;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}

.search:focus-within {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text);
}

.search input::placeholder {
  color: var(--faint);
}

kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-key);
  white-space: nowrap;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px 4px 4px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}

.user-chip:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease);
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-3);
}

.btn-primary {
  background: var(--accent);
  border-color: rgba(255, 255, 255, 0.18);
  color: #0a0b10;
  font-weight: 620;
}

.btn-primary:hover {
  background: #aae7e8;
  color: #0a0b10;
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(240, 115, 106, 0.28);
  background: var(--danger-soft);
}

.btn-danger:hover {
  color: #fff;
  background: rgba(240, 115, 106, 0.28);
}

.btn-sm {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: 7px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- 工具卡片 ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 16px;
}

.tool-grid {
  margin-top: 20px;
}

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.result-count, .loading-message {
  color: var(--muted);
  font-size: 13px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  min-height: 248px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
  overflow: hidden;
}

.card:is(a, button):hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex: none;
  font-weight: 600;
  background: var(--surface-3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-key);
}

.tool-icon[data-accent="violet"] {
  color: #d8ceff;
  background: rgba(183, 155, 255, 0.12);
  border-color: rgba(183, 155, 255, 0.45);
}

.tool-icon[data-accent="cyan"] {
  color: #a8edf1;
  background: rgba(92, 219, 224, 0.1);
  border-color: rgba(92, 219, 224, 0.42);
}

.tool-icon[data-accent="amber"] {
  color: #f5d7a6;
  background: rgba(232, 178, 92, 0.1);
  border-color: rgba(232, 178, 92, 0.42);
}

.tool-icon[data-accent="green"] {
  color: #a9f2cf;
  background: rgba(63, 207, 142, 0.1);
  border-color: rgba(63, 207, 142, 0.4);
}

.tool-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  overflow-wrap: anywhere;
}

.tool-desc {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.8;
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.tool-storage {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.service-status, .tool-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

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

.tool-action {
  color: var(--accent);
  font-weight: 600;
}

.unavailable .tool-action {
  color: var(--muted);
}

.card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 7px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.01em;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.pill[data-tone="public"] {
  color: var(--accent);
  border-color: rgba(141, 217, 218, 0.24);
  background: var(--accent-soft);
}

.pill[data-tone="user"] {
  color: var(--text-dim);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.pill[data-tone="admin"] {
  color: #f0c98a;
  border-color: rgba(232, 178, 92, 0.26);
  background: var(--warn-soft);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}

.dot.online {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(63, 207, 142, 0.14);
}

.dot.offline {
  background: #5d646e;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 38px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 11.5px;
}

.site-foot a {
  color: var(--muted);
  transition: color 0.15s var(--ease);
}

.site-foot a:hover {
  color: var(--text-dim);
}

.foot-dot {
  color: var(--border-strong);
}

.icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--faint);
  transition: all 0.15s var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-3);
}

/* ---------- 空状态与提示 ---------- */

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.012);
}

.empty h2, .empty h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dim);
}

.empty p {
  margin: 0;
  font-size: 13px;
}

.empty .btn {
  margin-top: 20px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  transition: all 0.15s var(--ease);
}

.chip:hover {
  color: var(--text-dim);
  border-color: var(--border-strong);
  background: var(--surface-1);
}

.chip.active {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.chip-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--faint);
}

.chip.active .chip-count {
  color: var(--muted);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 12px;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 560;
}

.section-label:first-child {
  margin-top: 0;
}

.section-label .count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border);
  color: var(--muted);
  letter-spacing: 0;
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.card.add {
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-style: dashed;
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.012);
  text-align: center;
  min-height: 168px;
}

.card.add:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.add-plus {
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  font-weight: 300;
}

.add-title {
  font-size: 13.5px;
  font-weight: 560;
  color: var(--text-dim);
}

.add-hint {
  color: var(--faint);
  font-size: 10.5px;
}

/* ---------- 表格（管理） ---------- */

.panel {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  overflow: hidden;
}

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

.panel-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
}

.panel-head p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--faint);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 560;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.012);
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  vertical-align: middle;
}

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

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.018);
}

.cell-strong {
  color: var(--text);
  font-weight: 540;
}

.cell-sub {
  display: block;
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 1px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 11px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.tag.ok {
  color: var(--ok);
  border-color: rgba(63, 207, 142, 0.24);
  background: var(--ok-soft);
}

.tag.warn {
  color: var(--warn);
  border-color: rgba(232, 178, 92, 0.24);
  background: var(--warn-soft);
}

.tag.danger {
  color: var(--danger);
  border-color: rgba(240, 115, 106, 0.24);
  background: var(--danger-soft);
}

/* ---------- 表单控件 ---------- */

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

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

.input,
.select,
textarea.input {
  height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
  width: 100%;
}

textarea.input {
  height: auto;
  padding: 9px 11px;
  resize: vertical;
  min-height: 66px;
}

.input:focus,
.select:focus,
textarea.input:focus {
  border-color: var(--accent-line);
  background: var(--surface-3);
}

.input::placeholder {
  color: var(--faint);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23868d97' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hint {
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.5;
}

/* ---------- 弹层 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 7, 0.66);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 40;
  animation: fade 0.16s var(--ease);
}

.modal {
  width: min(520px, 100%);
  border-radius: var(--r-xl);
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: pop 0.18s var(--ease);
}

.modal-head {
  padding: 18px 20px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.modal-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--faint);
}

.modal-body {
  padding: 4px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  max-height: 62vh;
  overflow: auto;
}

.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--faint);
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-3);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
}

/* ---------- 命令面板 ---------- */

.palette {
  width: min(560px, 100%);
  align-self: start;
  margin-top: 12vh;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.palette input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  font-size: 14px;
}

.palette-list {
  max-height: 46vh;
  overflow: auto;
  padding: 6px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--text-dim);
  cursor: pointer;
}

.palette-item[aria-selected="true"],
.palette-item:hover {
  background: var(--surface-3);
  color: var(--text);
}

.palette-item .mono {
  margin-left: auto;
  color: var(--faint);
}

/* ---------- 提示条 ---------- */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  font-size: 12.5px;
  color: var(--text-dim);
  animation: pop 0.18s var(--ease);
}

.toast.error {
  border-color: rgba(240, 115, 106, 0.4);
  color: #ffd8d4;
}

.toast.ok {
  border-color: rgba(63, 207, 142, 0.4);
  color: #d3ffe9;
}

/* ---------- 登录页 ---------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.auth-brand {
  position: relative;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--surface-1);
}

.auth-brand-inner {
  position: relative;
  z-index: 1;
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
}

.auth-title {
  font-size: 40px;
  line-height: 1.14;
  letter-spacing: -0.035em;
  font-weight: 620;
  margin: 26px 0 14px;
  max-width: 12em;
  text-wrap: balance;
}

.only-wide {
  display: block;
}

@media (max-width: 900px) {
  .only-wide {
    display: none;
  }
}

.auth-title em {
  font-style: normal;
  background: linear-gradient(96deg, #a99cff, #7a8bff 45%, #5ce0d0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-lead {
  color: var(--muted);
  font-size: 13.5px;
  max-width: 42ch;
  line-height: 1.65;
}

.auth-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 2;
}

.auth-meta .pill {
  height: 24px;
  font-size: 11px;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 40px;
}

.auth-card {
  width: min(400px, 100%);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 24px;
  color: var(--text-dim);
  font-size: 13px;
}

.back-link:hover {
  color: var(--accent);
}

.login-context {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-strong);
}

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

.login-context h1 {
  margin: 8px 0;
  font-size: 25px;
  overflow-wrap: anywhere;
}

.login-context p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.auth-form .input {
  min-height: 46px;
  font-size: 16px;
}

.auth-form .btn {
  min-height: 46px;
}

.auth-card h2 {
  margin: 0 0 6px;
  font-size: 21px;
  letter-spacing: -0.025em;
  font-weight: 620;
}

.auth-card > p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-error {
  display: none;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--danger-soft);
  border: 1px solid rgba(240, 115, 106, 0.3);
  color: #ffd3cf;
  font-size: 12.5px;
}

.auth-error.show {
  display: block;
}

.auth-foot {
  margin-top: 22px;
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.6;
}

.auth-card > .auth-foot {
  margin: 24px 0 0;
  color: var(--muted);
}

.auth-switch {
  margin: 20px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.auth-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-left: 8px;
  color: var(--accent);
}

.registration-page {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 32px 24px 56px;
}

.registration-card {
  width: min(460px, 100%);
}

.registration-card h1 {
  margin: 0;
  font-size: 28px;
}

.registration-lead {
  margin: 10px 0 24px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.8;
}

.registration-result {
  padding: 24px 0;
  color: var(--text-dim);
}

.registration-result h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
}

.registration-result ul {
  padding-left: 20px;
}

.registration-result li a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
}

.permission-warning, .permission-notice {
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.8;
  background: var(--surface-2);
}

.permission-notice {
  margin: 0 0 20px;
}

.permission-warning {
  border-color: rgba(232, 178, 92, .4);
  color: #f0c98a;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-tabs .btn, .table-scroll .btn {
  min-height: 40px;
}

body:has(.overlay) {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  width: 100%;
}

.user-app-list {
  min-width: 120px;
  max-width: 260px;
  overflow-wrap: anywhere;
}

.grant-choices {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  margin: 0;
  padding: 12px;
}

.grant-choices legend {
  color: var(--text-dim);
  padding: 0 6px;
  font-size: 13px;
}

.grant-choices label {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  cursor: pointer;
}

.grant-choices input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

altcha-widget {
  --altcha-max-width: 100%;
  --altcha-color-base: var(--surface-1);
  --altcha-color-base-content: var(--text);
  --altcha-color-primary: var(--accent);
  --altcha-border-color: var(--border-strong);
  --altcha-color-neutral-content: var(--text-dim);
  color-scheme: inherit;
  display: block;
  min-height: 76px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 620;
  letter-spacing: -0.02em;
}

.brand-mark .logo {
  margin: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 13px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .auth {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    display: none;
  }
  .main {
    padding: 18px 16px 48px;
  }
  .shell {
    grid-template-columns: 56px minmax(0, 1fr);
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .search {
    min-width: 0;
    flex: 1;
    width: auto;
  }
  .topbar-right {
    width: 100%;
  }
  .auth-panel {
    padding: 24px;
  }
}

@media (max-width: 600px) {
  .shell {
    display: block;
  }
  .rail {
    height: auto;
    flex-direction: row;
    padding: 8px 16px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    z-index: 10;
  }
  .rail .logo {
    margin: 0 8px 0 0;
  }
  .rail-btn.active::before {
    display: none;
  }
  .main {
    padding: 24px 16px 40px;
  }
  .site-name {
    margin-bottom: 8px;
  }
  .page-title {
    font-size: 26px;
  }
  .search kbd {
    display: none;
  }
  .topbar-right:has(.registration-entry) {
    flex-wrap: wrap;
  }
  .topbar-right:has(.registration-entry) .search {
    flex-basis: 100%;
  }
  .admin-tabs .btn, .table-scroll .btn {
    min-height: 44px;
  }
  .card {
    padding: 20px;
  }
  .catalog-toolbar .toolbar {
    flex-wrap: wrap;
  }
  .catalog-toolbar .chip {
    min-height: 44px;
  }
  .toast-stack {
    left: 16px;
    right: 16px;
  }
  .toast {
    min-width: 0;
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- 服务器监控 ---------- */

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

@media (max-width: 1100px) {
  .mon-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.mon-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
}

.mon-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mon-label {
  font-size: 12.5px;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}

.mon-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
}

.mon-badge[data-tone='warn'] {
  color: var(--warn);
  background: var(--warn-soft);
}

.mon-badge[data-tone='danger'] {
  color: var(--danger);
  background: var(--danger-soft);
}

.spark {
  width: 100%;
  height: 76px;
  display: block;
}

.mon-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--faint);
}

.mon-sys {
  margin-top: 14px;
  padding: 16px;
}

.mon-sys-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.mon-sys-row div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mon-sys-row span {
  font-size: 11px;
  color: var(--faint);
}

.mon-sys-row strong {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
}

.mon-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.6;
  color: var(--faint);
}

.mon-scale {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--faint);
  text-align: right;
  margin-bottom: -8px;
}
