/* ==========================================================================
   MarkHub — 令牌层 (tokens)
   ========================================================================== */

:root {
  color-scheme: light;

  /* 暖琥珀 + 链接蓝 */
  --bg: #fffbeb;
  --bg-sidebar: #fdf4e3;
  --surface: #ffffff;
  --surface-2: #fcf6f0;
  --fg: #0f172a;
  --fg-muted: #475569;
  --border: #f3e6d3;
  --border-strong: #e6d5bd;

  --brand: #d97706;
  --brand-strong: #b45309;
  --brand-soft: #fef3c7;
  --on-brand: #000000;

  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #dbeafe;
  --on-accent: #ffffff;

  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #059669;

  --ring: #b45309;

  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.05), 0 1px 3px rgb(15 23 42 / 0.04);
  --shadow-md: 0 4px 6px -1px rgb(15 23 42 / 0.07), 0 10px 20px -4px rgb(15 23 42 / 0.08);
  --shadow-lg: 0 18px 40px -12px rgb(15 23 42 / 0.22);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-full: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  --sidebar-w: 268px;
  --topbar-h: 68px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 200ms;

  --g-amber: #d97706;
  --g-blue: #2563eb;
  --g-green: #059669;
  --g-rose: #e11d48;
  --g-violet: #7c3aed;
  --g-cyan: #0891b2;
  --g-orange: #ea580c;
  --g-slate: #64748b;
}

[data-theme='dark'] {
  color-scheme: dark;

  --bg: #0b1120;
  --bg-sidebar: #0e1626;
  --surface: #141d2f;
  --surface-2: #1b263b;
  --fg: #e8edf5;
  --fg-muted: #9aa8bd;
  --border: #263246;
  --border-strong: #35435c;

  --brand: #fbbf24;
  --brand-strong: #f59e0b;
  --brand-soft: rgb(251 191 36 / 0.16);
  --on-brand: #1a1204;

  --accent: #3b82f6;
  --accent-strong: #60a5fa;
  --accent-soft: rgb(59 130 246 / 0.18);
  --on-accent: #ffffff;

  --danger: #f87171;
  --danger-soft: rgb(248 113 113 / 0.18);
  --success: #34d399;

  --ring: #fbbf24;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 8px 24px -6px rgb(0 0 0 / 0.55);
  --shadow-lg: 0 20px 48px -12px rgb(0 0 0 / 0.7);

  --g-amber: #fbbf24;
  --g-blue: #60a5fa;
  --g-green: #34d399;
  --g-rose: #fb7185;
  --g-violet: #a78bfa;
  --g-cyan: #22d3ee;
  --g-orange: #fb923c;
  --g-slate: #94a3b8;
}

/* ==========================================================================
   基础
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/*
 * 兜底规则：类选择器设置的 display 会盖掉 UA 样式表里的 [hidden]{display:none}
 * （例如 .field{display:flex} 会让 hidden 的输入框照样显示），所以统一压住。
 */
[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI',
    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

p {
  margin: 0;
}

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

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

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

svg {
  display: block;
  flex: none;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection {
  background: var(--brand-soft);
  color: var(--fg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  border-radius: var(--r-full);
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--fg-muted);
  background-clip: content-box;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   按钮
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 2.5rem;
  padding: 0 var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--fg);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.btn:hover {
  background: var(--border);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  background: var(--accent-strong);
}

.btn--brand {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: var(--shadow-sm);
}

.btn--brand:hover {
  background: var(--brand-strong);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--fg);
}

.btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--fg-muted);
}

.btn--danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.btn--danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn--block {
  width: 100%;
}

.btn--sm {
  min-height: 2rem;
  padding: 0 var(--sp-3);
  font-size: 0.8125rem;
  border-radius: var(--r-sm);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--fg-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.icon-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.icon-btn:hover {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.icon-btn--danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-btn[aria-pressed='true'] {
  background: var(--accent);
  color: var(--on-accent);
}

.icon-btn[aria-pressed='true']:hover {
  background: var(--accent-strong);
  color: var(--on-accent);
}

.icon-btn--sm {
  width: 2rem;
  height: 2rem;
}

.icon-btn--sm svg {
  width: 1rem;
  height: 1rem;
}

@media (pointer: coarse) {
  .icon-btn {
    width: 2.75rem;
    height: 2.75rem;
  }
}

/* ==========================================================================
   表单
   ========================================================================== */

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

.field__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg);
}

