/* NetVault — дизайн-система */
@font-face {
  font-family: "Manrope"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url("../vendor/fonts/manrope-cyrillic-wght-normal.d02c8c2a9140.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url("../vendor/fonts/manrope-latin-wght-normal.fc03edc2c673.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f0eee8;
  --surface-3: #e9e6df;
  --border: #e4e0d7;
  --border-strong: #d3cec3;
  --text: #191b22;
  --text-2: #3b3f4a;
  --muted: #6c707c;
  --faint: #9a9da7;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-soft: #ecebff;
  --accent-text: #3f37c9;
  --success: #0f9f6e;
  --success-soft: #e3f6ee;
  --warning: #c27803;
  --warning-soft: #fdf3dc;
  --danger: #dc2f45;
  --danger-soft: #fde8eb;
  --sidebar: #12141b;
  --sidebar-2: #1b1e27;
  --sidebar-text: #a8acb8;
  --sidebar-strong: #f3f4f7;
  --shadow-sm: 0 1px 2px rgba(20, 22, 30, .05);
  --shadow: 0 1px 2px rgba(20, 22, 30, .04), 0 6px 20px -6px rgba(20, 22, 30, .10);
  --shadow-lg: 0 20px 50px -12px rgba(20, 22, 30, .25);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1015;
  --surface: #151820;
  --surface-2: #1b1f29;
  --surface-3: #232836;
  --border: #252a36;
  --border-strong: #333a4a;
  --text: #e8eaf0;
  --text-2: #c6cad5;
  --muted: #8d93a3;
  --faint: #646b7c;
  --accent: #8487ff;
  --accent-2: #9b9dff;
  --accent-soft: #23254a;
  --accent-text: #b3b5ff;
  --success: #34d399;
  --success-soft: #0f2e25;
  --warning: #fbbf24;
  --warning-soft: #33280d;
  --danger: #fb7185;
  --danger-soft: #3a1820;
  --sidebar: #0a0b0f;
  --sidebar-2: #151820;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "ss01";
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: 26px; font-weight: 750; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 15.5px; font-weight: 700; }
p { margin: 0 0 .8em; }
code, pre, .mono { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.icon { flex-shrink: 0; vertical-align: middle; }
::selection { background: var(--accent-soft); }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; color: var(--sidebar-strong); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #a855f7 60%, #ec4899); color: #fff; box-shadow: 0 6px 18px -6px #7c3aed;
}
.brand-name { font-weight: 800; font-size: 16.5px; letter-spacing: -.02em; }
.brand-sub { font-size: 11.5px; color: var(--sidebar-text); opacity: .8; margin-top: -2px; }

.vault-switch { position: relative; margin: 0 0 14px; }
.vault-switch summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--sidebar-2); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; color: var(--sidebar-strong);
}
.vault-switch summary::-webkit-details-marker { display: none; }
.vault-switch .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.vault-switch .vs-name { font-weight: 650; font-size: 13.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vault-switch .vs-caret { opacity: .6; font-size: 11px; }
.vault-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--sidebar-2); border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08); padding: 6px; box-shadow: var(--shadow-lg); z-index: 50;
}
.vault-menu a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--sidebar-text); font-size: 13.5px; }
.vault-menu a:hover { background: rgba(255,255,255,.06); color: var(--sidebar-strong); text-decoration: none; }

.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #5d6271; padding: 16px 12px 6px; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8.5px 12px; border-radius: 10px; color: var(--sidebar-text);
  font-weight: 550; font-size: 13.8px; margin-bottom: 1px; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.05); color: var(--sidebar-strong); text-decoration: none; }
