/* PageHome - 响应式样式 */
:root {
  --bg: #0f1419;
  --bg-card: #1a2332;
  --bg-input: #252d3a;
  --border: #2d3a4d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --primary: #58a6ff;
  --primary-hover: #79b8ff;
  --secondary: #30363d;
  --danger: #f85149;
  --success: #3fb950;
  --radius: 10px;
  --font-sans: 'Noto Sans SC', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
}
html {
  font-size: 16px;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.75rem;
}
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}
.main-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--primary);
  background: rgba(88, 166, 255, 0.1);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  min-width: 0;
}
.header-actions .user-email {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-right: 0.25rem;
  max-width: 10em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

/* 主题切换按钮 */
.theme-toggle {
  margin-left: 0.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1rem;
}
.theme-toggle .theme-icon {
  display: block;
}
.header-actions .btn-nav-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.header-actions .btn-nav-action .nav-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}
.btn-icon {
  padding: 0.5rem;
  line-height: 0;
}
.btn-icon .nav-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  vertical-align: middle;
}

/* Main */
.main-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  padding: 0.75rem 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.site-footer .footer-inner {
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}
.site-footer .icp-link {
  color: var(--text-muted);
  text-decoration: none;
}
.site-footer .icp-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* 亮色主题（稍微亮一点的暗色系） */
body.theme-light {
  --bg: #f3f4f6;        /* 整体浅灰偏暖背景 */
  --bg-card: #ffffff;   /* 卡片白色，提升层次感 */
  --bg-input: #f1f5f9;  /* 输入框浅灰 */
  --border: #d1d5db;    /* 边框浅灰 */
  --text: #111827;      /* 深色文字 */
  --text-muted: #6b7280;/* 次级文字 */
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  padding: 0.75rem 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.site-footer .footer-inner {
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}
.site-footer .icp-link {
  color: var(--text-muted);
  text-decoration: none;
}
.site-footer .icp-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Pages */
.page {
  animation: fadeIn 0.2s ease;
}
.page.hidden {
  display: none !important;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Auth */
.auth-card {
  position: relative;
  max-width: 400px;
  margin: 2rem auto;
  padding: 2rem;
}
.auth-card-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.auth-card-close:hover {
  color: var(--text);
  background: var(--bg-input);
}
.auth-card h1 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  padding-right: 2rem;
  font-size: 1.5rem;
}
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 1rem;
}
.auth-card .login-type,
.auth-card .change-pw-method {
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.auth-card .login-type label,
.auth-card .change-pw-method label {
  cursor: pointer;
  color: var(--text-muted);
}
.auth-card .input-with-btn {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.auth-card .input-with-btn input {
  flex: 1;
  margin-bottom: 0;
}
.auth-switch {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--text-muted);
}
.auth-switch a {
  color: var(--primary);
  text-decoration: none;
}
.security-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  background: rgba(88, 166, 255, 0.1);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--primary);
  color: #fff;
}
.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}
.btn.secondary {
  background: var(--secondary);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.secondary:hover:not(:disabled) {
  background: #3d444d;
}
.btn.danger {
  background: var(--danger);
  color: #fff;
}
.btn.small {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

/* 亮色主题下按钮微调：次级按钮用浅色背景，整体更轻盈 */
body.theme-light .btn.secondary,
body.theme-light .btn.btn-icon.secondary,
body.theme-light .hero-actions .btn.secondary,
body.theme-light .bookmarks-toolbar .btn.secondary {
  background: #e5e7eb;
  color: #111827;
  border-color: #d1d5db;
}
body.theme-light .btn.secondary:hover:not(:disabled),
body.theme-light .btn.btn-icon.secondary:hover:not(:disabled),
body.theme-light .hero-actions .btn.secondary:hover:not(:disabled),
body.theme-light .bookmarks-toolbar .btn.secondary:hover:not(:disabled) {
  background: #d1d5db;
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card h2 {
  margin-top: 0;
  font-size: 1.25rem;
}
.security-list {
  margin: 1rem 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
}
.security-list li {
  margin-bottom: 0.5rem;
}

/* 安全策略页 - 面向普通用户 */
.security-page {
  max-width: 720px;
  margin: 0 auto;
}
.security-page .card {
  margin-bottom: 1.5rem;
}
.security-page .card:last-child {
  margin-bottom: 0;
}
.security-page h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.35rem;
}
.security-page h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--text);
}
.security-intro .lead {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  margin: 0;
}
.security-intro .lead strong {
  color: var(--primary);
}

