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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #111827;
  height: 100vh;
  overflow: hidden;
}

#app { display: flex; flex-direction: column; height: 100vh; }

.header {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
}

.brand { font-family: monospace; font-weight: 700; font-size: 14px; color: #2962ff; letter-spacing: 0.05em; }

.btn-icon {
  background: none; border: none; font-size: 16px; cursor: pointer; color: #6b7280;
}
.btn-icon:hover { color: #111827; }

.main { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 220px;
  background: #f5f5f5;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar.hidden { display: none; }

.tabs { display: flex; border-bottom: 1px solid #e0e0e0; }

.tab {
  flex: 1;
  padding: 8px;
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.active { color: #2962ff; border-bottom-color: #2962ff; }
.tab:hover { color: #d1d5db; }

#sidebar-content { flex: 1; overflow-y: auto; }

.search-box { padding: 8px; border-bottom: 1px solid #e0e0e0; }

.search-input {
  width: 100%;
  padding: 4px 8px 4px 24px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 12px;
  background: #f5f5f5;
}

.search-input:focus { outline: none; border-color: #2962ff; }

.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 12px; }

.watchlist-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
}

.watchlist-item:hover { background: #fff; }
.watchlist-item.active { background: #e0e0e0; }

.watchlist-symbol { font-family: monospace; font-weight: 600; font-size: 13px; grid-row: 1 / 3; }
.watchlist-source { font-size: 10px; color: #9ca3af; background: #e0e0e0; padding: 1px 4px; border-radius: 2px; margin-left: 4px; align-self: start; }
.watchlist-price { font-family: monospace; font-size: 13px; text-align: right; grid-column: 2; grid-row: 1; }
.watchlist-change { font-family: monospace; font-size: 11px; text-align: right; grid-column: 2; grid-row: 2; }
.watchlist-change.up { color: #26a69a; }
.watchlist-change.down { color: #ef5350; }

.watchlist-price { text-align: right; }
.price { font-family: monospace; font-size: 13px; }
.change { font-family: monospace; font-size: 11px; }
.change.up { color: #26a69a; }
.change.down { color: #ef5350; }

.portfolio-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e0e0e0;
}

.portfolio-symbol { font-family: monospace; font-weight: 600; font-size: 13px; grid-row: 1 / 3; }
.portfolio-source { font-size: 10px; color: #9ca3af; background: #e0e0e0; padding: 1px 4px; border-radius: 2px; margin-left: 4px; align-self: start; }
.portfolio-value { font-family: monospace; font-size: 13px; text-align: right; grid-column: 2; grid-row: 1; }
.portfolio-pnl { font-family: monospace; font-size: 11px; text-align: right; grid-column: 2; grid-row: 2; }
.portfolio-pnl.up { color: #26a69a; }
.portfolio-pnl.down { color: #ef5350; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #e0e0e0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
}

.section-header .delete-btn {
  background: none; border: none; color: #ef5350; cursor: pointer; font-size: 12px;
}

.add-section-btn {
  padding: 4px 12px;
  background: none; border: none;
  font-size: 11px; color: #6b7280;
  cursor: pointer; text-align: left;
}
.add-section-btn:hover { color: #111827; }

.chart-area { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.toolbar {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.symbol-name { font-family: monospace; font-weight: 600; margin-right: 8px; }

.toolbar-group { display: flex; gap: 2px; }

.tf-btn {
  padding: 2px 6px;
  background: none; border: none;
  font-family: monospace; font-size: 11px;
  color: #6b7280; cursor: pointer; border-radius: 2px;
}
.tf-btn:hover { background: #e0e0e0; }
.tf-btn.active { background: #2962ff; color: #fff; }

.chart-type-btn {
  padding: 2px 6px; background: none; border: none;
  font-size: 14px; color: #6b7280; cursor: pointer;
}
.chart-type-btn:hover { color: #111827; }
.chart-type-btn.active { color: #2962ff; }

.draw-btn {
  padding: 2px 6px; background: none; border: none;
  font-family: monospace; font-size: 12px;
  color: #6b7280; cursor: pointer; border-radius: 2px;
}
.draw-btn:hover { background: #e0e0e0; }
.draw-btn.active { background: #2962ff; color: #fff; }

.toolbar-divider { width: 1px; height: 16px; background: #e0e0e0; }

#chart-container { flex: 1; position: relative; }

.dropdown {
  position: absolute;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
}

.dropdown-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
}
.dropdown-item:hover { background: #e0e0e0; }

.dropdown-label {
  padding: 4px 12px;
  font-size: 11px;
  color: #9ca3af;
  text-transform: uppercase;
  border-bottom: 1px solid #e0e0e0;
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
}

.loading { text-align: center; padding: 20px; color: #9ca3af; }

.drawing-menu {
  position: fixed;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 8px;
  z-index: 1000;
}

.color-swatch {
  width: 20px; height: 20px;
  border-radius: 2px;
  cursor: pointer;
  display: inline-block;
  margin: 2px;
  border: 2px solid transparent;
}
.color-swatch.selected { border-color: #555; }

.btn { padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-primary { background: #2962ff; color: #fff; border: none; }
.btn-secondary { background: #e0e0e0; color: #111827; border: none; }
.btn-danger { background: #ef5350; color: #fff; border: none; }
