/* =====================================================================
   书签集 Bookmark Hub - 样式表
   ===================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Source Han Sans SC', 'Noto Sans CJK SC', sans-serif;

  --accent: #4f6ef7;
  --accent-strong: #3b58e0;
  --accent-soft: rgba(79, 110, 247, 0.12);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 18px 40px rgba(16, 24, 40, 0.16);

  --card-min: 268px;
  --topbar-h: 64px;
}

html[data-theme='light'] {
  --bg: #f4f6fa;
  --bg-grad: radial-gradient(1200px 600px at 8% -10%, rgba(79, 110, 247, 0.14), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(16, 185, 129, 0.1), transparent 55%);
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef1f6;
  --border: #e5e8ef;
  --border-strong: #d3d8e3;
  --text: #1b2130;
  --text-soft: #4a5468;
  --muted: #818b9e;
  --hover: rgba(17, 24, 39, 0.04);
  --scrim: rgba(17, 24, 39, 0.45);
}

html[data-theme='dark'] {
  --bg: #0d1017;
  --bg-grad: radial-gradient(1200px 600px at 8% -10%, rgba(79, 110, 247, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(16, 185, 129, 0.1), transparent 55%);
  --surface: #161a23;
  --surface-2: #1c212c;
  --surface-3: #232936;
  --border: #262c39;
  --border-strong: #333b4c;
  --text: #e8ecf4;
  --text-soft: #b9c2d4;
  --muted: #8b95ab;
  --hover: rgba(255, 255, 255, 0.05);
  --scrim: rgba(3, 5, 9, 0.62);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
}

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  background-clip: content-box;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================================================ 启动占位 */
.boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 100vh;
  height: 100dvh;
  color: var(--muted);
}
.boot__spinner,
.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================== 通用件 */
.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.1s, box-shadow 0.16s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 110, 247, 0.28);
}
.btn--primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn--danger:hover:not(:disabled) {
  filter: brightness(0.94);
  background: var(--danger);
  border-color: var(--danger);
}
.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-soft);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--hover);
  border-color: transparent;
}
.btn--sm {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.btn--icon {
  width: 38px;
  padding: 0;
}
.btn--icon.btn--sm {
  width: 32px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* 标签行：左标题右操作按钮 */
.field__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}
.field__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.2px;
}
.field__hint {
  font-size: 12px;
  color: var(--muted);
}
.field__hint--error {
  color: var(--danger);
}

/* AI 生成标签按钮 */
.ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 99px;
  border: 1px solid rgba(79, 110, 247, 0.35);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.ai-btn:hover:not(:disabled) {
  background: rgba(79, 110, 247, 0.2);
  border-color: rgba(79, 110, 247, 0.5);
}
.ai-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 84px;
  line-height: 1.6;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--muted);
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
  cursor: pointer;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--text-soft);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  max-width: 100%;
}
.chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip:hover {
  background: var(--border);
}
.chip--active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(79, 110, 247, 0.35);
}
.chip--static {
  cursor: default;
}
.chip--static:hover {
  background: var(--surface-3);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge--ok {
  background: rgba(16, 185, 129, 0.14);
  color: var(--success);
}
.badge--warn {
  background: rgba(245, 158, 11, 0.16);
  color: var(--warning);
}
.badge--err {
  background: rgba(239, 68, 68, 0.14);
  color: var(--danger);
}
.badge--muted {
  background: var(--surface-3);
  color: var(--muted);
}

.switch-hint {
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================== 登录页 */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login__card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 36px 34px 30px;
  position: relative;
  overflow: hidden;
}
.login__card::before {
  content: '';
  position: absolute;
  inset: -60% 40% 60% -30%;
  background: radial-gradient(circle at 30% 30%, rgba(79, 110, 247, 0.22), transparent 60%);
  pointer-events: none;
}
.login__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  position: relative;
}
.login__logo {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), #7b8cff);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 20px rgba(79, 110, 247, 0.35);
}
.login__title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.login__subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.login__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}
.login__error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  font-size: 13px;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.login__footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  position: relative;
}
.login__submit {
  height: 44px;
  font-size: 15px;
  font-weight: 600;
}
.pw-wrap {
  position: relative;
}
.pw-wrap .input {
  padding-right: 44px;
}
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}
.pw-toggle:hover {
  background: var(--hover);
  color: var(--text);
}

