/* AAI Panel — visual language aligned with Armadko A-PANEL */

:root {
  --bg: #06060f;
  --surface: #0e0e1a;
  --surface2: #12121f;
  --card: #171923;
  --card2: #1d2130;
  --border: rgba(99, 102, 241, 0.12);
  --border2: rgba(255, 255, 255, 0.06);
  --blue: #3b82f6;
  --blue2: #6366f1;
  --purple: #7c3aed;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #475569;
  --t-fast: 0.15s ease;
  --t-base: 0.2s ease;
  --t-slow: 0.3s ease;
  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.7);
  outline-offset: 2px;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(59, 130, 246, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 110%, rgba(124, 58, 237, 0.06) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Crect width='1' height='1' x='0' y='0' fill='rgba(255,255,255,0.012)'/%3E%3C/svg%3E");
  background-size: 100% 100%, 100% 100%, 32px 32px;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.45); }

.muted { color: var(--text2); }
.muted a,
.auth-link a {
  color: #818cf8;
  text-decoration: none;
  font-weight: 600;
}
.muted a:hover,
.auth-link a:hover { color: #a5b4fc; text-decoration: underline; }

.error {
  color: var(--red);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  padding: 0.65rem 0.85rem;
  border-radius: var(--r-sm);
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0 0 0.85rem;
}

/* ═══ AUTH ═══════════════════════════════════════════════════════════════════ */
.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: min(380px, 100%);
  background: linear-gradient(145deg, rgba(14, 14, 26, 0.96) 0%, rgba(10, 10, 20, 0.96) 100%);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: 28px;
  padding: 2.4rem 1.9rem 1.9rem;
  text-align: center;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
  animation: card-in 0.45s ease both;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

.auth-logo {
  font-size: 1.85rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -1px;
  margin: 0 0 0.2rem;
  position: relative;
  line-height: 1.1;
}

.auth-logo span {
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-sub {
  font-size: 0.55rem;
  color: var(--text3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin: 0 0 1.5rem;
  position: relative;
}

.auth-lead {
  color: var(--text2);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0 0 1.25rem;
  position: relative;
}

.auth-form {
  display: grid;
  gap: 0.65rem;
  text-align: left;
  position: relative;
}

.auth-form label {
  display: grid;
  gap: 0.3rem;
  color: var(--text3);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-form input,
.composer textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  transition: border-color var(--t-base), background var(--t-base), box-shadow var(--t-base);
}

.auth-form input:focus,
.composer textarea:focus {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  outline: none;
}

.auth-form input::placeholder,
.composer textarea::placeholder { color: var(--text3); }

.btn-primary,
.auth-form button[type="submit"],
.composer button[type="submit"],
.side-nav button.nav-action {
  width: 100%;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter var(--t-base), box-shadow var(--t-base), transform var(--t-fast);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover,
.auth-form button[type="submit"]:hover,
.composer button[type="submit"]:hover,
.side-nav button.nav-action:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 28px rgba(99, 102, 241, 0.55);
}

.btn-primary:active,
.auth-form button[type="submit"]:active,
.composer button[type="submit"]:active { transform: scale(0.98); }

.btn-primary:disabled,
.composer button:disabled {
  opacity: 0.55;
  cursor: wait;
  filter: none;
}

.auth-link {
  margin: 1.1rem 0 0;
  font-size: 0.82rem;
  color: var(--text3);
  position: relative;
}

/* ═══ APP SHELL ══════════════════════════════════════════════════════════════ */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 140;
}

.sb-overlay.open { display: block; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-right: 1px solid rgba(99, 102, 241, 0.2);
  overflow-y: auto;
  scrollbar-width: none;
  transition: transform 0.25s ease;
  z-index: 150;
}

.sidebar::-webkit-scrollbar { display: none; }

.lsb-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.1rem 0.9rem 0.9rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.lsb-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.lsb-logo-icon svg { width: 18px; height: 18px; }

.lsb-name {
  font-size: 1.1rem;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.5px;
}

.lsb-name span {
  background: linear-gradient(90deg, #6366f1, #60a5fa, #a78bfa, #3b82f6, #6366f1);
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
}

.lsb-ver {
  font-size: 0.5rem;
  color: var(--text3);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 0.2rem;
}

.user-chip {
  margin: 0.7rem 0.65rem 0;
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.user-chip .uname {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  width: fit-content;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.1);
  border-radius: 99px;
  padding: 0.2rem 0.55rem;
}

.lsb-sep-lbl {
  font-size: 0.55rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text3);
  padding: 0.85rem 0.9rem 0.35rem;
  opacity: 0.7;
}

.hints {
  list-style: none;
  margin: 0;
  padding: 0 0.55rem;
  display: grid;
  gap: 0.25rem;
}

.hints li {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  line-height: 1.35;
}

.hints li:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text2);
  border-color: var(--border2);
}

.side-nav {
  margin-top: auto;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.4rem;
  flex-shrink: 0;
}

.side-nav button,
.side-nav form button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), filter var(--t-base);
}

