/* App layout — sidebar + main + topbar + ticker */

.ticker-bar {
  height: var(--tickerbar-h);
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 100;
}
.ticker-track {
  display: inline-block;
  animation: ticker-scroll 60s linear infinite;
  padding-left: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: var(--tickerbar-h);
}
.ticker-item {
  margin-right: 32px;
}
.ticker-item.up { color: var(--green); }
.ticker-item.down { color: var(--red); }
.ticker-item.placeholder { color: var(--text-3); }
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gap-lg);
  position: sticky;
  top: var(--tickerbar-h);
  z-index: 99;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: var(--gap);
}
.hamburger {
  background: none;
  border: none;
  color: var(--text-1);
  font-size: 20px;
  display: none;
}
@media (max-width: 768px) {
  .hamburger { display: block; }
}
.logo {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  font-weight: 700;
  font-size: 16px;
}
.logo-icon { font-size: 20px; }

.period-select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.theme-toggle, .notif-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 16px;
}
.notif-btn .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--red);
  color: white;
  font-size: 9px;
  border-radius: 8px;
  min-width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.user-menu {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  cursor: pointer;
}
.user-name {
  font-size: 13px;
  font-weight: 500;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--topbar-h) - var(--tickerbar-h));
}
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.open { display: block; position: fixed; z-index: 200; height: 100%; }
}

.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  padding: var(--gap) 0;
  display: flex;
  flex-direction: column;
}
.nav-list {
  list-style: none;
  flex: 1;
}
.nav-section-title {
  padding: var(--gap) var(--gap) var(--gap-sm) var(--gap);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px var(--gap);
  color: var(--text-2);
  border-left: 2px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
  font-size: 14px;
  text-decoration: none;
}
.nav-item:hover {
  background: var(--bg-2);
  color: var(--text-1);
  text-decoration: none;
}
.nav-item.active {
  background: var(--bg-2);
  color: var(--text-1);
  border-left-color: var(--blue);
  font-weight: 600;
}
.nav-item.nav-sub { padding-left: 32px; font-size: 13px; }
.nav-icon { width: 18px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--bg-3);
  color: var(--text-2);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-family: var(--font-mono);
}
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: var(--gap) var(--gap);
}

.sidebar-footer {
  padding: var(--gap);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.health-indicators {
  display: flex;
  gap: 6px;
}
.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  cursor: pointer;
}
.health-dot.active { background: var(--green); box-shadow: 0 0 6px var(--green); }
.health-dot.stale  { background: var(--yellow); }
.health-dot.down   { background: var(--red); }
.version {
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.main {
  padding: var(--gap-lg);
  overflow-x: hidden;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 50vh;
  gap: var(--gap);
  color: var(--text-2);
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--bg-3);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.notif-dropdown {
  position: fixed;
  top: calc(var(--tickerbar-h) + var(--topbar-h));
  right: var(--gap);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 320px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
}
.notif-header {
  padding: var(--gap);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.notif-empty {
  padding: var(--gap-lg);
  color: var(--text-3);
  text-align: center;
}
