:root {
  --font-display: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --bg: #f9f9fb;
  --surface: #ffffff;
  --surface-hover: #f4f4f6;
  --segmented-bg: #eeeef0;
  --border: #e4e4e7;
  --input-border: #d4d4d8;
  --text: #15141a;
  --muted: #5b5b66;
  --muted-2: #8f8f9d;
  --accent: #ff7139;
  --accent-hover: #e85d26;
  --hover-tint: rgba(0, 0, 0, 0.05);
}
html.dark {
  --bg: #1c1b22;
  --surface: #2b2a33;
  --surface-hover: #32313b;
  --segmented-bg: #2b2a33;
  --border: #3a3944;
  --input-border: #3a3944;
  --text: #fbfbfe;
  --muted: #b1b1bd;
  --muted-2: #8f8f9d;
  --hover-tint: rgba(255, 255, 255, 0.05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .brand { font-family: var(--font-display); }
.hidden { display: none !important; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
html.dark .topbar { border-bottom-color: #2f2e38; }
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav { display: flex; align-items: center; gap: 28px; }
@media (max-width: 767px) { .nav { display: none; } }
.nav-link {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-underline-offset: 4px;
  transition: color 0.15s ease;
}
.nav-link:hover { color: var(--text); text-decoration: underline; }
.nav-link.active {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}
.mobile-nav {
  display: none;
  max-width: 320px;
  margin: 0 auto;
  padding: 4px;
  border-radius: 8px;
  background: var(--segmented-bg);
  border: 1px solid var(--border);
  gap: 4px;
}
@media (max-width: 767px) { .mobile-nav { display: flex; } }
.topbar-actions { display: flex; align-items: center; flex-shrink: 0; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease;
}
.btn-secondary:hover { border-color: rgba(255, 113, 57, 0.6); }
.theme-icon { display: inline-flex; align-items: center; }
.text-link {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.text-link:hover { text-decoration: underline; }
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.search-section { padding-top: 8px; padding-bottom: 4px; }
.search-bar {
  max-width: 768px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 0 8px 0 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: border-color 0.15s ease;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-icon {
  display: inline-flex;
  align-items: center;
  color: var(--muted-2);
  padding-right: 8px;
  flex-shrink: 0;
}
.bookmarks-only-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  padding: 12px 12px 12px 0;
  margin-right: 12px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}
.search-bar select {
  background: transparent;
  color: var(--muted);
  border: none;
  border-right: 1px solid var(--border);
  padding: 12px 8px 12px 0;
  margin-right: 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}
.search-bar select:hover { color: var(--text); }
.search-bar select option { background: var(--surface); color: var(--text); }
.search-bar input {
  flex: 1;
  background: transparent;
  color: var(--text);
  border: none;
  padding: 14px 4px;
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  min-width: 0;
}
.search-bar input::placeholder { color: var(--muted-2); }
.kbd-hint {
  display: inline-block;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--input-border);
  color: var(--muted-2);
  flex-shrink: 0;
}
.search-bar .kbd-hint { margin-right: 4px; }
@media (max-width: 639px) { .search-bar .kbd-hint { display: none; } }
.section { display: flex; flex-direction: column; gap: 16px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.head-left { display: flex; align-items: baseline; gap: 12px; }
.section-head h2 { font-size: 16px; font-weight: 600; }
.muted-count {
  font-size: 12px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.speed-dial-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 640px) { .speed-dial-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 768px) { .speed-dial-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.dial-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.15s ease;
}
.dial-card:hover { transform: translateY(-2px); border-color: rgba(255, 113, 57, 0.6); }
.dial-card:active { transform: scale(0.985); }
.dial-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}
.dial-unpin {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 4px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--muted-2);
  opacity: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.dial-card:hover .dial-unpin,
.dial-unpin:focus-visible { opacity: 1; }
.dial-unpin:hover { color: var(--accent); background: var(--hover-tint); }
.dial-title {
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dial-host {
  width: 100%;
  font-size: 11px;
  color: var(--muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-badge {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  overflow: hidden;
}
.site-badge.lg {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 14px;
}
.site-badge img {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  object-fit: contain;
}
.site-badge.lg img {
  width: 20px;
  height: 20px;
}
.site-badge.brand-gh { background: #24292f; color: #fff; border-color: transparent; }
html.dark .site-badge.brand-gh { background: #fbfbfe; color: #15141a; }
.site-badge.brand-yt { background: rgba(255, 0, 0, 0.15); color: #ff0000; border-color: transparent; }
.site-badge.brand-hn { background: #ff6600; color: #fff; border-color: transparent; }
.site-badge.brand-mdn { background: #1b1b1b; color: #fff; border-color: transparent; }
html.dark .site-badge.brand-mdn { background: #3a3944; }
.site-badge.brand-wiki { background: #e4e4e7; color: #15141a; border-color: transparent; }
html.dark .site-badge.brand-wiki { background: #3a3944; color: #fbfbfe; }
.site-badge.brand-fig { background: rgba(10, 207, 131, 0.15); color: #0acf83; border-color: transparent; }
.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
  padding-top: 8px;
}
@media (min-width: 1024px) { .workspace { grid-template-columns: 240px 1fr; } }
.sidebar { display: flex; flex-direction: column; gap: 20px; }
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-2);
}
.folder-list { display: flex; flex-direction: column; gap: 4px; }
.folder-row { display: flex; align-items: center; gap: 4px; }
.folder-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.folder-btn:hover { background: var(--hover-tint); color: var(--text); }
.folder-btn.active { background: rgba(255, 113, 57, 0.12); color: var(--accent); font-weight: 500; }
.folder-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}
.folder-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-del {
  padding: 6px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted-2);
  opacity: 0;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.folder-row:hover .folder-del,
.folder-del:focus-visible { opacity: 1; }
.folder-del:hover { color: #ef4444; }
.sidebar-foot {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
html.dark .sidebar-foot { border-top-color: #2f2e38; }
#new-folder-form { padding: 0 8px 8px; }
#new-folder-form input {
  width: 100%;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.main-col { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
}
.toolbar-left { display: flex; align-items: baseline; gap: 12px; }
.toolbar-left h2 { font-size: 18px; font-weight: 600; }
.toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.select-sm {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}
.select-sm:focus { border-color: var(--accent); }
.segmented {
  display: inline-flex;
  align-items: center;
  background: var(--segmented-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 4px 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
html.dark .seg-btn.active { background: #3a3944; color: var(--text); }
.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 640px) { .bookmark-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 768px) { .bookmark-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .bookmark-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bm-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.15s ease;
}
.bm-card:hover { transform: translateY(-2px); border-color: rgba(255, 113, 57, 0.6); }
.bm-card:hover .bm-title,
.bm-row:hover .bm-row-title { color: var(--accent); }
.bm-card.menu-open { z-index: 30; }
.bm-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: inherit;
}
.bm-meta { min-width: 0; flex: 1; }
.bm-title {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.bm-host {
  font-size: 11px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.pinned-tag { font-family: var(--font-sans); color: var(--accent); font-weight: 500; }
.bm-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.bm-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 14px;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
}
html.dark .bm-row { border-bottom-color: #35343f; }
.bm-row:first-child { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.bm-row:last-child { border-bottom: none; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.bm-row:hover { background: var(--surface-hover); }
.bm-row.menu-open { z-index: 30; }
.bm-row-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: inherit;
}
.bm-row-title {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.bm-row-host {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 639px) { .bm-row-host { display: none; } }
.bm-row-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.bm-row-folder { font-size: 12px; color: var(--muted-2); }
@media (max-width: 767px) { .bm-row-folder { display: none; } }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--hover-tint); color: var(--text); }
.menu-wrap { position: relative; flex-shrink: 0; }
.menu-popover {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  width: 176px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  padding: 4px 0;
  z-index: 40;
}
.menu-item {
  display: block;
  width: 100%;
  padding: 7px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover { background: var(--hover-tint); }
.menu-item.danger { color: #ef4444; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-card {
  width: 100%;
  max-width: 448px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.modal-sm { max-width: 384px; }
.modal-lg { max-width: 520px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.shortcuts-list { gap: 10px; }
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  color: var(--muted);
}
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field input, .field select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.sub-block { display: flex; flex-direction: column; gap: 10px; }
.sub-block h4 { font-size: 14px; font-weight: 600; }
.helper-text { font-size: 12px; color: var(--muted); line-height: 1.5; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.divider { border-top: 1px solid var(--border); }
.status-text { font-size: 12px; color: var(--accent); font-weight: 500; }
.empty-box {
  background: var(--surface);
  border: 1px dashed var(--input-border);
  border-radius: 12px;
  padding: 36px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}