/* Donor-native dark visual: everything on #2D2D2D, red accent for the
   active timeframe and the selected calendar day.

   The palette, the reset, the base typography, the #topbar frame and the
   sign-in card live in /shared/base.css (libs/web/base.css), which every
   entry point of the zone links first. This file is what makes the TERMINAL
   look like the terminal. */

body { display: flex; flex-direction: column; }

/* ---- navbar ---- */

/* Holds the donor nav elements (instrument dropdown, month dropdown, slider)
   and stretches so the slider (flex:1) fills the bar between brand and TFs. */
#nav-container {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1 1 auto;
  min-width: 0;
}

/* Instrument selector: a native <select> dressed as a nav element. Hidden
   until /api/init serves more than one chartable instrument; switching
   navigates to ?symbol=... (see app.js renderInstrumentSelector). */
#instrument-select {
  height: 36px;
  padding: 0 8px;
  margin-left: 4px;
  background-color: transparent;
  border: none;
  color: #cccccc;
  font-size: 14px;
  cursor: pointer;
  appearance: auto;
  /* Shrinkable, unlike the fixed topbar items: without min-width:0 the
     select's min-content width overflows the topbar on mobile widths and
     pushes #tf-switch off the bar. */
  flex: 0 1 auto;
  min-width: 0;
}
#instrument-select:hover { color: #ffffff; }
#instrument-select option { background-color: #3a3a3a; color: #E0E0E0; }