/* ============================================================== 主框架 */
.shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}
.sidebar {
  flex: 0 0 262px;
  width: 262px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 40;
}
.sidebar__head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.sidebar__logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #7b8cff);
  display: grid;
  place-items: center;
  color: #fff;
}
.sidebar__name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
}
.sidebar__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px 24px;
}
.sidebar__section {
  margin-bottom: 18px;
}
.sidebar__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13.5px;
  border: 1px solid transparent;
  transition: background 0.14s, color 0.14s;
  user-select: none;
}
.nav-item:hover {
  background: var(--hover);
  color: var(--text);
}
.nav-item--active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item__count {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.nav-item--active .nav-item__count {
  color: var(--accent);
}
.nav-item__actions {
  display: none;
  gap: 2px;
  align-items: center;
}
.nav-item:hover .nav-item__actions {
  display: flex;
}
.nav-item:hover .nav-item__count {
  display: none;
}
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}
.icon-btn--danger:hover {
  background: rgba(239, 68, 68, 0.14);
  color: var(--danger);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 8px;
}
.tag-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border-radius: 99px;
  padding: 2px;
  transition: background 0.14s;
}
.tag-wrap:hover {
  background: var(--hover);
}
.tag-del {
  display: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 16px;
  height: 16px;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  place-items: center;
}
.tag-wrap:hover .tag-del {
  display: grid;
}
.tag-del:hover {
  background: rgba(239, 68, 68, 0.16);
  color: var(--danger);
}

.sidebar__stats {
  margin: 0 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat__value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat__label {
  font-size: 11.5px;
  color: var(--muted);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-h);
  padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 460px;
}
.search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search .input {
  padding-left: 38px;
}
.search__clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}
.topbar__spacer {
  flex: 1;
}
.topbar__group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar__group .select {
  width: auto;
  height: 38px;
}

.content {
  padding: 20px 24px 56px;
  flex: 1;
}

/* 用户菜单 */
.user-menu {
  position: relative;
}
.user-btn__name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px 0 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
}
.user-btn:hover {
  background: var(--surface-2);
}
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #7b8cff);
  flex: 0 0 auto;
  text-transform: uppercase;
}
.avatar--lg {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 14px;
}
.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 208px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
}
.dropdown__header {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.dropdown__name {
  font-weight: 600;
  font-size: 13.5px;
}
.dropdown__role {
  font-size: 11.5px;
  color: var(--muted);
}
.dropdown__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
}
.dropdown__item:hover {
  background: var(--hover);
  color: var(--text);
}
.dropdown__item--danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* ============================================================== 书签网格 */
.content-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.content-head__title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}
.content-head__meta {
  font-size: 12.5px;
  color: var(--muted);
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
}
html[data-density='compact'] .grid {
  --card-min: 214px;
  gap: 12px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.card__shot {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card__shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform 0.4s ease;
}
.card:hover .card__shot img {
  transform: scale(1.035);
}
.card__shot--fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.card__skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, var(--surface-3) 30%, var(--surface-2) 50%, var(--surface-3) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  from {
    background-position: 130% 0;
  }
  to {
    background-position: -30% 0;
  }
}
.card__shot-status {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(17, 24, 39, 0.62);
  backdrop-filter: blur(6px);
}
.card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(12, 16, 24, 0.5), transparent 42%);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.card:hover .card__overlay,
.card:focus-within .card__overlay {
  opacity: 1;
}
.card__ov-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  color: #1b2130;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.14s;
}
.card__ov-btn:hover {
  transform: scale(1.07);
}
.card__ov-btn--danger:hover {
  background: var(--danger);
  color: #fff;
}
.card__body {
  padding: 12px 14px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.card__head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.card__favicon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex: 0 0 auto;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.card__favicon img {
  width: 17px;
  height: 17px;
  object-fit: contain;
}
.card__title {
  font-size: 14px;
  font-weight: 650;
  margin: 2px 0 1px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.card__host {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card__desc {
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  min-height: 0;
}
.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  padding-top: 2px;
}
.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.card__metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card__cat {
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 8px;
  border-radius: 99px;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 卡片上的 AI 打标签状态胶囊 */
.ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 99px;
  border: 1px dashed rgba(79, 110, 247, 0.4);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  max-width: 100%;
  transition: background 0.15s, border-color 0.15s;
}
.ai-chip:hover {
  background: rgba(79, 110, 247, 0.2);
}
.ai-chip > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chip .spinner {
  width: 11px;
  height: 11px;
  border-width: 2px;
}
.ai-chip--error {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}
.ai-chip--error:hover {
  background: rgba(239, 68, 68, 0.18);
}

.card__error {
  font-size: 11.5px;
  color: var(--danger);
  display: flex;
  gap: 6px;
  align-items: flex-start;
  line-height: 1.4;
}

/* 空状态 / 骨架 */
.empty {
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty__icon {
  width: 60px;
  height: 60px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.empty__title {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
}
.skeleton-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
}
.skeleton-card {
  height: 268px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
.load-more {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}

/* ============================================================== 弹层 */
.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.scrim--top {
  z-index: 120;
}
.modal {
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 0.18s ease;
}
.modal--wide {
  max-width: 900px;
}
.modal--sm {
  max-width: 420px;
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.modal__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.modal__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  flex: 1;
}
.modal__body {
  padding: 18px 20px;
  overflow-y: auto;
}
.modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex: 0 0 auto;
}
.modal__foot-spacer {
  flex: 1;
}
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}
.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}
.alert--error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--danger);
}
.alert--info {
  background: var(--accent-soft);
  border: 1px solid rgba(79, 110, 247, 0.25);
  color: var(--accent);
}

