:root {
  --bg: #0f1418;
  --panel: #172026;
  --panel-2: #1d2830;
  --line: #31404b;
  --text: #eef3f6;
  --muted: #9cafbc;
  --green: #41d18d;
  --red: #ff6464;
  --blue: #6ab7ff;
  --gold: #d4b15d;
  --input: #10181d;
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Segoe UI, Inter, Arial, sans-serif;
  letter-spacing: 0;
}
button, input, select { font: inherit; }
button {
  border: 1px solid var(--line);
  background: #22303a;
  color: var(--text);
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
}
button:hover { border-color: var(--blue); background: #263846; }
button:disabled { opacity: .55; cursor: wait; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 11px;
  outline: none;
}
input:focus, select:focus { border-color: var(--blue); }
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.field-title {
  color: var(--muted);
  font-size: 13px;
}
.field-help {
  display: block;
  color: #7f949f;
  font-size: 11px;
  line-height: 1.35;
}
.hidden { display: none !important; }
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(65, 209, 141, .08), transparent 34%),
    linear-gradient(260deg, rgba(106, 183, 255, .10), transparent 36%),
    var(--bg);
}
.login-panel {
  width: min(440px, 100%);
  background: rgba(23, 32, 38, .95);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid #48616f;
  border-radius: 8px;
  color: var(--green);
  font-weight: 800;
  margin-bottom: 18px;
}
.brand-mark.small {
  width: 40px;
  height: 40px;
  margin: 0;
}
.login-panel h1 { margin: 0 0 8px; font-size: 30px; }
.login-panel p { margin: 0 0 24px; color: var(--muted); line-height: 1.5; }
.login-form { display: grid; gap: 16px; }
.login-form button { margin-top: 4px; background: #1e6f50; border-color: #2e9d72; }
.form-error { color: var(--red); min-height: 20px; font-size: 13px; }
.padded-error { padding: 0 14px 14px; }
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}
.sidebar {
  background: #121a20;
  border-right: 1px solid var(--line);
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
}
.side-brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.side-brand span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}
nav { display: grid; align-content: start; gap: 8px; }
nav button {
  text-align: left;
  background: transparent;
}
nav button.active {
  background: #20313b;
  border-color: #567284;
}
.user-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}
.workspace {
  padding: 22px;
  min-width: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  align-items: center;
}
.topbar h2 { margin: 0 0 4px; font-size: 25px; }
.topbar p { margin: 0; color: var(--muted); }
.status-line { display: flex; gap: 10px; align-items: center; color: var(--muted); }
#modePill {
  color: var(--green);
  border: 1px solid rgba(65, 209, 141, .35);
  padding: 7px 10px;
  border-radius: 6px;
}
.tab { display: none; }
.tab.active { display: block; }
.notice {
  border: 1px solid rgba(212, 177, 93, .45);
  background: rgba(212, 177, 93, .10);
  color: #f0d992;
  border-radius: 8px;
  padding: 11px 13px;
  margin-bottom: 14px;
  font-size: 13px;
}
.action-strip {
  display: grid;
  grid-template-columns: minmax(150px, 210px) repeat(2, auto) minmax(90px, 120px) auto auto minmax(220px, 300px) repeat(5, auto);
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, .8fr);
  gap: 14px;
  margin-bottom: 14px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  min-width: 0;
}
.panel-head {
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
}
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-head span { color: var(--muted); font-size: 13px; }
.chart-panel canvas {
  display: block;
  width: 100%;
  height: min(55vh, 520px);
  background: #0d1317;
}
.result-panel { min-height: 0; }
#outputBox {
  margin: 0;
  padding: 14px;
  height: min(55vh, 520px);
  overflow: auto;
  white-space: pre-wrap;
  color: #d8e3e9;
  font-size: 12px;
  line-height: 1.45;
}
.job-list, .table-wrap, .config-editor { padding: 14px; }
.job {
  display: grid;
  grid-template-columns: 120px 100px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.job pre {
  grid-column: 1 / -1;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 6px 0 0;
  padding: 10px;
  max-height: 180px;
  overflow: auto;
}
.split {
  display: grid;
  grid-template-columns: minmax(280px, .75fr) minmax(420px, 1.25fr);
  gap: 14px;
}
.grid-form {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.grid-form button { align-self: end; }
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check-row input { width: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  border-bottom: 1px solid rgba(255,255,255,.07);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 600; }
.config-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}
.config-section h4 {
  margin: 0;
  padding: 12px;
  background: var(--panel-2);
}
.config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
}
.button-row { display: flex; gap: 8px; }
.buy { color: var(--green); }
.sell { color: var(--red); }
.hold { color: var(--gold); }
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; grid-template-rows: auto auto auto; }
  nav { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid, .split { grid-template-columns: 1fr; }
  .action-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .config-grid, .grid-form { grid-template-columns: 1fr; }
}
