:root {
  --paper: #faf9f6;
  --white: #fffefa;
  --sidebar: #f0f2e9;
  --ink: #303d32;
  --muted: #63705f;
  --line: #dce1d4;
  --green: #496550;
  --green-dark: #344e3c;
  --danger: #a74639;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  font-synthesis: none;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; border: 0; background: none; }
button:disabled { cursor: wait; opacity: .6; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1, h2 { font-weight: 600; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
input, textarea, select { width: 100%; min-width: 0; min-height: 44px; padding: 9px 12px; border: 1px solid #bdc8b6; border-radius: 10px; outline: none; color: var(--ink); background: var(--white); font-size: 1rem; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #727d6d; }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px #49655016; }
textarea { resize: vertical; min-height: 96px; }
select { cursor: pointer; }
label { display: block; font-weight: 500; margin: 16px 0 7px; }
input[type=checkbox], input[type=radio] { accent-color: var(--green); }
input[type=checkbox] { width: 19px; height: 19px; min-height: 0; margin: 0; flex-shrink: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px; border: 1px solid transparent; border-radius: 10px; font-size: 1rem; font-weight: 500; white-space: nowrap; transition: background .15s; }
.button svg { width: 19px; height: 19px; }
.button.primary { background: var(--green); color: #fffef9; }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { background: var(--white); border-color: #cbd3c3; }
.button.secondary:hover { background: #eaf0e2; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border-radius: 9px; color: #5b6e53; flex-shrink: 0; }
.icon-button:hover { color: var(--green-dark); background: #e0e8d8; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 7px 9px; border-radius: 8px; font-size: 1rem; color: var(--green); }
.text-button svg { width: 20px; height: 20px; }
.text-button:hover { background: #e9eedf; }
.danger { color: var(--danger); }
.danger:hover { background: #f6e6e0; }
.danger-button { color: white; background: var(--danger); }
.danger-button:hover { background: #8d382e; }
.brand { display: inline-flex; align-items: center; gap: 13px; }
.brand img { width: 38px; height: 38px; }
.brand > span { font-family: Georgia, "Times New Roman", serif; font-size: 2.4rem; letter-spacing: -2px; font-weight: 600; line-height: 1; }
.brand-dot { color: #81946d; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; flex-direction: column; width: 240px; padding: 26px 18px 0; background: var(--sidebar); border-right: 1px solid var(--line); }
.sidebar > .brand { margin: 0 8px 28px; }
.sidebar nav { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; margin: 3px 0; padding: 7px 11px; border-radius: 10px; text-align: left; color: #58674f; font-size: 1.067rem; }
.nav-item > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: #e3e8dc; }
.nav-item.active { background: #dfe7d6; color: #36503a; font-weight: 600; }
.nav-count { margin-left: auto; min-width: 27px; padding: 0 5px; text-align: center; color: #5c6d51; font-size: 1rem; }
.active .nav-count { background: #ccdaba; color: #3d5734; border-radius: 5px; }
.group-heading { margin: 30px 0 8px; padding: 0 12px; }
.nav-label { color: var(--muted); font-size: 1rem; font-weight: 600; }
.group-row { display: flex; align-items: center; position: relative; }
.group-row .nav-item { padding-right: 51px; }
.group-row .group-edit { position: absolute; right: 4px; width: 36px; height: 40px; }
.group-row .group-edit svg { width: 20px; height: 20px; }
.group-dot { width: 11px; height: 11px; margin: 0 5px; border-radius: 4px; background: var(--tag-ink); flex-shrink: 0; }
.new-group-button { display: flex; align-items: center; gap: 11px; min-height: 44px; margin-top: 8px; padding: 8px 12px; border-radius: 10px; color: #586e4b; font-size: 1rem; }
.new-group-button:hover { background: #e3e8dc; }
.sidebar-bottom { margin-top: 24px; border-top: 1px solid var(--line); }
.account { display: flex; align-items: center; gap: 10px; padding: 19px 0; }
.avatar { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; color: #4a6241; background: #e0e7d4; border: 1px solid #c3d1b5; border-radius: 50%; font-family: Georgia, serif; font-size: 1.25rem; }
.account strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 1rem; font-weight: 500; }
.workspace { margin-left: 240px; min-height: 100vh; }
#main-content { max-width: 1536px; margin: auto; padding: 34px 36px 36px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-title-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-heading h1 { overflow-wrap: anywhere; font-size: 2rem; line-height: 1.35; }
.page-heading > .button { flex-shrink: 0; font-size: 1.067rem; }
.mobile-menu { display: none; }
.collection-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.search-box { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; max-width: 560px; min-height: 46px; padding: 0 15px; color: #67795c; background: var(--white); border: 1px solid #cbd3c3; border-radius: 10px; }
.search-box:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px #49655016; }
.search-box input { border: 0; background: transparent; padding: 10px 0; box-shadow: none; }
.sort-control { margin: 0; flex-shrink: 0; }
.sort-control select { width: 140px; padding: 9px 10px; }
.results-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; font-size: 1rem; color: var(--muted); }
.results-line strong { color: #3f5736; font-weight: 600; }
.results-actions { display: flex; align-items: center; gap: 8px; }
.bookmark-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.bookmark-card { position: relative; isolation: isolate; min-width: 0; min-height: 265px; display: flex; flex-direction: column; padding: 20px 20px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); transition: transform .15s, border-color .15s, box-shadow .15s; }
.bookmark-card:hover { transform: translateY(-3px); border-color: #afc19d; box-shadow: 0 8px 24px #354a300a; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.site-icon { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--tag-border); color: var(--tag-ink); background: var(--tag-bg); border-radius: 12px; font-family: Georgia, serif; font-size: 1.6rem; font-weight: 600; flex-shrink: 0; }
.site-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--tag-bg); padding: 4px; }
.card-tools { display: flex; gap: 5px; }
.favorite-button.is-favorite { color: #92702b; }
.favorite-button.is-favorite svg { fill: #c2ab6a38; }
.card-link { position: relative; display: block; flex: 1; min-height: 125px; padding: 17px 0 19px; }
.card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; padding-right: 15px; font-size: 1.267rem; line-height: 1.5; font-weight: 600; }
.card-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; margin-top: 10px; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.card-domain { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 26px; margin-top: 11px; color: #63765a; font-size: 1rem; }
.open-arrow { position: absolute; right: 0; bottom: 22px; width: 19px; height: 19px; color: #617b53; }
.card-footer { position: relative; display: flex; align-items: center; min-height: 54px; padding: 8px 0; border-top: 1px solid var(--line); }
.group-badge { min-height: 36px; max-width: 100%; padding: 7px 13px; border-radius: 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--tag-ink); background: var(--tag-bg); font-size: 1rem; }
.group-badge:hover { filter: brightness(.95); }
.bookmark-card.has-cover { overflow: hidden; min-height: 290px; color: #fff; background: #25372c; border-color: #344b3a; }
.card-cover { position: absolute; inset: 0; z-index: 0; display: block; overflow: hidden; border-radius: inherit; background: #25372c; }
.card-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.card-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, #09170f70 0%, #09170f29 25%, #09170fb3 60%, #09170ff2 100%); pointer-events: none; }
.has-cover:hover .card-cover img { transform: scale(1.025); }
.has-cover .card-top, .has-cover .card-link, .has-cover .card-footer { position: relative; z-index: 1; }
.has-cover .card-top, .has-cover .card-footer { pointer-events: none; }
.has-cover .card-tools, .has-cover .group-badge { pointer-events: auto; }
.has-cover .card-link { display: flex; flex-direction: column; justify-content: flex-end; min-height: 155px; }
.has-cover .card-title { color: #fff; text-shadow: 0 1px 5px #0005; }
.has-cover .card-description { color: #fffffff0; -webkit-line-clamp: 2; text-shadow: 0 1px 4px #0005; }
.has-cover .card-domain { color: #ffffffdf; }
.has-cover .card-footer { border-top-color: #ffffff40; }
.has-cover .group-badge { color: #fff; background: #ffffff26; border: 1px solid #ffffff30; }
.has-cover .group-badge:hover { background: #ffffff40; }
.has-cover .card-tools .icon-button { color: #fff; background: #0b1a1180; }
.has-cover .card-tools .icon-button:hover { background: #0b1a11bd; }
.has-cover .card-tools .favorite-button.is-favorite { color: #ffe0a0; }
.has-cover .favorite-button.is-favorite svg { fill: #ffe0a045; }
.has-cover .site-icon { border-color: #ffffff90; box-shadow: 0 1px 8px #0002; }
.has-cover .open-arrow { color: #fff; }
.has-cover .card-link:focus-visible, .has-cover .group-badge:focus-visible, .has-cover .icon-button:focus-visible { outline-color: #fff; }
.loading-state { padding: 110px 15px; text-align: center; color: var(--muted); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 360px; padding: 40px 20px; border: 1px dashed #bdcbb0; border-radius: var(--radius); }
.empty-icon { width: 56px; height: 56px; margin-bottom: 20px; color: #7b926a; stroke-width: 1.3; }
.empty-state h2 { margin-bottom: 24px; font-size: 1.267rem; font-weight: 500; }
.toast { position: fixed; left: calc(50% + 120px); bottom: 30px; z-index: 100; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 14px 22px; border-radius: 12px; color: var(--white); background: #344b3b; font-size: 1rem; box-shadow: 0 4px 24px #233b2420; }
.toast.error { background: #9d473a; }
[data-color=sage] { --tag-ink: #536d3e; --tag-bg: #edf2e3; --tag-border: #d0dbc0; }
[data-color=blue] { --tag-ink: #3c6883; --tag-bg: #eaf1f5; --tag-border: #cbdde8; }
[data-color=violet] { --tag-ink: #765c8a; --tag-bg: #f0eaf5; --tag-border: #dfd1e9; }
[data-color=amber] { --tag-ink: #89651f; --tag-bg: #f7efdf; --tag-border: #e8d8b6; }
[data-color=rose] { --tag-ink: #945f5a; --tag-bg: #f6eae8; --tag-border: #e8ceca; }
[data-color=slate] { --tag-ink: #5c675b; --tag-bg: #edf0e8; --tag-border: #d4dcce; }
dialog { width: min(540px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 26px; border: 1px solid #d3dcc9; border-radius: 18px; color: var(--ink); background: var(--paper); box-shadow: 0 20px 100px #23351a24; overflow: auto; }
dialog::backdrop { background: #25322266; }
dialog form > label:first-of-type { margin-top: 0; }
.small-dialog { width: min(460px, calc(100% - 32px)); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.dialog-heading h2 { font-size: 1.6rem; line-height: 1.4; }
.dialog-heading > .icon-button { margin-right: -7px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; min-height: 44px; color: #506846; }
.checkbox-label svg { width: 20px; height: 20px; }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.dialog-actions-right { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; }
.form-error { padding: 11px 14px; margin-top: 16px; border-radius: 9px; color: #923c30; background: #f8e8e0; font-size: 1rem; overflow-wrap: anywhere; }
.color-field { border: 0; padding: 0; margin: 24px 0 0; }
.color-field legend { font-weight: 500; margin-bottom: 13px; }
.color-options { display: flex; flex-wrap: wrap; gap: 12px; }
.color-option { position: relative; display: flex; align-items: center; justify-content: center; margin: 0; cursor: pointer; }
.color-option input { appearance: none; -webkit-appearance: none; width: 36px; height: 36px; min-height: 0; padding: 0; border: 5px solid var(--paper); outline: 1px solid transparent; background: var(--tag-ink); border-radius: 50%; box-shadow: none; cursor: pointer; }
.color-option input:checked { outline: 2px solid var(--tag-ink); }
.color-option input:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.color-option > span { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.confirm-icon { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; margin-bottom: 20px; border-radius: 50%; color: var(--danger); background: #f5e6de; }
.confirm-content h2 { margin-bottom: 12px; font-size: 1.5rem; }
.confirm-content p { color: var(--muted); font-size: 1rem; line-height: 1.8; overflow-wrap: anywhere; }
.confirm-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.url-input-row, .group-select-row { display: flex; align-items: stretch; gap: 10px; }
.url-input-row input, .group-select-row select { flex: 1; min-width: 0; }
.url-input-row .button, .group-select-row .button { padding: 9px 13px; }
.metadata-status { margin-top: 12px; color: var(--muted); font-size: 1rem; }
.metadata-status.is-error { color: #915f36; }
.metadata-preview { overflow: hidden; margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.preview-cover { display: block; width: 100%; max-height: 220px; aspect-ratio: 2.2; object-fit: cover; }
.preview-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.preview-summary img { width: 36px; height: 36px; object-fit: contain; border-radius: 7px; }
.preview-summary .text-button { margin-left: auto; }
.sidebar-overlay { display: none; }
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 24px; background: #f1f3eb; }
.login-shell { width: 100%; max-width: 440px; padding: 34px; border: 1px solid #d9e0d1; border-radius: 18px; background: var(--white); box-shadow: 0 12px 60px #4a583407; }
.login-shell > .brand { margin-bottom: 28px; }
.login-form-wrap h1 { font-size: 1.875rem; margin-bottom: 26px; }
.login-form-wrap label { margin-top: 20px; }
.login-form-wrap input { min-height: 48px; }
.login-submit { width: 100%; margin-top: 28px; min-height: 48px; font-size: 1.067rem; }
@media (max-width: 1100px) {
  .sidebar { width: 240px; padding-left: 15px; padding-right: 15px; }
  .workspace { margin-left: 240px; }
  #main-content { padding: 32px; }
  .bookmark-grid { gap: 20px; }
  .bookmark-card { padding: 20px 20px 0; }
  .toast { left: calc(50% + 120px); }
}
@media (max-width: 900px) {
  .sidebar { width: 280px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; display: block; z-index: 19; border-radius: 0; background: #23351a66; }
  .workspace { margin-left: 0; }
  #main-content { padding: 28px; }
  .mobile-menu { display: inline-flex; }
  .page-heading h1 { font-size: 2rem; }
  .toast { left: 50%; }
  input, textarea, select { font-size: 16px; }
  .icon-button { width: 44px; height: 44px; }
  .group-row .group-edit { height: 44px; }
}
@media (max-width: 640px) {
  #main-content { padding: 24px 18px; }
  .page-heading { gap: 10px; margin-bottom: 24px; }
  .page-title-row { gap: 7px; }
  .page-heading h1 { font-size: 1.75rem; }
  .page-heading > .button { font-size: 1rem; gap: 6px; padding: 10px 13px; }
  .mobile-menu { width: 40px; }
  .collection-toolbar { gap: 10px; }
  .sort-control select { width: 130px; }
  .search-box { gap: 8px; padding: 0 11px; }
  .bookmark-grid { grid-template-columns: 1fr; gap: 20px; }
  .bookmark-card { padding: 20px 20px 0; }
  .bookmark-card.has-cover { min-height: 280px; }
  .results-actions { gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
  .results-actions .text-button { padding-left: 6px; padding-right: 6px; }
  dialog { padding: 24px 20px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .button { padding-left: 16px; padding-right: 16px; }
  .login-page { padding: 18px; }
  .login-shell { padding: 30px 26px; }
}
@media (max-width: 380px) {
  .page-heading { flex-wrap: wrap; }
  .page-heading > .button { margin-left: auto; }
  .page-title-row { gap: 3px; }
  .page-heading h1 { font-size: 1.6rem; }
  .collection-toolbar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; }
  .sort-control { margin-left: auto; }
  .url-input-row { flex-wrap: wrap; }
  .url-input-row input { flex-basis: 100%; }
  .url-input-row .button { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