.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  min-height: 40px;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.tag-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.tag-input input {
  flex: 1;
  min-width: 100px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  height: 24px;
}
.tag-input__pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 6px 0 9px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.tag-input__pill button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  opacity: 0.7;
}
.tag-input__pill button:hover {
  opacity: 1;
}
.tag-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 灯箱 */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 15, 0.88);
  backdrop-filter: blur(6px);
  z-index: 140;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 34px;
  gap: 14px;
}
.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 150px);
  max-height: calc(100dvh - 150px);
  border-radius: 16px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  background: #fff;
}
.lightbox__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  flex-wrap: wrap;
  justify-content: center;
}
.lightbox__title {
  font-weight: 650;
  font-size: 15px;
}
.lightbox__close {
  position: absolute;
  top: 22px;
  right: 26px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Toast */
.toasts {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 220px;
  max-width: 380px;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  animation: slideIn 0.2s ease;
  pointer-events: auto;
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.toast--success .toast__dot {
  background: var(--success);
}
.toast--error .toast__dot {
  background: var(--danger);
}
.toast--info .toast__dot {
  background: var(--accent);
}
.toast__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

/* ============================================================== 用户管理 */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.tbl th {
  text-align: left;
  padding: 10px 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
table.tbl td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl tr:last-child td {
  border-bottom: 0;
}
table.tbl tr:hover td {
  background: var(--surface-2);
}
.tbl__user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tbl__actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.you-tag {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 99px;
  padding: 0 7px;
  font-weight: 600;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text-soft);
  letter-spacing: 0.3px;
}

/* ============================================================== 错误日志 */
.log-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.log-filters .select {
  width: auto;
  min-width: 116px;
  height: 34px;
  font-size: 13px;
}
.log-search {
  flex: 1 1 180px;
  max-width: 300px;
}
.log-search .input {
  height: 34px;
  font-size: 13px;
}
.logs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.log {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.log--error {
  border-left-color: var(--danger);
}
.log--warn {
  border-left-color: var(--warning);
}
.log--info {
  border-left-color: var(--accent);
}
.log__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}
.log__scope {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.log__time {
  font-variant-numeric: tabular-nums;
}
.log__user {
  color: var(--accent);
}
.log__msg {
  margin-top: 6px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word;
}
.log__detail {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
  cursor: pointer;
}
.log__detail--clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.log-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

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

/* 顶部栏的侧边栏开关：宽屏折叠、窄屏抽屉，两种尺寸下都可用 */
.mobile-toggle {
  display: inline-flex;
  flex: 0 0 auto;
}

/* 侧边栏头部自带的收起按钮只服务于窄屏抽屉；
   宽屏统一用顶部栏那一个开关，避免两个入口重复 */
.sidebar__collapse {
  display: none;
}

/* ---------------------------------------------------- 宽屏：可折叠侧边栏 */
@media (min-width: 901px) {
  .shell {
    --sidebar-w: 262px;
  }
  .shell--collapsed {
    --sidebar-w: 0px;
  }
  .sidebar {
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    transition: flex-basis 0.22s ease, width 0.22s ease;
  }
  .shell--collapsed .sidebar {
    overflow: hidden;
    border-right-width: 0;
  }
}

/* ------------------------------------------- 平板 / 手机：抽屉式侧边栏 */
@media (max-width: 900px) {
  body.no-scroll {
    overflow: hidden;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(84vw, 300px);
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar--open {
    transform: none;
  }
  .sidebar__head {
    height: auto;
    min-height: var(--topbar-h);
    padding-top: env(safe-area-inset-top);
  }
  .sidebar__collapse {
    display: grid;
  }
  .sidebar__body {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    background: var(--scrim);
    z-index: 35;
  }

  /* 顶部栏：第一行「菜单 + 搜索 + 头像」，第二行「排序 + 新建」 */
  .topbar {
    padding: 10px 12px;
    gap: 8px;
  }
  .mobile-toggle {
    order: 1;
  }
  .search {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }
  .topbar__spacer {
    display: none;
  }
  .user-menu {
    order: 3;
  }
  .topbar__group {
    order: 4;
    flex: 1 1 100%;
  }
  .topbar__group .select {
    flex: 1 1 auto;
    min-width: 0;
  }
  .user-btn__name {
    display: none;
  }

  .content {
    padding: 14px 12px calc(40px + env(safe-area-inset-bottom));
  }

  /* iOS 聚焦到小于 16px 的输入框会自动放大页面 */
  .input,
  .select,
  .textarea,
  .tag-input input {
    font-size: 16px;
  }
}

/* --------------------------------------------- 触屏 / 小屏：触控友好化 */
@media (hover: none), (max-width: 900px) {
  /* 触屏没有 hover，卡片位移会残留 */
  .card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
  .icon-btn {
    width: 32px;
    height: 32px;
  }
  .nav-item {
    height: auto;
    min-height: 42px;
    padding: 6px 10px;
  }
  .ai-btn {
    height: 30px;
    padding: 0 11px;
    font-size: 12px;
  }
  .ai-chip {
    height: 26px;
  }
  .tag-del {
    width: 20px;
    height: 20px;
  }
}

/* 触屏设备上 :hover 永远不成立，操作入口必须常驻显示 */
@media (hover: none), (max-width: 560px) {
  .card__overlay {
    opacity: 1;
    background: linear-gradient(180deg, rgba(12, 16, 24, 0.42), transparent 40%);
  }
  .card__ov-btn {
    width: 36px;
    height: 36px;
  }
  .nav-item__actions {
    display: flex;
  }
  .tag-del {
    display: grid;
  }
}

/* ------------------------------------------------------ 手机竖屏（<=560） */
@media (max-width: 560px) {
  .topbar__group .btn--icon {
    display: none; /* 密度与主题切换在手机上意义不大，主题仍在头像菜单里 */
  }

  .grid,
  .skeleton-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .card__shot {
    aspect-ratio: 16 / 9;
  }
  .card__foot {
    flex-wrap: wrap;
  }

  /* 弹窗改为底部抽屉，拇指可达 */
  .scrim {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-width: none;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
  }
  .modal__head {
    padding: 14px 16px;
  }
  .modal__body {
    padding: 16px;
  }
  .modal__foot {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .modal__foot-spacer {
    display: none;
  }
  .modal__foot .btn {
    flex: 1;
  }

  .toasts {
    left: 12px;
    right: 12px;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .toast {
    min-width: 0;
    max-width: none;
  }

  .lightbox {
    padding: 16px;
  }
  .lightbox img {
    max-height: calc(100dvh - 170px);
  }
  .lightbox__close {
    top: calc(14px + env(safe-area-inset-top));
    right: 14px;
  }

  .login {
    padding: 16px;
  }
  .login__card {
    padding: 26px 20px 22px;
    border-radius: 18px;
  }

  .content-head__title {
    font-size: 16px;
  }
  .empty {
    padding: 46px 16px;
  }
}

.hidden {
  display: none !important;
}