.field__hint {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.field__error {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--danger);
}

.field__error svg {
  width: 0.875rem;
  height: 0.875rem;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 0.9375rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  appearance: none;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--fg-muted);
  opacity: 0.75;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--fg-muted);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input[aria-invalid='true'],
.textarea[aria-invalid='true'],
.select[aria-invalid='true'] {
  border-color: var(--danger);
}

.input[aria-invalid='true']:focus,
.textarea[aria-invalid='true']:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.textarea {
  min-height: 4.5rem;
  resize: vertical;
  line-height: 1.5;
}

.select {
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}

[data-theme='dark'] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa8bd' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.select--bare {
  min-height: 2.25rem;
  padding: 0 2rem 0 0.625rem;
  border-color: transparent;
  background-color: transparent;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg-muted);
}

.select--bare:hover {
  background-color: var(--surface-2);
  color: var(--fg);
}

/* 复选 / 开关 */
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-size: 0.875rem;
  user-select: none;
}

.check input {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ==========================================================================
   徽标 / 头像 / 图标
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 1.375rem;
  padding: 0 0.5rem;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge svg {
  width: 0.75rem;
  height: 0.75rem;
}

.badge--group {
  background: color-mix(in srgb, var(--g) 12%, transparent);
  border-color: color-mix(in srgb, var(--g) 30%, transparent);
  color: color-mix(in srgb, var(--g) 82%, var(--fg));
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.375rem;
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--fg-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.nav__item[aria-current='page'] .count {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: var(--r-full);
  background: linear-gradient(140deg, var(--brand), var(--g-orange));
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  user-select: none;
}

.favicon {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.favicon__letter {
  display: grid;
  place-items: center;
  position: absolute;
  inset: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.favicon__img {
  position: absolute;
  inset: 0;
  margin: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 180ms var(--ease);
}

.favicon__img.is-ready {
  opacity: 1;
}

.favicon--lg {
  width: 2.5rem;
  height: 2.5rem;
}

.favicon--lg .favicon__letter {
  font-size: 1rem;
}

.dot {
  display: block;
  flex: none;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: var(--r-full);
  background: var(--g, var(--brand));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--g, var(--brand)) 18%, transparent);
}

.spinner {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  border-radius: var(--r-full);
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Toast
   ========================================================================== */

.toasts {
  position: fixed;
  z-index: 90;
  right: var(--sp-5);
  bottom: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: min(22rem, calc(100vw - 2.5rem));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: 0.75rem var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  pointer-events: auto;
  animation: toast-in 260ms var(--ease) both;
}

.toast[data-leaving='true'] {
  animation: toast-out 180ms var(--ease) both;
}

.toast svg {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 1px;
}

.toast--ok svg {
  color: var(--success);
}

.toast--error svg {
  color: var(--danger);
}

.toast--info svg {
  color: var(--accent);
}

.toast__body {
  flex: 1;
  min-width: 0;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(16px);
  }
}

/* ==========================================================================
   弹窗
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  overflow-y: auto;
}

.modal[hidden] {
  display: none;
}

.modal__scrim {
  position: fixed;
  inset: 0;
  background: rgb(15 23 42 / 0.45);
  backdrop-filter: blur(2px);
  animation: fade-in 160ms var(--ease) both;
}

.modal__panel {
  position: relative;
  width: min(34rem, 100%);
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in 220ms var(--ease) both;
}

.modal__panel--sm {
  width: min(26rem, 100%);
}

.modal__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) 0;
}

.modal__title {
  flex: 1;
  font-size: 1.0625rem;
}

.modal__sub {
  margin-top: 2px;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--fg-muted);
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-5);
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: 0 var(--sp-5) var(--sp-5);
}

.modal__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

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

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}

/* ==========================================================================
   应用外壳
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(15 23 42 / 0.4);
  animation: fade-in 160ms var(--ease) both;
}

.scrim[hidden] {
  display: none;
}

/* --- 侧边栏 ------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  height: 100vh;
  padding: var(--sp-4);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.sidebar__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: 1;
  min-width: 0;
  color: var(--fg);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand__mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.7rem;
  background: linear-gradient(140deg, var(--brand) 10%, var(--g-orange) 90%);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.brand__mark svg {
  width: 1.25rem;
  height: 1.25rem;
}

.brand__name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand__sub {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

.sidebar__close {
  display: none;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--sp-3);
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--fg-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav__item svg {
  width: 1.125rem;
  height: 1.125rem;
}

.nav__item span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav__item:hover {
  background: var(--surface);
  color: var(--fg);
}

.nav__item[aria-current='page'] {
  background: var(--surface);
  color: var(--brand-strong);
  box-shadow: var(--shadow-sm);
}

.nav__item--dropping {
  background: var(--brand-soft);
  color: var(--brand-strong);
  outline: 2px dashed var(--brand);
  outline-offset: -2px;
}

.nav__label {
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.groups {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.groups__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-right: var(--sp-1);
}

.groups__head .nav__label {
  flex: 1;
  padding-bottom: var(--sp-2);
}

.groups__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0 var(--sp-1) 0 0;
  list-style: none;
  overflow-y: auto;
}

.group-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  border-radius: var(--r-md);
  transition: background var(--dur) var(--ease);
}

.group-row:hover {
  background: var(--surface);
}

.group-row[aria-current='page'] {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.group-row--dragging {
  opacity: 0.5;
}

.group-row__btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: 1;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0 var(--sp-2) 0 var(--sp-3);
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--fg-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
}

.group-row__btn span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-row:hover .group-row__btn,
.group-row[aria-current='page'] .group-row__btn {
  color: var(--fg);
}

.group-row[aria-current='page'] .group-row__btn {
  color: var(--brand-strong);
}

.group-row__grip {
  width: 0.875rem;
  height: 1.125rem;
  color: var(--border-strong);
  cursor: grab;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.group-row:hover .group-row__grip {
  opacity: 1;
}

.group-row__grip:active {
  cursor: grabbing;
}

.group-row__actions {
  display: none;
  gap: 0;
}

.group-row:hover .group-row__actions,
.group-row:focus-within .group-row__actions {
  display: flex;
}

.sidebar__foot {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.sidebar__links {
  display: flex;
  gap: var(--sp-1);
}

.sidebar__links .nav__item {
  min-height: 2.25rem;
  font-size: 0.8125rem;
}

.user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
}

.user__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.user__name {
  font-size: 0.8125rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user__email {
  font-size: 0.6875rem;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- 主区 --------------------------------------------------------------- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--topbar-h);
  padding: var(--sp-3) var(--sp-6);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar__menu {
  display: none;
}

.search {
  position: relative;
  flex: 1;
  max-width: 34rem;
  display: flex;
  align-items: center;
}

.search svg {
  position: absolute;
  left: 0.75rem;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--fg-muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 3rem 0 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  font-size: 0.875rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  appearance: none;
  -webkit-appearance: none;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

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

.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search kbd {
  position: absolute;
  right: 0.625rem;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--fg-muted);
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
}

.search__clear {
  position: absolute;
  right: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
}

.search__clear svg {
  position: static;
  width: 0.875rem;
  height: 0.875rem;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
}

.content {
  flex: 1;
  width: 100%;
  max-width: 90rem;
  padding: var(--sp-6);
}

.content__head {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.content__title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 1.375rem;
}

.content__sub {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--fg-muted);
}

.content__spacer {
  flex: 1;
}

.drop-target {
  border: 2px dashed var(--brand);
  border-radius: var(--r-lg);
  background: var(--brand-soft);
}

.bookmarks {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  align-content: start;
}

.bookmarks--list {
  grid-template-columns: 1fr;
  gap: var(--sp-2);
}

/* --- 书签卡片 ----------------------------------------------------------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    transform var(--dur) var(--ease);
  animation: card-in 300ms var(--ease) both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card:focus-within {
  border-color: var(--brand);
}

.card--dragging {
  opacity: 0.45;
}

.card__top {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.card__main {
  flex: 1;
  min-width: 0;
}

.card__title {
  display: block;
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--fg);
  text-decoration: none;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.card__title:hover {
  color: var(--brand-strong);
  text-decoration: none;
}

.card__url {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__desc {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: auto;
}

.card__foot .badge {
  min-width: 0;
}

.card__foot .badge span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__actions {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
}

.card__actions .icon-btn--sm {
  width: 1.75rem;
  height: 1.75rem;
}

.card__actions .icon-btn--sm svg {
  width: 0.9375rem;
  height: 0.9375rem;
}

.card__pin {
  color: var(--brand);
}

.card__pin[aria-pressed='false'] {
  opacity: 0;
}

.card:hover .card__pin[aria-pressed='false'],
.card:focus-within .card__pin[aria-pressed='false'] {
  opacity: 1;
}

.card__grip {
  width: 0.875rem;
  color: var(--border-strong);
  cursor: grab;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.card:hover .card__grip,
.card:focus-within .card__grip {
  opacity: 1;
}

.card__grip:active {
  cursor: grabbing;
}

/* 列表视图 */
.bookmarks--list .card {
  flex-direction: row;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
}

.bookmarks--list .card__top {
  align-items: center;
  flex: 1;
  min-width: 0;
}

.bookmarks--list .card__main {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}

.bookmarks--list .card__title {
  -webkit-line-clamp: 1;
  flex: none;
  max-width: 22rem;
}

.bookmarks--list .card__url {
  margin-top: 0;
  flex: 1;
  min-width: 0;
}

.bookmarks--list .card__desc {
  display: none;
}

.bookmarks--list .card__foot {
  margin-top: 0;
  flex: none;
  order: 3;
}

.bookmarks--list .card__actions {
  order: 4;
}

@media (pointer: coarse) {
  .card__actions,
  .group-row__actions {
    opacity: 1;
  }
}

/* --- 空状态 ------------------------------------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.empty__icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--r-full);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.empty__icon svg {
  width: 1.75rem;
  height: 1.75rem;
}

.empty__title {
  font-size: 1rem;
}

.empty__text {
  max-width: 26rem;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

/* --- 骨架屏 ------------------------------------------------------------- */

.skeleton {
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.skeleton__line {
  height: 0.75rem;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton__line + .skeleton__line {
  margin-top: var(--sp-2);
}

.skeleton__line--w60 {
  width: 60%;
}

.skeleton__line--w40 {
  width: 40%;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==========================================================================
   颜色选择
   ========================================================================== */

.colors {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.color-chip {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--r-full);
  background: transparent;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.color-chip i {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--r-full);
  background: var(--g);
}

.color-chip:hover {
  transform: scale(1.1);
}

.color-chip[aria-pressed='true'] {
  border-color: var(--g);
}

.color-chip[aria-pressed='true']::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-full);
  box-shadow: inset 0 0 0 2px var(--surface);
}

/* ==========================================================================
   登录 / 注册
   ========================================================================== */

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

.auth__aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--sp-8);
  padding: var(--sp-8);
  background: linear-gradient(155deg, var(--brand) 0%, var(--g-orange) 55%, #b45309 100%);
  color: #fff;
}

.auth__aside .brand__mark {
  background: rgb(255 255 255 / 0.2);
  box-shadow: none;
}

.auth__aside .brand__name,
.auth__aside .brand__sub {
  color: #fff;
}

.auth__pitch h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  letter-spacing: -0.03em;
}

.auth__pitch p {
  max-width: 30rem;
  margin-top: var(--sp-4);
  font-size: 1rem;
  color: rgb(255 255 255 / 0.85);
}

.auth__features {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin: var(--sp-6) 0 0;
  padding: 0;
  list-style: none;
}

.auth__features li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: 0.9375rem;
  color: rgb(255 255 255 / 0.92);
}

