/* ===================== TOKENS ===================== */
:root {
  --bg: #0a0b0f;
  --sidebar-bg: #0c0d12;
  --surface: #131419;
  --surface-2: #16171e;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);

  --text: #e9eaf0;
  --text-dim: #9799a4;
  --text-muted: #6b6d78;

  --purple: #06B6D4;
  --purple-soft: rgba(var(--ac-rgb), 0.16);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);

  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 232px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  letter-spacing: -0.01em;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* the `hidden` attribute must always win over component display rules
   (otherwise hidden flex/grid elements like the owner banner still show) */
[hidden] {
  display: none !important;
}

/* ===================== SHELL ===================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width 0.2s ease;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--purple), var(--green));
  transform: rotate(45deg);
  flex-shrink: 0;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover:not(.disabled):not(.active) {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.nav-item.active {
  background: var(--purple-soft);
  color: #fff;
}

.nav-item.active .nav-icon {
  color: var(--purple);
}

.nav-icon {
  width: 18px;
  font-size: 15px;
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.soon-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1e3a8a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Collapsed state */
.app-shell.collapsed .sidebar {
  width: 68px;
}
.app-shell.collapsed .nav-label,
.app-shell.collapsed .brand-name,
.app-shell.collapsed .soon-badge {
  display: none;
}

/* ===================== MAIN ===================== */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 8px;
  flex-wrap: wrap;
}

.topbar-title h1 {
  font-size: 26px;
}

.topbar-title p {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.routine-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--purple-soft);
  border: 1px solid rgba(var(--ac-rgb), 0.35);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
}

.info-i {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-style: italic;
  font-weight: 700;
  opacity: 0.8;
}

.range-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}

.range-tabs button {
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}

.range-tabs button:hover {
  color: var(--text);
}

.range-tabs button.active {
  background: var(--purple);
  color: #fff;
}
/* Custom range: a calendar button at the end of the range tabs and a small "From / To" popover */
.range-tabs .range-cal { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.range-tabs .range-cal svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.range-cal-txt { white-space: nowrap; }
.range-cal-txt:empty { display: none; }
.action-group[data-actions="dashboard"] { position: relative; }
.range-caption { display: none; }
.range-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: 320px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.16s cubic-bezier(0.23, 1, 0.32, 1), transform 0.16s cubic-bezier(0.23, 1, 0.32, 1);
}
.range-pop.open { opacity: 1; transform: none; }
.range-pop[hidden] { display: none; }
.range-pop-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.range-pop .form-field input { min-width: 0; }
.range-pop input[type="date"] { color-scheme: dark; }
[data-theme="light"] .range-pop input[type="date"] { color-scheme: light; }
.range-pop-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
html.rm .range-pop { transition: opacity 0.16s ease; transform: none; }
@media (max-width: 860px) {
  .range-tabs .range-cal { flex: 0 0 auto; padding-left: 10px; padding-right: 10px; }
  .range-cal-txt { display: none; }
  .range-caption:not([hidden]) { display: block; width: 100%; align-self: stretch; margin: 8px 0 0; padding-right: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); text-align: right; }
  .range-pop { left: 0; right: 0; width: auto; transform-origin: top center; }
}

.content {
  padding: 16px 32px 40px;
}

/* ===================== PANELS ===================== */
.panel {
  display: none;
}
.panel.active {
  display: block;
}

.placeholder {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 80px 32px;
  text-align: center;
  color: var(--text-dim);
}
.placeholder h2 {
  font-size: 22px;
  color: var(--text);
  margin-bottom: 8px;
}

/* ===================== CARDS ===================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-head h3 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-style: italic;
  color: var(--text-muted);
}

.beta-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--purple-soft);
  color: var(--accent-text);
  text-transform: none;
  letter-spacing: 0;
}

.pos {
  color: var(--green);
}
.neg {
  color: var(--red);
}

.trend {
  font-size: 14px;
}
.trend.up {
  color: var(--green);
}

/* ===== Stat grid ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card h2 {
  font-size: 26px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.r-badges {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
}

.r-badge {
  font-size: 11px;
  font-weight: 600;
}
.r-badge.pos {
  color: var(--green);
}
.r-badge.neg {
  color: var(--red);
}

.smiley {
  color: var(--green);
  font-size: 18px;
}

.ring-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(
    var(--green) 0 var(--pct),
    var(--red) var(--pct) 100%
  );
  -webkit-mask: radial-gradient(circle 18px at center, transparent 98%, #000 100%);
  mask: radial-gradient(circle 18px at center, transparent 98%, #000 100%);
}

/* ===== Middle grid ===== */
.middle-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.left-col,
.right-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===== Chart card ===== */
.chart-card {
  min-height: 420px;
}

