:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #6f7787;
  --line: #e8ebf0;
  --blue: #1769e0;
  --soft: #f6f8fb;
  --list-width: 48%;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); font: 14px/1.5 Inter, "Segoe UI", sans-serif; background: white; }
button, input, select, textarea { font: inherit; }
button:disabled { cursor: wait; opacity: .6; }
header { height: 72px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
header strong { font-size: 18px; }
.brand-block { min-width: 0; }
.brand-line, .top-actions { display: flex; align-items: center; gap: 7px; }
#stats { margin-left: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
#last-sync { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.top-actions button, .search-box button, .primary { border: 0; padding: 8px 11px; border-radius: 7px; color: white; background: var(--blue); cursor: pointer; white-space: nowrap; }
#api-status.status-missing { background: #b42318; }
#api-status.status-ready { background: #198754; font-style: italic; }
#api-status.status-demo { background: #c76b00; }
#sync.secondary, #rerate.secondary { border: 1px solid #cfd5de; color: #4d596b; background: white; }
.header-search { position: relative; min-width: 0; padding-bottom: 15px; }
.search-box { display: flex; }
#search { width: min(430px, 34vw); min-width: 210px; border: 1px solid #d7dce4; border-radius: 8px 0 0 8px; padding: 8px 11px; outline: none; }
#search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #1769e01a; }
#local-search { border-radius: 0; background: #245c8f; }
#smart-search { border-radius: 0 8px 8px 0; background: #6d4aff; }
#action-status { position: absolute; top: 38px; right: 0; max-width: 620px; color: var(--muted); white-space: nowrap; }
main { height: calc(100vh - 72px); display: grid; grid-template-columns: 220px minmax(420px, var(--list-width)) 6px minmax(320px, 1fr); }
aside, .list-panel { overflow: auto; }
aside { border-right: 1px solid var(--line); }
aside { padding: 18px 12px; background: var(--soft); }
h2 { margin: 10px 10px 7px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; color: #333d50; }
.nav:hover, .nav.active { color: var(--blue); background: white; }
.nav small { float: right; color: var(--muted); }
.source-folders { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.source-folders summary { padding: 7px 10px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; cursor: pointer; }
.list-head { height: 46px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); color: var(--muted); }
.filters { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr 1fr 1fr; gap: 6px; padding: 9px; border-bottom: 1px solid var(--line); }
.filters select, .filters input { min-width: 0; border: 1px solid #d7dce4; border-radius: 6px; padding: 6px; font-size: 11px; background: white; }
.favorite { padding: 15px 17px; border-bottom: 1px solid var(--line); cursor: pointer; }
.favorite:hover, .favorite.active { background: #f7faff; }
.favorite h3 { margin: 0 0 6px; font-size: 15px; }
.meta { color: var(--muted); font-size: 12px; }
.summary { margin: 8px 0 0; color: #4b5568; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pill { display: inline-block; margin: 8px 5px 0 0; padding: 2px 7px; border-radius: 999px; background: #eef3fb; color: #355379; font-size: 11px; }
.detail { padding: 28px; overflow: auto; }
.detail.empty { display: grid; place-items: center; color: var(--muted); }
.detail h1 { margin: 0 0 12px; font-size: 24px; line-height: 1.35; }
.detail-grid { display: grid; grid-template-columns: 92px 1fr; gap: 10px; margin: 24px 0; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; }
.category-editor { display: flex; gap: 7px; }
.category-editor select, .category-editor button { border: 1px solid #d7dce4; border-radius: 7px; padding: 5px 8px; background: white; }
.category-editor button { color: white; border-color: var(--blue); background: var(--blue); cursor: pointer; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 22px 0 12px; }
.editor-grid label, .editor-field { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.editor-grid select, .editor-field select, .editor-field input, .editor-field textarea { width: 100%; border: 1px solid #d7dce4; border-radius: 7px; padding: 7px 8px; color: var(--ink); background: white; font: inherit; }
.editor-field { margin: 10px 0; }
.editor-field select[multiple] { min-height: 130px; }
.primary { margin-top: 4px; }
.detail-actions { display: flex; gap: 8px; }
.secondary { padding: 7px 12px; border: 1px solid #d7dce4; border-radius: 7px; color: var(--blue); background: white; cursor: pointer; }
#save-status { margin-left: 8px; color: var(--muted); }
.detail .excerpt { padding: 16px; border-radius: 9px; background: var(--soft); white-space: pre-wrap; }
.open-link { display: inline-block; margin-top: 18px; padding: 9px 13px; border-radius: 8px; color: white; background: var(--blue); text-decoration: none; }
.no-results { padding: 40px 18px; text-align: center; color: var(--muted); }
#resize-handle { position: relative; cursor: col-resize; background: #f2f4f7; border-left: 1px solid var(--line); border-right: 1px solid var(--line); touch-action: none; }
#resize-handle::after { content: ""; position: absolute; top: 50%; left: 2px; width: 2px; height: 42px; border-radius: 2px; background: #b8c0cc; transform: translateY(-50%); }
#resize-handle:hover, #resize-handle:focus { background: #e7eef9; outline: none; }
dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid #d7dce4; border-radius: 8px; color: var(--ink); box-shadow: 0 18px 60px #17203330; }
dialog::backdrop { background: #17203370; }
.api-form { padding: 20px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-head h1 { margin: 0; font-size: 18px; }
.dialog-close { width: 32px; height: 32px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; font-size: 22px; }
.api-form p { margin: 8px 0 18px; color: var(--muted); font-size: 12px; }
.api-form label { display: grid; gap: 5px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.api-form input { width: 100%; padding: 9px 10px; border: 1px solid #d7dce4; border-radius: 7px; color: var(--ink); background: white; }
.api-form input:disabled { background: var(--soft); }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
#api-save-status { color: var(--muted); font-size: 12px; }
@media (max-width: 1100px) { .filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 980px) { main { grid-template-columns: 190px 1fr; } .detail, #resize-handle { display: none; } #search { width: 28vw; } .top-actions button { padding-inline: 7px; } }