/* 流程图 */
.security-flow .flow-diagram {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1.25rem 0;
  padding: 1rem 0;
}
.security-flow .flow-step {
  flex: 1;
  min-width: 120px;
  max-width: 200px;
  text-align: center;
  padding: 1rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.security-flow .flow-step.highlight {
  border-color: var(--primary);
  background: rgba(88, 166, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}
.security-flow .flow-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}
.security-flow .flow-label {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.35;
  display: block;
}
.security-flow .flow-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 1.25rem;
}
.security-flow .flow-note {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
  padding: 0.75rem 1rem;
  background: rgba(88, 166, 255, 0.06);
  border-radius: 6px;
  border-left: 3px solid var(--primary);
}

/* 两种密码卡片 */
.pass-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.pass-card {
  padding: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pass-card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.pass-card h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: var(--text);
}
.pass-card p {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.pass-card p:last-child {
  margin-bottom: 0;
}
.pass-card-tip {
  font-size: 0.85rem;
  color: var(--primary);
  opacity: 0.95;
}
.pass-card-warn {
  font-size: 0.85rem;
  color: #f0883e;
}
.pass-card-warn strong {
  color: #f0883e;
}

/* 清单样式 */
.security-checklist-list,
.security-reminder-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text);
  line-height: 1.6;
}
.security-checklist-list li,
.security-reminder-list li {
  margin-bottom: 0.6rem;
}
.security-device-mode .security-device-note {
  font-size: 0.9em;
  color: var(--muted, #666);
  margin-top: 0.75rem;
}

.security-checklist-list li:last-child,
.security-reminder-list li:last-child {
  margin-bottom: 0;
}
.security-reminder-list li strong {
  color: var(--text-muted);
}

/* Home hero */
.hero {
  text-align: center;
  padding: 3rem 1rem;
}
.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.hero p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* 第三行：收藏页工具栏（仅登录/本机模式且在该页时显示） */
.bookmarks-toolbar-row {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.bookmarks-toolbar-row.hidden {
  display: none !important;
}
.bookmarks-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.5rem;
  max-width: 100%;
}
.bookmarks-toolbar-groups {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.group-select-label {
  flex-shrink: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.group-select-wrap {
  position: relative;
  min-width: 10rem;
  max-width: 16rem;
  flex: 1;
}
.group-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.6rem 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}
.group-select-trigger:hover {
  border-color: var(--text-muted);
  background-color: var(--bg-input);
}
.group-select-trigger:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}
.group-select-arrow {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-left: 0.35rem;
  flex-shrink: 0;
}
.group-select-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.2rem;
  max-height: 16rem;
  overflow-y: auto;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  z-index: 100;
}
.group-select-panel.hidden {
  display: none !important;
}
.group-select-option {
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.group-select-option:last-child {
  border-bottom: none;
}
.group-select-option:hover {
  background-color: var(--bg-input);
}
.group-select-option.active {
  background-color: rgba(88, 166, 255, 0.15);
  color: var(--primary);
}
.bookmarks-toolbar-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Toolbar (legacy / in-page) */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.group-tabs .tab {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.group-tabs .tab:hover {
  color: var(--primary);
  border-color: var(--primary);
}
.group-tabs .tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Encrypted group */
.encrypted-lock {
  text-align: center;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.encrypted-lock input {
  max-width: 280px;
  margin: 0.5rem 0.5rem 0.5rem 0;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text);
}
.unlock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: rgba(63, 185, 80, 0.15);
  border: 1px solid var(--success);
  border-radius: 6px;
  margin-bottom: 1rem;
}

/* Bookmark list - 紧凑单条，减少行高 */
.bookmark-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.bookmark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-wrap: nowrap;
  min-height: 0;
  line-height: 1.35;
}
.bookmark-item .info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.bookmark-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.bookmark-item .title-link {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bookmark-item .title-link:hover {
  text-decoration: underline;
}
.bookmark-item .meta {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.85;
  white-space: nowrap;
}
.bookmark-item .note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.bookmark-item .actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
  align-items: center;
}
.bookmark-item .actions .btn-icon {
  padding: 0.3rem;
  min-width: 1.75rem;
}
.bookmark-item .actions .btn-icon .nav-icon {
  width: 0.95rem;
  height: 0.95rem;
}

