:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #eef2f0;
  --surface-hover: #e7eeeb;
  --text: #17211d;
  --muted: #65716c;
  --border: #d9e0dd;
  --border-strong: #bdcac5;
  --primary: #173d32;
  --primary-hover: #245446;
  --accent: #d45d45;
  --accent-soft: #f8e8e4;
  --blue: #286b8f;
  --yellow: #e7b84d;
  --danger: #b93c34;
  --danger-soft: #f9e7e5;
  --shadow-sm: 0 1px 2px rgba(20, 36, 30, 0.06);
  --shadow-md: 0 12px 32px rgba(20, 36, 30, 0.14);
  --sidebar-width: 244px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111614;
  --surface: #19201d;
  --surface-soft: #202925;
  --surface-hover: #29352f;
  --text: #edf3f0;
  --muted: #9fada7;
  --border: #303c37;
  --border-strong: #46564f;
  --primary: #75b99f;
  --primary-hover: #90cbb5;
  --accent: #ee8068;
  --accent-soft: #412921;
  --blue: #79b8d9;
  --yellow: #e7bd61;
  --danger: #ed776f;
  --danger-soft: #3e2524;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select { font: inherit; }

button { letter-spacing: 0; }

button,
a { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 35%, transparent);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(220px, 1fr) max-content;
  align-items: center;
  gap: 24px;
  min-height: 76px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: block;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border-radius: 8px;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-wrap {
  position: relative;
  width: 100%;
  max-width: 720px;
  justify-self: center;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  display: grid;
  width: 19px;
  height: 19px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 43px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

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

.search-wrap input:focus {
  border-color: var(--border-strong);
  outline: none;
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

.clear-search {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
}

.top-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.top-actions > * { flex: 0 0 auto; }

.icon-button,
.command-button,
.primary-button,
.secondary-button,
.danger-button,
.card-action,
.section-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover,
.card-action:hover,
.section-action:hover { background: var(--surface-hover); color: var(--text); }

.icon-button svg,
.command-button svg,
.primary-button svg,
.secondary-button svg,
.danger-button svg,
.card-action svg,
.section-action svg,
.nav-item svg,
.popover-menu svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 2;
}

.command-button,
.primary-button,
.secondary-button,
.danger-button {
  min-height: 38px;
  gap: 8px;
  padding: 0 13px;
  font-weight: 650;
}

.command-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.command-button:hover,
.command-button.is-active { border-color: var(--border-strong); background: var(--surface-hover); }

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

:root[data-theme="dark"] .primary-button { color: #10241d; }
.primary-button:hover { background: var(--primary-hover); }

.secondary-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.secondary-button:hover { background: var(--surface-hover); }

.danger-button { background: var(--danger); color: #fff; }
.danger-button:hover { filter: brightness(0.92); }

.menu-anchor { position: relative; }

.account-button {
  display: inline-flex;
  min-width: 0;
  height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 9px 0 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.account-button:hover,
.account-button[aria-expanded="true"] {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.account-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

:root[data-theme="dark"] .account-avatar { color: #10241d; }

.account-name {
  max-width: 96px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chevron {
  display: grid;
  width: 14px;
  color: var(--muted);
  transition: transform 140ms ease;
}

.account-chevron svg { width: 14px; height: 14px; }
.account-button[aria-expanded="true"] .account-chevron { transform: rotate(180deg); }

.popover-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 8px);
  left: 0;
  width: 208px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.popover-menu-right { right: 0; left: auto; }

.popover-menu button {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.popover-menu button:hover { background: var(--surface-hover); }
.popover-menu .danger-menu-item { color: var(--danger); }

.account-menu { width: 220px; }
.account-menu form { margin: 0; }

.account-summary {
  display: grid;
  gap: 3px;
  padding: 9px 10px 8px;
}

.account-summary strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-summary span { color: var(--muted); font-size: 11px; }

.menu-divider {
  display: block;
  height: 1px;
  margin: 5px 4px;
  background: var(--border);
}

.workspace {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: calc(100vh - 76px);
}

.sidebar {
  position: sticky;
  top: 76px;
  display: flex;
  height: calc(100vh - 76px);
  flex-direction: column;
  padding: 22px 14px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.category-nav {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.nav-label {
  margin: 18px 10px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.nav-label:first-child { margin-top: 0; }

.nav-item {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 40px;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.nav-item:hover { background: var(--surface-soft); color: var(--text); }

.nav-item.is-active {
  background: color-mix(in srgb, var(--primary) 11%, var(--surface));
  color: var(--primary);
  font-weight: 700;
}

.nav-item.is-active::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  content: "";
}

.nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item em {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 8px 0;
  border-top: 1px solid var(--border);
}

.storage-status {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.storage-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ea573;
  box-shadow: 0 0 0 3px color-mix(in srgb, #3ea573 16%, transparent);
}

.storage-status.is-syncing i,
.storage-status.is-pending i {
  background: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 16%, transparent);
  animation: sync-pulse 1.2s ease-in-out infinite;
}

.storage-status.is-error i,
.storage-status.is-offline i {
  background: var(--yellow);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 18%, transparent);
}

.storage-status.is-conflict { color: var(--danger); font-weight: 700; }
.storage-status.is-conflict i {
  background: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent);
}

@keyframes sync-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1); }
}

.main-content {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 30px clamp(20px, 3vw, 48px) 80px;
  outline: none;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: 0;
}

.page-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.page-heading-actions,
.section-actions,
.card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.content-section {
  margin: 0 0 34px;
  scroll-margin-top: 100px;
}

.section-heading {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-title-wrap {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 9px;
}

.section-heading h2 {
  overflow: hidden;
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-heading .section-count {
  color: var(--muted);
  font-size: 11px;
}

.section-action,
.card-action {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.view-all-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.view-all-button:hover { background: var(--surface-hover); }
.view-all-button svg { width: 15px; height: 15px; }

.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 250px));
  gap: 10px;
  justify-content: start;
}

.bookmark-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 78px;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.bookmark-card:hover {
  z-index: 1;
  border-color: var(--border-strong);
  box-shadow: 0 8px 22px rgba(20, 36, 30, 0.09);
  transform: translateY(-1px);
}

.bookmark-card.is-dragging { opacity: 0.42; }
.bookmark-card.is-drop-target { border-color: var(--accent); }

.bookmark-link {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.bookmark-icon {
  position: relative;
  z-index: 1;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 16px;
  font-weight: 800;
  pointer-events: none;
}

.bookmark-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.bookmark-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  pointer-events: none;
}

.bookmark-copy strong,
.bookmark-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-copy strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

.bookmark-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.card-actions {
  position: relative;
  z-index: 2;
  align-self: start;
  margin: -6px -6px 0 0;
}

.bookmark-card:not(:hover):not(:focus-within) .card-actions:not(.is-pinned) { opacity: 0; }

.card-action.is-pinned { color: var(--accent); }
.card-action.danger:hover { background: var(--danger-soft); color: var(--danger); }

.edit-mode .bookmark-card { cursor: grab; }
.edit-mode .bookmark-card:active { cursor: grabbing; }
.edit-mode .bookmark-card .card-actions { opacity: 1 !important; }

.empty-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 32px;
  height: 32px;
  margin-bottom: 10px;
  color: var(--border-strong);
}

.empty-state p { margin: 0; font-size: 13px; }

.search-result-meta {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12px;
}

.search-highlight {
  padding: 0 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--yellow) 48%, transparent);
  color: inherit;
}

.modal {
  width: min(520px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.modal::backdrop {
  background: rgba(10, 18, 15, 0.52);
  backdrop-filter: blur(3px);
}

.modal form { padding: 22px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.modal h2 { margin: 0; font-size: 20px; letter-spacing: 0; }

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.form-grid { display: grid; gap: 15px; }

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.form-grid input,
.form-grid select {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text);
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: var(--primary);
  outline: none;
  background: var(--surface);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

.confirm-modal { width: min(420px, calc(100vw - 28px)); text-align: center; }
.confirm-modal form { padding: 28px; }
.confirm-modal h2 { margin: 12px 0 7px; }
.confirm-modal p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.confirm-modal .modal-actions { justify-content: center; }

.conflict-modal { width: min(470px, calc(100vw - 28px)); text-align: center; }
.conflict-modal form { padding: 28px; }
.conflict-modal h2 { margin: 7px 0 8px; }
.conflict-modal p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.conflict-actions { justify-content: center; }

.conflict-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--blue);
}

.conflict-icon svg { width: 24px; height: 24px; }

.confirm-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
}

.confirm-icon svg { width: 22px; height: 22px; }

.toast-region {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: 20px;
  display: grid;
  max-width: min(360px, calc(100vw - 40px));
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: 12px;
  animation: toast-in 180ms ease both;
}

.toast svg { width: 17px; height: 17px; color: #3ea573; }
.toast.error svg { color: var(--danger); }

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

.boot-state {
  display: grid;
  min-height: calc(100vh - 180px);
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
}

.boot-state p { margin: 0; font-size: 12px; }

.boot-spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: boot-spin 800ms linear infinite;
}

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

.is-booting .search-wrap,
.is-booting .top-actions {
  opacity: 0.58;
  pointer-events: none;
}

/* Login */
.login-page {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
}

.login-topbar {
  display: flex;
  min-height: 76px;
  align-items: center;
  padding: 12px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.login-main {
  display: grid;
  width: 100%;
  place-items: center;
  padding: 40px 16px;
}

.login-panel {
  width: min(440px, calc(100vw - 28px));
  padding: 32px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.login-heading { margin-bottom: 24px; }
.login-heading h1 { margin: 8px 0 6px; font-size: 28px; line-height: 1.2; }
.login-heading p { margin: 0; color: var(--muted); font-size: 13px; }

.login-badge {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.login-alert {
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border));
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.login-form { display: grid; gap: 16px; }

.login-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.login-field > input,
.password-control,
.captcha-control input {
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text);
}

.login-field > input,
.captcha-control input { width: 100%; padding: 0 12px; }

.login-field > input:focus,
.password-control:focus-within,
.captcha-control input:focus {
  border-color: var(--primary);
  outline: none;
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

.password-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
}

.password-control input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.password-control button,
.captcha-refresh {
  height: 34px;
  margin-right: 5px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: var(--surface-hover);
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.captcha-control {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(68px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.captcha-control img {
  display: block;
  width: 100%;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: 7px;
  object-fit: cover;
}

.captcha-control input {
  height: 56px;
  text-align: center;
  text-transform: uppercase;
}

.captcha-refresh { height: 40px; margin: 0; }

.human-check {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.human-check input { width: 16px; height: 16px; accent-color: var(--primary); }

.login-submit {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 750;
  transition: background 140ms ease, transform 140ms ease;
}

.login-submit:hover { background: var(--primary-hover); transform: translateY(-1px); }

.login-footer {
  padding: 18px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 1000px) {
  :root { --sidebar-width: 210px; }
  .topbar { grid-template-columns: var(--sidebar-width) minmax(220px, 1fr) auto; gap: 14px; }
  .command-button span { display: none; }
  .command-button { width: 38px; padding: 0; }
  .bookmark-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 240px)); }
}

@media (max-width: 760px) {
  .topbar {
    position: sticky;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 116px;
    padding: 10px 14px 12px;
  }

  .brand-copy small { display: none; }
  .search-wrap { grid-row: 2; grid-column: 1 / -1; }
  .top-actions { gap: 3px; }
  .top-actions > .icon-button:first-child { display: none; }
  .primary-button { padding: 0 11px; }
  .workspace { display: block; min-height: calc(100vh - 116px); }

  .sidebar {
    position: sticky;
    z-index: 20;
    top: 116px;
    display: block;
    width: 100%;
    height: auto;
    padding: 8px 12px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .category-nav {
    display: flex;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .category-nav::-webkit-scrollbar { display: none; }
  .nav-label, .sidebar-footer { display: none; }

  .nav-item {
    display: inline-flex;
    width: auto;
    min-width: max-content;
    min-height: 34px;
    gap: 7px;
    padding: 6px 10px;
    border: 1px solid transparent;
  }

  .nav-item svg { width: 16px; height: 16px; }
  .nav-item em { display: none; }
  .nav-item.is-active { border-color: var(--border); }
  .nav-item.is-active::before { display: none; }

  .main-content { padding: 22px 14px 60px; }
  .page-heading { align-items: flex-start; margin-bottom: 22px; }
  .page-heading h1 { font-size: 25px; }
  .bookmark-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .bookmark-card { min-height: 72px; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 9px; padding: 10px; }
  .bookmark-icon { width: 36px; height: 36px; }
  .bookmark-icon img { width: 23px; height: 23px; }
  .bookmark-card:not(:hover):not(:focus-within) .card-actions:not(.is-pinned) { opacity: 1; }
  .card-action:not(.is-pinned):not(.edit-action):not(.delete-action) { display: none; }
  .popover-menu { position: fixed; top: 66px; right: 12px; left: auto; }
  .account-button { width: 38px; padding: 0 4px; justify-content: center; }
  .account-name, .account-chevron { display: none; }
  .account-menu { top: 66px; }
}

@media (max-width: 460px) {
  .brand-mark { flex-basis: 34px; width: 34px; height: 34px; }
  .brand-copy strong { font-size: 14px; }
  .top-actions .primary-button span { display: none; }
  .top-actions .primary-button { width: 38px; padding: 0; }
  .bookmark-grid { grid-template-columns: 1fr; }
  .page-heading-actions .command-button span { display: inline; }
  .page-heading-actions .command-button { width: auto; padding: 0 11px; }
  .login-main { padding: 24px 12px; }
  .login-panel { padding: 24px 20px; }
  .login-heading h1 { font-size: 25px; }
  .captcha-control { grid-template-columns: minmax(130px, 1fr) 66px auto; gap: 6px; }
  .captcha-refresh { padding: 0 8px; }
}

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