/* EA Control Panel: styles for the server-rendered pages (dark by default). */
:root {
  --bg: #0e1116;
  --surface: #161a21;
  --surface-2: #1c212a;
  --line: #2a313c;
  --text: #e7eaf0;
  --muted: #98a2b3;
  --accent: #5b9cff;
  --accent-ink: #0b1220;
  --ok: #3fb97a;
  --warn: #e5a53a;
  --crit: #ef5a52;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
}
a { color: var(--accent); }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .2px; }
.mark {
  width: 14px; height: 14px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--ok));
}

/* Login */
.login {
  max-width: 380px; margin: 0 auto; padding: 12vh 16px 32px;
  display: flex; flex-direction: column; gap: 18px;
}
.login .brand { justify-content: center; color: var(--muted); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px;
}
.login .card { display: flex; flex-direction: column; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 6px; }
label { font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
input[type=text], input[type=password] {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font: inherit; width: 100%;
}
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button {
  margin-top: 18px; padding: 10px 14px; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.quiet {
  margin: 0; background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500;
  padding: 6px 10px;
}
.note { margin: 0 0 8px; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.note.info { background: rgba(91, 156, 255, .12); border: 1px solid rgba(91, 156, 255, .35); }
.note.error { background: rgba(239, 90, 82, .12); border: 1px solid rgba(239, 90, 82, .4); }
.fine { text-align: center; color: var(--muted); font-size: 12px; margin: 0; }

/* Panel pages */
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.content { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; display: grid; gap: 16px; }
.content > * { min-width: 0; } /* lets wide tables scroll inside their card on phones */
.content p { margin: 0; color: var(--muted); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
td:last-child { white-space: normal; min-width: 180px; }
.mono { font-family: var(--mono); }
tr.k-login_failed td:nth-child(2), tr.k-request_refused td:nth-child(2) { color: var(--warn); }
tr.k-locked td:nth-child(2), tr.k-address_blocked td:nth-child(2) { color: var(--crit); }
tr.k-login td:nth-child(2) { color: var(--ok); }

/* Navigation */
.top .brand { flex: none; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

/* Alerts page */
.strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  color: var(--muted); font-size: 14px;
}
.strip .big { color: var(--text); font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.strip .right { margin-left: auto; }
.muted-note { color: var(--warn); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); box-shadow: 0 0 0 4px rgba(239, 90, 82, .2); }
.sev {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px; border: 1px solid var(--line); color: var(--muted);
}
.sev.critical { color: var(--crit); border-color: rgba(239, 90, 82, .5); background: rgba(239, 90, 82, .1); }
.sev.warning { color: var(--warn); border-color: rgba(229, 165, 58, .5); background: rgba(229, 165, 58, .1); }
.sev.info { color: var(--accent); border-color: rgba(91, 156, 255, .5); }
.badge {
  display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--line); color: var(--muted); margin-left: 4px;
}
.badge.live { color: #ffd2cf; background: rgba(239, 90, 82, .25); border-color: rgba(239, 90, 82, .6); }
.sub { color: var(--muted); font-size: 12px; white-space: normal; }
td .sub { margin-top: 2px; max-width: 520px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.stale { color: var(--crit); }
.warn-text { color: var(--warn); }
td form { margin: 0; }
button.small { margin: 0; padding: 6px 10px; font-size: 13px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 14px; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.inline-form .grow { flex: 1; min-width: 200px; }
select, .inline-form input[type=text] {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font: inherit; font-size: 14px;
}
.content h2 + p { margin-bottom: 10px; }

/* Phones: header on two rows; open alerts as stacked cards */
@media (max-width: 640px) {
  .top { flex-wrap: wrap; row-gap: 8px; }
  .who span { display: none; }
  .nav { order: 3; flex-basis: 100%; }
  .strip .right { margin-left: 0; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.stack td { border: 0; padding: 3px 0; white-space: normal; min-width: 0; }
  table.stack td.inl { display: inline-block; width: auto; margin-right: 10px; }
}

/* Bots and terminals */
.ok-text { color: var(--ok) !important; }
.bot-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 12px; background: var(--surface-2); }
.bot-head { margin-bottom: 4px; }
.bot-card .inline-form { margin-top: 10px; }
.inline-form label.short { max-width: 140px; }
.inline-form input[type=password] {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font: inherit; font-size: 14px;
}
.bot-card input[type=text], .bot-card select { background: var(--surface); }
.copy-row {
  display: grid; grid-template-columns: 220px 1fr auto; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.copy-label { color: var(--muted); font-size: 13px; }
.copy-row code { font-family: var(--mono); font-size: 13px; word-break: break-all; color: var(--text); }
.steps { color: var(--muted); padding-left: 20px; }
.steps li { margin: 6px 0; }
.steps code { font-family: var(--mono); color: var(--text); }
@media (max-width: 640px) {
  .copy-row { grid-template-columns: 1fr auto; }
  .copy-label { grid-column: 1 / -1; }
  .inline-form label.short { max-width: none; }
}
.steps-title { margin-top: 22px; }
.qr { background: #fff; display: inline-block; padding: 6px; border-radius: 8px; margin: 6px 0 12px; line-height: 0; }
.qr svg { display: block; width: 220px; height: auto; }
.login .sub { margin: -6px 0 10px; }

/* Performance */
.gain::before, .loss::before {  /* polarity as a mark beside the value; the text stays ink */
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px;
  vertical-align: middle;
}
.gain::before { background: #3987e5; }
.loss::before { background: #e66767; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 14px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.chart { width: 100%; height: auto; display: block; }
.content h1 .badge, .content td .badge { vertical-align: middle; }
td.name { white-space: normal; min-width: 220px; }
.tags { margin-top: 2px; }
.tags .badge { margin-left: 0; }