.auth__features svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 2px;
  flex: none;
  opacity: 0.9;
}

.auth__note {
  font-size: 0.75rem;
  color: rgb(255 255 255 / 0.7);
}

.auth__main {
  display: grid;
  place-items: center;
  padding: var(--sp-6);
}

.auth__card {
  width: min(25rem, 100%);
}

.auth__card h2 {
  font-size: 1.5rem;
}

.auth__card > p {
  margin-top: var(--sp-1);
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.auth__form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-top: var(--sp-6);
}

.auth__switch {
  margin-top: var(--sp-5);
  font-size: 0.875rem;
  color: var(--fg-muted);
  text-align: center;
}

.auth__switch button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth__summary {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--danger);
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--fg);
  font-size: 0.8125rem;
}

.auth__summary svg {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  margin-top: 1px;
  color: var(--danger);
}

.auth__summary ul {
  margin: 0;
  padding-left: 1.1rem;
}



@media (max-width: 900px) {
  .auth {
    grid-template-columns: 1fr;
  }

  .auth__aside {
    display: none;
  }
}

/* ==========================================================================
   响应式
   ========================================================================== */

@media (max-width: 1024px) {
  :root {
    --sidebar-w: 15rem;
  }
}

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

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(20rem, 86vw);
    transform: translateX(-102%);
    transition: transform 260ms var(--ease);
    box-shadow: var(--shadow-lg);
  }

  .sidebar[data-open='true'] {
    transform: translateX(0);
  }

  .sidebar__close {
    display: inline-flex;
  }

  .topbar__menu {
    display: inline-flex;
  }

  .topbar {
    padding: var(--sp-3) var(--sp-4);
    gap: var(--sp-2);
  }

  .search kbd {
    display: none;
  }

  .content {
    padding: var(--sp-4);
  }

  .content__head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-2);
  }

  .content__head .btn span {
    display: none;
  }

  .content__head .btn {
    position: fixed;
    right: var(--sp-4);
    bottom: var(--sp-5);
    z-index: 35;
    width: 3.5rem;
    height: 3.5rem;
    min-height: 3.5rem;
    padding: 0;
    border-radius: var(--r-full);
    box-shadow: var(--shadow-lg);
  }

  .content__head .btn svg {
    width: 1.5rem;
    height: 1.5rem;
  }

  .bookmarks {
    grid-template-columns: 1fr;
  }

  .topbar__actions .segmented {
    display: none;
  }

  .topbar__actions .select--bare {
    display: none;
  }
}

