:root {
  --bg: #0a0c11;
  --panel: rgba(22, 26, 35, 0.78);
  --panel-solid: #161a23;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #e7e9ee;
  --muted: #8b93a7;
  --green: #4ade80;
  --red: #f87171;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --amber: #fbbf24;
  --radius: 16px;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(167, 139, 250, 0.16), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, rgba(74, 222, 128, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 16px; font: 600 14px/1 inherit; color: var(--text);
  cursor: pointer; text-decoration: none; transition: transform .08s, filter .15s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-green { background: linear-gradient(180deg, #4ade80, #22c55e); color: #052e14; }
.btn-red { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.35); color: #fecaca; }
.btn-purple { background: linear-gradient(180deg, #a78bfa, #8b5cf6); color: #160b33; }
.btn-ghost { background: rgba(255, 255, 255, 0.05); border-color: var(--border-strong); }
.btn:not(:disabled):hover { filter: brightness(1.1); }
.btn-discord { background: #5865f2; color: #fff; padding: 12px 22px; font-size: 15px; width: 100%; }
.btn-discord svg { width: 20px; height: 20px; }
.icon-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; width: 28px; height: 28px; cursor: pointer; font-size: 14px;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* ---------- Login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(380px, 100%); text-align: center; padding: 36px 28px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 22px;
  backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.login-card h1 { margin: 16px 0 4px; font-size: 24px; }
.login-card p { margin: 0 0 24px; }
.login-error { background: rgba(248, 113, 113, 0.12); color: #fecaca; border-radius: 10px; padding: 10px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; background: rgba(10, 12, 17, 0.7); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #a78bfa, #4ade80); color: #0a0c11; font-weight: 800;
}
.brand-mark.big { width: 56px; height: 56px; border-radius: 16px; font-size: 26px; margin: 0 auto; }
.brand-title { font-weight: 700; }
.brand-sub { font-size: 12px; color: var(--muted); }
.user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-solid); }

/* ---------- Layout ---------- */
.grid {
  display: grid; grid-template-columns: 360px 1fr; gap: 20px;
  padding: 20px 24px; max-width: 1500px; margin: 0 auto;
  height: calc(100vh - 65px);
}
.col-side { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; min-height: 0; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; backdrop-filter: blur(14px);
}
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px;
}
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn-row .btn { flex: 1; }

/* ---------- Status ---------- */
.status-head { display: flex; align-items: center; gap: 14px; }
.bot-head {
  width: 56px; height: 56px; border-radius: 12px; overflow: hidden; flex: none;
  background: var(--panel-solid) linear-gradient(135deg, rgba(167, 139, 250, .25), rgba(74, 222, 128, .15));
  border: 1px solid var(--border);
}
.bot-head img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.status-name { font-size: 18px; font-weight: 700; margin-top: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; border: 1px solid;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-off { color: var(--muted); border-color: var(--border-strong); }
.pill-wait { color: var(--amber); border-color: rgba(251, 191, 36, .35); }
.pill-wait .dot { animation: pulse 1.2s infinite; }
.pill-on { color: var(--green); border-color: rgba(74, 222, 128, .35); background: rgba(74, 222, 128, .08); }
.pill-on .dot { box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); animation: ring 2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@keyframes ring { 70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 0; }
.stats div { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.stats dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stats dd { margin: 2px 0 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.switch { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; color: var(--muted); cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: rgba(255, 255, 255, .1); position: relative; transition: background .2s; flex: none; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track .thumb { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--purple); outline-offset: 2px; }

.notice { border-color: rgba(167, 139, 250, .4); background: rgba(167, 139, 250, .08); }
.notice-title { font-weight: 700; color: var(--purple); }
.notice p { margin: 4px 0 12px; font-size: 13px; }

/* ---------- Modi ---------- */
.modes { display: grid; gap: 8px; }
.mode {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
}
.mode.active { border-color: rgba(74, 222, 128, .45); background: rgba(74, 222, 128, .06); }
.mode-info { flex: 1; min-width: 0; }
.mode-name { font-weight: 600; }
.mode-desc { font-size: 12px; color: var(--muted); }

/* ---------- Deals ---------- */
.deals { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.deals li:not(.muted) { border-left: 3px solid var(--purple); background: rgba(167, 139, 250, .06); border-radius: 8px; padding: 8px 10px; }
.deal-top { display: flex; justify-content: space-between; font-weight: 600; }
.deal-profit { color: var(--green); }
.deal-sub { color: var(--muted); font-size: 12px; }

/* ---------- Konsole ---------- */
.console-card { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.console-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.console-head .card-title { margin: 0; }
.console-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mini { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 4px 11px; font: 600 12px/1.4 inherit; cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.active { color: #160b33; background: var(--purple); border-color: var(--purple); }
.quick { padding: 0 18px 14px; }
.quick .chip { font-family: var(--mono); font-weight: 500; }

.log {
  flex: 1; overflow-y: auto; padding: 14px 18px; min-height: 0;
  font: 13px/1.6 var(--mono); background: rgba(0, 0, 0, 0.25);
}
.line { white-space: pre-wrap; word-break: break-word; }
.line .ts { color: #7f879a; margin-right: 8px; }
.c-dim { color: #858c9c; }
.c-red { color: var(--red); }
.c-green { color: var(--green); }
.c-blue { color: var(--blue); }
.c-purple { color: var(--purple); }
.c-bold { font-weight: 700; }
.line.deal { background: rgba(167, 139, 250, .08); border-radius: 4px; }
.line.error { background: rgba(248, 113, 113, .05); border-radius: 4px; }

.cmd { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); }
.prompt { color: var(--purple); font: 700 18px var(--mono); }
.cmd input {
  flex: 1; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-strong); border-radius: 10px;
  color: var(--text); padding: 10px 12px; font: 14px var(--mono); outline: none; min-width: 0;
}
.cmd input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(167, 139, 250, .18); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 10px 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); font-size: 14px; z-index: 20;
}
.toast.error { border-color: rgba(248, 113, 113, .5); color: #fecaca; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; height: auto; padding: 16px; }
  .col-side { overflow: visible; }
  .console-card { height: 75vh; }
  .topbar { padding: 12px 16px; }
  .user span { display: none; }
}
