:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e5e9f2;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef0ff;
  --gain: #0b8f62;
  --gain-soft: #e3f7ee;
  --loss: #d92d20;
  --loss-soft: #fdeceb;
  --flat-soft: #eef1f6;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
}

html {
  font-size: 15px;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
}

/* ---------- Header ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  color: #e2e8f0;
  background:
    radial-gradient(900px 140px at 12% -40%, rgba(99, 102, 241, 0.42), transparent 70%),
    radial-gradient(700px 120px at 88% -50%, rgba(45, 212, 191, 0.16), transparent 70%),
    linear-gradient(180deg, #0c1228 0%, #0f1733 100%);
  box-shadow: 0 10px 30px rgba(12, 18, 40, 0.22);
}

/* Thin accent line along the bottom edge */
.app-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.75) 30%, rgba(45, 212, 191, 0.55) 70%, transparent);
}

.app-header .navbar {
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.app-header .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.18);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
}

.brand:hover {
  color: #fff;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #818cf8, #4f46e5 55%, #4338ca);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.2s;
}

.brand:hover .brand-mark {
  transform: translateY(-1px) rotate(-4deg);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-tag {
  color: #8b96b5;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Segmented tab bar */
.app-tabs {
  gap: 0.2rem;
  padding: 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.app-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.05rem;
  border-radius: 10px;
  color: #a4aecb;
  font-size: 0.93rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.18s, background-color 0.18s, box-shadow 0.18s;
}

.app-tab svg {
  flex: none;
  width: 17px;
  height: 17px;
  opacity: 0.8;
  transition: opacity 0.18s, transform 0.18s;
}

.app-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.app-tab:hover svg {
  opacity: 1;
  transform: translateY(-1px);
}

.app-tab:focus-visible {
  outline: 2px solid #a5b4fc;
  outline-offset: 2px;
}

.app-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.app-tab.active svg {
  opacity: 1;
}

.header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.header-time {
  color: #8b96b5;
  font-size: 0.74rem;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.market-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd3e6;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.market-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}

.market-status.open {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
}

.market-status.open .dot {
  background: #34d399;
  animation: pulse 1.8s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  }

  100% {
    box-shadow: 0 0 0 8px rgba(52, 211, 153, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .market-status.open .dot {
    animation: none;
  }
}

/* Collapsed (mobile) menu: tabs stack full width */
@media (max-width: 991.98px) {
  .app-tabs {
    margin-top: 0.8rem;
  }

  .header-meta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.8rem;
  }
}

/* ---------- Page scaffolding ---------- */

.app-main {
  flex: 1;
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
}

.app-footer {
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-title {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.page-sub {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-body {
  padding: 1.4rem;
}

.panel-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
}

/* ---------- Buttons, forms, alerts ---------- */

.btn {
  --bs-btn-border-radius: 10px;
  --bs-btn-font-weight: 600;
  --bs-btn-padding-x: 1rem;
}

.btn-sm {
  --bs-btn-border-radius: 8px;
  --bs-btn-padding-x: 0.7rem;
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-ghost {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--flat-soft);
  --bs-btn-hover-border-color: #d5dbe7;
  --bs-btn-active-bg: var(--flat-soft);
  --bs-btn-active-border-color: #d5dbe7;
}

.btn-ghost-danger {
  --bs-btn-color: var(--loss);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-color: var(--loss);
  --bs-btn-hover-bg: var(--loss-soft);
  --bs-btn-hover-border-color: #f6cfcb;
  --bs-btn-active-color: var(--loss);
  --bs-btn-active-bg: var(--loss-soft);
  --bs-btn-active-border-color: #f6cfcb;
}

.form-label {
  color: #334155;
  font-size: 0.85rem;
  font-weight: 600;
}

.form-control,
.form-select {
  padding: 0.6rem 0.85rem;
  border-color: #d9dfea;
  border-radius: 10px;
}

.form-control:focus,
.form-select:focus,
.btn:focus-visible {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.search-input {
  width: 280px;
  max-width: 100%;
  padding-left: 2.4rem;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 0.85rem center;
}

.alert {
  border: 0;
  border-radius: 12px;
  font-size: 0.92rem;
}

.alert-info {
  background: var(--brand-soft);
  color: #3730a3;
}

.alert-warning {
  background: #fff6e0;
  color: #8a5a00;
}

/* ---------- Summary cards ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 991.98px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 479.98px) {
  .stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.stat {
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 0.45rem;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-value .cur {
  margin-right: 0.2rem;
  font-size: 0.6em;
  font-weight: 600;
  opacity: 0.65;
}

.stat-foot {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-hero {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 60%, #3730a3 100%);
  box-shadow: 0 12px 28px rgba(67, 56, 202, 0.32);
}

.stat-hero .stat-label,
.stat-hero .stat-foot {
  color: rgba(255, 255, 255, 0.78);
}

/* ---------- Gain / loss ---------- */

.text-gain {
  color: var(--gain);
}

.text-loss {
  color: var(--loss);
}

.text-flat {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pill .arrow {
  font-size: 0.6em;
}

.pill-gain {
  background: var(--gain-soft);
  color: var(--gain);
}

.pill-loss {
  background: var(--loss-soft);
  color: var(--loss);
}

.pill-flat {
  background: var(--flat-soft);
  color: var(--muted);
}

/* ---------- Data tables ---------- */

.data-table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}

.data-table th[data-sort] {
  cursor: pointer;
}

.data-table th[data-sort]:hover {
  color: var(--ink);
}

.data-table th[data-dir="asc"]::after {
  content: " ▲";
  font-size: 0.7em;
}

.data-table th[data-dir="desc"]::after {
  content: " ▼";
  font-size: 0.7em;
}

.data-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #eef1f6;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background-color 0.12s;
}

.data-table tbody tr:hover {
  background: #f8f9fd;
}

.data-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.data-table .sub {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.data-table .strong {
  font-weight: 600;
}

.data-table .muted {
  color: #a3adbd;
}

.scrip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: hsl(var(--h, 240) 75% 94%);
  color: hsl(var(--h, 240) 55% 36%);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.scrip-symbol {
  font-weight: 700;
  letter-spacing: -0.005em;
}

/* A scrip's symbol with its signal badge beside it. */
.scrip-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pill-sm {
  padding: 0.02rem 0.42rem;
  font-size: 0.68rem;
  text-decoration: none;
}

.scrip-name {
  max-width: 200px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weight {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.weight-bar {
  width: 56px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--flat-soft);
}

.weight-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  white-space: nowrap;
}

.star {
  padding: 0;
  border: 0;
  background: none;
  color: #c3cad6;
  font-size: 1.25rem;
  line-height: 1;
  transition: color 0.12s, transform 0.12s;
}

.star:hover {
  color: #f5b301;
  transform: scale(1.15);
}

.star.on {
  color: #f5b301;
}

.breadth {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* ---------- Meroshare ---------- */

.account + .account {
  margin-top: 1rem;
}

.account-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.account-status {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--flat-soft);
  color: #475569;
  font-size: 0.86rem;
}

.account-status.ok {
  background: var(--gain-soft);
  color: #086b4a;
}

.account-status.fail {
  background: var(--loss-soft);
  color: #a3241a;
}

.hint {
  color: var(--muted);
  font-size: 0.84rem;
}

/* ---------- Scrip chart ---------- */

a.scrip-symbol {
  display: block;
  color: var(--ink);
  text-decoration: none;
}

a.scrip-symbol:hover {
  color: var(--brand);
  text-decoration: underline;
}

.avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  font-size: 1rem;
}

.chart-panel {
  padding: 1.1rem 1.25rem 0.9rem;
}

.chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  min-height: 1.4rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.chart-legend b {
  color: var(--ink);
  font-weight: 600;
}

.chart-legend b.text-gain {
  color: var(--gain);
}

.chart-legend b.text-loss {
  color: var(--loss);
}

.chart-legend .when {
  color: var(--ink);
  font-weight: 700;
}

.segmented {
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.25rem;
  border-radius: 11px;
  background: var(--flat-soft);
}

.segmented button {
  padding: 0.3rem 0.8rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  transition: background-color 0.15s, color 0.15s;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.active {
  background: var(--surface);
  color: var(--brand-dark);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

/* Switches for what is drawn over the candles. */
.chart-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.6;
  transition: opacity 0.15s, background-color 0.15s, color 0.15s, border-color 0.15s;
}

.chip:hover {
  opacity: 1;
}

.chip.active {
  border-color: transparent;
  background: var(--brand-soft);
  color: var(--brand-dark);
  opacity: 1;
}

/* Colour key for a line on the chart. */
.chip i {
  width: 9px;
  height: 3px;
  border-radius: 2px;
}

.chart-area {
  height: 640px;
}

@media (max-width: 767.98px) {
  .chart-area {
    height: 380px;
  }
}

.chart-credit {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.76rem;
}

/* ---------- Alerts ---------- */

.pill-watch {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.steps {
  margin-bottom: 1.1rem;
  padding-left: 1.2rem;
}

.steps li + li {
  margin-top: 0.35rem;
}

.steps code {
  color: var(--brand-dark);
}

/* ---------- Dialogs ---------- */

.app-dialog {
  border: 0;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.app-dialog .modal-header,
.app-dialog .modal-footer {
  padding: 1.1rem 1.4rem;
  border-color: var(--line);
}

.app-dialog .modal-body {
  padding: 1.25rem 1.4rem;
}

.app-dialog .modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.segmented-wide {
  display: flex;
}

.segmented label {
  flex: 1;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.segmented label:hover {
  color: var(--ink);
}

.segmented .btn-check:checked + label {
  background: var(--surface);
  color: var(--brand-dark);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.segmented .btn-check:focus-visible + label {
  outline: 2px solid #a5b4fc;
  outline-offset: 1px;
}

.segmented .btn-check:disabled + label {
  opacity: 0.45;
  cursor: not-allowed;
}

.dialog-now {
  margin-bottom: 1rem;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  background: var(--brand-soft);
  color: #3730a3;
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.alert-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.alert-btn.has-alerts {
  --bs-btn-color: var(--brand-dark);
  --bs-btn-bg: var(--brand-soft);
  --bs-btn-border-color: #d9dcff;
  --bs-btn-hover-color: var(--brand-dark);
  --bs-btn-hover-bg: #e2e5ff;
}

.placed-alerts {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.placed-title {
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.placed-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0;
}

.placed-alert + .placed-alert {
  border-top: 1px solid #eef1f6;
}

.placed-alert .strong {
  font-weight: 600;
}

.placed-alert .sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- Profiles ---------- */

.profile-switch {
  margin-right: 1.1rem;
}

.profile-button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transition: background-color 0.18s, border-color 0.18s;
}

.profile-button:hover,
.profile-button[aria-expanded="true"] {
  border-color: rgba(129, 140, 248, 0.6);
  background: rgba(255, 255, 255, 0.1);
}

.profile-button .avatar,
.profile-menu .avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 0.7rem;
}

.profile-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.profile-caption {
  color: #8b96b5;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.profile-name {
  max-width: 150px;
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The header runs Bootstrap's dark theme; the menu is a light card like the rest of the app. */
.profile-menu {
  --bs-dropdown-bg: var(--surface);
  --bs-dropdown-color: var(--ink);
  --bs-dropdown-link-color: var(--ink);
  --bs-dropdown-link-hover-color: var(--ink);
  --bs-dropdown-link-hover-bg: var(--flat-soft);
  --bs-dropdown-link-active-color: var(--brand-dark);
  --bs-dropdown-link-active-bg: var(--brand-soft);
  --bs-dropdown-border-color: var(--line);
  --bs-dropdown-divider-bg: var(--line);
  min-width: 230px;
  margin-top: 0.5rem !important;
  padding: 0.4rem;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
}

.profile-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 9px;
  font-weight: 600;
}

.rename-form {
  margin-top: 0.6rem;
}

.rename-form.show,
.rename-form.collapsing {
  display: flex;
  gap: 0.4rem;
}

@media (max-width: 991.98px) {
  .profile-switch {
    margin: 0.8rem 0 0;
  }
}

/* ---------- Live data pull status ---------- */

.pull-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 1.5rem;
  margin-bottom: 1.5rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel .pull-bar {
  margin-bottom: 0;
  padding: 0.9rem 1rem;
  background: var(--bg);
  box-shadow: none;
}

.pull-info {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.pull-dot {
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 0.4rem;
  border-radius: 50%;
  background: var(--gain);
  box-shadow: 0 0 0 4px var(--gain-soft);
}

.pull-bar.failed .pull-dot {
  background: var(--loss);
  box-shadow: 0 0 0 4px var(--loss-soft);
}

.pull-main {
  font-size: 0.98rem;
}

.pull-ago {
  margin-left: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.pull-sub {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.pull-bar .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.panel-subtitle {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  font-weight: 700;
}

/* ---------- Bot test results ---------- */

.check-list {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.check-head {
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.check + .check {
  margin-top: 0.7rem;
}

.check-mark {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--flat-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.check-ok .check-mark {
  background: var(--gain-soft);
  color: var(--gain);
}

.check-failed .check-mark {
  background: var(--loss-soft);
  color: var(--loss);
}

.check-name {
  font-size: 0.92rem;
  font-weight: 600;
}

.check-detail {
  color: var(--muted);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.check-failed .check-detail {
  color: #a3241a;
}

.check-skipped .check-name {
  color: var(--muted);
}

/* A button that shows only an icon; its name is in the title and aria-label. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 0.5rem;
}

/* On narrower screens the row buttons keep their icon (and count) and drop the word, so none are cut off. */
@media (max-width: 1439.98px) {
  .row-actions .btn-label {
    display: none;
  }
}

/* The buttons column stays pinned to the right edge of the table, so it is never cut off
   when the table is wider than the screen and scrolls sideways. */
.data-table td:has(> .row-actions) {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--surface);
  transition: background-color 0.12s;
}

.data-table tbody tr:hover td:has(> .row-actions) {
  background: #f8f9fd;
}

/* The description that pops up when an icon-only button is pointed at. */
.tooltip {
  --bs-tooltip-bg: #0f1733;
  --bs-tooltip-color: #f1f5f9;
  --bs-tooltip-opacity: 1;
  --bs-tooltip-padding-x: 0.6rem;
  --bs-tooltip-padding-y: 0.35rem;
  --bs-tooltip-border-radius: 8px;
  --bs-tooltip-font-size: 0.78rem;
  font-weight: 600;
}

html[data-bs-theme="dark"] .tooltip {
  --bs-tooltip-bg: #e5e9f5;
  --bs-tooltip-color: #0b1020;
}

/* Tighter columns on narrower screens, to keep the whole table in view for longer. */
@media (max-width: 1439.98px) {
  .data-table th,
  .data-table td {
    padding-inline: 0.65rem;
  }

  .scrip-name {
    max-width: 170px;
  }
}

/* ---------- Sign-in, setup and no-access pages ---------- */

.auth-page {
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(1200px 600px at 20% -10%, #312e81 0%, transparent 60%), #0f1226;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.auth-name {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.auth-tag {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-title {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---------- Users ---------- */

.user-edit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.profile-checks {
  display: grid;
  gap: 0.25rem;
}

.profile-checks.is-off {
  opacity: 0.5;
}

.profile-menu .dropdown-header {
  padding: 0.35rem 0.85rem;
  color: var(--muted);
  font-size: 0.74rem;
}

/* ---------- Signals ---------- */

.pill-strong.pill-gain {
  background: var(--gain);
  color: #fff;
}

.pill-strong.pill-loss {
  background: var(--loss);
  color: #fff;
}

.segmented a {
  padding: 0.3rem 0.8rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

.segmented a:hover {
  color: var(--ink);
}

.segmented a.active {
  background: var(--surface);
  color: var(--brand-dark);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.breadth {
  align-items: center;
}

.breadth .segmented {
  flex-wrap: wrap;
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 991.98px) {
  .pick-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.pick {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem 1.35rem;
  border-top: 3px solid var(--gain);
}

.pick-sell {
  border-top-color: var(--loss);
}

.pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.pick-head .scrip {
  min-width: 0;
}

a.pick-symbol {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pick-score {
  flex: none;
  text-align: right;
}

.pick-score .score {
  margin-top: 0.2rem;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.pick-figures {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.9rem;
  font-variant-numeric: tabular-nums;
}

.pick-figures .cur {
  color: var(--muted);
  font-size: 0.85em;
}

.pick-reasons {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.pick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}

.pick-next {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.45rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.pick-next a {
  margin-left: 0.4rem;
  font-weight: 700;
  text-decoration: none;
}

.pick-none {
  margin: 0;
}

.pick-note {
  margin: -0.75rem 0 1.5rem;
}

.tag {
  margin-right: 0.3rem;
  padding: 0.05rem 0.4rem;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 700;
}

.data-table td.reasons {
  min-width: 17rem;
  max-width: 26rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.how-scored {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.how-scored summary {
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.how-scored p,
.how-scored ul {
  margin: 0.75rem 0 0;
}

.signal-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.35rem;
}

.signal-panel .score {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.signal-panel .pick-reasons {
  flex: 1 1 22rem;
}

/* ---------- Dividends ---------- */

.dividend-panel {
  margin-bottom: 1.5rem;
}

.dividend-panel .panel-title {
  margin-bottom: 0.35rem;
}

.dividend-history {
  margin-top: 1.5rem;
}

.book-closes {
  margin: 0;
  padding-left: 1.1rem;
}

/* ---------- Dark theme ---------- */

/* The header is dark in both themes. This is the light / dark switch in it: a thumb slides under the icon in use. */
.theme-toggle {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 60px;
  height: 32px;
  margin-right: 1.1rem;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #7f8aa8;
  transition: border-color 0.18s, background-color 0.18s;
}

.theme-toggle:hover {
  border-color: rgba(129, 140, 248, 0.6);
  background: rgba(255, 255, 255, 0.1);
}

.theme-toggle:focus-visible {
  outline: 2px solid #a5b4fc;
  outline-offset: 2px;
}

.theme-toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-bs-theme="dark"] .theme-toggle::before {
  transform: translateX(28px);
}

.theme-toggle svg {
  position: relative;
  width: 14px;
  height: 14px;
  transition: color 0.18s;
}

.theme-toggle .sun,
html[data-bs-theme="dark"] .theme-toggle .moon {
  color: #fff;
}

html[data-bs-theme="dark"] .theme-toggle .sun {
  color: #7f8aa8;
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle::before {
    transition: none;
  }
}

@media (max-width: 991.98px) {
  .theme-toggle {
    margin: 0.8rem 0 0;
  }
}

/* Icons in the account part of the profile menu, lined up under the profile avatars. */
.profile-menu .dropdown-item > svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0 7px;
  color: var(--muted);
}

.profile-menu .dropdown-item.active > svg {
  color: inherit;
}

html[data-bs-theme="dark"] {
  --bg: #0b1020;
  --surface: #141b2f;
  --ink: #e5e9f5;
  --muted: #94a0b8;
  --line: #263048;
  --brand: #6366f1;
  --brand-dark: #c7d2fe;
  --brand-soft: #262c5a;
  --gain: #34d399;
  --gain-soft: #0f3a2e;
  --loss: #f87171;
  --loss-soft: #45201f;
  --flat-soft: #1e2740;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.28);

  /* Bootstrap's own parts (inputs, dialogs, menus) take their colours from these. */
  --bs-body-bg: var(--surface);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
}

/* :where keeps this as weak as the plain "a" rule, so links with their own colour keep it. */
:where(html[data-bs-theme="dark"]) a {
  color: #a5b4fc;
}

html[data-bs-theme="dark"] .btn-primary {
  --bs-btn-hover-bg: #4f46e5;
  --bs-btn-hover-border-color: #4f46e5;
  --bs-btn-active-bg: #4f46e5;
  --bs-btn-active-border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

html[data-bs-theme="dark"] .btn-ghost {
  --bs-btn-hover-border-color: #3a4664;
  --bs-btn-active-border-color: #3a4664;
  --bs-btn-active-color: var(--ink);
  --bs-btn-disabled-color: var(--muted);
  --bs-btn-disabled-bg: var(--surface);
  --bs-btn-disabled-border-color: var(--line);
}

html[data-bs-theme="dark"] .btn-ghost-danger {
  --bs-btn-hover-border-color: #6b2b28;
  --bs-btn-active-border-color: #6b2b28;
}

html[data-bs-theme="dark"] .form-label {
  color: #cbd5e1;
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select {
  border-color: #33405c;
  background-color: #0f1629;
}

html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-select:focus {
  border-color: #818cf8;
}

html[data-bs-theme="dark"] .search-input {
  background-color: var(--surface);
}

html[data-bs-theme="dark"] .alert-info,
html[data-bs-theme="dark"] .dialog-now {
  color: #c7d2fe;
}

html[data-bs-theme="dark"] .alert-warning {
  background: #3a2f10;
  color: #fcd88a;
}

html[data-bs-theme="dark"] .data-table td,
html[data-bs-theme="dark"] .placed-alert + .placed-alert {
  border-color: #1f2840;
}

html[data-bs-theme="dark"] .data-table tbody tr:hover,
html[data-bs-theme="dark"] .data-table tbody tr:hover td:has(> .row-actions) {
  background: #19213a;
}

html[data-bs-theme="dark"] .data-table .muted {
  color: #5d6a85;
}

html[data-bs-theme="dark"] .star {
  color: #4a5672;
}

html[data-bs-theme="dark"] .star:hover,
html[data-bs-theme="dark"] .star.on {
  color: #f5b301;
}

html[data-bs-theme="dark"] .avatar {
  background: hsl(var(--h, 240) 45% 22%);
  color: hsl(var(--h, 240) 85% 82%);
}

html[data-bs-theme="dark"] .pill-strong.pill-gain {
  color: #05281c;
}

html[data-bs-theme="dark"] .pill-strong.pill-loss {
  color: #3d0b08;
}

html[data-bs-theme="dark"] .account-status {
  color: var(--muted);
}

html[data-bs-theme="dark"] .account-status.ok {
  color: #6ee7b7;
}

html[data-bs-theme="dark"] .account-status.fail,
html[data-bs-theme="dark"] .check-failed .check-detail {
  color: #fca5a5;
}

html[data-bs-theme="dark"] .alert-btn.has-alerts {
  --bs-btn-border-color: #3b4280;
  --bs-btn-hover-bg: #303874;
}

html[data-bs-theme="dark"] .app-dialog,
html[data-bs-theme="dark"] .profile-menu {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

/* ---------- News ---------- */

.news-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 2rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 991.98px) {
  .news-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

.news-list a {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}

.news-list a:hover {
  color: var(--brand);
  text-decoration: underline;
}

html[data-bs-theme="dark"] .news-list a:hover {
  color: #a5b4fc;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.6rem;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.news-source {
  font-weight: 700;
}

/* News on a pick card. */
.pick-score .score-parts {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
}

.pick-news {
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.pick-news-count {
  margin-left: 0.4rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.pick-news ul {
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
}

.pick-news li + li {
  margin-top: 0.35rem;
}

.pick-news li > span:first-child {
  display: inline-block;
  width: 1rem;
  font-size: 0.7em;
}

.pick-news a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.pick-news a:hover {
  text-decoration: underline;
}

.news-when {
  margin-left: 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

/* ---------- News page ---------- */

/* A second heading further down a page. */
.section-head {
  margin-top: 2rem;
}

.section-head .page-title {
  font-size: 1.25rem;
}

.headline-list {
  display: grid;
  gap: 0.75rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}

.headline-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 2rem;
  margin-top: 0;
}

@media (max-width: 991.98px) {
  .headline-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

.headline-list li {
  display: flex;
  gap: 0.5rem;
  min-width: 0;
}

.headline-list .tone {
  flex: none;
  width: 0.9rem;
  padding-top: 0.25rem;
  font-size: 0.65rem;
}

.headline-list li > div > a {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}

.headline-list li > div > a:hover {
  text-decoration: underline;
}

.news-meta a.tag {
  margin-right: 0;
  text-decoration: none;
}

.good-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 1199.98px) {
  .good-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .good-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.good-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.1rem 1.2rem;
  border-top: 3px solid var(--gain);
}

.good-figures {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.good-card .hint {
  margin-top: auto;
}