/* 分组管理弹窗 */
.modal-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem 0;
  line-height: 1.5;
}
.group-manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  max-height: 280px;
  overflow-y: auto;
}
.group-manage-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
.group-manage-item:last-child {
  border-bottom: none;
}
.group-manage-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
}
.group-badge {
  font-size: 0.75rem;
  color: var(--primary);
  background: rgba(88, 166, 255, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}
.group-manage-actions {
  flex-shrink: 0;
}
.group-fixed-tip {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Common links grid */
.page-title {
  margin-top: 0;
  font-size: 1.5rem;
}
.page-desc {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.common-categories {
  margin-top: 1rem;
}
.common-category {
  margin-bottom: 2rem;
}
.common-category-title {
  font-size: 1.1rem;
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.common-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}
.common-link-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.2s, background 0.2s, transform 0.15s ease;
  word-break: break-all;
}
.common-link-item:hover {
  border-color: var(--primary);
  background: rgba(88, 166, 255, 0.08);
  transform: translateY(-2px);
}
.common-link-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-input);
}
.common-link-favicon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.common-link-favicon-fallback {
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(88, 166, 255, 0.15);
  border-radius: 10px;
}
.common-link-label {
  text-align: center;
  line-height: 1.3;
  max-width: 100%;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  overflow-y: auto;
}
.modal.hidden {
  display: none !important;
}
.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 440px;
}
.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  color: var(--text);
  background: var(--bg-input);
}
.modal-content h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  padding-right: 2rem;
}
.modal-content label:not(.form-label):not(.radio-option) {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.modal-content input,
.modal-content select,
.modal-content textarea {
  width: 100%;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
.modal-form .form-row input,
.modal-form .form-row .input-with-btn {
  margin-bottom: 0;
}
.modal-content textarea {
  resize: vertical;
  min-height: 60px;
}
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 0.25rem;
}
.modal-content .hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* 弹窗表单统一对齐（修改密码等） */
.modal-form .form-row {
  margin-bottom: 1.25rem;
}
.modal-form .form-row:last-of-type {
  margin-bottom: 0;
}
.modal-form .form-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.modal-form .radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
}
.modal-form .radio-option {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.95rem;
}
.modal-form .radio-option input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}
.modal-form .form-row .input-with-btn {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}
.modal-form .form-row .input-with-btn input {
  flex: 1;
  min-width: 0;
}
.modal-form .form-row input[type="password"],
.modal-form .form-row input[type="text"] {
  width: 100%;
}

/* Utility */
.hidden {
  display: none !important;
}
.text-muted {
  color: var(--text-muted);
}