.side-nav button.nav-action {
  /* inherits .btn-primary look via selector above */
}

.side-nav button.ghost,
.side-nav form button.ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
  box-shadow: none;
}

.side-nav button.ghost:hover,
.side-nav form button.ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.12);
}

.side-nav form { margin: 0; }

.side-nav .icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ═══ MAIN ═══════════════════════════════════════════════════════════════════ */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 1rem;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.mob-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  border-radius: 9px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-fast);
  padding: 0;
}

.mob-menu-btn:hover { background: rgba(255, 255, 255, 0.08); }
.mob-menu-btn svg { width: 18px; height: 18px; }

.topbar-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.topbar-title span {
  color: #818cf8;
}

.topbar-meta {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.35rem 0.7rem;
  border-radius: 99px;
  border: 1px solid var(--border2);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  flex-shrink: 0;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.chat-head {
  flex-shrink: 0;
  padding: 1rem 1.25rem 0.75rem;
}

.chat-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 800;
}

.chat-head p {
  margin: 0;
  color: var(--text2);
  font-size: 0.82rem;
  line-height: 1.4;
}

.log {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.bubble {
  max-width: min(720px, 92%);
  padding: 0.85rem 1rem;
  border-radius: 16px;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 0.9rem;
  animation: rise 0.28s ease;
  word-break: break-word;
}

.bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(99, 102, 241, 0.18));
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-bottom-right-radius: 6px;
}

.bubble.agent {
  align-self: flex-start;
  background: linear-gradient(145deg, rgba(14, 14, 26, 0.95), rgba(10, 10, 20, 0.95));
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}

.bubble.typing {
  color: var(--text2);
  font-style: italic;
  opacity: 0.85;
}

.bubble .meta {
  display: block;
  margin-top: 0.45rem;
  color: var(--text3);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.composer {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  padding: 0.85rem 1.15rem calc(0.95rem + var(--safe-b));
  border-top: 1px solid var(--border);
  background: rgba(14, 14, 26, 0.92);
  backdrop-filter: blur(12px);
}

.composer textarea {
  resize: none;
  min-height: 52px;
  max-height: 140px;
  border-radius: 14px;
  line-height: 1.4;
}

.composer button[type="submit"] {
  width: auto;
  min-width: 7.5rem;
  align-self: end;
  padding: 0.85rem 1.15rem;
}

/* ═══ MOTION ═════════════════════════════════════════════════════════════════ */
@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 300% center; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lsb-name span { animation: none; }
  .auth-card,
  .bubble { animation: none; }
}

/* ═══ RESPONSIVE — LAPTOP ════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  :root { --sidebar-w: 220px; }
  .bubble { max-width: min(640px, 94%); }
}

/* ═══ RESPONSIVE — TABLET ════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --sidebar-w: 210px; }
  .chat-head { padding: 0.9rem 1rem 0.6rem; }
  .log { padding: 0.65rem 1rem 0.85rem; }
  .composer { padding: 0.75rem 1rem calc(0.85rem + var(--safe-b)); }
  .topbar-meta { display: none; }
}

/* ═══ RESPONSIVE — PHONE / SMALL TABLET ══════════════════════════════════════ */
@media (max-width: 720px) {
  :root { --topbar-h: 50px; }

  html,
  body {
    overflow: hidden;
    height: 100%;
    height: 100dvh;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.7);
  }

  .sidebar.open { transform: translateX(0); }

  .mob-menu-btn { display: flex; }

  .chat-head h2 { font-size: 0.95rem; }
  .chat-head p { font-size: 0.76rem; }

  .bubble {
    max-width: 94%;
    font-size: 0.86rem;
    padding: 0.75rem 0.85rem;
  }

  .composer {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .composer button[type="submit"] {
    width: 100%;
    min-width: 0;
  }

  .auth-card {
    padding: 1.75rem 1.25rem 1.4rem;
    border-radius: 22px;
  }

  .auth-logo { font-size: 1.55rem; }
}

/* ═══ RESPONSIVE — NARROW PHONE ══════════════════════════════════════════════ */
@media (max-width: 400px) {
  .auth-card { padding: 1.4rem 1rem 1.2rem; }
  .lsb-logo-icon { width: 32px; height: 32px; }
  .lsb-name { font-size: 1rem; }
  .topbar { padding: 0 0.7rem; }
  .chat-head { padding: 0.75rem 0.75rem 0.5rem; }
  .log { padding: 0.5rem 0.75rem 0.75rem; gap: 0.6rem; }
}

/* ═══ LANDSCAPE PHONE ════════════════════════════════════════════════════════ */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 480px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 150;
    transform: translateX(-105%);
  }

  .sidebar.open { transform: translateX(0); }
  .mob-menu-btn { display: flex; }
  .chat-head { display: none; }
  .composer textarea { min-height: 40px; }
}

/* ═══ NAV ITEMS ══════════════════════════════════════════════════════════════ */
.lsb-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.45rem 0.2rem;
  flex-shrink: 0;
}

.lsb-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  margin: 0;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text3);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.lsb-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.lsb-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text2);
  border-color: var(--border2);
}

