/* Stock Ticker — custom styles on top of Tailwind CDN. */

:root {
  --pos: #34d399; /* emerald-400 */
  --neg: #f87171; /* red-400 */
  --flat: #94a3b8; /* slate-400 */
}

body {
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif;
}

kbd {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  font-size: 0.75rem;
  font-family:
    ui-monospace,
    SFMono-Regular,
    'SF Mono',
    Menlo,
    Consolas,
    monospace;
  background: rgb(30 41 59);
  border: 1px solid rgb(51 65 85);
  border-bottom-width: 2px;
  border-radius: 0.35rem;
  color: rgb(226 232 240);
  line-height: 1.2;
}

/* Range / chart-type buttons. */
.range-btn,
.type-btn {
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  border-radius: 0.4rem;
  border: 1px solid rgb(51 65 85);
  background: transparent;
  color: rgb(203 213 225);
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.range-btn:hover,
.type-btn:hover {
  background: rgb(30 41 59);
  color: rgb(248 250 252);
}
.range-btn.active,
.type-btn.active {
  background: rgb(16 185 129);
  border-color: rgb(16 185 129);
  color: rgb(2 6 23);
  font-weight: 600;
}

/* Watchlist tabs. */
.list-tab {
  font-size: 0.85rem;
  padding: 0.35rem 0.8rem;
  border-radius: 0.4rem;
  border: 1px solid transparent;
  background: rgb(15 23 42 / 0.6);
  color: rgb(203 213 225);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.list-tab:hover {
  background: rgb(30 41 59);
  border-color: rgb(51 65 85);
}
.list-tab.active {
  background: rgb(16 185 129 / 0.15);
  border-color: rgb(16 185 129 / 0.6);
  color: rgb(167 243 208);
  font-weight: 600;
}
.list-tab .list-count {
  font-size: 0.7rem;
  background: rgb(30 41 59);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  color: rgb(148 163 184);
}
.list-tab.active .list-count {
  background: rgb(2 6 23);
  color: rgb(110 231 183);
}
.list-tab .list-close {
  color: rgb(100 116 139);
  font-size: 0.85rem;
  line-height: 1;
  padding: 0 0.15rem;
}
.list-tab .list-close:hover {
  color: rgb(248 113 113);
}

/* Mode switcher. */
.mode-btn {
  padding: 0.35rem 0.85rem;
  background: rgb(15 23 42 / 0.6);
  color: rgb(203 213 225);
  border-right: 1px solid rgb(30 41 59);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.mode-btn:last-child {
  border-right: none;
}
.mode-btn:hover {
  background: rgb(30 41 59);
}
.mode-btn.active {
  background: rgb(16 185 129);
  color: rgb(2 6 23);
  font-weight: 600;
}

/* Toolbar small buttons. */
.tool-btn {
  font-size: 0.78rem;
  padding: 0.32rem 0.6rem;
  border-radius: 0.4rem;
  border: 1px solid rgb(51 65 85);
  background: rgb(15 23 42 / 0.6);
  color: rgb(203 213 225);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.tool-btn:hover {
  background: rgb(30 41 59);
  border-color: rgb(71 85 105);
}
.tool-btn.active {
  background: rgb(16 185 129);
  color: rgb(2 6 23);
  border-color: rgb(16 185 129);
}

/* Inline indicator toggles (Log / %Δ / Auto). */
.ind-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  border-radius: 0.4rem;
  background: rgb(15 23 42 / 0.6);
  border: 1px solid rgb(51 65 85);
  color: rgb(203 213 225);
  cursor: pointer;
  user-select: none;
}
.ind-toggle input[type='checkbox'] {
  accent-color: rgb(16 185 129);
  width: 0.9rem;
  height: 0.9rem;
}
.ind-toggle:hover {
  border-color: rgb(71 85 105);
}

/* Indicators dropdown rows. */
.ind-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
  cursor: pointer;
  color: rgb(226 232 240);
}
.ind-row input[type='checkbox'] {
  accent-color: rgb(16 185 129);
}
.ind-row:hover {
  color: rgb(248 250 252);
}

/* Search suggestion dropdown rows. */
.suggestion-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid rgb(30 41 59);
}
.suggestion-row:last-child {
  border-bottom: none;
}
.suggestion-row:hover,
.suggestion-row.hl {
  background: rgb(30 41 59);
}
.suggestion-row .sym {
  font-weight: 600;
  color: rgb(248 250 252);
}
.suggestion-row .name {
  color: rgb(148 163 184);
  font-size: 0.8rem;
  margin-top: 0.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
}
.suggestion-row .ex {
  font-size: 0.7rem;
  color: rgb(100 116 139);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Quote tiles. */
.quote-tile {
  background: rgb(15 23 42 / 0.6);
  border: 1px solid rgb(30 41 59);
  border-radius: 0.55rem;
  padding: 0.55rem 0.65rem;
  position: relative;
  cursor: pointer;
  transition:
    transform 0.1s,
    border-color 0.15s;
}
.quote-tile:hover {
  border-color: rgb(71 85 105);
  transform: translateY(-1px);
}
.quote-tile.dragging {
  opacity: 0.5;
  transform: scale(0.97);
}
.quote-tile.drag-over {
  outline: 2px dashed rgb(16 185 129);
  outline-offset: -2px;
}
.quote-tile .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.quote-tile .sym {
  font-weight: 700;
  letter-spacing: 0.02em;
}
.quote-tile .swatch {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  flex: 0 0 auto;
}
.quote-tile .name {
  color: rgb(148 163 184);
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.05rem;
}
.quote-tile .price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.3rem;
}
.quote-tile .price {
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.quote-tile .delta {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.quote-tile.up .delta {
  color: var(--pos);
}
.quote-tile.down .delta {
  color: var(--neg);
}
.quote-tile.flat .delta {
  color: var(--flat);
}
.quote-tile .actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.4rem;
}
.quote-tile button.tile-btn {
  flex: 1;
  font-size: 0.68rem;
  padding: 0.25rem 0.35rem;
  border-radius: 0.3rem;
  border: 1px solid rgb(30 41 59);
  background: rgb(15 23 42);
  color: rgb(203 213 225);
  cursor: pointer;
}
.quote-tile button.tile-btn:hover {
  background: rgb(30 41 59);
  border-color: rgb(71 85 105);
}
.quote-tile button.tile-btn.danger:hover {
  background: rgb(76 5 25);
  border-color: rgb(225 29 72);
  color: rgb(254 226 226);
}
.quote-tile.hidden-series {
  opacity: 0.55;
}
.quote-tile.hidden-series .price {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgb(100 116 139);
}
.quote-tile.focused {
  outline: 1.5px solid rgb(16 185 129);
  outline-offset: -1.5px;
}

/* Heatmap tiles. */
.heatmap-tile {
  border-radius: 0.5rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgb(30 41 59);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: transform 0.1s;
}
.heatmap-tile:hover {
  transform: translateY(-1px);
}
.heatmap-tile .h-sym {
  font-weight: 700;
  letter-spacing: 0.02em;
}
.heatmap-tile .h-price {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}
.heatmap-tile .h-delta {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
}

/* Portfolio table. */
#portfolio-table tbody tr {
  border-bottom: 1px solid rgb(30 41 59);
}
#portfolio-table tbody tr:hover {
  background: rgb(30 41 59 / 0.5);
}
#portfolio-table tbody input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.3rem;
  padding: 0.2rem 0.4rem;
  color: rgb(241 245 249);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#portfolio-table tbody input:hover {
  border-color: rgb(51 65 85);
}
#portfolio-table tbody input:focus {
  outline: none;
  border-color: rgb(16 185 129);
  background: rgb(15 23 42);
}
#portfolio-table .summary-card {
  background: rgb(15 23 42 / 0.6);
  border: 1px solid rgb(30 41 59);
  border-radius: 0.6rem;
  padding: 0.55rem 0.75rem;
}
.summary-card {
  background: rgb(15 23 42 / 0.6);
  border: 1px solid rgb(30 41 59);
  border-radius: 0.6rem;
  padding: 0.55rem 0.75rem;
}
.summary-card .lbl {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.65rem;
  color: rgb(148 163 184);
}
.summary-card .val {
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 0.1rem;
}