/* 收藏列表空状态 */
.bookmark-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.bookmark-empty p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.bookmark-empty-hint {
  margin-top: 0.5rem !important;
  font-size: 0.85rem !important;
  opacity: 0.85;
}
.bookmark-reenter-password {
  padding: 1.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bookmark-reenter-password p {
  margin: 0 0 0.75rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.reenter-password-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.reenter-password-form input {
  flex: 1;
  min-width: 10rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.reenter-password-form input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Responsive - 手机端 */
@media (max-width: 600px) {
  .site-header {
    padding: 0.25rem 0.75rem 0.4rem;
    gap: 0.3rem 0.5rem;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
  }
  .logo-wrap {
    width: 100%;
    grid-column: 1 / 3;
    grid-row: 1;
    justify-content: flex-start;
  }
  .site-header .logo {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    padding: 0.1rem 0;
    text-align: left;
  }
  .theme-toggle {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.8rem;
  }
  .main-nav {
    grid-column: 1;
    grid-row: 2;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    order: 2;
    gap: 0.2rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .main-nav::-webkit-scrollbar {
    display: none;
  }
  .main-nav a {
    flex-shrink: 0;
    padding: 0.35rem 0.45rem;
    font-size: 0.8rem;
    white-space: nowrap;
    color: var(--text-muted);
  }
  .header-actions {
    grid-column: 2;
    grid-row: 2;
    flex-shrink: 1;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 0.2rem;
  }
  /* 未登录：右侧仅显示图标，节省高度 */
  .header-actions .btn-nav-action {
    padding: 0.4rem;
    min-width: 0;
    flex-shrink: 0;
  }
  .header-actions .btn-nav-action .nav-icon {
    width: 1.15rem;
    height: 1.15rem;
    display: inline-block;
    vertical-align: middle;
  }
  .header-actions .btn-nav-action .nav-action-label {
    display: none;
  }
  /* 已登录：邮箱强烈截断，保证第二行单行；完整邮箱见 title 悬停 */
  .header-actions .user-email {
    max-width: 4.2em;
    text-align: right;
    margin-right: 0.2rem;
    margin-bottom: 0;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
  }
  .header-actions .btn-icon {
    flex-shrink: 0;
    padding: 0.35rem;
  }
  .header-actions .btn-icon .nav-icon {
    width: 1.1rem;
    height: 1.1rem;
  }
  .main-content {
    padding: 0.75rem;
  }
  .hero {
    padding: 2rem 0.75rem;
  }
  .hero h1 {
    font-size: 1.75rem;
  }
  .hero-actions {
    gap: 0.75rem;
  }
  .hero-actions .btn {
    padding: 0.6rem 1rem;
  }
  .auth-card {
    padding: 1.25rem;
    margin: 1rem auto;
  }
  /* 收藏页第三行：标签+分组下拉，右侧按钮紧凑 */
  .bookmarks-toolbar {
    padding: 0.4rem 0.75rem;
    gap: 0.5rem;
  }
  .group-select-label {
    font-size: 0.85rem;
  }
  .group-select-wrap {
    min-width: 8rem;
    max-width: 12rem;
  }
  .group-select-trigger {
    padding: 0.4rem 0.5rem 0.4rem 0.6rem;
    font-size: 0.85rem;
  }
  .group-select-option {
    padding: 0.4rem 0.65rem;
    font-size: 0.8125rem;
  }
  .group-select-panel {
    max-height: 14rem;
  }
  .bookmarks-toolbar-actions {
    gap: 0.35rem;
  }
  .bookmarks-toolbar-actions .btn {
    padding: 0.45rem 0.65rem;
    font-size: 0.85rem;
  }
  .encrypted-lock {
    padding: 1.25rem;
  }
  .encrypted-lock input {
    max-width: 100%;
    margin: 0.5rem 0;
  }
  .unlock-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .bookmark-list {
    min-height: 80px;
    gap: 0.35rem;
  }
  .bookmark-empty {
    min-height: 100px;
    padding: 1.25rem 0.75rem;
  }
  .bookmark-item {
    padding: 0.45rem 0.6rem;
  }
  .bookmark-item .title-link {
    font-size: 0.85rem;
  }
  .bookmark-item .meta {
    font-size: 0.68rem;
  }
  .bookmark-item .note {
    font-size: 0.75rem;
  }
  .bookmark-item .actions .btn-icon {
    padding: 0.25rem;
    min-width: 1.6rem;
  }
  .bookmark-item .actions .btn-icon .nav-icon {
    width: 0.9rem;
    height: 0.9rem;
  }
  /* 常用链接 */
  .common-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
  }
  .common-link-item {
    padding: 0.75rem 0.5rem;
  }
  .common-link-icon {
    width: 36px;
    height: 36px;
  }
  .common-link-favicon,
  .common-link-favicon-fallback {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  .common-category-title {
    font-size: 1rem;
  }
  /* 安全策略页 */
  .security-flow .flow-diagram {
    flex-direction: column;
    align-items: stretch;
  }
  .security-flow .flow-step {
    max-width: none;
  }
  .security-flow .flow-arrow {
    transform: rotate(90deg);
    align-self: center;
  }
  .pass-cards {
    grid-template-columns: 1fr;
  }
}

/* 超小屏（如窄屏手机） */
@media (max-width: 380px) {
  .header-actions .btn {
    font-size: 0.8rem;
  }
  .main-nav a {
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
  }
}