@media (max-width: 480px) {
  .topbar__actions .btn--primary {
    display: none;
  }
}

@media print {
  .sidebar,
  .topbar,
  .card__actions {
    display: none;
  }
}

.input--code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.4em;
  text-align: center;
}

.input-with-button {
  display: flex;
  gap: var(--sp-2);
  align-items: stretch;
}

.input-with-button .input {
  flex: 1;
  min-width: 0;
}

.input-with-button__btn {
  flex: none;
  white-space: nowrap;
}

.input-with-button__btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- 拖拽高亮 ----------------------------------------------------------- */

.dropzone--over {
  outline: 2px dashed var(--brand);
  outline-offset: -2px;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

/* --- 管理模块入口 ------------------------------------------------------- */

.sidebar__admin {
  padding-top: var(--sp-1);
  border-top: 1px solid var(--border);
}

.sidebar__admin[hidden] {
  display: none;
}

.sidebar__admin .nav__item[aria-current='page'] {
  background: var(--accent);
  color: var(--on-accent);
}

.sidebar__admin .nav__item[aria-current='page'] .count {
  background: rgb(255 255 255 / 0.25);
  color: var(--on-accent);
}

#adminBadge {
  background: var(--danger-soft);
  color: var(--danger);
}

/* --- 未验证提示条 ------------------------------------------------------- */

