* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f1117;
  color: #e1e4e8;
  line-height: 1.5;
}

header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid #2d333b;
}

header h1 { font-size: 22px; font-weight: 600; white-space: nowrap; }

/* Navigation */
.nav-links { display: flex; gap: 4px; }

.nav-link {
  color: #8b949e;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-link:hover { color: #e1e4e8; background: #1c2128; }
.nav-link.active { color: #fff; background: #1f6feb; }

#content, .loading {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #8b949e;
  font-size: 18px;
}

/* Summary cards */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.summary-card {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 8px;
  padding: 16px;
}

.summary-card .label {
  font-size: 12px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-card .value {
  font-size: 20px;
  font-weight: 600;
  margin-top: 4px;
}

.summary-card .sub {
  font-size: 14px;
  color: #c9d1d9;
  margin-top: 2px;
}

/* Sections */
.section {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 { font-size: 16px; font-weight: 600; }

.section-header select {
  background: #0d1117;
  color: #e1e4e8;
  border: 1px solid #2d333b;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
}

/* Toggle */
.toggle { display: flex; }

.toggle button {
  background: #0d1117;
  color: #8b949e;
  border: 1px solid #2d333b;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.toggle button:first-child { border-radius: 6px 0 0 6px; }
.toggle button:last-child { border-radius: 0 6px 6px 0; }
.toggle button.active { background: #1f6feb; color: #fff; border-color: #1f6feb; }

/* Ticker select */
.ticker-select {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.ticker-select input {
  width: 100%;
  background: #0d1117;
  color: #e1e4e8;
  border: 1px solid #2d333b;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
}

.ticker-select input:focus { border-color: #1f6feb; }

.ticker-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 6px;
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
}

.ticker-dropdown.open { display: block; }

.ticker-dropdown .item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 14px;
}

.ticker-dropdown .item:hover { background: #1f6feb22; }

.ticker-dropdown .item .symbol {
  font-weight: 600;
  min-width: 60px;
}

.ticker-dropdown .item .name {
  color: #8b949e;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.chart-container { height: 300px; position: relative; }
.chart-container canvas { max-height: 260px; }

.chart-container h3 {
  font-size: 14px;
  font-weight: 500;
  color: #8b949e;
  margin-bottom: 12px;
}

.no-data {
  color: #484f58;
  font-size: 13px;
  text-align: center;
  padding: 40px;
}

/* Filings table */
.filings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.filings-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid #2d333b;
  color: #8b949e;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.filings-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #1c2128;
}

.filings-table tr:hover td { background: #1c2128; }

.type-badge {
  background: #1f6feb22;
  color: #58a6ff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
  color: #8b949e;
}

.pagination button {
  background: #0d1117;
  color: #e1e4e8;
  border: 1px solid #2d333b;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}

.pagination button:disabled { opacity: 0.4; cursor: default; }

/* View text button */
.view-text-btn {
  background: #1f6feb22;
  color: #58a6ff;
  border: 1px solid #1f6feb44;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.view-text-btn:hover {
  background: #1f6feb44;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 10px;
  width: 90%;
  max-width: 1000px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

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

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: #8b949e;
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover { color: #e1e4e8; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.filing-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #c9d1d9;
  max-height: none;
}

/* Auth area in header */
.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  white-space: nowrap;
}
.auth-avatar {
  width: 26px;
  height: 26px;
  min-width: 26px;
  max-width: 26px;
  border-radius: 50%;
  border: 1px solid #2d333b;
  object-fit: cover;
}
.auth-name {
  font-size: 13px;
  color: #8b949e;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-login {
  margin-left: auto;
  white-space: nowrap;
  background: #1f6feb22;
  color: #58a6ff !important;
  border: 1px solid #1f6feb44;
  padding: 6px 14px !important;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.15s;
}
.auth-login:hover {
  background: #1f6feb44;
}
.auth-logout {
  color: #8b949e !important;
  font-size: 12px !important;
}

@media (max-width: 768px) {
  .charts-grid { grid-template-columns: 1fr; }
  header { flex-direction: column; align-items: stretch; }
  .ticker-select { max-width: none; }
  .modal { width: 98%; max-height: 90vh; }
  .auth-area { margin-left: 0; }
}
