/* ============================================================
   RepoGuard · 仓护  —  design system
   ============================================================ */

:root {
  --bg: #070b11;
  --bg-soft: #0b1119;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-strong: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e8eef7;
  --text-dim: #93a1b5;
  --text-faint: #64748b;
  --accent: #3ddc97;
  --accent-soft: rgba(61, 220, 151, 0.14);
  --accent-2: #6ea8fe;
  --accent-2-soft: rgba(110, 168, 254, 0.14);
  --danger: #ff6b81;
  --danger-soft: rgba(255, 107, 129, 0.14);
  --warn: #ffc464;
  --warn-soft: rgba(255, 196, 100, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.9);
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(61, 220, 151, 0.09), transparent 60%),
    radial-gradient(800px 500px at 92% 0%, rgba(110, 168, 254, 0.09), transparent 62%),
    radial-gradient(700px 700px at 60% 110%, rgba(61, 220, 151, 0.05), transparent 65%);
  z-index: 0;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

::selection {
  background: rgba(61, 220, 151, 0.3);
}

/* ---------- scrollbar ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
  background-clip: padding-box;
}

/* ============================================================
   Shell
   ============================================================ */
.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 40%);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, rgba(61, 220, 151, 0.9), rgba(110, 168, 254, 0.85));
  color: #04120c;
  font-weight: 800;
  box-shadow: 0 8px 26px -10px rgba(61, 220, 151, 0.8);
}

.brand-name {
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 15px;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-label {
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  border: 1px solid transparent;
  transition: all 0.16s ease;
  cursor: pointer;
  background: none;
  font: inherit;
  text-align: left;
  width: 100%;
}
.nav-item:hover {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-soft);
  border-color: rgba(61, 220, 151, 0.25);
  color: #c9ffe6;
}
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .count {
  color: #a7f3d0;
}
.nav-item svg {
  flex: none;
  opacity: 0.9;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}
.user-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #06180f;
  background: linear-gradient(140deg, #7ef3c0, #6ea8fe);
  flex: none;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role {
  font-size: 11px;
  color: var(--text-faint);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 17, 0.72);
  backdrop-filter: blur(14px);
}

.page-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.1px;
  margin: 0;
}
.page-sub {
  font-size: 12px;
  color: var(--text-faint);
  margin: 0;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.content {
  padding: 26px 28px 70px;
  max-width: 1280px;
  width: 100%;
}

.view-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.view-head .page-title {
  font-size: 20px;
  letter-spacing: -0.2px;
}
.view-head .page-sub {
  margin-top: 3px;
}

/* ============================================================
   Buttons / chips
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}
.btn:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.22);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn svg {
  flex: none;
}

.btn-primary {
  background: linear-gradient(160deg, #47e6a4, #2fc98a);
  border-color: rgba(61, 220, 151, 0.5);
  color: #04170f;
  font-weight: 700;
  box-shadow: 0 10px 26px -14px rgba(61, 220, 151, 0.9);
}
.btn-primary:hover {
  background: linear-gradient(160deg, #55f0b0, #35d694);
  border-color: rgba(61, 220, 151, 0.7);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover {
  color: var(--text);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(255, 107, 129, 0.3);
  color: #ffb3bd;
}
.btn-danger:hover {
  background: rgba(255, 107, 129, 0.22);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-icon {
  padding: 6px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: transparent;
  border-color: transparent;
  color: var(--text-faint);
}
.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.7;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  white-space: nowrap;
}
.chip-accent {
  background: var(--accent-soft);
  border-color: rgba(61, 220, 151, 0.25);
  color: #a7f3d0;
}
.chip-blue {
  background: var(--accent-2-soft);
  border-color: rgba(110, 168, 254, 0.25);
  color: #c3dcff;
}
.chip-warn {
  background: var(--warn-soft);
  border-color: rgba(255, 196, 100, 0.3);
  color: #ffdca8;
}
.chip-danger {
  background: var(--danger-soft);
  border-color: rgba(255, 107, 129, 0.3);
  color: #ffb9c4;
}

/* ============================================================
   Cards
   ============================================================ */
.panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 13.5px;
  font-weight: 650;
  margin: 0;
}
.panel-body {
  padding: 18px;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  cursor: pointer;
  transition: all 0.18s ease;
  overflow: hidden;
}
.project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: radial-gradient(400px 120px at 15% 0%, rgba(61, 220, 151, 0.1), transparent 70%);
  pointer-events: none;
}
.project-card:hover {
  border-color: rgba(61, 220, 151, 0.32);
  transform: translateY(-2px);
  box-shadow: 0 22px 44px -30px rgba(0, 0, 0, 0.95);
}
.project-card:hover::after {
  opacity: 1;
}
.project-card.archived {
  opacity: 0.62;
}
.project-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.project-name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.1px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-domain {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-desc {
  font-size: 12.5px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}
.project-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-faint);
  border-top: 1px dashed var(--border);
  padding-top: 11px;
  margin-top: auto;
}
.project-meta b {
  color: var(--text-dim);
  font-weight: 600;
}