.nav a.active { background: rgba(129, 132, 255, .14); color: #fff; }
.nav a.active .icon { color: #a5a8ff; }
.nav .count { margin-left: auto; font-size: 11.5px; opacity: .6; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.06); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; color: var(--sidebar-strong); }
.user-chip:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; font-size: 12.5px;
  background: linear-gradient(135deg, #312e81, #6d28d9); color: #fff; flex-shrink: 0;
}
.user-chip .u-name { font-weight: 650; font-size: 13.5px; line-height: 1.2; }
.user-chip .u-sub { font-size: 11.5px; color: var(--sidebar-text); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0; cursor: pointer;
  background: transparent; color: inherit;
}
.icon-btn:hover { background: rgba(127,127,127,.12); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-toggle { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; min-width: 0; }
.crumbs a { color: var(--muted); }
.crumbs .sep { opacity: .5; }
.crumbs .cur { color: var(--text); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search { margin-left: auto; position: relative; width: min(380px, 40vw); }
.topbar-search input { padding-left: 38px; background: var(--surface); height: 38px; }
.topbar-search .icon { position: absolute; left: 12px; top: 10px; color: var(--faint); }
.topbar-search kbd { position: absolute; right: 10px; top: 9px; }
.search-pop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; max-height: 420px; overflow: auto;
}
.search-pop.open { display: block; }
.search-pop a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.search-pop a:hover, .search-pop a.hl { background: var(--surface-2); text-decoration: none; }
.search-pop .t { font-size: 11.5px; color: var(--muted); margin-left: auto; }
kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted);
}
.content { padding: 28px 32px 60px; max-width: 1360px; width: 100%; }
.content.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 6px 0 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 6px; }

