:root {
  --ink: #172033;
  --muted: #6b7280;
  --line: #d9dee8;
  --panel: #ffffff;
  --page: #f4f7fb;
  --brand: #116466;
  --brand-2: #1f8a70;
  --danger: #b42318;
  --warn: #9a6700;
  --ok: #0f766e;
  --shadow: 0 18px 45px rgba(23, 32, 51, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--page); }
button, input, select { font: inherit; }
button { border: 0; border-radius: 7px; padding: 10px 14px; cursor: pointer; font-weight: 700; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 11px 12px; color: var(--ink); background: #fff; outline: none; }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(17, 100, 102, .12); }
.hidden { display: none !important; }
.primary { background: var(--brand); color: #fff; }
.primary:hover { background: var(--brand-2); }
.ghost { background: #eef4f4; color: var(--brand); }
.danger { background: #fff1f0; color: var(--danger); }
.warning { background: #fff7e6; color: var(--warn); }
button:disabled { cursor: not-allowed; opacity: .45; }
.eyebrow { margin: 0 0 5px; color: var(--brand); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 0; }
.error { color: var(--danger); min-height: 20px; margin: 0; }
.login-view { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #eef4f4 0%, #f7f9fc 45%, #e9eff8 100%); padding: 24px; }
.login-panel { width: min(430px, 100%); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 34px; }
.login-panel h1 { margin: 0 0 26px; font-size: 30px; }
.stack { display: grid; gap: 16px; }
.app { min-height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 34px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 7px; background: #2dd4bf; color: #082f49; font-weight: 950; }
.brand h2 { margin: 0; }
.workspace { width: min(1500px, 100%); margin: 0 auto; padding: 24px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.topbar h2 { margin: 0; font-size: 26px; }
.topbar .brand { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.market-strip { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }
.market-card, .broker-strip, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 22px rgba(23, 32, 51, .05); }
.market-card { min-height: 112px; padding: 18px; display: grid; align-content: center; gap: 8px; }
.market-card span, .broker-strip span { color: var(--muted); font-weight: 900; font-size: 12px; text-transform: uppercase; }
.market-card strong { font-size: 30px; line-height: 1; }
.market-card small { color: var(--muted); }
.market-card small.up { color: var(--ok); }
.market-card small.down { color: var(--danger); }
.broker-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 14px; overflow: hidden; }
.broker-strip div { padding: 15px 18px; background: #fff; display: grid; gap: 5px; }
.broker-strip strong { font-size: 15px; }
.panel { padding: 18px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 14px; font-size: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }
.strategy-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 14px; }
.tables { display: grid; grid-template-columns: 1fr; gap: 14px; }
.tables .panel { margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.empty { color: var(--muted); text-align: center; padding: 20px; }
.logs { display: grid; gap: 9px; max-height: 360px; overflow: auto; }
.log { display: grid; gap: 3px; border-left: 3px solid var(--line); padding: 8px 10px; background: #f8fafc; border-radius: 0 7px 7px 0; }
.log.success { border-color: var(--ok); }
.log.error { border-color: var(--danger); }
.log.warn { border-color: var(--warn); }
.log time { color: var(--muted); font-size: 12px; }
dialog { border: 0; border-radius: 8px; padding: 0; box-shadow: var(--shadow); width: min(460px, calc(100vw - 30px)); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
.modal { padding: 22px; display: grid; gap: 14px; }
.modal h3 { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
@media (max-width: 1100px) {
  .market-strip { grid-template-columns: repeat(2, 1fr); }
  .strategy-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .workspace { padding: 14px; }
  .topbar, .panel-head { align-items: stretch; flex-direction: column; }
  .actions { justify-content: stretch; }
  .actions button { flex: 1 1 45%; }
  .market-strip, .broker-strip, .strategy-grid, .tables { grid-template-columns: 1fr; }
}
