/* Standalone: no external assets, scripts, fonts, or tracking. */
    :root {
      --ink: #27313d; --muted: #8b929e; --subtle: #68717f;
      --line: #eceef2; --soft: #f7f8fa; --surface: #fff;
      --active: #eef1ff; --accent: #5269ce; --danger: #bd4747;
      --sidebar: 202px; --cols: minmax(220px, 1.18fr) minmax(150px, 1fr) 98px;
      --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    }
    * { box-sizing: border-box; }
    [hidden] { display: none !important; }
    body { margin: 0; color: var(--ink); background: #fff; font: 13px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
    button, input, select, textarea { font: inherit; color: inherit; }
    button { border: 0; background: none; cursor: pointer; }
    button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
    button:disabled { opacity: .28; cursor: default; }
    a { color: inherit; text-decoration: none; }
    h1, h2, h3, p { margin: 0; }
    input, textarea, select { min-width: 0; }
    input::placeholder, textarea::placeholder { color: #a0a6b0; }
    button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
    input:focus, select:focus, textarea:focus { outline: 2px solid #5269ce50; outline-offset: 1px; border-color: #9aa7df; }
    ::selection { background: #e3e8ff; }
    .icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }
    .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
    .icon-button { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--muted); flex-shrink: 0; }
    .icon-button:hover:not(:disabled), .icon-button[aria-expanded="true"] { color: var(--ink); background: #eceff4; }
    .button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 35px; padding: 7px 13px; border-radius: 6px; border: 1px solid var(--line); background: #fff; font-size: 12px; font-weight: 500; white-space: nowrap; }
    .button:hover { background: var(--soft); }
    .button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
    .button.primary:hover { background: #3a4756; }
    .button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
    .button.quiet { border-color: transparent; color: var(--subtle); }
    .button .icon { width: 15px; height: 15px; }
    .danger-text { color: var(--danger) !important; }
    /* One navigation, one search, one list. */
    .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 25px 16px; background: #f8f9fb; border-right: 1px solid var(--line); z-index: 40; overflow-y: auto; }
    .brand { display: inline-flex; align-items: center; gap: 9px; margin: 0 11px 37px; padding: 0; }
    .brand-symbol { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 7px; background: var(--ink); color: #fff; }
    .brand-symbol .icon { width: 15px; height: 15px; stroke-width: 1.8; }
    .brand-word { font-size: 21px; font-weight: 740; line-height: 1; letter-spacing: -.8px; }
    .side-nav { display: grid; gap: 4px; }
    .nav-item { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 37px; padding: 8px 11px; border-radius: 6px; text-align: left; color: #66707d; font-size: 12px; }
    .nav-item:hover { background: #eef0f4; }
    .nav-item.is-active { color: var(--accent); background: var(--active); font-weight: 600; }
    .nav-item .icon { width: 16px; height: 16px; }
    .nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .side-heading { display: flex; justify-content: space-between; align-items: center; margin: 27px 5px 7px 11px; color: #939aa5; font-size: 11px; }
    .side-heading .icon-button { width: 24px; height: 24px; }
    .side-heading .icon { width: 14px; height: 14px; }
    .sidebar-groups { display: grid; gap: 3px; }
    .workspace { margin-left: var(--sidebar); }
    .topbar { position: sticky; top: 0; z-index: 20; height: 69px; padding: 0 36px; border-bottom: 1px solid var(--line); background: #ffffffed; backdrop-filter: blur(12px); display: flex; align-items: center; gap: 14px; }
    .search-box { display: flex; align-items: center; gap: 9px; width: 360px; max-width: 58%; padding: 0 11px; height: 35px; border: 1px solid #edf0f4; border-radius: 6px; background: #f8f9fb; }
    .search-box:focus-within { border-color: #acb7e7; }
    .search-box > .icon { width: 16px; height: 16px; color: #949ba6; }
    .search-input { width: 100%; border: 0; outline: none !important; background: transparent; height: 32px; font-size: 12px; }
    .search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
    .search-box .icon-button { width: 21px; height: 23px; }
    .search-box .icon-button .icon { width: 13px; height: 13px; }
    .topbar > .primary { margin-left: auto; }
    .mobile-menu { display: none; }
    .content { max-width: 1220px; padding: 24px 36px 25px; margin: auto; }
    .library-header { min-height: 37px; display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
    .page-heading { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
    .page-heading h1 { font-size: 21px; font-weight: 650; line-height: 1.4; letter-spacing: -.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .result-count { color: var(--muted); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
    .library-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
    .category-filter { position: relative; display: flex; align-items: center; }
    .category-filter select { appearance: none; padding: 6px 24px 6px 9px; border: 1px solid var(--line); background: #fff; font-size: 11px; border-radius: 5px; cursor: pointer; width: 112px; text-overflow: ellipsis; color: var(--subtle); }
    .category-filter .icon { position: absolute; right: 8px; width: 11px; height: 11px; pointer-events: none; color: #9299a5; }
    .category-filter.is-filtered select { border-color: #cbd3f3; color: var(--accent); background: #f8f9ff; }
    .bulk-toolbar { position: sticky; top: 69px; z-index: 15; display: flex; align-items: center; gap: 14px; min-height: 43px; margin: -5px 0 7px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fffffff5; backdrop-filter: blur(12px); }
    .bulk-select-all { display: inline-flex; align-items: center; gap: 8px; min-height: 29px; color: var(--subtle); font-size: 11px; cursor: pointer; white-space: nowrap; }
    .bulk-select-all input, .row-select input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
    .bulk-actions { min-width: 0; margin-left: auto; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
    .bulk-actions strong { margin-right: 3px; color: var(--ink); font-size: 11px; font-weight: 600; white-space: nowrap; }
    .bulk-actions .button { min-height: 29px; padding: 5px 9px; font-size: 11px; }
    .column-labels { display: grid; grid-template-columns: 30px var(--cols) 62px; column-gap: 20px; padding: 0 7px 9px; color: #949ba6; font-size: 10px; border-bottom: 1px solid var(--line); }
    .column-labels span:last-of-type { padding-left: 7px; }
    .bookmark-group + .bookmark-group { margin-top: 9px; }
    .group-heading { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 7px 11px 4px; }
    .group-heading h2 { font-size: 12px; font-weight: 550; color: #7e8794; }
    .bookmark-row { position: relative; display: grid; grid-template-columns: 30px minmax(0,1fr) 62px; align-items: center; column-gap: 20px; min-height: 48px; padding: 0 7px; border-bottom: 1px solid #f0f1f4; border-radius: 4px; background: #fff; }
    .bookmark-row:hover, .bookmark-row:focus-within, .bookmark-row.menu-open { background: #f8f9fc; }
    .bookmark-row.is-selected { background: #f3f5ff; }
    .row-select { display: grid; place-items: center; width: 30px; min-height: 46px; cursor: pointer; }
    .bookmark-link { min-width: 0; display: grid; grid-template-columns: var(--cols); align-items: center; column-gap: 20px; min-height: 47px; padding: 6px 0; border-radius: 3px; }
    .site { display: flex; align-items: center; min-width: 0; gap: 11px; }
    .site-logo { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #00000006; border-radius: 6px; background: var(--logo-bg); color: var(--logo-fg); font: 600 15px/1 var(--font); flex-shrink: 0; }
    .site-logo .icon { width: 17px; height: 17px; }
    .site-logo > svg:not(.icon) { width: 12px; height: 18px; }
    .site-text { min-width: 0; }
    .site-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 1.45; font-weight: 570; }
    .site-domain { display: block; margin-top: 1px; color: #a0a6b0; font-size: 10px; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .site-purpose { color: #7b8491; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .site-category { justify-self: start; font-size: 10px; color: #89919d; padding: 2px 7px; border: 1px solid #edf0f4; border-radius: 4px; line-height: 1.5; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 2px; }
    .row-actions .icon-button { opacity: 0; width: 28px; height: 28px; }
    .row-actions .icon-button .icon { width: 15px; height: 15px; }
    .row-actions .is-favorite { color: #b7a070; opacity: 1; }
    .is-favorite .icon { fill: currentColor; stroke-width: 1.3; }
    .bookmark-row:hover .row-actions .icon-button, .bookmark-row:focus-within .row-actions .icon-button, .bookmark-row.menu-open .row-actions .icon-button { opacity: 1; }
    .empty-state { display: grid; justify-items: center; gap: 13px; padding: 88px 16px; color: var(--muted); font-size: 12px; }
    .empty-group { padding: 16px 11px; color: #a0a6b0; font-size: 11px; }
    .empty-group button { color: var(--accent); padding: 0; font-size: inherit; }
    .single-group .group-heading { display: none; }
    .is-dragging { opacity: .35; }
    .drop-zone-active { background: #f3f5ff !important; box-shadow: inset 0 0 0 1px #c2cbef; border-radius: 6px; }
    .bookmark-row.drag-before::before, .bookmark-row.drag-after::after { content: ""; position: absolute; z-index: 3; height: 2px; left: 0; right: 0; background: #7789d3; }
    .bookmark-row.drag-before::before { top: -1px; }
    .bookmark-row.drag-after::after { bottom: -1px; }
    /* Menus and forms only appear when needed. */
    .popup-menu { position: fixed; width: 198px; padding: 5px; border: 1px solid #e6e9ef; border-radius: 8px; box-shadow: 0 8px 30px #24324912, 0 2px 6px #24324908; background: #fff; z-index: 80; overflow-y: auto; }
    .popup-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 33px; padding: 7px 9px; border-radius: 4px; text-align: left; font-size: 12px; }
    .popup-menu button:hover, .popup-menu button:focus-visible { background: #f3f5f9; outline: none; }
    .popup-menu .icon { width: 14px; height: 14px; color: #8d95a2; }
    .popup-menu .menu-check { margin-left: auto; color: var(--accent); }
    .popup-menu .menu-divider { height: 1px; background: var(--line); margin: 5px 4px; }
    .popup-menu .menu-note { padding: 8px 9px 6px; color: #969eaa; font-size: 10px; }
    .popup-menu .sort-label { color: #9aa2ad; font-size: 10px; padding: 5px 9px 3px; }
    .dialog { padding: 0; border: 1px solid #e6e9ef; border-radius: 11px; width: min(450px, calc(100% - 32px)); max-height: calc(100dvh - 40px); color: var(--ink); box-shadow: 0 20px 80px #18233829; background: #fff; }
    .dialog::backdrop { background: #18213038; backdrop-filter: blur(2px); }
    .dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 13px; gap: 16px; }
    .dialog-header h2 { font-size: 16px; font-weight: 650; }
    .dialog-header .icon-button { width: 25px; height: 25px; }
    .dialog-body { padding: 4px 22px 20px; }
    .dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
    .field { display: grid; gap: 6px; margin-bottom: 14px; font-size: 12px; }
    .field > span { color: #687382; font-size: 11px; }
    .field input, .field select, .field textarea, .entity-input { width: 100%; padding: 9px 10px; border: 1px solid #e4e8ee; border-radius: 6px; background: #fff; font-size: 12px; }
    .field textarea { resize: vertical; min-height: 62px; max-height: 150px; }
    .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .field-group { margin-top: 4px; }
    .extra-fields summary { width: fit-content; font-size: 11px; color: #969da7; cursor: pointer; padding: 2px 0; }
    .extra-fields[open] summary { margin-bottom: 13px; }
    .check-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--subtle); }
    .check-label input, .import-option input { accent-color: var(--accent); }
    .form-error { font-size: 11px; color: var(--danger); margin-top: 11px; }
    .form-error:empty { display: none; }
    .manager-dialog { width: min(510px, calc(100% - 32px)); }
    .manage-row { display: flex; gap: 3px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
    .manage-row input { min-width: 0; width: 100%; flex: 1; border: 1px solid transparent; border-radius: 4px; font-size: 12px; padding: 7px 5px; }
    .manage-row input:hover:not(:disabled) { border-color: #e7eaf0; }
    .manage-row input:disabled { background: transparent; color: #a0a6b0; opacity: 1; -webkit-text-fill-color: #a0a6b0; }
    .manage-row .entity-count { font-size: 10px; color: #a0a6b0; min-width: 18px; text-align: center; margin-right: 7px; font-variant-numeric: tabular-nums; }
    .manage-row .icon-button { width: 27px; height: 27px; }
    .manage-row .icon { width: 14px; height: 14px; }
    .add-entity-form { display: flex; gap: 8px; padding-top: 18px; }
    .add-entity-form input { flex: 1; }
    .confirm-dialog { width: min(370px, calc(100% - 32px)); }
    .confirm-copy { color: var(--subtle); font-size: 12px; overflow-wrap: anywhere; line-height: 1.8; }
    .import-summary { color: var(--subtle); font-size: 12px; margin-bottom: 17px; }
    .import-option { display: flex; align-items: flex-start; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; margin-top: 9px; cursor: pointer; }
    .import-option input { margin-top: 4px; }
    .import-option strong { display: block; font-weight: 550; font-size: 12px; }
    .import-option small { display: block; color: #929ba7; font-size: 10px; margin-top: 3px; }
    .toast { position: fixed; left: calc(50% + var(--sidebar)/2); bottom: 27px; transform: translate(-50%, 10px); background: #2e3948; color: #fff; font-size: 12px; padding: 10px 16px; border-radius: 7px; box-shadow: 0 6px 24px #1b2c3d18; max-width: min(450px, calc(100% - 32px)); z-index: 100; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
    .toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
    .storage-warning { background: #fff6e8; color: #936328; font-size: 11px; padding: 10px 36px; }
    .nav-backdrop { display: none; }
    @media (min-width: 1600px) { .topbar { padding-right: max(36px, calc((100vw - var(--sidebar) - 1148px)/2)); padding-left: max(36px, calc((100vw - var(--sidebar) - 1148px)/2)); } }
    @media (max-width: 1150px) { :root { --sidebar: 184px; --cols: minmax(178px, 1.05fr) minmax(100px, 1fr) 76px; } .topbar { padding: 0 26px; } .content { padding-left: 26px; padding-right: 26px; } .column-labels, .bookmark-row, .bookmark-link { column-gap: 14px; } }
    @media (max-width: 960px) { :root { --cols: minmax(150px, 1fr) 78px; } .site-purpose, .purpose-label { display: none; } .column-labels { grid-template-columns: 30px var(--cols) 62px; } .row-actions .icon-button { opacity: 1; } .bulk-actions { overflow-x: auto; justify-content: flex-start; } }
    @media (max-width: 720px) {
      :root { --sidebar: 210px; }
      .sidebar { transform: translateX(-100%); transition: transform .18s ease; }
      .workspace { margin-left: 0; }
      .topbar { height: 61px; padding: 0 17px; gap: 10px; }
      .mobile-menu { display: inline-flex; margin-left: -4px; width: 27px; }
      .search-box { flex: 1; width: auto; max-width: none; }
      .topbar > .primary { padding: 7px 11px; font-size: 11px; gap: 5px; }
      .content { padding: 22px 18px 30px; }
      .library-header { margin-bottom: 17px; }
      .bulk-toolbar { top: 61px; flex-wrap: wrap; gap: 4px 10px; padding: 7px 8px; }
      .bulk-actions { width: 100%; margin-left: 0; padding-bottom: 1px; }
      .page-heading h1 { font-size: 19px; }
      .page-heading { gap: 7px; }
      .library-tools { gap: 3px; }
      .category-filter select { width: 98px; font-size: 10px; }
      .column-labels { padding-left: 6px; padding-right: 4px; }
      .bookmark-row { padding-left: 2px; padding-right: 0; min-height: 56px; grid-template-columns: 26px minmax(0,1fr) 56px; gap: 8px; }
      .row-select { width: 26px; min-height: 54px; }
      .bookmark-link { min-height: 55px; gap: 10px; }
      .column-labels { grid-template-columns: 26px var(--cols) 56px; gap: 10px; padding-left: 2px; }
      .group-heading { padding-left: 6px; min-height: 36px; }
      .site { gap: 9px; }
      .site-category { font-size: 9px; padding: 2px 5px; }
      .row-actions { gap: 0; }
      .row-actions .icon-button { opacity: 1; }
      .toast { left: 50%; width: max-content; bottom: 20px; }
      .nav-open { overflow: hidden; }
      .nav-open .sidebar { transform: translateX(0); }
      .nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: #18213038; z-index: 35; }
      .storage-warning { padding: 9px 18px; }
    }
    @media (max-width: 420px) {
      :root { --cols: minmax(0,1fr) 56px; }
      .content { padding-left: 13px; padding-right: 13px; }
      .topbar { padding-left: 14px; padding-right: 14px; gap: 8px; }
      .topbar > .primary { padding: 7px 9px; }
      .site-logo { width: 26px; height: 26px; border-radius: 5px; }
      .site-title { font-size: 12px; }
      .site-domain { font-size: 10px; }
      .bookmark-link { column-gap: 8px; }
      .column-labels { column-gap: 8px; }
      .page-heading h1 { font-size: 18px; max-width: 135px; }
      .result-count { font-size: 11px; }
      .manage-row { gap: 1px; }
      .manage-row .entity-count { display: none; }
      .manage-row .icon-button { width: 25px; }
      .dialog-body { padding-left: 18px; padding-right: 18px; }
      .dialog-header, .dialog-footer { padding-left: 18px; padding-right: 18px; }
    }
    @media (hover: none) { .row-actions .icon-button { opacity: 1; } }
    @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

.auth-shell { min-height:100dvh; display:grid; place-items:center; padding:24px; background:#f8f9fb; }
.auth-card { width:min(330px,100%); padding:29px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.auth-card .brand { margin:0 0 30px; }
.auth-card h1 { font-size:16px; margin:22px 0 19px; font-weight:600; }
.auth-card .primary { width:100%; }
.auth-card .form-error { margin-top:14px; }
.auth-tabs { display:grid; grid-template-columns:1fr 1fr; gap:3px; padding:3px; border-radius:8px; background:var(--soft); }
.auth-tabs button { min-height:31px; border-radius:6px; color:var(--muted); font-size:12px; }
.auth-tabs button[aria-selected="true"] { color:var(--ink); background:#fff; box-shadow:0 1px 4px #24324912; font-weight:600; }
.auth-hint { margin-top:13px; color:var(--muted); font-size:10px; line-height:1.6; text-align:center; }
.auth-loading { color:var(--subtle); font-size:12px; }
.storage-warning { display:flex; align-items:center; gap:12px; }
.storage-warning button { padding:2px 4px; color:var(--accent); text-decoration:underline; flex-shrink:0; }
body.is-busy { cursor:progress; }
body.is-busy button { cursor:progress; }
.load-more { margin:18px auto 0; display:flex; }
.noscript-warning { margin:30px; }