.chart-wrap {
  width: 100%;
  height: 360px;
}

.chart-wrap svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.axis-label {
  fill: var(--text-muted);
  font-size: 11px;
}

.grid-line {
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 1;
}

/* ===== Trades card ===== */
.trades-card {
  min-height: 200px;
}

.link-btn {
  color: var(--purple);
  font-size: 13px;
  font-weight: 600;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 36px 0 8px;
}

.empty-text {
  color: var(--text-muted);
}

.demo-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--purple-soft);
  border: 1px solid rgba(var(--ac-rgb), 0.3);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
}

/* ===== Edge card ===== */
.edge-card {
  min-height: 230px;
}

.edge-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 14px 0;
}

.edge-pie {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: conic-gradient(
    rgba(255, 255, 255, 0.07) 0 25%,
    rgba(255, 255, 255, 0.04) 25% 60%,
    rgba(255, 255, 255, 0.09) 60% 100%
  );
  -webkit-mask: radial-gradient(circle 20px at center, transparent 98%, #000 100%);
  mask: radial-gradient(circle 20px at center, transparent 98%, #000 100%);
  margin-bottom: 10px;
  opacity: 0.6;
}

.edge-empty h4 {
  font-size: 15px;
}

.edge-empty p {
  color: var(--text-muted);
  font-size: 12px;
  max-width: 240px;
}

/* ===== Discipline card ===== */
.discipline-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.discipline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.discipline-row.spread {
  justify-content: space-between;
}

.discipline-row.strong {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.d-label {
  color: var(--text-dim);
}

.trade-dots {
  display: flex;
  gap: 6px;
}

.trade-dots .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
}

.open-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  margin-left: auto;
}

.pnl-amount {
  font-size: 18px;
  font-weight: 700;
}

.pnl-bar {
  position: relative;
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--red-soft), rgba(255, 255, 255, 0.06) 33%, var(--green-soft));
}

.pnl-zero {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 12px;
  background: var(--text-dim);
  border-radius: 2px;
}

.pnl-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -6px;
}

.limits {
  font-size: 12px;
  color: var(--text-dim);
}
.limits strong {
  color: var(--text);
}

.banner {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
}
/* the two discipline banners used to sit flush against each other */
#disc-banners {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#disc-banners:empty {
  display: none;
}