.verify-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
  border-radius: var(--r-md);
  font-size: 0.875rem;
}

.verify-banner[hidden] {
  display: none;
}

.verify-banner__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: var(--r-full);
  background: var(--brand);
  color: var(--on-brand);
}

.verify-banner__icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.verify-banner__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.4;
}

.verify-banner__body span {
  font-size: 0.8125rem;
  color: var(--fg-muted);
}

/* --- 待验证全屏卡 ------------------------------------------------------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: var(--bg);
  overflow-y: auto;
}

.gate[hidden] {
  display: none;
}

.gate__card {
  width: min(30rem, 100%);
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

.gate__icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto var(--sp-4);
  border-radius: var(--r-full);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.gate__icon svg {
  width: 1.75rem;
  height: 1.75rem;
}

.gate__title {
  font-size: 1.25rem;
}

.gate__text {
  margin-top: var(--sp-2);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--fg-muted);
}

.gate__link {
  margin-top: var(--sp-5);
  padding: var(--sp-4);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  text-align: left;
}

.gate__link[hidden] {
  display: none;
}

.gate__linkLabel {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.gate__linkUrl {
  display: block;
  margin: var(--sp-2) 0 var(--sp-3);
  font-size: 0.75rem;
  line-height: 1.5;
  word-break: break-all;
}

.gate__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-6);
}

.gate__hint {
  min-height: 1.25rem;
  margin-top: var(--sp-3);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.gate__hint:empty {
  min-height: 0;
}

/* --- 管理模块 ----------------------------------------------------------- */

.stat-grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
}

