.layout-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  background-color: var(--background-color);
}

/* Sidebar Styling */
.sidebar {
  background-color: var(--secondary-color);
  border-right: 1px solid var(--border-color);
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar.open {
  width: 240px;
}

.sidebar.closed {
  width: 70px;
}

.sidebar-header {
  height: 64px;
  flex-shrink: 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.logo-text {
  font-weight: bold;
  font-size: 1.2rem;
  margin-left: 10px;
  letter-spacing: 2px;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-color);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-btn:hover {
  box-shadow: none;
  color: var(--accent-color);
}

.sidebar-nav {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 0;
}

.sidebar-footer {
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-color);
  opacity: 0.7;
}

.nav-item {
  border-left: 3px solid transparent;
  gap: 12px;
  position: relative;
}

.nav-item:hover, .nav-item.active {
  background-color: var(--accent-tint-10);
  opacity: 1;
  color: var(--text-color);
  border-left-color: var(--accent);
}

.nav-badge {
  font-size: 0.6rem;
  color: var(--alert);
  border: 1px solid var(--alert);
  padding: 1px 5px;
  background: var(--alert-tint-10);
  letter-spacing: 1px;
  margin-left: auto;
}

.nav-label {
  margin-left: 12px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-group-toggle {
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.6;
}

.nav-group-toggle:hover {
  box-shadow: none;
  opacity: 1;
}

.nav-group-chevron {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.nav-group-children {
  display: flex;
  flex-direction: column;
}

.nav-subitem {
  padding-left: 40px;
  font-size: 0.85rem;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-meta {
  font-size: 0.6rem;
  opacity: 0.4;
  letter-spacing: 1px;
  line-height: 1.6;
  white-space: nowrap;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
}

.logout-btn:hover {
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  background: transparent;
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Topbar Styling */
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  overflow: hidden;
  background-color: var(--background-color);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* Dark/light toggle in topbar.
 * Sits between the threat indicator and the system status pill,
 * matching the slim/quiet voice of the rest of the topbar. */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  cursor: pointer;
  transition: border-color var(--dur-quick) var(--ease),
              color var(--dur-quick) var(--ease),
              background var(--dur-quick) var(--ease);
}
.theme-toggle-btn:hover {
  background: var(--accent-tint-10);
  border-color: var(--accent);
  /* Without these the global button:hover wins and pushes
   * color to var(--bg) and adds matrix-glow — the lucide icon
   * (currentColor stroke) collapses into the tinted background. */
  color: var(--accent);
  box-shadow: none;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.7rem;
  letter-spacing: 1px;
  opacity: 0.7;
  white-space: nowrap;
  text-transform: uppercase;
}

.crumbs .sep {
  opacity: 0.3;
}

.crumb-sector {
  color: var(--violet);
}

.search-container {
  display: flex;
  align-items: center;
  background-color: var(--secondary-color);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  max-width: 420px;
  min-width: 0;
  width: 100%;
  font-size: 0.85rem;
  flex-shrink: 1;
}

.search-container > input {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-icon {
  margin-right: 8px;
  opacity: 0.5;
}

.search-container input {
  background: transparent;
  border: none;
  width: 100%;
  padding: 4px;
}

.search-container input:focus {
  box-shadow: none;
}

.search-kbd {
  font-size: 0.6rem;
  border: 1px solid var(--border-color);
  padding: 1px 5px;
  opacity: 0.5;
  letter-spacing: 1px;
  margin-left: 8px;
  white-space: nowrap;
}

.threat-level {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  letter-spacing: 1px;
  padding: 6px 10px;
  border: 1px solid var(--alert);
  color: var(--alert);
  background: var(--alert-tint-10);
  text-transform: uppercase;
}

.threat-level .dot {
  width: 6px;
  height: 6px;
  background: var(--alert);
  border-radius: 50%;
  animation: decnet-pulse 1s infinite alternate;
}

.topbar-clock {
  font-size: 0.75rem;
  opacity: 0.6;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.topbar-status {
  font-size: 0.7rem;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 1280px) {
  .threat-level span:last-child { display: none; }
  .topbar-clock { display: none; }
}

@media (max-width: 980px) {
  .crumbs { display: none; }
}

.neon-blink {
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; text-shadow: var(--matrix-green-glow); }
  50% { opacity: 0.5; }
}

.violet-accent {
  color: var(--accent-color);
  filter: drop-shadow(var(--violet-glow));
}

.matrix-text {
  color: var(--text-color);
}

/* Viewport for dynamic content */
.content-viewport {
  flex-grow: 1;
  padding: 32px;
  overflow-y: auto;
}

/* Dashboard fills the viewport without scrolling — panels scroll internally */
.content-viewport:has(> .dashboard > .dash-grid) {
  overflow: hidden;
}