.banner.ok {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.banner.info {
  background: var(--purple-soft);
  color: var(--accent-text);
  border: 1px solid rgba(var(--ac-rgb), 0.25);
}

/* ===================== TOPBAR ACTION GROUPS ===================== */
.action-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.action-group[hidden] {
  display: none;
}

.unit-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
}
.unit-toggle button {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.unit-toggle button.active {
  background: var(--purple);
  color: #fff;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 9px;
  background: var(--purple);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.primary-btn:hover {
  background: var(--accent-deep);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.ghost-btn {
  padding: 6px 13px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.ghost-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.muted-note {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}
.muted {
  color: var(--text-muted);
}
.dim {
  color: var(--text-muted);
  font-weight: 600;
}

/* ===================== JOURNAL ===================== */
.journal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.journal-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Calendar */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cal-nav h3 {
  font-size: 18px;
}
/* the month's net P&L next to its name: plain colour, no glow (money never glows) */
.cal-month-pnl {
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
  background: color-mix(in srgb, currentColor 13%, transparent);
}
.cal-month-pnl[hidden] { display: none; }
@media (max-width: 560px) {
  /* phones: the P&L sits under the month name, so long month names never push it around */
  .calendar-card .cal-nav { display: grid; grid-template-columns: auto auto 1fr; column-gap: 10px; row-gap: 3px; }
  .calendar-card .cal-nav .icon-btn { grid-row: 1 / span 2; }
  .calendar-card .cal-nav h3 { grid-column: 3; grid-row: 1; }
  .calendar-card .cal-month-pnl { grid-column: 3; grid-row: 2; justify-self: start; }
}
.cal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.cal-weekdays span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  padding-left: 2px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.cal-cell {
  position: relative;
  min-height: 96px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.012);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cal-cell:hover {
  border-color: var(--border-strong);
}
.cal-cell .cell-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  position: absolute;
  top: 8px;
  right: 10px;
}
.cal-cell.out {
  opacity: 0.35;
  cursor: default;
}
.cal-cell.out:hover {
  border-color: var(--border);
}
.cal-cell.today {
  border-color: var(--purple);
  background: rgba(var(--ac-rgb), 0.07);
}
.cal-cell.selected {
  border-color: var(--purple);
  box-shadow: 0 0 0 1px var(--purple);
}
.today-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--purple);
  color: #fff;
}
.cell-data {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
}
.cell-trades {
  font-size: 11px;
  color: var(--text-dim);
}
.cell-pnl {
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

/* Summaries */
.journal-summaries {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.summary-card h3,
.weekly-card h3 {
  font-size: 16px;
  margin-bottom: 18px;
}
.summary-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: end;
}
.r-hist {
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-rows: 1fr auto;
  gap: 4px 6px;
  height: 160px;
}
.r-hist-axis {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}
.r-hist-bars {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
}
.r-bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
}
.r-bar {
  width: 100%;
  background: var(--purple);
  border-radius: 4px 4px 0 0;
  min-height: 0;
}
.r-hist-labels {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  gap: 6px;
}
.r-hist-labels span {
  flex: 1;
  text-align: center;
  font-size: 9px;
  color: var(--text-muted);
}
.summary-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.srow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.srow span {
  color: var(--text-dim);
}
.srow strong {
  font-weight: 600;
}

.weekly-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 32px;
}
.week {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 56px;
}
.week-label {
  font-size: 13px;
  font-weight: 600;
}

/* Day detail */
.day-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
}
/* the day's sections sit inside the slide-animation wrapper, so it needs the same
   16px rhythm (without it P&L, metrics, rows and the trades table were flush) */
.day-swap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.day-swap .day-pnl-label {
  margin-top: -12px; /* the label belongs to the number above it */
}
/* next to the calendar the day panel is narrow: drop the Emotion column so the
   P&L column stays in view instead of scrolling off to the right */
.day-detail {
  container: dayd / inline-size;
}
@container dayd (max-width: 360px) {
  .trades-block .trades-table th:nth-child(4),
  .trades-block .trades-table td:nth-child(4) {
    display: none;
  }
}
.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.day-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.day-nav h3 {
  font-size: 16px;
}
.day-pnl {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.day-pnl .cents {
  font-size: 20px;
  opacity: 0.7;
}
.day-pnl-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 3px;
}
.day-metrics {
  display: grid;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.day-metrics.two {
  grid-template-columns: 1fr 1fr;
}
.day-metrics.three {
  grid-template-columns: repeat(3, 1fr);
}
.day-metrics div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.day-metrics strong {
  font-size: 20px;
}
.day-metrics span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.detail-rows {
  display: flex;
  flex-direction: column;
}
.drow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.drow .check {
  color: var(--green);
}
.caret {
  color: var(--text-muted);
  font-size: 12px;
}
.note-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.note-title {
  font-size: 13px;
  font-weight: 600;
}
.note-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-dim);
}
.trades-head h4 {
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.trades-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.seg {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 3px;
}
.seg button {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.seg button.active {
  background: var(--purple);
  color: #fff;
}
.instr-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}
.trades-table {
  width: 100%;
  border-collapse: collapse;
}
.trades-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
.trades-table td {
  font-size: 13px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--border);
}
.trade-row {
  cursor: pointer;
  transition: background 0.15s;
}
.trade-row:hover {
  background: rgba(255, 255, 255, 0.03);
}
.flag {
  font-size: 12px;
}

