/* SkySail GX7 Override — internal control surface. No build step.
 *
 * Shares the ops dashboard's dark palette deliberately, but the act buttons and
 * the permanent live-money banner are visually louder: this page is the one that
 * moves the fleet, and it should never be mistaken for the read-only ops view.
 */

:root {
  --bg: #0b1120;
  --panel: #111a2e;
  --panel2: #16213a;
  --line: #223052;
  --text: #dbe4f5;
  --muted: #7d8db0;
  --green: #2fd07f;
  --amber: #f0b429;
  --red: #f2545b;
  --blue: #4c9aff;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* ---- header ---- */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0e162a, var(--bg));
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 26px; }
h1 { font-size: 17px; margin: 0; letter-spacing: 0.4px; }
.sub { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.header-right { display: flex; align-items: center; gap: 14px; }

.price {
  font-family: var(--mono); font-size: 22px; font-weight: 600;
  min-width: 108px; text-align: right;
}
.price.up { color: var(--green); }
.price.down { color: var(--red); }

.freshness {
  font-family: var(--mono); font-size: 12px; color: var(--green);
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 20px;
  background: var(--panel); white-space: nowrap;
}
.freshness.stale { color: var(--red); border-color: var(--red); animation: pulse 1.2s infinite; }
.freshness.warn { color: var(--amber); border-color: var(--amber); }
@keyframes pulse { 50% { opacity: 0.5; } }

.ghost-btn {
  background: none; color: var(--muted); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12px;
}
.ghost-btn:hover { color: var(--text); border-color: var(--muted); }

/* ---- live-money banner ---- */
.live-banner {
  background: #2a1420; border-bottom: 1px solid #5a2530; color: #ffd9de;
  font-size: 12.5px; padding: 7px 22px; text-align: center; letter-spacing: 0.2px;
}
.live-banner strong { color: #fff; }

/* ---- key gate / modal ---- */
.key-gate {
  position: fixed; inset: 0; background: rgba(5, 9, 18, 0.93);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 20px;
}
.key-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 26px 30px; width: 380px; max-height: 92vh; overflow: auto;
}
.key-card.wide { width: 460px; }
.key-card h2 { margin: 0 0 8px; font-size: 16px; }
.key-card p { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.key-card label {
  display: block; font-size: 11.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin: 12px 0 5px;
}
.key-card input {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-family: var(--mono); font-size: 13px;
}
.key-card > button {
  margin-top: 16px; width: 100%; padding: 9px; border: none; border-radius: 8px;
  background: var(--blue); color: #06101f; font-weight: 600; cursor: pointer;
}
.key-error { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 8px; }

.confirm-body { font-size: 13px; margin-bottom: 4px; }
.confirm-body .row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 0; border-bottom: 1px dashed var(--line);
}
.confirm-body .row b { font-family: var(--mono); }
.confirm-body .row.headline b { font-size: 16px; }
.confirm-ask { color: var(--muted); font-size: 12.5px; margin: 14px 0 6px; }
.confirm-ask b { color: var(--amber); }

/* ---- layout ---- */
main { padding: 16px 22px 40px; max-width: 1400px; margin: 0 auto; }
section { margin-bottom: 18px; }
.section-head {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px;
}
.section-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted); margin: 0; font-weight: 600; }
.hint { color: var(--muted); font-size: 11.5px; margin-left: auto; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---- alerts ---- */
.alert {
  border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; font-size: 13px;
  border: 1px solid; display: flex; gap: 10px; align-items: flex-start;
}
.alert.red { background: #2a1418; border-color: #6b2630; color: #ffd7dc; }
.alert.amber { background: #2a2211; border-color: #6b5320; color: #ffeec2; }
.alert.green { background: #10281d; border-color: #1f5c3c; color: #c8f5dc; }
.alert .x { margin-left: auto; cursor: pointer; color: inherit; opacity: 0.6; }
.alert .x:hover { opacity: 1; }

/* ---- chart ---- */
.chart-section .section-head { margin-bottom: 6px; }
.window-tabs { display: flex; gap: 4px; margin-left: auto; }
.window-tabs button {
  background: var(--panel); color: var(--muted); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 11.5px;
  font-family: var(--mono);
}
.window-tabs button.active { color: var(--text); border-color: var(--blue); }
.chart-wrap {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; height: 360px; overflow: hidden;
}
#chart { display: block; width: 100%; height: 100%; }
.chart-empty {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: var(--muted); font-size: 13px;
  pointer-events: none;
}

/* ---- position stack ---- */
.stack { margin-bottom: 14px; }
.stack-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.stack-row span { color: var(--muted); }
.stack-row b { font-size: 15px; }
.stack-row.total { border-bottom: none; padding-top: 10px; }
.stack-row.total span { color: var(--text); }
.stack-row.total b { font-size: 20px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.zero { color: var(--muted); }

.kv-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.kv-grid > div { display: flex; flex-direction: column; gap: 2px; }
.kv-grid span { color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.4px; }
.kv-grid b { font-size: 13.5px; }
.stop { color: var(--red); }
.target { color: var(--green); }

.fleet-line {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 12.5px; font-family: var(--mono);
}

/* ---- controls ---- */
.field-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.field-row label {
  width: 92px; flex: none; color: var(--muted); font-size: 12px;
}
.field-row input {
  flex: 1; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 13px; min-width: 0;
}
.field-row input.narrow { flex: 0 0 108px; }
.field-row input:focus { outline: none; border-color: var(--blue); }

.btn-row { display: flex; gap: 10px; margin-top: 10px; }
.act {
  flex: 1; padding: 11px 8px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; cursor: pointer; color: #06101f;
}
.act:disabled { opacity: 0.4; cursor: not-allowed; }
.act.buy { background: var(--green); }
.act.sell { background: var(--red); color: #fff; }
.act.flat { background: var(--amber); }
.act.neutral { background: var(--blue); }
.act.danger { background: var(--red); color: #fff; }
.act.ghost {
  background: none; color: var(--muted); border-color: var(--line); font-weight: 500;
}
.act.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }

.fine { color: var(--muted); font-size: 11.5px; margin: 14px 0 0; line-height: 1.5; }

/* ---- tables ---- */
.table-wrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  overflow: auto; max-height: 320px;
}
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  position: sticky; top: 0; background: var(--panel2); text-align: left;
  padding: 9px 12px; color: var(--muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 8px 12px; border-bottom: 1px solid var(--line); font-family: var(--mono);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel2); }
.empty-row td { color: var(--muted); font-family: inherit; text-align: center; padding: 18px; }

footer {
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 11.5px; font-family: var(--mono);
  display: flex; gap: 20px; flex-wrap: wrap;
}