/* nav buttons / month dropdown (donor nav.css:24-52) */
.nav-btn {
  height: 36px;
  padding: 0 12px;
  background-color: transparent;
  border: none;
  color: #cccccc;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s;
}
.nav-btn:hover { color: #ffffff; }
.nav-btn::after { content: '\25BC'; font-size: 10px; opacity: 0.7; }
.nav-btn[data-btn="month"] { width: 75px; justify-content: space-between; }

/* dropdown (donor nav.css:186-223, 399-413) */
.dropdown { position: relative; }
.dropdown.hidden { display: none !important; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background-color: #2d2d2d;
  border: 1px solid #404040;
  min-width: 160px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 100;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  padding: 10px 16px;
  color: #b0b0b0;
  cursor: pointer;
  transition: background-color 0.15s;
}
.dropdown-item:hover { background-color: #3a3a3a; color: #ffffff; }
.dropdown-item.disabled { color: #505050; cursor: not-allowed; }
.dropdown-menu::-webkit-scrollbar { width: 6px; }
.dropdown-menu::-webkit-scrollbar-track { background: #2d2d2d; }
.dropdown-menu::-webkit-scrollbar-thumb { background: #505050; }
.dropdown-menu::-webkit-scrollbar-thumb:hover { background: #606060; }

/* slider / track / weeks (donor nav.css:226-255) */
.calendar-slider {
  flex: 1;
  height: 40px;
  background-color: #3a3a3a;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.calendar-track { display: flex; align-items: center; height: 100%; }
.week {
  display: flex;
  align-items: center;
  height: 100%;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.week-gap { width: 40px; }

/* day cell (donor nav.css:258-396) */
.day-cell {
  width: 48px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b0b0b0;
  font-size: 15px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
  user-select: none;
}
.day-cell:hover { color: #ffffff; }
/* No data: dimmed and not selectable (donor .holiday; cursor made default
   here since these cells swallow clicks). */
.day-cell.holiday { color: #505050; cursor: default; }
.day-cell.holiday:hover { color: #707070; }
.day-cell.selected::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background-color: #e53935;
  box-shadow: 0 0 8px rgba(229, 57, 53, 0.5);
}
.day-cell .progress-ring {
  position: absolute;
  width: 24px;
  height: 24px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.day-cell .progress-ring-bg { fill: none; stroke: #404040; stroke-width: 1.5; }
.day-cell .progress-ring-fill {
  fill: none;
  stroke: #ffa726;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.day-cell .day-number { position: relative; z-index: 1; }

/* ---- timeframe buttons (donor .mode-btn, nav.css:416-450) ---- */

#tf-switch { display: flex; gap: 8px; flex: 0 0 auto; margin-left: 16px; }

.mode-btn {
  /* FIXED box: wide enough for the longest label ("59m") and never
     resized by the inline editor — nothing in the row may jump. */
  width: 44px;
  height: 36px;
  padding: 0;
  background-color: transparent;
  border: 1px solid #505050;
  color: #707070;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  text-align: center;
}
.mode-btn:hover:not(.disabled) { border-color: #707070; color: #909090; }
.mode-btn.active {
  background-color: #3a3a3a;
  border-color: #e53935;
  color: #e0e0e0;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
}
.mode-btn.disabled { color: #404040; border-color: #353535; cursor: not-allowed; }
/* Inline timeframe editor: an absolute overlay INSIDE the fixed button
   box — opening it cannot change the button's size or shift the row. */
.mode-btn .tf-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #e0e0e0;
  font: inherit;
  text-align: center;
  padding: 0;
}

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

#chart-area { flex: 1 1 auto; min-height: 0; position: relative; background: var(--bg); }
#chart-container { position: absolute; inset: 0; }

/* ---- status bar ---- */

#statusbar {
  display: flex;
  gap: 18px;
  padding: 4px 14px;
  background: var(--bg);
  color: var(--text-mute);
  font-size: 11px;
  flex: 0 0 auto;
}

#status-integrity.warn { color: #e0a030; }

/* ---- sign-in overlay (identity.md 7.6) ----
   Covers the empty CHART when the API answers 401 -- the navigation stays
   visible behind it. The card itself is styled in /shared/base.css. */

#login-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 10;
}


/* Replay control bar: floats over the chart, out of the way of the price axis. */
#replay-bar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(45, 45, 45, 0.94);
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  z-index: 20;
  font-size: 12px;
}
#replay-bar[hidden] { display: none; }
#replay-bar button {
  background: #3a3a3a;
  color: #e0e0e0;
  border: 1px solid #4a4a4a;
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 12px;
  min-width: 26px;
}
#replay-bar button:hover { background: #4a4a4a; }
#replay-bar #rp-play.playing { border-color: #e53935; color: #e53935; }
#replay-bar #rp-trades.playing { border-color: #26a69a; color: #26a69a; }
#replay-bar input[type=range] { width: 260px; accent-color: #e53935; }
#replay-bar #rp-clock {
  color: #b0b0b0;
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: center;
}

/* ---- trading surface (execution_layer.md 9) ----
   Floats over the chart, top-left, out of the way of the price axis (right)
   and of the replay bar (bottom centre). z-index 15: above the chart, below
   the sign-in overlay (10 is the overlay's own layer for the chart area, and
   trading controls must not float over a login prompt). */

#trade-panel {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 9px;
  background: rgba(45, 45, 45, 0.94);
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
  /* Sized by its content: with the money and the status lines gone (owner,
     2026-08-03) a 250px floor would hold open an empty box over the chart. */
  min-width: 0;
}
#trade-panel[hidden] { display: none; }
#trade-panel .tp-row { display: flex; align-items: center; gap: 8px; }
#trade-panel button {
  background: #3a3a3a;
  color: #e0e0e0;
  border: 1px solid #4a4a4a;
  border-radius: 3px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 12px;
}
#trade-panel button:hover:not(:disabled) { background: #4a4a4a; }
/* A disabled entry button is not a styling detail: it is the visible half of
   "trading is off" / "reduce-only", and the reason is spelled out in .tp-note
   right under it. */
#trade-panel button:disabled { opacity: 0.45; cursor: not-allowed; }
#trade-panel .tp-buy { border-color: #26a69a; color: #7fd8ce; min-width: 74px; }
#trade-panel .tp-sell { border-color: #ef5350; color: #f5a3a1; min-width: 74px; }
#trade-panel .tp-size { display: inline-flex; align-items: center; gap: 4px; }
#trade-panel .tp-size button { padding: 1px 7px; min-width: 22px; }
#trade-panel #tp-qty {
  min-width: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
/* The door to the cabinet, shown under the one blocker the client can act on
   himself: no master account yet. There is no account SELECTOR here and never
   will be -- the panel trades the master (owner, 2026-08-03). */
#trade-panel .tp-door {
  color: var(--accent);
  text-decoration: underline;
  white-space: nowrap;
}
#trade-panel .tp-door:hover { color: #ffffff; }
/* The ONLY line left besides the buttons, and it exists to answer "why is
   this button dark". Empty most of the time -- and an empty node must not
   reserve a row of its own next to the buttons. */
#trade-panel .tp-note { color: var(--text-mute); font-size: 11px; }
#trade-panel .tp-note:empty { display: none; }
#trade-panel .tp-toast {
  font-size: 11px;
  color: var(--text-dim);
  border-left: 2px solid #4a4a4a;
  padding-left: 6px;
  margin-top: 3px;
  max-width: 320px;
}
#trade-panel .tp-toast.err { color: #f5a3a1; border-left-color: var(--accent); }

/* Pending-order menu on right click. Positioned in VIEWPORT coordinates
   (document.body), so it is not clipped by the chart's own box. */
.trade-menu {
  position: fixed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: rgba(45, 45, 45, 0.98);
  border: 1px solid #4a4a4a;
  border-radius: 3px;
  padding: 3px;
  font-size: 12px;
}
.trade-menu button {
  background: transparent;
  color: #e0e0e0;
  border: 0;
  text-align: left;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
}
.trade-menu button:hover { background: #4a4a4a; }
.trade-menu-note {
  color: var(--text-mute);
  font-size: 10px;
  padding: 3px 12px 4px;
  border-bottom: 1px solid #4a4a4a;
  margin-bottom: 2px;
}
#trade-panel .tp-toast { display: flex; align-items: flex-start; gap: 6px; }
#trade-panel .tp-toast-x {
  background: transparent;
  border: 0;
  color: var(--text-mute);
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
#trade-panel .tp-toast-x:hover { color: var(--text); background: transparent; }
/* The reason trading is impossible is not a footnote: a disabled button with a
   dim grey explanation reads as a broken button (the owner pressed Buy, nothing
   happened, and the sentence was 11px of grey). */
#trade-panel .tp-note.blocked { color: var(--accent); }

/* A requested-but-missing symbol is named, loudly and for the page's life
   (trade_history.md 9, precondition (b)). */
.status-miss { color: #e0a030; }