/* ---------------------------------------------------------------- components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { display: flex; align-items: center; gap: 9px; }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.stack > * + * { margin-top: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.hidden { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 650; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }
:root[data-theme="dark"] .btn-primary { color: #0e1015; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.8px; border-radius: 9px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }

.field { margin-bottom: 16px; }
.field > label, .label { display: block; font-weight: 650; font-size: 13px; margin-bottom: 6px; color: var(--text-2); }
.help { font-size: 12.3px; color: var(--muted); margin-top: 5px; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--danger); font-size: 12.5px; }
.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s; outline: none;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 18%, transparent); }
.textarea { height: auto; min-height: 90px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
.textarea.mono, textarea.mono { font-family: var(--mono); font-size: 13px; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input[type="color"].input { padding: 4px; width: 56px; cursor: pointer; }
.switch { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--surface-3); position: relative; cursor: pointer; transition: background .2s; vertical-align: middle; flex-shrink: 0; border: 1px solid var(--border); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.8px; font-weight: 650; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--tc, #8b8fa0) 14%, transparent); color: color-mix(in srgb, var(--tc, #8b8fa0) 80%, var(--text));
  border: 1px solid color-mix(in srgb, var(--tc, #8b8fa0) 22%, transparent); white-space: nowrap; text-decoration: none !important;
}
.tag:hover { background: color-mix(in srgb, var(--tc, #8b8fa0) 22%, transparent); }
.tag-inline { color: var(--accent-text); background: var(--accent-soft); padding: 0 6px; border-radius: 6px; font-size: .92em; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.type-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--tc); }
.type-pill .sw { width: 8px; height: 8px; border-radius: 3px; background: var(--tc); }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 14px; font-size: 13.8px; }
.alert-success { background: var(--success-soft); border-color: transparent; color: color-mix(in srgb, var(--success) 70%, var(--text)); }
.alert-error, .alert-danger { background: var(--danger-soft); border-color: transparent; color: color-mix(in srgb, var(--danger) 75%, var(--text)); }
.alert-warning { background: var(--warning-soft); border-color: transparent; color: color-mix(in srgb, var(--warning) 70%, var(--text)); }
.alert-info { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.toasts .alert { box-shadow: var(--shadow-lg); margin: 0; animation: toast-in .35s cubic-bezier(.2,.9,.3,1.2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.table { width: 100%; border-collapse: collapse; font-size: 13.8px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 11px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.table-wrap { overflow-x: auto; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; width: fit-content; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 650; font-size: 13.2px; display: inline-flex; align-items: center; gap: 7px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs .n { font-size: 11.5px; color: var(--faint); }

.empty { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty .empty-ico { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.empty h3 { margin-bottom: 6px; }

.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 650; display: flex; align-items: center; gap: 7px; }
.stat .v { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.stat .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tc, var(--accent)); }

.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), #a855f7); transition: width .5s ease; }
.progress.running > div { background-size: 200% 100%; animation: shimmer 1.6s linear infinite; background-image: linear-gradient(90deg, var(--accent), #a855f7, var(--accent)); }
@keyframes shimmer { to { background-position: -200% 0; } }

.console { background: #0c0e13; color: #c9d1d9; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; border-radius: 12px; padding: 16px 18px; max-height: 460px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

dialog.modal { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(10, 12, 18, .5); backdrop-filter: blur(3px); }
.modal-head { padding: 20px 22px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 16px 22px; }
.modal-foot { padding: 0 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------------------------------------------------------- entities */
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.entity-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s; position: relative; }
.entity-card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--tc) 45%, var(--border)); box-shadow: var(--shadow); transform: translateY(-1px); }
.entity-card .ec-top { display: flex; align-items: center; gap: 12px; }
.ent-avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex-shrink: 0; background: color-mix(in srgb, var(--tc) 15%, var(--surface)); color: var(--tc); }
.ent-avatar.round { border-radius: 50%; }
.ent-avatar.lg { width: 64px; height: 64px; font-size: 21px; border-radius: 18px; }
.ent-avatar.lg.round { border-radius: 50%; }
.entity-card .ec-title { font-weight: 700; font-size: 14.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.entity-card .ec-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entity-card .ec-sum { font-size: 12.8px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 0; }
.me-star { position: absolute; top: 12px; right: 12px; color: #f59e0b; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .li-main { min-width: 0; flex: 1; }
.list-item .li-title { font-weight: 650; font-size: 13.8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-sub { font-size: 12.3px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ent-avatar.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
.ent-avatar.sm.round { border-radius: 50%; }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.filters .input { width: auto; }
.filters .grow { flex: 1; min-width: 220px; }
.type-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.type-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; }
.type-chip:hover { text-decoration: none; border-color: var(--border-strong); }
.type-chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.type-chip .sw { width: 8px; height: 8px; border-radius: 3px; background: var(--tc); }
.type-chip .n { color: var(--faint); font-size: 12px; }
.type-chip.active .n { color: inherit; opacity: .7; }

.entity-hero { display: flex; gap: 18px; align-items: flex-start; padding: 24px; }
.entity-hero h1 { font-size: 27px; }
.prop-list { display: grid; grid-template-columns: 150px 1fr; gap: 10px 14px; font-size: 13.8px; }
.prop-list dt { color: var(--muted); font-weight: 600; }
.prop-list dd { margin: 0; word-break: break-word; }
.rel-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; }
.rel-item:hover { background: var(--surface-2); }
.rel-type { font-size: 11.5px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.rel-item .rel-note { font-size: 12.3px; color: var(--muted); }
.path-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.path-chain .step { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); font-weight: 600; font-size: 13px; color: var(--text); }
.path-chain .arrow { color: var(--faint); font-size: 11.5px; display: inline-flex; align-items: center; gap: 4px; }

.prose { font-size: 15px; line-height: 1.72; color: var(--text-2); overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3 { margin: 1.4em 0 .5em; color: var(--text); }
.prose h1 { font-size: 22px; } .prose h2 { font-size: 18.5px; } .prose h3 { font-size: 16px; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 .9em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 .9em; }
.prose li { margin: .2em 0; }
.prose blockquote { margin: 0 0 1em; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--muted); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.prose code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.prose pre { background: var(--surface-2); padding: 14px 16px; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; margin: 0 0 1em; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 7px 11px; }
.prose th { background: var(--surface-2); }
.prose a.wikilink, .chat-msg a.wikilink { color: var(--accent-text); background: var(--accent-soft); padding: 0 6px; border-radius: 6px; font-weight: 600; text-decoration: none; }
.prose a.wikilink:hover { filter: brightness(.95); }
.wikilink-missing { color: var(--muted); border-bottom: 1px dashed var(--faint); }
.prose strong { color: var(--text); }

/* relation editor */
.rel-row { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr 38px; gap: 8px; margin-bottom: 8px; }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 42px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: text; }
.tag-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 18%, transparent); }
.tag-input input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 120px; font: inherit; color: var(--text); height: 30px; }
.tag-input .tag button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px; font-size: 14px; line-height: 1; opacity: .7; }
.type-select { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.type-select label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; cursor: pointer; font-weight: 650; font-size: 13.2px; background: var(--surface); transition: border-color .15s, background .15s; }
.type-select input { display: none; }
.type-select label:has(input:checked) { border-color: var(--tc); background: color-mix(in srgb, var(--tc) 9%, var(--surface)); color: var(--tc); }
.type-select .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--tc); }

