/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f3f5f7;
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: var(--shadow);
  padding: 28px 26px;
}
.brand-mark { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.brand-mark .logo, .side-brand .logo, .logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: #C8102E;
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 16px;
  overflow: hidden;
}
.brand-mark .logo.logo-img, .side-brand .logo.logo-img, img.logo {
  background: transparent;
  padding: 0;
  object-fit: cover;
}
.side-brand .logo { width: 28px; height: 28px; font-size: 13px; border-radius: 7px; }
.brand-mark h1 { margin: 0; font-size: 18px; color: var(--heading); font-weight: 650; }
.brand-mark p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

/* App shell — ATLAS-like */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.sidebar {
  background: #f8fafc;
  border-right: 1px solid var(--line);
  padding: 0 0 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.side-brand {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  margin-bottom: 8px;
  position: sticky;
  top: 0;
  z-index: 2;
}
.side-brand strong { display: block; color: var(--heading); font-size: 13px; }
.side-brand span { color: var(--muted); font-size: 11px; }
.nav-close {
  display: none;
  margin-left: auto;
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  padding: 4px 8px;
  cursor: pointer;
}
.nav-toggle {
  display: none;
  width: 38px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 9px;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--heading);
  border-radius: 2px;
}
.nav-backdrop {
  display: none;
}
.nav-section {
  margin: 12px 0 4px;
  padding: 0 12px;
  color: #7a8694;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav-btn {
  width: 100%;
  text-align: left;
  display: flex; gap: 8px; align-items: center;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  color: var(--text);
  border-radius: 0;
  padding: 8px 12px;
  margin: 0;
  font-size: 13px;
}
a.nav-btn { color: var(--text); text-decoration: none; }
.nav-btn:hover { background: #eef3f8; text-decoration: none; }
.nav-btn.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--heading);
  font-weight: 600;
}
.nav-btn .ico { width: 1.1rem; text-align: center; color: #6b7785; font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: var(--topbar-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky; top: 0; z-index: 20;
}
.topbar .left, .topbar .right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar h2 { margin: 0; font-size: 15px; color: var(--heading); font-weight: 650; }
.env-pill {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 2px;
  background: #fff3cd; color: #7a5b00; border: 1px solid #efe0a5;
}
.chip-mini {
  font-size: 12px; color: var(--muted);
  padding: 2px 8px; border-radius: 2px;
  border: 1px solid var(--line); background: var(--bg-soft);
}
.agent-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 8px; border-radius: 2px; border: 1px solid var(--line);
  background: var(--bg-soft); font-size: 12px;
}
.agent-chip .av {
  width: 22px; height: 22px; border-radius: 50%;
  background: #d9e6f5; color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 10px;
}
.content { padding: 14px 16px 36px; min-width: 0; }
.footer-note { margin-top: 18px; color: var(--muted); font-size: 11px; text-align: center; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  html, body { overflow-x: clip; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    height: 100dvh;
    z-index: 80;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 28px rgba(15, 39, 68, 0.18);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-toggle { display: inline-flex; }
  .nav-close { display: inline-flex; align-items: center; justify-content: center; }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 39, 68, 0.45);
    z-index: 70;
  }
  .nav-backdrop[hidden] { display: none !important; }
  body.nav-open { overflow: hidden; }
  .topbar {
    height: auto;
    min-height: var(--topbar-h);
    padding: 8px 10px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .topbar .left { flex: 1 1 auto; min-width: 0; }
  .topbar .right { flex: 1 1 100%; justify-content: flex-end; }
  .topbar h2 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(52vw, 220px);
  }
  .topbar-desktop-only { display: none !important; }
  .agent-chip-text { display: none; }
  .chip-working { display: none; }
  .content { padding: 10px 10px 28px; }
}

@media (max-width: 640px) {
  .topbar .right { gap: 6px; }
  .env-pill { display: none; }
  .agent-chip { padding: 3px 6px; }
  .content { padding: 8px 8px 24px; }
}
