@import "tailwindcss";

:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e8eaf0;
  background: #080a0f;
  font-synthesis: none;
  --nx-panel: #10131a;
  --nx-panel-soft: #0d1016;
  --nx-line: #202530;
  --nx-muted: #7e8799;
  --nx-accent: #8b7cf6;
  --nx-accent-soft: rgba(139, 124, 246, .12);
  --nx-green: #51d49a;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 70% -20%, #17152b 0, transparent 34%), #080a0f; }
button { color: inherit; font: inherit; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 224px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px 14px; border-right: 1px solid #1a1e27; background: rgba(9, 11, 16, .94); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 25px; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid #443d7c; border-radius: 10px; background: linear-gradient(145deg, #241f44, #12121f); color: #b8adff; box-shadow: 0 0 24px rgba(139,124,246,.13); }
.brand strong { display: block; font-size: 13px; letter-spacing: .14em; }
.brand span, .owner span { display: block; color: var(--nx-muted); font-size: 10px; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button, .sidebar-bottom > button { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; padding: 9px 10px; border-radius: 7px; background: transparent; color: #8991a1; font-size: 12px; text-align: left; cursor: pointer; }
.nav button:hover, .nav button.active { color: #ececf5; background: var(--nx-accent-soft); }
.nav button.active { box-shadow: inset 2px 0 var(--nx-accent); }
.nav button i { margin-left: auto; padding: 1px 6px; border: 1px solid #343947; border-radius: 8px; font-size: 9px; font-style: normal; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid #1b1f28; padding-top: 10px; }
.owner { display: grid; grid-template-columns: 31px 1fr auto; gap: 9px; align-items: center; margin-top: 10px; padding: 10px 8px; }
.owner strong { font-size: 11px; }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: #28243f; color: #bcb3ff; font-size: 10px; }
main { min-width: 0; }
.topbar { height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; border-bottom: 1px solid #191d25; background: rgba(8,10,15,.68); backdrop-filter: blur(16px); }
.search { width: min(390px, 42vw); display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid #202530; border-radius: 7px; color: #6f7889; font-size: 11px; }
.search kbd { margin-left: auto; padding: 2px 5px; border: 1px solid #2c313d; border-radius: 4px; color: #606979; font-size: 9px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.connection { display: flex; gap: 6px; align-items: center; font-size: 10px; color: #8c95a5; }
.connection.live { color: var(--nx-green); }
.connection.preview { color: #e6b75d; }
.ask, .refresh { display: flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid #37315e; border-radius: 7px; background: #18152a; color: #c4bbff; font-size: 10px; cursor: pointer; }
.content { padding: 16px 16px 60px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 28px; }
.eyebrow, .kicker { color: #7065c8; font-size: 9px; font-weight: 700; letter-spacing: .18em; }
h1 { margin: 7px 0 5px; font-size: 27px; letter-spacing: -.04em; }
.page-heading p, .placeholder p { margin: 0; color: var(--nx-muted); font-size: 11px; }
.refresh { border-color: var(--nx-line); background: var(--nx-panel); color: #a5adba; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.metrics article, .panel { border: 1px solid var(--nx-line); background: linear-gradient(145deg, rgba(18,21,29,.96), rgba(12,15,21,.96)); border-radius: 9px; }
.metrics article { padding: 16px 17px; }
.metrics span { color: #717a8a; font-size: 8px; font-weight: 700; letter-spacing: .14em; }
.metrics strong { display: block; margin: 7px 0 5px; font-size: 24px; letter-spacing: -.04em; }
.metrics small { color: #687181; font-size: 9px; }
.metrics small.up { color: #55c995; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.panel { padding: 18px; min-height: 180px; }
.span-2 { grid-column: span 2; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 15px; border-bottom: 1px solid #1d222c; }
.panel-head h2 { margin: 4px 0 0; font-size: 13px; }
.panel-head button { border: 0; background: transparent; color: #8e96a5; font-size: 9px; }
.badge { padding: 4px 8px; border-radius: 10px; font-size: 8px; }
.badge.positive { color: var(--nx-green); background: rgba(81,212,154,.1); }
.badge.warning { color: #e7b660; background: rgba(231,182,96,.1); }
.runtime-row { display: flex; align-items: center; gap: 12px; padding-top: 22px; }
.runtime-icon { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 9px; color: #ad9fff; background: var(--nx-accent-soft); }
.runtime-main strong, .model strong, .project strong, .event strong { display: block; font-size: 11px; }
.runtime-main span, .model small, .event small { display: block; margin-top: 4px; color: var(--nx-muted); font-size: 9px; }
.pulse-bars { height: 42px; display: flex; align-items: center; gap: 3px; margin-left: auto; }
.pulse-bars i { width: 3px; min-height: 5px; border-radius: 3px; background: linear-gradient(#927fff, #443b7c); }
.model { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 12px 2px; border-bottom: 1px solid #1b2029; }
.model > span:last-child { color: #687181; font-size: 8px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #657083; }
.status-dot.online { background: var(--nx-green); box-shadow: 0 0 7px rgba(81,212,154,.4); }
.status-dot.offline { background: #e16e75; }
.project { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid #1b2029; }
.project-letter { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid #353047; border-radius: 7px; color: #a99cf5; font-size: 10px; }
.project-info > div:first-child { display: flex; justify-content: space-between; }
.project-info span { color: var(--nx-muted); font-size: 8px; }
.project b { color: #838c9c; font-size: 9px; }
.progress { height: 3px; margin-top: 8px; overflow: hidden; border-radius: 4px; background: #242936; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #685ac8, #a091ff); }
.event { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid #1b2029; }
.event > span { width: 6px; height: 6px; margin-top: 4px; border-radius: 50%; background: #657083; }
.event > span.runtime { background: var(--nx-green); }
.event > span.deploy { background: #8b7cf6; }
.event > span.security { background: #e5ad52; }
.placeholder { min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.placeholder svg { margin-bottom: 18px; color: #8074d8; }
.placeholder h2 { margin: 8px 0; }
.mobile-menu { display: none; border: 0; background: transparent; color: #aaa4e7; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; left: -240px; width: 224px; transition: left .2s ease; }
  .sidebar.open { left: 0; box-shadow: 20px 0 60px #000; }
  .mobile-menu { display: block; }
  .topbar { padding: 0 18px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}

@media (max-width: 560px) {
  .content { padding: 26px 16px 40px; }
  .search { display: none; }
  .topbar { justify-content: space-between; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .page-heading { align-items: start; }
  .page-heading p { max-width: 220px; line-height: 1.5; }
  .runtime-row { flex-wrap: wrap; }
  .pulse-bars { width: 100%; margin-left: 57px; }
}


.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.module-card { min-height: 190px; padding: 18px; border: 1px solid var(--nx-line); border-radius: 9px; background: linear-gradient(145deg, rgba(18,21,29,.96), rgba(12,15,21,.96)); }
.module-card h3, .model-detail h3, .timeline h3, .chat-shell h3 { margin: 8px 0 4px; font-size: 13px; }
.module-card p, .model-detail p, .timeline p, .chat-shell p { margin: 0; color: var(--nx-muted); font-size: 10px; line-height: 1.5; }
.module-card-head, .project-card footer { display: flex; align-items: center; justify-content: space-between; }
.project-card .progress { margin: 34px 0 12px; }
.project-card footer { color: var(--nx-muted); font-size: 9px; }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.kanban-column { min-height: 380px; padding: 12px; border: 1px solid var(--nx-line); border-radius: 9px; background: rgba(14,17,23,.8); }
.kanban-column > header { display: flex; justify-content: space-between; padding: 5px 3px 14px; color: #aeb4c0; font-size: 10px; }
.kanban-column > header b { padding: 1px 6px; border-radius: 8px; background: #242936; }
.task-card { margin-bottom: 9px; padding: 14px; border: 1px solid #252a35; border-radius: 8px; background: #12151c; }
.task-card h3 { margin: 10px 0 22px; font-size: 11px; }
.task-card select { width: 100%; margin-bottom: 12px; padding: 7px 8px; border: 1px solid #292f3b; border-radius: 7px; outline: none; color: #c8ccd5; background: #0c0f14; font: inherit; font-size: 9px; cursor: pointer; }
.task-card footer { display: flex; gap: 5px; align-items: center; color: var(--nx-muted); font-size: 8px; }
.priority { font-size: 8px; text-transform: uppercase; color: #9b91e6; }.priority.critical { color: #ec7b82; }.priority.high { color: #e5b05e; }
.empty-state { padding: 35px 0; text-align: center; color: #596171; font-size: 9px; }
.agent-card { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: start; }
.agent-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; color: #66d5a4; background: rgba(81,212,154,.1); }
.agent-avatar.violet { color: #a99cff; background: var(--nx-accent-soft); }
.module-list { padding: 4px 18px; }
.model-detail { display: grid; grid-template-columns: 45px 1fr auto; align-items: center; gap: 14px; padding: 19px 0; border-bottom: 1px solid #1d222c; }
.route-rank { color: #6f63c9; font-size: 12px; font-weight: 700; }
.timeline { padding: 6px 20px; }
.timeline article { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 18px 0; border-bottom: 1px solid #1d222c; }
.timeline-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: #70d8aa; background: rgba(81,212,154,.1); }.timeline-icon.security { color: #e5b05e; background: rgba(229,176,94,.1); }
.chat-shell { max-width: 760px; margin: auto; padding: 0; overflow: hidden; }
.chat-shell > header { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 16px; border-bottom: 1px solid var(--nx-line); }
.messages { min-height: 360px; padding: 22px; }
.message { max-width: 75%; margin-bottom: 12px; padding: 12px 14px; border-radius: 10px; background: #171b23; }.message.owner { margin-left: auto; background: #211d39; }.message strong { font-size: 9px; color: #9d91eb; }
.chat-shell form { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 14px; border-top: 1px solid var(--nx-line); }
.chat-shell input { min-width: 0; padding: 11px 13px; border: 1px solid #292f3b; border-radius: 8px; outline: none; color: #e7e9ef; background: #0c0f14; font: inherit; font-size: 10px; }
.chat-shell form button { width: 38px; border: 1px solid #443d7c; border-radius: 8px; color: #beb4ff; background: #211d39; }
@media (max-width: 900px) { .module-grid, .kanban { grid-template-columns: 1fr; } }
.quick-create { display: grid; grid-template-columns: minmax(180px, 360px) auto; gap: 8px; margin-bottom: 12px; }
.quick-create input { padding: 10px 12px; border: 1px solid #292f3b; border-radius: 8px; outline: none; color: #e7e9ef; background: #0c0f14; font: inherit; font-size: 10px; }
.quick-create button { padding: 0 14px; border: 1px solid #443d7c; border-radius: 8px; color: #c1b8ff; background: #211d39; font-size: 9px; cursor: pointer; }
.message.error { color: #e9a1a5; background: rgba(193,70,79,.12); border: 1px solid rgba(225,110,117,.2); }
.message.pending { opacity: .68; }
.chat-shell input:disabled, .chat-shell button:disabled { cursor: wait; opacity: .55; }
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.settings-grid .module-card { min-height: 165px; }
.settings-grid .badge { display: inline-block; margin-top: 28px; }
.sidebar-bottom > button.active { color: #ececf5; background: var(--nx-accent-soft); }
@media (max-width: 700px) { .settings-grid { grid-template-columns: 1fr; } }

.owner { width: 100%; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.owner:hover { background: var(--nx-accent-soft); border-radius: 8px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 32px; border: 1px solid var(--nx-line); border-radius: 14px; background: linear-gradient(145deg, rgba(18,21,29,.98), rgba(10,12,18,.98)); box-shadow: 0 28px 90px rgba(0,0,0,.4); }
.login-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 28px; border-bottom: 1px solid #1d222c; }
.login-brand strong { display: block; font-size: 13px; letter-spacing: .14em; }
.login-brand span { display: block; margin-top: 3px; color: var(--nx-muted); font-size: 10px; }
.login-heading { padding: 28px 0 20px; }
.login-heading h1 { margin-top: 9px; font-size: 25px; }
.login-heading p { margin: 0; color: var(--nx-muted); font-size: 11px; line-height: 1.6; }
.login-card form { display: grid; gap: 14px; }
.login-card label span { display: block; margin-bottom: 7px; color: #aab1bf; font-size: 10px; }
.login-card input { width: 100%; padding: 12px 13px; border: 1px solid #2a303b; border-radius: 8px; outline: none; color: #eef0f5; background: #0a0d12; font: inherit; font-size: 12px; }
.login-card input:focus { border-color: #6559b8; box-shadow: 0 0 0 3px rgba(139,124,246,.1); }
.login-card form button { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 5px; padding: 12px; border: 1px solid #554a9b; border-radius: 8px; color: #e6e2ff; background: linear-gradient(135deg, #332b68, #211d43); cursor: pointer; }
.login-card form button:disabled { cursor: wait; opacity: .6; }
.login-error { margin: 0; padding: 10px 12px; border: 1px solid rgba(225,110,117,.25); border-radius: 8px; color: #efa2a7; background: rgba(193,70,79,.1); font-size: 10px; }
.login-card footer { margin-top: 24px; color: #626b7b; font-size: 8px; line-height: 1.5; text-align: center; }

/* Project health row */
.project-health-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.health-card { padding: 12px 16px; border: 1px solid var(--nx-line); border-radius: 9px; background: linear-gradient(145deg, rgba(18,21,29,.96), rgba(12,15,21,.96)); text-align: center; }
.health-label { display: block; color: #717a8a; font-size: 8px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.health-card strong { display: block; margin-top: 6px; font-size: 22px; letter-spacing: -.04em; }
.health-online { color: var(--nx-green); }
.health-degraded { color: #e7b660; }
.health-offline { color: #e16e75; }
.health-unknown { color: #7e8799; }

/* Runtime health indicators */
.runtime-health-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.runtime-health-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.runtime-health-dot.healthy { background: var(--nx-green); box-shadow: 0 0 7px rgba(81,212,154,.4); }
.runtime-health-dot.unhealthy { background: #e7b660; box-shadow: 0 0 7px rgba(231,182,96,.3); }
.runtime-health-text { font-size: 9px; color: var(--nx-muted); }
.runtime-incident { margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.incident-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid rgba(229,176,94,.3); border-radius: 6px; background: rgba(229,176,94,.08); color: #e5b05e; font-size: 9px; }

/* Snapshot agents in dashboard */
.snapshot-agents { margin-top: 14px; padding-top: 14px; border-top: 1px solid #1d222c; }
.snapshot-agents-head { display: flex; align-items: center; gap: 6px; font-size: 9px; color: #7065c8; font-weight: 700; letter-spacing: .1em; margin-bottom: 8px; text-transform: uppercase; }
.snapshot-agents-list { display: flex; flex-direction: column; gap: 6px; }
.snapshot-agent-item { display: flex; align-items: center; gap: 7px; padding: 4px 0; }
.snapshot-agent-item .name { font-size: 10px; color: #e8eaf0; }
.snapshot-agent-item .role-tag { margin-left: auto; font-size: 8px; padding: 1px 6px; border: 1px solid #343947; border-radius: 6px; color: #8991a1; }
.status-dot--sm { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.status-dot--sm.online { background: var(--nx-green); }
.status-dot--sm.degraded { background: #e7b660; }
.status-dot--sm.offline { background: #e16e75; }

/* Badge negative for offline */
.badge.negative { color: #e16e75; background: rgba(225,110,117,.1); }

@media (max-width: 900px) { .project-health-row { grid-template-columns: repeat(2, 1fr); } }
