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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-muted: #666;
  --accent: #2962ff;
  --green: #26a69a;
  --red: #ef5350;
  --header-height: 52px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

header h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-right label {
  color: var(--text-muted);
}

#cols-input {
  width: 48px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 6px;
  border-radius: 4px;
  text-align: center;
}

#add-chart-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

#add-chart-btn:hover { background: #1a4fd6; }

main {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(var(--grid-cols, 2), 1fr);
  gap: 12px;
  align-content: start;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 320px;
}

.card-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.symbol-input {
  width: 80px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.symbol-input:focus { outline: none; border-color: var(--accent); }

.timeframe-select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.watch-price-input {
  width: 90px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: #f0b90b;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.watch-price-input::placeholder { color: var(--text-muted); }

.last-updated {
  color: var(--text-muted);
  font-size: 11px;
  margin-left: auto;
  white-space: nowrap;
}

.error-msg {
  color: var(--red);
  font-size: 11px;
  margin-left: auto;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
}

.remove-btn:hover { color: var(--red); }

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

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.5;
}

select option { background: var(--surface); }

.symbol-wrap {
  position: relative;
}

.symbol-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 280px;
  background: #242424;
  border: 1px solid var(--border);
  border-radius: 4px;
  list-style: none;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  max-height: 240px;
  overflow-y: auto;
}

.symbol-dropdown.hidden { display: none; }

.symbol-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.symbol-option:last-child { border-bottom: none; }
.symbol-option:hover, .symbol-option.active { background: #2e2e2e; }

.opt-symbol {
  font-weight: 600;
  font-size: 13px;
  min-width: 60px;
  color: var(--text);
}

.opt-name {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opt-type {
  font-size: 11px;
  color: #444;
  flex-shrink: 0;
}
