/* @section:layout - App Shell, Sidebar, Header */

/* App Layout */
.app {
  display: flex;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  width: 200px;
  background: #1e293b;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  z-index: 200;
  -webkit-backface-visibility: hidden;
  -webkit-transform: translate3d(0,0,0);
  -webkit-transition: -webkit-transform 0.2s ease-out;
  transition: transform 0.2s ease-out;
}

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #334155;
}

.sidebar-header .logo {
  font-weight: 800;
  font-size: 16px;
  color: #818cf8;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: #334155;
  color: #fff;
}

.nav-item.active {
  background: #334155;
  color: #fff;
  border-left-color: #818cf8;
}

.nav-icon { font-size: 16px; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #334155;
}

.sidebar-footer .time {
  font-size: 11px;
  color: #64748b;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 200px;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.5);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  -webkit-transition: opacity 0.2s ease-out;
  transition: opacity 0.2s ease-out;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 200px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: hidden;
}

/* Top Header */
.top-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: #1e293b;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  align-items: center;
  justify-content: center;
}

.menu-btn:hover { background: #f1f5f9; }

/* Search - pill style */
.header-search {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  transition: all 0.2s;
}

.header-search:focus-within {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.1);
}

.header-search input {
  border: none;
  padding: 10px 14px;
  flex: 1;
  min-width: 80px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  background: transparent;
  color: #1e293b;
}

.header-search input:focus { outline: none; }
.header-search input::placeholder { color: #94a3b8; font-weight: 500; }

.btn-search {
  background: #1e293b;
  color: #fff;
  border: none;
  width: 34px;
  height: 34px;
  margin: 2px;
  font-size: 16px;
  border-radius: 10px;
  cursor: pointer;
}

.btn-search:hover { background: #334155; }

/* Signal - minimal inline */
.header-signal {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.score.b { color: #10b981; }
.score.s { color: #ef4444; }
.score.n { color: #94a3b8; }

.sig {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sig.b { background: #ecfdf5; color: #059669; }
.sig.s { background: #fef2f2; color: #dc2626; }
.sig.n { background: #f8fafc; color: #64748b; }

/* Action buttons - ghost */
.top-header .header-actions {
  display: flex;
  gap: 2px;
}

.top-header .header-actions button {
  background: transparent;
  border: none;
  color: #94a3b8;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.top-header .header-actions button:hover {
  background: #f1f5f9;
  color: #1e293b;
}

/* Status & Bias */
.status-text {
  font-size: 11px;
  color: #94a3b8;
}

.bias-text {
  font-size: 10px;
  color: #64748b;
}

.bias-text:empty, .status-text:empty { display: none; }

/* History */
.header-history {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0;
  margin-left: auto;
  -webkit-overflow-scrolling: touch;
}

.header-history:empty { display: none; }

/* History Items */
.history-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.history-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

.history-item .ticker { color: #475569; font-weight: 700; }
.history-item:hover .ticker { color: #818cf8; }
.history-item .time { font-size: 8px; color: #94a3b8; }

/* Pages */
.page {
  display: none;
  flex: 1;
}

.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

.page-header .header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.page-header .header-actions .btn-ai,
.page-header .header-actions .btn-primary {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.page-header .header-actions .btn-ai {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
}

.page-header .header-actions .btn-primary {
  background: #818cf8;
  color: #fff;
  border: none;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
