/* backend-nav 登录页与导航页的样式。prompt-lab/ 是原样复制来的页面，自带样式，不引用本文件。 */

:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #e2e6ec;
  --text: #1c2230;
  --sub: #667085;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eaf1ff;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fef5e4;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --panel: #181c25;
    --line: #2a303c;
    --text: #e7eaf0;
    --sub: #98a2b3;
    --primary: #5b8dff;
    --primary-hover: #7aa2ff;
    --primary-soft: #1c2740;
    --danger: #ff8a80;
    --danger-soft: #3a1d1d;
    --warn: #f5b755;
    --warn-soft: #33270f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

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

body {
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button, input { font: inherit; color: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn:focus-visible, .field input:focus-visible, .tile:focus-visible {
  outline: 3px solid var(--primary-soft);
  outline-offset: 1px;
  border-color: var(--primary);
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-ghost { background: transparent; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.notice {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}
.notice-error { background: var(--danger-soft); color: var(--danger); }
.notice-info { background: var(--primary-soft); color: var(--primary); }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}
.env-badge {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--warn-soft);
  color: var(--warn);
}
.env-badge[data-env="prod"] { background: var(--primary-soft); color: var(--primary); }

/* ===================== 登录页 ===================== */

.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 32px 28px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 20px 0 4px; font-size: 22px; line-height: 1.3; }
.login-card .lead { margin: 0 0 22px; color: var(--sub); font-size: 14px; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 6px; font-size: 13px; color: var(--sub); }
.field input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.login-card .btn-primary { width: 100%; margin-top: 6px; min-height: 44px; }
.login-card .notice { margin-bottom: 16px; }
.login-foot { margin: 18px 0 0; font-size: 12px; color: var(--sub); text-align: center; }

/* ===================== 导航页 ===================== */

.topbar {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-meta { text-align: right; line-height: 1.3; min-width: 0; }
.user-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.user-sub { font-size: 12px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }

.nav-main { max-width: 1080px; margin: 0 auto; padding: 36px 24px 56px; }
.nav-main h1 { margin: 0 0 4px; font-size: 24px; }
.nav-main .lead { margin: 0 0 24px; color: var(--sub); }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  list-style: none;
  margin: 0; padding: 0;
}
.tile {
  display: flex; flex-direction: column; gap: 6px;
  height: 100%;
  min-height: 132px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
a.tile:hover { border-color: var(--primary); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { a.tile:hover { transform: none; } }
.tile-name { font-size: 17px; font-weight: 650; overflow-wrap: anywhere; }
.tile-code { font-family: var(--mono); font-size: 12px; color: var(--sub); }
.tile-foot {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; color: var(--sub);
}
.tile-host { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-go { color: var(--primary); font-weight: 600; white-space: nowrap; }
.tile-disabled { box-shadow: none; opacity: .75; border-style: dashed; }
.tile-disabled .tile-foot { color: var(--warn); }

.state {
  padding: 48px 24px;
  text-align: center;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--sub);
}
.state h2 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.state p { margin: 0 0 16px; }
.state .spinner { color: var(--primary); width: 22px; height: 22px; display: inline-block; }

@media (max-width: 520px) {
  .topbar { padding: 10px 16px; }
  .nav-main { padding: 24px 16px 40px; }
  .user-meta { display: none; }
}