.lsb-item.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(99, 102, 241, 0.14));
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.22);
}

.nav-count {
  margin-left: auto;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 99px;
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  font-size: 0.65rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ═══ VIEWS / PANE ═══════════════════════════════════════════════════════════ */
.view-area {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

.view-area.active {
  display: flex;
}

.view-area .chat-main {
  flex: 1;
  min-height: 0;
}

.pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1rem 1.15rem 1.15rem;
}

.pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-bottom: 0.9rem;
}

.pane-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 800;
}

.pane-sub {
  margin: 0;
  color: var(--text2);
  font-size: 0.8rem;
}

.btn-sm {
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.28);
  color: #a5b4fc;
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}

.btn-sm:hover {
  filter: brightness(1.12);
  background: rgba(99, 102, 241, 0.22);
}

/* ═══ INFO GRID / STATUS ═════════════════════════════════════════════════════ */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.info-card {
  background: linear-gradient(145deg, rgba(14, 14, 26, 0.95), rgba(10, 10, 20, 0.95));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  animation: rise 0.28s ease;
}

.info-card .label {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 0.35rem;
}

.info-card .value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}

.info-card .hint {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--text2);
  line-height: 1.35;
}

.info-card.ok .value { color: var(--green); }
.info-card.warn .value { color: var(--yellow); }
.info-card.bad .value { color: var(--red); }

.limits-card {
  background: linear-gradient(145deg, rgba(14, 14, 26, 0.95), rgba(10, 10, 20, 0.95));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  overflow: auto;
}

.limits-card h3 {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 800;
}

.limits-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.limits-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border2);
  font-size: 0.8rem;
}

.limits-list .k { color: var(--text2); font-weight: 600; }
.limits-list .v {
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.limits-list .v.deny { color: var(--red); }
.limits-list .v.allow { color: var(--green); }
.limits-list .v.soft { color: var(--yellow); }

/* ═══ PROJECTS ═══════════════════════════════════════════════════════════════ */
.projects-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 0.85rem;
  overflow: hidden;
}

.projects-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
  padding-right: 0.15rem;
}

.project-card {
  text-align: left;
  width: 100%;
  background: linear-gradient(145deg, rgba(14, 14, 26, 0.95), rgba(10, 10, 20, 0.95));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 0.9rem;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

.project-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.06);
}

.project-card.active {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.project-card .pc-name {
  display: block;
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.project-card .pc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 99px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border2);
  color: var(--text2);
}

.chip.kind {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
}

.chip.tool {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

.chip.score {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.25);
  color: #86efac;
}

.chip.warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

.chip.err {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.project-detail {
  min-height: 0;
  overflow: auto;
  background: linear-gradient(145deg, rgba(14, 14, 26, 0.95), rgba(10, 10, 20, 0.95));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
}

.project-detail.empty-state {
  display: grid;
  place-items: center;
  color: var(--text3);
  text-align: center;
  font-size: 0.85rem;
}

.pd-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.pd-title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.tree {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
}

.tree ul {
  list-style: none;
  margin: 0.15rem 0 0.15rem 0.85rem;
  padding: 0;
  border-left: 1px solid rgba(99, 102, 241, 0.15);
}

.tree li {
  margin: 0.1rem 0;
}

.tree button.file-link,
.tree .dir-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  color: var(--text2);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
  text-align: left;
}

.tree button.file-link:hover {
  background: rgba(99, 102, 241, 0.12);
  color: #c7d2fe;
}

.tree .dir-label {
  color: var(--text);
  cursor: default;
}

.file-preview {
  margin-top: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.file-preview .fp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text2);
}

.file-preview pre {
  margin: 0;
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border2);
  overflow: auto;
  max-height: 420px;
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.55;
  white-space: pre;
  color: #e2e8f0;
}

.readme-box {
  margin-bottom: 0.9rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.18);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text2);
  white-space: pre-wrap;
  max-height: 160px;
  overflow: auto;
}

.empty-list {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text3);
  font-size: 0.85rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
}

/* ═══ BUBBLE META / CONTENT ══════════════════════════════════════════════════ */
.bubble .body {
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble .body code,
.bubble .inline-code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.82em;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 5px;
  padding: 0.05rem 0.3rem;
}

.bubble .body pre {
  margin: 0.55rem 0 0;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border2);
  overflow: auto;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre;
}

.bubble .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.55rem;
}

.bubble .meta {
  display: none;
}

.status-dot.offline,
.status-dot.warn {
  background: var(--yellow);
  box-shadow: 0 0 8px var(--yellow);
}

.status-dot.bad {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 300;
  background: #1d2130;
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--text);
  padding: 0.65rem 1rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  max-width: min(420px, 92vw);
  text-align: center;
}

@media (max-width: 900px) {
  .projects-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .projects-list {
    max-height: 240px;
  }
}

@media (max-width: 720px) {
  .pane {
    padding: 0.85rem 0.85rem calc(0.85rem + var(--safe-b));
  }

  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 400px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
}