/* ===================== TRADE DETAIL (inspect) ===================== */
.trade-detail {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.back-link {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  align-self: flex-start;
}
.back-link:hover {
  color: var(--text);
}
.trade-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.trade-title {
  font-size: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.trade-title .sep {
  color: var(--text-muted);
  font-weight: 400;
}
.auto-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 7px;
  background: var(--purple-soft);
  color: var(--accent-text);
}
.trade-head-actions {
  display: flex;
  gap: 8px;
}

.trade-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 16px;
  align-items: start;
}
.trade-details-card h3,
.trade-right h3 {
  font-size: 17px;
  margin-bottom: 16px;
}
.trade-pnl {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.trade-pnl .cents {
  font-size: 18px;
  opacity: 0.7;
}
.trade-top-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
  padding: 18px 0;
  margin: 14px 0 4px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.trade-top-row > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trade-top-row strong {
  font-size: 16px;
}
.trade-top-row .sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.trade-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.trade-section:last-child {
  border-bottom: none;
}
.section-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.kv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 6px 0;
}
.kv span {
  color: var(--text-dim);
}
.kv strong {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trade-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.charts-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.chart-thumb-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.candles {
  height: 130px;
  border-radius: 8px;
  background: #f7f7f9;
  overflow: hidden;
}
.candles svg {
  width: 100%;
  height: 100%;
}

.reflect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 4px;
}
.reflect-col {
  display: flex;
  flex-direction: column;
}
.field-label {
  font-size: 12px;
  color: var(--text-dim);
  margin: 14px 0 8px;
}
.reflect-col .field-label:first-child {
  margin-top: 0;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  cursor: pointer;
}
.checkbox input {
  width: 17px;
  height: 17px;
  accent-color: var(--purple);
}
.tag-field {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 7px;
  background: rgba(var(--ac-rgb), 0.14);
  border: 1px solid rgba(var(--ac-rgb), 0.28);
  font-size: 12.5px;
  color: #cffafe;
}
.tag i {
  font-style: normal;
  opacity: 0.6;
  cursor: pointer;
}
.select,
.input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--text);
}
.input {
  color: var(--text-dim);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
}
.reflect-emotions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.textarea {
  position: relative;
  padding: 14px 40px 14px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-dim);
  min-height: 90px;
}
.mic-icon {
  position: absolute;
  right: 12px;
  bottom: 12px;
  opacity: 0.6;
}

/* ===================== LIVE EXTRAS ===================== */
.dot.filled {
  background: var(--purple);
  border-color: var(--purple);
}
.banner.danger {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.pnl-bar {
  position: relative;
  overflow: hidden;
}
.pnl-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 4px;
}
.danger-btn {
  padding: 8px 16px;
  border-radius: 9px;
  background: var(--red-soft);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
}
.danger-btn:hover {
  background: rgba(248, 113, 113, 0.2);
}
.tag-field.empty {
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ===================== MODAL ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.modal-overlay.hidden {
  display: none;
}
.modal {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.modal-head h3 {
  font-size: 17px;
}
.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

/* ===================== FORMS ===================== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-row:has(.form-field:nth-child(3)) {
  grid-template-columns: 1fr 1fr 1fr;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* trade form: when a label wraps (longer languages), the boxes of a row still line up */
#trade-modal .form-row > .form-field { justify-content: flex-end; }
.form-field label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}
.form-field input,
.form-field select,
.form-field textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--purple);
}
.form-field textarea {
  resize: vertical;
}
.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-muted);
}
.checkbox-field {
  justify-content: flex-end;
  padding-bottom: 10px;
}