.stat-card {
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.stat-card__value {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-card__label {
  margin-top: var(--sp-1);
  font-size: 0.8125rem;
  color: var(--fg-muted);
}

.stat-card--warn .stat-card__value {
  color: var(--brand-strong);
}

.user-table {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.user-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease);
}

.user-row:hover {
  border-color: var(--brand);
}

.user-row__main {
  flex: 1;
  min-width: 0;
}

.user-row__name {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.9375rem;
  font-weight: 650;
}

.user-row__meta {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.user-row__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: var(--r-full);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tag--admin {
  background: var(--accent);
  color: var(--on-accent);
}

.tag--disabled {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag--unverified {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.tag--ok {
  background: color-mix(in srgb, var(--success) 16%, transparent);
  color: var(--success);
}

.detail-section {
  margin-bottom: var(--sp-5);
}

.detail-section__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list li {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  font-size: 0.8125rem;
}

.detail-list .detail-list__url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-muted);
}

.detail-list .badge {
  flex: none;
}

/* --- SMTP 设置 --------------------------------------------------------- */

.settings-card {
  max-width: 46rem;
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.settings-status {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  line-height: 1.5;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

.settings-status[data-state='ok'] {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-color: color-mix(in srgb, var(--success) 32%, transparent);
  color: var(--fg);
}

.settings-status[data-state='warn'] {
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 32%, transparent);
  color: var(--fg);
}

.settings-status svg {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
}

.settings-status[data-state='ok'] svg {
  color: var(--success);
}

.settings-status[data-state='warn'] svg {
  color: var(--brand-strong);
}

.settings-status strong {
  color: var(--fg);
}

.settings-grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.settings-toggle {
  margin-top: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.settings-toggle input {
  width: 1.125rem;
  height: 1.125rem;
}

.scope-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.scope-icon svg {
  width: 1.375rem;
  height: 1.375rem;
}

.groups__empty {
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--fg-muted);
}

.bookmarks[aria-busy='true'] {
  pointer-events: none;
}




/* ---------- 语言菜单 ---------- */
.lang-menu {
  position: fixed;
  z-index: 90;
  min-width: 11rem;
  padding: var(--sp-2);
  display: grid;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}
.lang-menu[hidden] { display: none; }
.lang-menu__title {
  padding: var(--sp-1) var(--sp-2);
  font-size: 0.75rem;
  color: var(--fg-muted);
}
.lang-menu__item {
  display: block;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  color: var(--fg);
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.lang-menu__item:hover { background: var(--surface-2); }
.lang-menu__item.is-active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

/* ---------- 语言切换按钮 ----------
 * 早先只有一个没有文字的地球图标，看不出是干什么的 —— 现在把当前语言
 * 写在按钮上（한국어 / 中文 / English / …），一眼就知道是语言、也知道现在选的是什么。 */
.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.2;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.lang-chip:hover { background: var(--surface-2); }
.lang-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-chip[aria-expanded='true'] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}
.lang-chip__icon { width: 16px; height: 16px; flex: none; }

/* 侧栏底部的署名。aside 是 justify-content: space-between，
 * 底部得有一个块，.auth__pitch 才会留在中间而不是掉到底部。 */
.auth__foot {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: rgb(255 255 255 / 0.62);
}

/* 侧栏底部：语言胶囊独占一行。
 * 它原本和 导入/导出/主题 并排在同一行，而那一行不换行，胶囊宽度又随
 * 语言名变化（简体中文 101px，更长的更宽），于是整行溢出、按钮被裁掉。 */
.lang-row { display: flex; }
.lang-row .lang-chip { flex: none; margin-bottom: var(--sp-2); }

/* 允许换行：日文「インポート/エクスポート」比中文「导入/导出」宽，
 * 侧栏 287px 装不下就会把「导出」挤出可视区。装得下时仍是原来的单行排布。 */
.sidebar__links { flex-wrap: wrap; }

/* 登录/注册/找回密码这几页没有工具栏，按钮贴在卡片右上角 */
.auth__card { display: flex; flex-direction: column; }
.lang-chip--card { align-self: flex-end; margin-bottom: var(--sp-3); }


/* ---------- 管理端语言选择 ---------- */
.lang-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.lang-choice {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font: inherit;
  font-size: 0.875rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.lang-choice:hover { border-color: var(--accent); }
.lang-choice.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}
.settings-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}