/* "Suggested" buttons in the empty state. */
.suggested-add {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: rgb(110 231 183);
  cursor: pointer;
}
.suggested-add:hover {
  color: rgb(167 243 208);
}

/* Detail drawer headings. */
.section-h {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  color: rgb(148 163 184);
  margin-bottom: 0.4rem;
}

/* Toasts. */
.toast {
  background: rgb(15 23 42 / 0.95);
  border: 1px solid rgb(51 65 85);
  border-radius: 0.55rem;
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  color: rgb(226 232 240);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 18rem;
  box-shadow:
    0 10px 25px -5px rgb(0 0 0 / 0.5),
    0 6px 10px -6px rgb(0 0 0 / 0.6);
  animation: toast-in 0.18s ease-out;
}
.toast.toast-alert {
  border-color: rgb(217 119 6);
  background: linear-gradient(180deg, rgb(120 53 15 / 0.85), rgb(15 23 42 / 0.95));
}
.toast.toast-info {
  border-color: rgb(16 185 129);
}
.toast.toast-error {
  border-color: rgb(225 29 72);
  background: linear-gradient(180deg, rgb(76 5 25 / 0.85), rgb(15 23 42 / 0.95));
}
.toast-close {
  margin-left: auto;
  color: rgb(148 163 184);
  cursor: pointer;
  padding: 0 0.25rem;
}
.toast-close:hover {
  color: rgb(248 250 252);
}
@keyframes toast-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Charts: keep canvases responsive in their boxes. */
.chart-pane {
  position: relative;
}
.chart-pane canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Tiny scrollbar polish. */
#ticker-suggestions::-webkit-scrollbar,
#detail-drawer::-webkit-scrollbar {
  width: 8px;
}
#ticker-suggestions::-webkit-scrollbar-thumb,
#detail-drawer::-webkit-scrollbar-thumb {
  background: rgb(51 65 85);
  border-radius: 4px;
}
#ticker-suggestions::-webkit-scrollbar-track,
#detail-drawer::-webkit-scrollbar-track {
  background: transparent;
}
