/* ChartTerminal v1 - terminal styling.
   Colour roles: black canvas; amber ONLY for editable/input fields;
   white for headings and clickable items; grey for shortcuts and
   secondary text; red/green only for market direction semantics,
   plus the documented red function title bar. No rounded corners,
   no gradients, no shadows. */

* { box-sizing: border-box; border-radius: 0; }

html, body {
  margin: 0; padding: 0;
  background: #000; color: #e8e8e8;
  font-family: ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
  font-size: 12px; line-height: 1.35;
}

button { font-family: inherit; font-size: 11px; background: #111; color: #e8e8e8;
  border: 1px solid #333; padding: 2px 8px; cursor: pointer; }
button:hover { border-color: #e8e8e8; }
button.active-view { background: #333; color: #fff; border-color: #e8e8e8; }

/* ---------- top bar ---------- */
#topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-bottom: 1px solid #262626; padding: 5px 8px; background: #050505;
}
.brand { color: #fff; font-weight: bold; letter-spacing: 1px; font-size: 14px; white-space: nowrap; }
.brand-sub { color: #7c7c7c; font-weight: normal; font-size: 10px; letter-spacing: 0; }

.global-cmd-wrap { position: relative; display: flex; align-items: center; gap: 4px; flex: 1; min-width: 260px; }
.cmd-label { color: #7c7c7c; }
.cmd-input {
  flex: 1; background: #1a1206; color: #ffa028; border: 1px solid #8a5a00;
  font-family: inherit; font-size: 12px; padding: 4px 6px; text-transform: uppercase;
  outline: none;
}
.cmd-input::placeholder { color: #6b4d12; }
.go-btn { background: #14351c; color: #7dff9a; border-color: #1f5c2e; font-weight: bold; }
.go-btn:hover { border-color: #7dff9a; }

.viewbar { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.viewbar-label { color: #7c7c7c; }

.suggest-box {
  position: absolute; top: 100%; left: 34px; right: 46px; z-index: 60;
  background: #0a0a0a; border: 1px solid #444; display: none; max-height: 220px; overflow: auto;
}
.suggest-box .sg-head { color: #7c7c7c; padding: 2px 6px; border-bottom: 1px solid #262626; font-size: 10px; }
.suggest-box .sg-item { padding: 2px 6px; cursor: pointer; color: #e8e8e8; white-space: nowrap; }
.suggest-box .sg-item:hover, .suggest-box .sg-item.sg-sel { background: #262626; }
.suggest-box .sg-item .sg-desc { color: #7c7c7c; margin-left: 8px; }

/* ---------- alert banner ---------- */
#alert-banner {
  background: #5c0d0d; color: #fff; border-bottom: 1px solid #ff5147;
  padding: 4px 8px; font-weight: bold; cursor: pointer;
}
#alert-banner.hidden { display: none; }

/* ---------- panel grid ---------- */
#grid {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  gap: 4px; padding: 4px; min-height: calc(100vh - 118px);
}
.panel {
  border: 1px solid #262626; background: #050505;
  display: flex; flex-direction: column; min-height: 300px; overflow: hidden;
}
.panel.focused { border-color: #ffa028; outline: 1px solid #ffa028; }

.p-toolbar {
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid #262626; padding: 2px 6px; background: #0a0a0a;
}
.p-loaded { color: #fff; font-weight: bold; }
.p-group { color: #7c7c7c; font-size: 10px; }
.p-icons { margin-left: auto; display: flex; gap: 4px; }
.p-icons button { padding: 0 6px; font-size: 10px; color: #7c7c7c; }
.p-icons button:hover { color: #fff; }

.p-cmdrow { position: relative; display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-bottom: 1px solid #1c1c1c; }
.p-cmdrow .prompt { color: #7c7c7c; }
.p-cmd { flex: 1; background: #1a1206; color: #ffa028; border: 1px solid #8a5a00;
  font-family: inherit; font-size: 12px; padding: 3px 5px; text-transform: uppercase; outline: none; }
.p-cmd::placeholder { color: #6b4d12; }
.p-cmdrow .suggest-box { left: 20px; right: 6px; }
.p-hint { color: #7c7c7c; font-size: 10px; padding: 0 6px 2px; border-bottom: 1px solid #1c1c1c; }

.p-menubar {
  display: flex; align-items: center; gap: 6px;
  background: #7a0d0d; color: #fff; padding: 2px 6px; min-height: 20px;
}
.p-menubar .mb-actions { display: flex; gap: 4px; }
.p-menubar .mb-actions button { background: #5c0a0a; color: #fff; border-color: #a33; font-size: 10px; padding: 0 5px; }
.p-menubar .mb-actions button:hover { border-color: #fff; }
.p-menubar .mb-title { margin-left: auto; font-weight: bold; letter-spacing: 1px; }
.p-menubar .mb-page { color: #e8b4b4; font-size: 10px; }

.p-body { flex: 1; overflow: auto; padding: 4px 6px; }
.p-info { border-top: 1px solid #1c1c1c; color: #7c7c7c; font-size: 10px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- tables ---------- */
table.dt { border-collapse: collapse; width: 100%; }
table.dt th { color: #fff; text-align: right; border-bottom: 1px solid #333; padding: 2px 5px; font-weight: bold; white-space: nowrap; }
table.dt th:first-child, table.dt td:first-child { text-align: left; }
table.dt td { text-align: right; padding: 1px 5px; white-space: nowrap; border-bottom: 1px solid #141414; }
table.dt tr.clickable { cursor: pointer; }
table.dt tr.clickable:hover td { background: #1c1c1c; }
table.dt tr.selrow td { background: #262626; }
.up { color: #16c784; }
.dn { color: #ea3943; }
.flat { color: #e8e8e8; }
.grey { color: #7c7c7c; }
.white { color: #fff; }
.ask { color: #ea3943; }
.bid { color: #16c784; }

/* ---------- function screens ---------- */
.fn-head { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #262626; padding-bottom: 3px; margin-bottom: 4px; }
.fn-head .ohlc { color: #e8e8e8; white-space: nowrap; overflow: hidden; }
.fn-head .summary { color: #7c7c7c; text-align: right; white-space: nowrap; }
.sec-title { color: #fff; font-weight: bold; margin: 6px 0 3px; border-bottom: 1px solid #1c1c1c; padding-bottom: 1px; }
.menu-item { padding: 1px 4px; cursor: pointer; }
.menu-item:hover { background: #1c1c1c; }
.menu-item .mnum { color: #fff; font-weight: bold; display: inline-block; width: 22px; }
.menu-item .mcode { color: #fff; display: inline-block; width: 52px; }
.menu-item .mdesc { color: #7c7c7c; }
.crumb { color: #7c7c7c; margin-bottom: 4px; }
.err { color: #ff5147; padding: 4px 0; }
.wire-line { padding: 1px 0; border-bottom: 1px solid #101010; }
.wire-line .wtime { color: #7c7c7c; }
.wire-line .wsrc { color: #fff; font-weight: bold; }
.liq-big { font-weight: bold; }

.snap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 4px; margin: 4px 0; }
.snap-box { border: 1px solid #262626; padding: 3px 6px; }
.snap-box .sb-head { color: #fff; font-size: 10px; cursor: pointer; }
.snap-box .sb-head:hover { text-decoration: underline; }
.snap-box .sb-val { font-size: 14px; }

canvas.gp-chart { width: 100%; display: block; background: #000; }

select.fld, input.fld {
  background: #1a1206; color: #ffa028; border: 1px solid #8a5a00;
  font-family: inherit; font-size: 11px; padding: 2px 4px; outline: none;
}
.fld-label { color: #7c7c7c; margin-right: 3px; }
.toolbar-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }

a.xlink { color: #6db3f2; text-decoration: none; }
a.xlink:hover { text-decoration: underline; }

/* ---------- footer ---------- */
#statusbar {
  display: flex; gap: 16px; align-items: center;
  border-top: 1px solid #262626; padding: 3px 8px; background: #050505; color: #7c7c7c;
  position: sticky; bottom: 0;
}
.st-ok { color: #16c784; }
.st-err { color: #ea3943; }
.st-wait { color: #7c7c7c; }
.st-right { margin-left: auto; color: #e8e8e8; }
#help-note { color: #555; font-size: 10px; padding: 2px 8px 6px; }

@media (max-width: 820px) {
  #grid { grid-template-columns: 1fr; grid-template-rows: none; }
  .panel { min-height: 260px; }
  #topbar { gap: 6px; }
}