/* ============================================================
   Forms
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 6px;
}
.label .req {
  color: var(--danger);
}
.hint {
  font-size: 11.5px;
  color: var(--text-faint);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(3, 7, 12, 0.6);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder,
.textarea::placeholder {
  color: #4b5b6f;
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(61, 220, 151, 0.55);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.12);
}
.textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.65;
}
.textarea.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
  cursor: pointer;
}
.select option {
  background: #0c131c;
}
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 11px;
  color: var(--text-faint);
  pointer-events: none;
}
.search-wrap .input {
  padding-left: 34px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.filter-bar .input,
.filter-bar .select {
  width: auto;
  min-width: 130px;
  font-size: 12.5px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  user-select: none;
}
.switch.on {
  color: #c9ffe6;
  border-color: rgba(61, 220, 151, 0.28);
  background: var(--accent-soft);
}

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  background: rgba(3, 6, 11, 0.72);
  backdrop-filter: blur(6px);
  animation: fade 0.16s ease;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }
}
.modal {
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #0d151f, #0a1017);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 1);
  animation: rise 0.2s ease;
  margin: auto 0;
}
.modal.wide {
  max-width: 820px;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.modal-title {
  font-size: 15px;
  font-weight: 650;
  margin: 0;
}
.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  border-radius: 0 0 16px 16px;
  flex: 0 0 auto;
}
.modal-foot .spacer {
  margin-right: auto;
}

/* ============================================================
   Timeline
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 26px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: linear-gradient(180deg, rgba(61, 220, 151, 0.5), rgba(255, 255, 255, 0.06));
}
.tl-item {
  position: relative;
  padding-bottom: 18px;
}
.tl-item:last-child {
  padding-bottom: 0;
}
.tl-dot {
  position: absolute;
  left: -25px;
  top: 6px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid #0b1119;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.16);
}
.tl-dot.blue {
  background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(110, 168, 254, 0.16);
}

/* ============================================================
   Record card
   ============================================================ */