/* ---------------------------------------------------------------- dashboard */
.vault-card { padding: 22px; display: flex; flex-direction: column; gap: 16px; color: var(--text); position: relative; overflow: hidden; transition: box-shadow .2s, transform .2s; }
.vault-card:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-2px); }
.vault-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--vc); }
.vault-card .vc-ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--vc) 14%, var(--surface)); color: var(--vc); }
.vault-card .vc-stats { display: flex; gap: 18px; }
.vault-card .vc-stats b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.vault-card .vc-stats span { font-size: 12px; color: var(--muted); }
.hero-banner {
  border-radius: 20px; padding: 30px 32px; color: #fff; position: relative; overflow: hidden; margin-bottom: 26px;
  background: radial-gradient(1200px 400px at 100% 0%, rgba(168,85,247,.55), transparent 60%), radial-gradient(800px 300px at 0% 100%, rgba(236,72,153,.35), transparent 60%), linear-gradient(135deg, #1e1b4b, #312e81);
}
.hero-banner h1 { color: #fff; font-size: 28px; }
.hero-banner p { color: rgba(255,255,255,.78); max-width: 640px; margin-top: 8px; }
.hero-banner .btn { box-shadow: none; }
.hero-banner .btn-light { background: #fff; color: #1e1b4b; border-color: #fff; }
.hero-banner .btn-glass { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.18); }
.hero-banner .btn-glass:hover { background: rgba(255,255,255,.2); }
.hero-grid-bg { position: absolute; inset: 0; opacity: .14; background-image: radial-gradient(rgba(255,255,255,.9) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(90deg, transparent, #000 70%); pointer-events: none; }

.quick { display: flex; align-items: center; gap: 14px; padding: 16px 18px; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.quick:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); }
.quick .q-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--qc-soft, var(--accent-soft)); color: var(--qc, var(--accent-text)); flex-shrink: 0; }
.quick b { display: block; font-size: 14px; }
.quick span { font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- chat */
.chat-layout { display: grid; grid-template-columns: 270px 1fr; height: calc(100vh - 63px); }
.chat-side { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.chat-side .cs-head { padding: 16px; border-bottom: 1px solid var(--border); }
.chat-side .cs-list { overflow-y: auto; padding: 8px; flex: 1; }
.cs-item { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 10px; color: var(--text-2); font-size: 13.4px; font-weight: 550; }
.cs-item:hover { background: var(--surface-2); text-decoration: none; }
.cs-item.active { background: var(--accent-soft); color: var(--accent-text); }
.cs-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 28px 24px 12px; scroll-behavior: smooth; }
.chat-inner { max-width: 860px; margin: 0 auto; }
.chat-msg { display: flex; gap: 14px; margin-bottom: 24px; animation: msg-in .3s ease; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.chat-msg .who { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; font-weight: 800; font-size: 12px; }
.chat-msg.user .who { background: var(--surface-3); color: var(--text-2); }
.chat-msg.assistant .who { background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; }
.chat-msg .bubble { min-width: 0; flex: 1; }
.chat-msg.user .bubble .text { background: var(--surface); border: 1px solid var(--border); padding: 12px 16px; border-radius: 4px 16px 16px 16px; display: inline-block; max-width: 100%; white-space: pre-wrap; word-wrap: break-word; }
.chat-msg .meta { font-size: 11.5px; color: var(--faint); margin-top: 6px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chat-msg .meta button { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 11.8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 6px; }
.chat-msg .meta button:hover { background: var(--surface-2); color: var(--text); }
.chat-msg.error .prose { color: var(--danger); }
.chat-status { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; padding: 6px 0; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.sources { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.source { display: inline-flex; align-items: center; gap: 6px; max-width: 280px; padding: 4px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.source:hover { border-color: var(--border-strong); text-decoration: none; }
.source b { color: var(--accent-text); }
.source span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-compose { padding: 12px 24px 22px; }
.compose-box { max-width: 860px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 10px 10px 10px 16px; transition: border-color .15s, box-shadow .15s; }
.compose-box:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow); }
.compose-box textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: inherit; font-size: 15px; line-height: 1.5; max-height: 220px; min-height: 26px; padding: 6px 0; }
.compose-bar { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.web-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border); font-size: 12.8px; font-weight: 650; color: var(--muted); cursor: pointer; user-select: none; background: var(--surface); }
.web-toggle input { display: none; }
.web-toggle:has(input:checked) { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.send-btn { margin-left: auto; width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; transition: transform .1s, opacity .15s; }
.send-btn:disabled { opacity: .4; cursor: default; }
.send-btn:not(:disabled):hover { transform: scale(1.05); }
.chat-empty { text-align: center; padding: 8vh 12px 20px; }
.chat-empty .big-ico { width: 68px; height: 68px; border-radius: 22px; margin: 0 auto 18px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; box-shadow: 0 16px 40px -12px #7c3aed; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 760px; margin: 26px auto 0; text-align: left; }
.suggestion { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13.5px; color: var(--text-2); transition: border-color .15s, transform .15s; font: inherit; text-align: left; }
.suggestion:hover { border-color: var(--accent); transform: translateY(-1px); }
.suggestion b { display: block; color: var(--text); margin-bottom: 3px; font-size: 13.8px; }

/* ---------------------------------------------------------------- graph */
.graph-wrap { position: relative; height: calc(100vh - 63px); background: var(--bg); }
#graph { position: absolute; inset: 0; }
.graph-panel { position: absolute; top: 16px; left: 16px; width: 290px; padding: 16px; z-index: 5; max-height: calc(100% - 32px); overflow: auto; }
.graph-info { position: absolute; top: 16px; right: 16px; width: 320px; padding: 18px; z-index: 5; max-height: calc(100% - 32px); overflow: auto; }
.legend { display: flex; flex-direction: column; gap: 6px; }
.legend label { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; cursor: pointer; }
.legend .sw { width: 11px; height: 11px; border-radius: 50%; background: var(--tc); }
.graph-hint { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--muted); background: var(--surface); padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art {
  position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 500px at 80% 10%, rgba(168,85,247,.5), transparent 60%), radial-gradient(700px 500px at 10% 90%, rgba(236,72,153,.35), transparent 60%), linear-gradient(160deg, #0f0d2e, #1e1b4b 50%, #2a1f5c);
}
.auth-art h1 { color: #fff; font-size: 40px; line-height: 1.12; letter-spacing: -.03em; max-width: 520px; }
.auth-art p { color: rgba(255,255,255,.72); font-size: 16px; max-width: 480px; margin-top: 16px; }
.auth-art .feat { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; color: rgba(255,255,255,.86); font-size: 14px; }
.auth-art .feat .icon { color: #c4b5fd; margin-top: 2px; }
.auth-art svg.net { position: absolute; right: -60px; top: 50%; transform: translateY(-50%); opacity: .55; pointer-events: none; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { font-size: 25px; margin-bottom: 6px; }

/* ---------------------------------------------------------------- manage */
.manage-layout { display: grid; grid-template-columns: 220px 1fr; gap: 26px; align-items: start; }
.manage-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.manage-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 13.6px; }
.manage-nav a:hover { background: var(--surface-2); text-decoration: none; }
.manage-nav a.active { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.test-result { margin-top: 12px; }
.code-block { position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 48px 12px 14px; font-family: var(--mono); font-size: 14px; word-break: break-all; }
.code-block .copy { position: absolute; top: 6px; right: 6px; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 18px 44px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 800; font-size: 13px; }

/* ---------------------------------------------------------------- responsive */
.backdrop { display: none; }
@media (max-width: 1100px) {
  .cols { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .graph-info { width: 280px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .25s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .topbar { padding: 10px 16px; }
  .topbar .menu-toggle { display: inline-grid; }
  .topbar-search { width: auto; flex: 1; }
  .topbar-search kbd { display: none; }
  .content { padding: 20px 16px 50px; }
  .grid-2, .grid-3, .form-grid, .manage-layout { grid-template-columns: 1fr; }
  .manage-nav { position: static; flex-direction: row; overflow-x: auto; }
  .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 59px); }
  .chat-side { display: none; }
  .chat-scroll { padding: 18px 14px 8px; }
  .chat-compose { padding: 8px 12px 14px; }
  .suggestions { grid-template-columns: 1fr; }
  .graph-panel { width: calc(100% - 32px); max-height: 40%; }
  .graph-info { top: auto; bottom: 16px; left: 16px; width: auto; max-height: 45%; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .rel-row { grid-template-columns: 1fr 1fr; }
  .rel-row .rel-note-in { grid-column: 1 / 2; }
  .prop-list { grid-template-columns: 1fr; gap: 2px; }
  .prop-list dd { margin-bottom: 8px; }
  .entity-hero { flex-direction: column; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .page-head h1 { font-size: 22px; }
  .crumbs { display: none; }
}
