:root {
  --bg: #050707;
  --panel: #0b1010;
  --panel-2: #101717;
  --line: #1b2928;
  --line-bright: #28413f;
  --text: #fff;
  --muted: #8fa09e;
  --aqua: #15f6df;
  --mint: #67cbc1;
  --seafoam: #45b9ac;
  --teal: #0b8e85;
  --danger: #ff6f78;
  --warning: #ffd166;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); color: var(--text); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 70% -20%, rgba(21,246,223,.09), transparent 35%), var(--bg); font-family: Geist, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.5; }
button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--aqua); outline-offset: 3px; }

.eyebrow { margin: 0 0 8px; color: var(--mint); font-size: 12px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.muted { color: var(--muted); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--aqua); box-shadow: 0 0 14px rgba(21,246,223,.8); }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-panel { width: min(430px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 20px; background: rgba(11,16,16,.92); box-shadow: 0 30px 90px rgba(0,0,0,.48); }
.login-logo { display: block; width: 190px; height: auto; margin: 0 0 44px; }
.login-panel h1 { margin: 0; font-size: clamp(34px, 7vw, 48px); line-height: 1.05; letter-spacing: -.045em; }
.login-panel .muted { margin: 14px 0 28px; }
.login-panel form { display: grid; gap: 10px; }
.login-panel label { color: #c8d2d1; font-size: 14px; font-weight: 650; }
.login-panel input, .system-search input { width: 100%; min-height: 50px; border: 1px solid var(--line-bright); border-radius: 10px; background: #070b0b; color: #fff; padding: 0 15px; }
.button { min-height: 50px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 750; }
.button.primary { margin-top: 5px; background: var(--aqua); color: #03110f; }
.button.primary:hover { background: #65fff0; }
.form-error { min-height: 24px; margin: 2px 0 0; color: var(--danger); font-size: 14px; }
.form-error.success { color: var(--aqua); }
.security-note { margin: 22px 0 0; color: var(--muted); font-size: 13px; }
.security-note .status-dot { margin-right: 6px; }

.topbar { position: sticky; top: 0; z-index: 20; height: 76px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 36px; border-bottom: 1px solid var(--line); background: rgba(5,7,7,.88); backdrop-filter: blur(18px); }
.brand { display: inline-flex; width: max-content; }
.brand img { display: block; width: 142px; height: auto; }
.main-nav { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #080c0c; }
.nav-button { min-height: 38px; padding: 0 17px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 700; }
.nav-button:hover { color: #fff; }
.nav-button.active { background: var(--panel-2); color: var(--aqua); }
.top-actions { justify-self: end; display: flex; align-items: center; gap: 12px; }
.icon-button, .text-button, .filter-button { border: 1px solid var(--line-bright); background: transparent; cursor: pointer; }
.icon-button { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 9px; }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover, .text-button:hover { border-color: var(--mint); color: var(--aqua); }
.icon-button.spinning svg { animation: spin .7s linear infinite; }
.text-button { min-height: 39px; padding: 0 13px; border-radius: 9px; color: #cad3d2; font-size: 14px; }
.text-button.small { min-height: 34px; padding: 0 11px; }
.user-badge { color: var(--muted); font-size: 13px; }

.workspace { width: min(1500px, calc(100% - 64px)); margin: 0 auto; padding: 58px 0 80px; }
.hero { display: flex; justify-content: space-between; gap: 40px; align-items: end; margin-bottom: 28px; }
.hero h1 { margin: 0; font-size: clamp(38px, 6vw, 68px); line-height: .98; letter-spacing: -.055em; }
.hero-description { margin: 16px 0 0; color: var(--muted); }
.sync-state { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }

.search-panel { position: sticky; top: 91px; z-index: 15; display: grid; grid-template-columns: minmax(250px, 1fr) auto auto; gap: 10px; margin-bottom: 38px; padding: 10px; border: 1px solid var(--line); border-radius: 15px; background: rgba(7,11,11,.93); backdrop-filter: blur(18px); box-shadow: 0 16px 42px rgba(0,0,0,.3); }
.search-field { min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border: 1px solid var(--line-bright); border-radius: 10px; background: var(--panel); }
.search-field:focus-within { border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(21,246,223,.08); }
.search-field svg { width: 20px; flex: 0 0 auto; fill: none; stroke: var(--mint); stroke-width: 1.7; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: #fff; font-size: 16px; }
.search-field input::placeholder, .system-search input::placeholder { color: #61706f; }
kbd { border: 1px solid var(--line-bright); border-radius: 5px; padding: 1px 7px; color: #748481; font: 12px/20px inherit; }
.filter-button { min-height: 52px; padding: 0 17px; border-radius: 10px; color: #bec8c7; font-weight: 700; }
.filter-button span { margin-right: 4px; font-size: 19px; }
.filter-button[aria-pressed="true"] { border-color: var(--aqua); background: rgba(21,246,223,.1); color: var(--aqua); }
.toggle { min-height: 52px; display: flex; align-items: center; gap: 9px; padding: 0 15px; color: #bec8c7; font-size: 14px; white-space: nowrap; }
.toggle input { position: absolute; opacity: 0; }
.toggle > span { position: relative; width: 38px; height: 22px; border-radius: 20px; background: #24302f; transition: .2s; }
.toggle > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #92a09e; transition: .2s; }
.toggle input:checked + span { background: var(--teal); }
.toggle input:checked + span::after { transform: translateX(16px); background: var(--aqua); }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading.compact { margin-bottom: 8px; }
.section-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.category-panel { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 9px; margin-bottom: 44px; }
.category-card { min-height: 76px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); text-align: left; cursor: pointer; }
.category-card:hover { border-color: var(--line-bright); background: var(--panel-2); }
.category-card.active { border-color: var(--aqua); background: rgba(21,246,223,.08); }
.category-card strong { font-size: 14px; }
.category-card span { color: var(--muted); font-size: 12px; }
.category-card.active strong, .category-card.active span { color: var(--aqua); }

.featured-systems { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.system-card { min-height: 112px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(140deg,var(--panel),#08100f); cursor: pointer; text-align: left; }
.system-card:hover, .system-card.active { border-color: var(--aqua); }
.system-card.active { background: rgba(21,246,223,.08); }
.system-card strong { font-size: 16px; }
.system-card div { display: flex; flex-wrap: wrap; gap: 6px; }
.system-card span, .system-chip span { color: var(--muted); font-size: 12px; }
.system-card .confirmed-count { color: var(--mint); }
.all-systems { margin: 12px 0 30px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.all-systems summary { padding: 16px 18px; cursor: pointer; font-weight: 700; }
.all-systems summary span { color: var(--muted); font-weight: 500; }
.system-search { padding: 0 14px 10px; }
.system-search input { min-height: 43px; }
.all-systems-list { max-height: 310px; overflow: auto; display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 14px 15px; }
.system-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: #080c0c; cursor: pointer; font-size: 13px; }
.system-chip:hover, .system-chip.active { border-color: var(--aqua); color: var(--aqua); }
.relation-legend { display: flex; flex-wrap: wrap; gap: 18px; margin: -10px 0 28px; color: var(--muted); font-size: 13px; }
.confidence-dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.confidence-dot.confirmed { background: var(--aqua); }
.confidence-dot.candidate { background: var(--warning); }

.accounts-grid { display: grid; grid-template-columns: minmax(300px,.8fr) minmax(420px,1.2fr); gap: 14px; }
.admin-card { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.admin-card h2 { margin: 0; font-size: 22px; }
.admin-card > .muted { font-size: 14px; }
.compact-form { display: grid; gap: 10px; margin-top: 20px; }
.compact-form label { color: #c8d2d1; font-size: 13px; font-weight: 650; }
.compact-form label span { color: var(--muted); font-weight: 400; }
.compact-form input, .compact-form select { width: 100%; min-height: 43px; margin-top: 5px; border: 1px solid var(--line-bright); border-radius: 8px; background: #070b0b; color: #fff; padding: 0 12px; }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.generated-invite { display: grid; gap: 9px; margin-top: 14px; padding: 12px; border: 1px solid rgba(21,246,223,.35); border-radius: 9px; background: rgba(21,246,223,.06); }
.generated-invite code { overflow-wrap: anywhere; color: var(--mint); font-size: 12px; }
.management-list { display: grid; gap: 8px; margin-top: 14px; }
.management-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 58px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #080c0c; }
.management-row strong { display: block; font-size: 14px; }
.management-row small { color: var(--muted); font-size: 11px; }
.management-actions { display: flex; gap: 6px; }
.management-actions button { min-height: 31px; padding: 0 9px; border: 1px solid var(--line-bright); border-radius: 7px; background: transparent; cursor: pointer; font-size: 12px; }
.management-actions button.approve { border-color: rgba(21,246,223,.4); color: var(--aqua); }
.management-actions button.block { color: var(--danger); }
.status-badge { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 5px; background: #1b2423; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.status-badge.pending { background: rgba(255,209,102,.12); color: var(--warning); }
.status-badge.active { background: rgba(21,246,223,.1); color: var(--aqua); }
.status-badge.blocked { background: rgba(255,111,120,.1); color: var(--danger); }
.invite-history { margin-top: 14px; }

.recent-section { margin: -12px 0 24px; }
.recent-list { display: flex; gap: 7px; overflow: auto; padding-bottom: 4px; }
.recent-pill { min-height: 32px; flex: 0 0 auto; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: #c4cecd; cursor: pointer; font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.recent-pill:hover { border-color: var(--aqua); color: var(--aqua); }

.catalog-summary { min-height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.catalog-summary p { margin: 0; color: var(--muted); }
.catalog-summary strong { color: #fff; font-size: 20px; }
.change-summary { display: flex; gap: 7px; }
.change-pill { padding: 3px 8px; border-radius: 99px; background: rgba(21,246,223,.1); color: var(--aqua); font-size: 11px; font-weight: 700; }
.change-pill.changed { background: rgba(255,209,102,.1); color: var(--warning); }
.change-pill.removed { background: rgba(255,111,120,.1); color: var(--danger); }
.list-head, .item-row { display: grid; grid-template-columns: minmax(280px,1.35fr) minmax(190px,.85fr) minmax(220px,.9fr) auto; gap: 18px; align-items: center; }
.list-head { min-height: 43px; padding: 0 15px; color: #60706e; font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.item-row { min-height: 92px; padding: 12px 14px; border: 1px solid transparent; border-top-color: var(--line); transition: background .15s, border-color .15s; }
.item-row:hover { border-color: var(--line-bright); border-radius: 11px; background: var(--panel); }
.item-main { min-width: 0; display: flex; align-items: center; gap: 13px; }
.item-icon { width: 62px; height: 62px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: radial-gradient(circle, #15201f, #080b0b); }
.item-icon img { width: 52px; height: 52px; object-fit: contain; }
.item-title { min-width: 0; }
.item-title h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0; font-size: 16px; line-height: 1.3; }
.item-title p { margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.item-badge { padding: 2px 6px; border-radius: 5px; background: rgba(21,246,223,.12); color: var(--aqua); font-size: 9px; letter-spacing: .08em; }
.item-badge.changed { background: rgba(255,209,102,.12); color: var(--warning); }
.favorite-button { width: 29px; height: 29px; flex: 0 0 auto; border: 0; background: transparent; color: #586462; cursor: pointer; font-size: 21px; }
.favorite-button.active { color: var(--aqua); }
.item-data { display: flex; flex-wrap: wrap; gap: 5px; }
.meta { padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; color: #95a4a2; font-size: 11px; }
.meta.confidence-confirmed { border-color: rgba(21,246,223,.35); color: var(--mint); }
.meta.confidence-candidate { border-color: rgba(255,209,102,.3); color: var(--warning); }
.resp { overflow: hidden; color: var(--mint); font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.copy-button { min-height: 38px; padding: 0 13px; border: 1px solid var(--line-bright); border-radius: 8px; background: transparent; color: #dce2e1; cursor: pointer; font-size: 13px; font-weight: 700; }
.copy-button:hover, .copy-button.copied { border-color: var(--aqua); background: rgba(21,246,223,.08); color: var(--aqua); }
.source-details { grid-column: 1 / -1; margin: -4px 0 1px 75px; color: var(--muted); font-size: 12px; }
.source-details summary { cursor: pointer; }
.source-details ul { margin: 7px 0 2px; padding-left: 17px; }
.source-details code { color: #9fb0ae; }
.empty-state { padding: 75px 20px; text-align: center; color: var(--muted); }
.empty-state > div { color: var(--line-bright); font-size: 48px; }
.empty-state h2 { margin: 8px 0 0; color: #fff; }
.empty-state p { margin: 7px 0; }
.load-more { width: 100%; min-height: 48px; margin-top: 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: #c8d2d1; cursor: pointer; }
.load-more:hover { border-color: var(--aqua); color: var(--aqua); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: min(420px,calc(100% - 48px)); padding: 13px 16px; border: 1px solid var(--teal); border-radius: 10px; background: #0b1716; box-shadow: 0 16px 45px #000; color: #e8fffc; font-size: 14px; }

@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1120px) { .category-panel { grid-template-columns: repeat(4,1fr); } .featured-systems { grid-template-columns: repeat(3,1fr); } .list-head, .item-row { grid-template-columns: minmax(260px,1.3fr) minmax(180px,.9fr) minmax(190px,.8fr) auto; } }
@media (max-width: 820px) {
  .topbar { height: auto; min-height: 70px; grid-template-columns: 1fr auto; padding: 12px 18px; }
  .brand img { width: 128px; } .main-nav { grid-row: 2; grid-column: 1 / -1; width: 100%; margin-top: 10px; } .nav-button { flex: 1; }
  .workspace { width: min(100% - 30px, 700px); padding-top: 38px; }
  .hero { align-items: flex-start; flex-direction: column; gap: 18px; }
  .search-panel { top: 122px; grid-template-columns: 1fr auto; } .search-field { grid-column: 1 / -1; } .toggle { justify-content: flex-end; }
  .category-panel { display: flex; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 5px; } .category-card { min-width: 145px; scroll-snap-align: start; }
  .featured-systems { grid-template-columns: repeat(2,1fr); }
  .accounts-grid { grid-template-columns: 1fr; }
  .list-head { display: none; }
  .item-row { grid-template-columns: 1fr auto; gap: 10px; padding: 14px 4px; }
  .item-main { grid-column: 1 / -1; } .item-data { grid-column: 1 / -1; } .resp { align-self: center; } .source-details { margin-left: 0; }
}
@media (max-width: 520px) {
  .login-panel { padding: 28px 22px; } .login-logo { width: 160px; margin-bottom: 36px; }
  .top-actions .user-badge { display: none; } .top-actions { gap: 7px; } .text-button { padding: 0 9px; }
  .hero h1 { font-size: 44px; } .sync-state { align-items: flex-start; }
  .search-panel { grid-template-columns: 1fr; } .filter-button, .toggle { min-height: 44px; justify-content: center; } kbd { display: none; }
  .featured-systems { grid-template-columns: 1fr; } .system-card { min-height: 92px; }
  .form-columns { grid-template-columns: 1fr; } .management-row { align-items: flex-start; flex-direction: column; }
  .catalog-summary { align-items: flex-start; flex-direction: column; padding: 9px 0; }
  .item-icon { width: 55px; height: 55px; } .item-icon img { width: 46px; height: 46px; }
  .resp { font-size: 12px; } .copy-button { padding: 0 10px; }
}