.record-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
  overflow: hidden;
  transition: border-color 0.16s ease;
}
.record-card:hover {
  border-color: var(--border-strong);
}
.record-head {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  align-items: flex-start;
}
.record-head:hover {
  background: rgba(255, 255, 255, 0.02);
}
.record-title {
  font-size: 13.5px;
  font-weight: 620;
  margin: 0 0 3px;
}
.record-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-faint);
}
.record-body {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.record-content {
  font-size: 13px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  border-left: 2px solid var(--border-strong);
  padding-left: 12px;
}

/* prompt block */
.prompt {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.prompt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
}
.prompt-label {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.prompt-body {
  margin: 0;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: #b9c8da;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
}
.prompt.empty .prompt-body {
  color: var(--text-faint);
  font-style: italic;
}

/* ============================================================
   Table
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: middle;
}
.table tr:last-child td {
  border-bottom: none;
}
.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.table .mono {
  font-family: var(--mono);
  font-size: 12.5px;
}
.pwd-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.4px;
  color: var(--text-dim);
}
.pwd-cell.revealed {
  color: #ffdf9e;
}

/* ============================================================
   Misc
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-faint);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  transition: color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab:hover {
  color: var(--text);
}
.tab.active {
  color: #b8ffdd;
  border-bottom-color: var(--accent);
}
.tab .count {
  font-size: 11px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text-dim);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: #0a1017;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.info-cell {
  background: #0a1017;
  padding: 14px 16px;
  min-width: 0;
}
.info-key {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.info-val {
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}
.info-val.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}
.info-val a {
  color: var(--accent-2);
  word-break: break-all;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-faint);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--surface-strong);
  color: var(--text-dim);
}
.empty h4 {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 600;
}
.empty p {
  margin: 0;
  font-size: 12.5px;
  max-width: 380px;
}

.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(61, 220, 151, 0.3);
  background: rgba(10, 22, 18, 0.96);
  color: #c9ffe6;
  font-size: 13px;
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.9);
  animation: rise 0.18s ease;
  max-width: 380px;
}
.toast.error {
  border-color: rgba(255, 107, 129, 0.36);
  background: rgba(28, 11, 15, 0.96);
  color: #ffc3cc;
}
.toast.info {
  border-color: rgba(110, 168, 254, 0.34);
  background: rgba(11, 18, 30, 0.96);
  color: #c3dcff;
}

.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 13px;
  padding: 32px;
  justify-content: center;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 650;
}
.section-title .line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row-wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}
/* 行内标题（如提示词块）给足最小宽度，窄屏时整行换行，避免文字被右侧控件压住 */
.row > .label.grow {
  flex: 1 1 170px;
}
.muted {
  color: var(--text-faint);
}
.dim {
  color: var(--text-dim);
}
.mono {
  font-family: var(--mono);
}
.nowrap {
  white-space: nowrap;
}

/* ---------- auth screens ---------- */
.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 30px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 1);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #47e6a4, #6ea8fe);
  color: #04120c;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 12px 30px -12px rgba(61, 220, 151, 0.8);
}
.auth-title {
  font-size: 20px;
  font-weight: 700;
  margin: 6px 0 0;
}
.auth-sub {
  font-size: 12.5px;
  color: var(--text-faint);
  margin: 0;
}
.auth-error {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(255, 107, 129, 0.3);
  color: #ffb9c4;
  font-size: 12.5px;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 9px 14px 7px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 11, 17, 0.92);
    backdrop-filter: blur(14px);
  }
  .brand {
    order: 1;
    padding: 0;
    gap: 8px;
  }
  .brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }
  .brand-mark svg {
    width: 16px;
    height: 16px;
  }
  .brand-name {
    font-size: 13px;
  }
  .sidebar .nav {
    order: 3;
    flex-basis: 100%;
    flex-direction: row;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    /* 右侧渐隐，提示这一排可以横向滑动 */
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
  }
  .sidebar .nav::-webkit-scrollbar {
    display: none;
  }
  .nav-label,
  .sidebar-foot .user-role,
  .brand-sub {
    display: none;
  }
  .nav-item {
    width: auto;
    flex: none;
    white-space: nowrap;
    padding: 6px 11px;
    font-size: 12.5px;
  }
  .nav-item .count {
    margin-left: 2px;
  }
  .sidebar-foot {
    order: 2;
    margin-top: 0;
    margin-left: auto;
    padding: 0;
    border: none;
    background: none;
  }
  .user-row {
    gap: 4px;
  }
  .user-name {
    display: none;
  }
  .topbar {
    padding: 12px 16px;
  }
  .content {
    padding: 18px 16px 60px;
  }
  .view-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .view-head > .grow {
    width: 100%;
  }
  .view-head > .row {
    width: 100%;
    justify-content: flex-start !important;
  }
  .search-wrap {
    flex: 1 1 180px;
    min-width: 0;
  }
  .search-wrap .input {
    width: 100% !important;
    min-width: 0;
  }
  .record-head {
    flex-wrap: wrap;
  }
  .record-head > .row {
    margin-left: auto;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .project-meta {
    flex-wrap: wrap;
  }
  .modal-backdrop {
    padding: 12px;
  }
  .table {
    font-size: 12px;
  }
  .hide-sm {
    display: none;
  }
}