/* ===================== NEWS ===================== */
.news-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.news-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.news-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.news-search input::placeholder {
  color: var(--text-muted);
}
.news-ccy {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ccy-chip {
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}
.ccy-chip.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}
.news-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.news-events {
  display: flex;
  flex-direction: column;
}
.event-row {
  display: grid;
  grid-template-columns: 48px 38px 14px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.event-time {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.event-ccy {
  font-weight: 700;
  font-size: 12px;
}
.impact {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.impact.high {
  background: var(--red);
}
.impact.medium {
  background: #fbbf24;
}
.impact.low {
  background: var(--green);
}
.impact.holiday {
  background: #a855f7;
}
.event-row.holiday {
  background: rgba(168, 85, 247, 0.08);
  border-left: 2px solid #a855f7;
  padding-left: 8px;
}
.event-row.holiday .event-vals { visibility: hidden; }
.news-tz {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.news-tz:focus { outline: none; border-color: var(--purple); }
.event-name {
  color: var(--text);
}
.event-vals {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}
.event-vals b {
  color: var(--text);
  font-weight: 600;
}
.news-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.feed-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.feed-meta {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.feed-ccy {
  font-weight: 700;
  color: var(--text);
}
.feed-title {
  font-size: 15px;
  margin-bottom: 6px;
}
.feed-body {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ===================== SETTINGS ===================== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 920px;
  align-items: start; /* a short card must not stretch empty next to a tall one */
}
.settings-grid .card h3 {
  font-size: 16px;
  margin-bottom: 16px;
}
.settings-grid .card .form-field {
  margin-bottom: 12px;
}
.settings-actions {
  display: flex;
  flex-wrap: wrap; /* four buttons don't fit one row on phones (and in Greek) */
  gap: 10px;
  margin-top: 12px;
}
.settings-save-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}
.save-note {
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}
/* Settings save themselves: a quiet "✓ Saved" in the corner of the card you changed */
.settings-grid > .card { position: relative; }
.autosave-note {
  position: absolute;
  top: 22px;
  right: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green);
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.2s cubic-bezier(0.23, 1, 0.32, 1), transform 0.2s cubic-bezier(0.23, 1, 0.32, 1);
  pointer-events: none;
}
.autosave-note.show { opacity: 1; transform: none; }
.autosave-note.neg { color: var(--red); }
html.rm .autosave-note { transition: opacity 0.2s ease; transform: none; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1180px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .middle-grid,
  .journal-grid,
  .trade-grid {
    grid-template-columns: 1fr;
  }
  .day-detail {
    position: static;
  }
  .reflect-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .topbar {
    padding: 20px 18px 8px;
  }
  .content {
    padding: 16px 18px 40px;
  }
}

/* ===================== LIGHT THEME ===================== */
[data-theme="light"] {
  --bg: #f3f4f8;
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #0f172a;
  --text-dim: #475569;
  --text-muted: #94a3b8;
}
[data-theme="light"] .nav-item:hover:not(.active) {
  background: rgba(15, 23, 42, 0.05);
}
[data-theme="light"] .trade-row:hover,
[data-theme="light"] .cal-cell {
  background: rgba(15, 23, 42, 0.015);
}
[data-theme="light"] .grid-line {
  stroke: rgba(15, 23, 42, 0.06);
}
[data-theme="light"] .user-avatar {
  color: #fff;
}
/* active nav text works on both themes */
.nav-item.active {
  color: var(--text);
}

/* ===================== AUTH ===================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 600px at 70% -10%, rgba(var(--ac-rgb), 0.18), transparent), var(--bg);
  padding: 24px;
}
.auth-overlay.hidden {
  display: none;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.auth-brand {
  justify-content: center;
  padding: 0 0 18px;
}
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}
.auth-tabs button {
  flex: 1;
  padding: 9px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-dim);
}
.auth-tabs button.active {
  background: var(--purple);
  color: #fff;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-submit {
  margin-top: 4px;
  justify-content: center;
  padding: 11px;
}
.auth-error {
  color: var(--red);
  font-size: 12.5px;
  min-height: 16px;
  margin: -4px 0;
}
.auth-hint {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* logout + user row */
.user-row {
  position: relative;
}
.logout-btn {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 15px;
}
.logout-btn:hover {
  background: var(--red-soft);
  color: var(--red);
}
.app-shell.collapsed .logout-btn {
  display: none;
}

/* ===================== USER SELECT ===================== */
.user-select {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
}

/* ===================== TAG INPUT ===================== */
.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.tag-input .tag-list {
  display: contents;
}
.tag-input input {
  flex: 1;
  min-width: 140px;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 4px;
}
.tag-input input::placeholder {
  color: var(--text-muted);
}
.tag.editable {
  cursor: default;
}
.tag i {
  cursor: pointer;
}

/* ===================== IMAGE UPLOAD ===================== */
.img-drop {
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  overflow: hidden;
  position: relative;
  background: var(--surface-2);
}
.img-drop:hover {
  border-color: var(--purple);
  color: var(--text-dim);
}
.img-drop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.img-thumb-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
}
.img-thumb-actions button {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* chart slots in inspect become drop zones */
.chart-thumb .candles.is-drop,
.chart-thumb .candles.is-empty {
  cursor: pointer;
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 8px;
}
.chart-thumb .candles.is-empty .empty-hint {
  display: block;
}
.chart-thumb .candles.is-empty .empty-upload {
  background: var(--surface-3, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
}
.chart-thumb .candles.is-empty .empty-upload:hover {
  border-color: var(--purple);
  color: var(--purple);
}
.chart-thumb .candles img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}
.chart-thumb {
  position: relative;
  border-radius: 8px;
  transition: box-shadow 0.15s, outline-color 0.15s;
  outline: 2px solid transparent;
  outline-offset: 2px;
}
.chart-thumb.selected {
  outline-color: var(--purple);
  box-shadow: 0 0 0 1px rgba(var(--ac-rgb), 0.35), 0 0 18px rgba(var(--ac-rgb), 0.25);
}
.chart-thumb.selected .candles.is-empty {
  border-color: var(--purple);
  color: var(--purple);
}

/* ===================== LIGHTBOX ===================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox.hidden {
  display: none;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  font-size: 30px;
  color: #fff;
  line-height: 1;
  z-index: 2;
}
.lightbox-zoom {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}
.lightbox-stage {
  max-width: 92vw;
  max-height: 88vh;
  overflow: auto;
}
.lightbox-stage img {
  display: block;
  transform-origin: top left;
  transition: transform 0.12s ease;
  max-width: 92vw;
}

/* ===================== NEWS EXTRAS ===================== */
.news-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: -4px 0 14px;
}
.news-note a {
  color: var(--purple);
}
.event-row.future .event-vals b {
  color: var(--text-muted);
}
.checkbox-field-inline {
  flex-direction: row;
  align-items: center;
}

/* ===================== INSPECT REFLECTION FIELDS ===================== */
.rf-input,
.rf-note {
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.rf-input:focus,
.rf-note:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}
.rf-input::placeholder,
.rf-note::placeholder {
  color: var(--text-muted);
}
.rf-note {
  resize: vertical;
  min-height: 96px;
  line-height: 1.55;
}

/* Custom caret for all selects so the native white arrow is gone */
select.rf-input,
.form-field select,
.user-select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239799a4' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
/* dropdown option list — readable in both themes */
.rf-input option,
.form-field select option,
.user-select option {
  background: var(--surface);
  color: var(--text);
}

/* ===================== CHART TOOLTIP ===================== */
.chart-wrap {
  position: relative;
}
.chart-tip {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: none;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
.chart-tip .tip-label {
  font-size: 10.5px;
  color: var(--text-muted);
}
.chart-tip strong {
  font-size: 13px;
}

/* ===================== VIEW-ONLY (other users' trades) ===================== */
.ro-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.ro-line {
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13.5px;
}
.ro-note {
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-dim);
  min-height: 80px;
}

/* ===================== OWNER CONSOLE ===================== */
.owner-shell {
  min-height: 100vh;
}
.owner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.owner-top .brand {
  padding: 0;
}
.owner-content {
  padding: 24px 32px 48px;
  max-width: 1100px;
}
.owner-stats {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 0;
}
.owner-table th,
.owner-table td {
  vertical-align: middle;
}
.owner-row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.owner-row-actions .ghost-btn,
.owner-row-actions .danger-btn {
  padding: 5px 10px;
  font-size: 12px;
}
.user-avatar.sm {
  width: 24px;
  height: 24px;
  font-size: 9px;
  display: inline-flex;
  vertical-align: middle;
  margin-right: 8px;
}
.owner-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 32px;
  background: var(--purple-soft);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.app-shell.owner-viewing #add-trade-btn,
.app-shell.owner-viewing #add-trade-btn-2,
.app-shell.owner-viewing #day-add {
  display: none;
}

/* ===================== GM JOURNAL ADDITIONS ===================== */
/* Headlines are real links now */
a.feed-card.link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
a.feed-card.link:hover {
  border-color: var(--purple);
  background: var(--surface-2);
}
a.feed-card.link .feed-title {
  color: var(--text);
}

/* Next high-impact event strip */
.news-next-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 10px;
}
.news-next-strip b { color: var(--text); }
.news-next-strip .muted { color: var(--text-muted); }

/* Change-password row in Settings */
.pw-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pw-row input {
  flex: 1 1 140px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: inherit;
}
.pw-row input:focus { outline: none; border-color: var(--purple); }

/* Owner access card in Settings */
.owner-access-card {
  border-color: color-mix(in srgb, var(--purple) 40%, transparent);
  background: linear-gradient(160deg, var(--purple-soft), transparent 55%);
}
