:root {
  --bg: #f9fafb;
  --bg-soft: #f3f4f6;
  --panel: rgba(255, 255, 255, .82);
  --panel-solid: #ffffff;
  --panel-soft: #f9fafb;
  --text: #111827;
  --text-soft: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --green: #16a34a;
  --green-strong: #15803d;
  --green-bright: #22c55e;
  --green-soft: #dcfce7;
  --green-ink: #166534;
  --rose: #e11d48;
  --rose-soft: #ffe4e6;
  --rose-ink: #9f1239;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --amber-ink: #92400e;
  --violet: #7c3aed;
  --sky: #0284c7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, .10);
  --shadow-lg: 0 30px 60px rgba(0, 0, 0, .10);
  --font-display: "Bricolage Grotesque", "Avenir Next", sans-serif;
  --font-body: "Geist", "Helvetica Neue", sans-serif;
  --font-mono: "Geist Mono", "SFMono-Regular", monospace;
  color-scheme: light;
}

.dark {
  --bg: #09090b;
  --bg-soft: #111113;
  --panel: rgba(24, 24, 27, .82);
  --panel-solid: #18181b;
  --panel-soft: #1c1c20;
  --text: #f4f4f5;
  --text-soft: #d4d4d8;
  --muted: #a1a1aa;
  --faint: #71717a;
  --line: #27272a;
  --line-strong: #3f3f46;
  --green: #22c55e;
  --green-strong: #16a34a;
  --green-bright: #4ade80;
  --green-soft: rgba(34, 197, 94, .13);
  --green-ink: #86efac;
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, .12);
  --rose-ink: #fda4af;
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, .12);
  --amber-ink: #fcd34d;
  --violet: #a78bfa;
  --sky: #38bdf8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, .45);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(34, 197, 94, .16), transparent 60%),
    radial-gradient(700px 480px at -10% 100%, rgba(16, 185, 129, .10), transparent 60%);
}

.dark body::before {
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(34, 197, 94, .12), transparent 60%),
    radial-gradient(700px 480px at -10% 100%, rgba(6, 95, 70, .18), transparent 60%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .55;
  background-image: radial-gradient(rgba(17, 24, 39, .10) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.dark .grain {
  background-image: radial-gradient(rgba(255, 255, 255, .10) 1px, transparent 1px);
  opacity: .4;
}

::selection { background: #bbf7d0; color: #14532d; }
.dark ::selection { background: #166534; color: #f0fdf4; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.05;
  margin: 0;
}

h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0; }
a { color: var(--green); }

code, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.micro, .eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint);
}

.eyebrow { color: var(--green); }

[hidden] { display: none !important; }

/* ── Brand ─────────────────────────────────────────────────────────────── */

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #22c55e, #059669);
  box-shadow: 0 8px 22px rgba(34, 197, 94, .28);
}

.brand-icon svg { width: 23px; height: 23px; }

.brand-copy { min-width: 0; }

.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1;
  white-space: nowrap;
}

.brand-name span { color: var(--text); }
.brand-name em { font-style: normal; color: var(--green); }
.dark .brand-name em { color: var(--green-bright); }

.brand-tag {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ── Shell ─────────────────────────────────────────────────────────────── */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(18px);
}

.dark .sidebar { background: rgba(9, 9, 11, .78); }

.sidebar-head { padding: 2px 8px 22px; border-bottom: 1px solid var(--line); }
.sidebar-sub {
  margin: 12px 0 0 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
}

.sidebar-section { flex: 1; padding-top: 18px; overflow-y: auto; }

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint);
}

.bot-list { display: grid; gap: 6px; }

.bot-list-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}

.bot-list-item:hover { background: var(--bg-soft); border-color: var(--line); }
.dark .bot-list-item:hover { background: rgba(255, 255, 255, .035); }

.bot-list-item.active {
  background: var(--green-soft);
  border-color: rgba(34, 197, 94, .24);
  box-shadow: 0 1px 2px rgba(22, 163, 74, .08);
}

.bot-list-name { font-weight: 700; font-size: 14px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-list-id { display: block; margin-top: 1px; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.bot-list-version { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 15px 8px 2px;
  border-top: 1px solid var(--line);
}

.operator { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }

.main { min-width: 0; padding: 0 32px 80px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  background: rgba(249, 250, 251, .78);
  backdrop-filter: blur(18px);
}

.dark .topbar { background: rgba(9, 9, 11, .78); }

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(34, 197, 94, .22);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-ink);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.live-clock { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }

.view {
  max-width: 1420px;
  margin: 0 auto;
  padding-top: 38px;
  animation: rise .45s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Theme switch ──────────────────────────────────────────────────────── */

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
}

.theme-switch button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}

.theme-switch button svg { width: 14px; height: 14px; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active {
  background: var(--panel-solid);
  color: var(--green-strong);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .10);
}
.dark .theme-switch button.active { color: var(--green-bright); box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }

/* ── Buttons / inputs ──────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s, border-color .18s, color .18s, transform .18s, box-shadow .18s;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible, .text-btn:focus-visible, .icon-btn:focus-visible, .theme-switch button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .25);
}

.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 20px rgba(22, 163, 74, .28);
}
.btn-primary:hover { background: var(--green-bright); box-shadow: 0 8px 30px rgba(22, 163, 74, .34); }
.dark .btn-primary { color: #052e16; }

.btn-secondary, .btn-ghost {
  background: var(--panel-solid);
  border-color: var(--line);
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover, .btn-ghost:hover { border-color: rgba(34, 197, 94, .5); color: var(--green-strong); background: var(--panel-solid); }
.dark .btn-secondary:hover, .dark .btn-ghost:hover { color: var(--green-bright); }

.btn-danger {
  background: var(--panel-solid);
  border-color: rgba(225, 29, 72, .24);
  color: var(--rose);
  box-shadow: var(--shadow-sm);
}
.btn-danger:hover { background: var(--rose-soft); border-color: rgba(225, 29, 72, .4); }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: 11px; border-radius: 10px; }
.btn-block { width: 100%; min-height: 46px; }
.btn-arrow { font-family: var(--font-mono); font-size: 14px; transition: transform .18s; }
.btn:hover .btn-arrow { transform: translateX(3px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.text-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .15s;
}
.text-btn:hover { color: var(--green); }

.icon-btn {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-solid);
  color: var(--green);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, background .15s, transform .15s;
}
.icon-btn:hover { border-color: rgba(34, 197, 94, .45); background: var(--green-soft); transform: translateY(-1px); }

.field { display: grid; gap: 8px; }
.field > span {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.field small { color: var(--faint); font-size: 11px; }

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-solid);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
  padding: 9px 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

input:hover, select:hover { border-color: var(--line-strong); }
input:focus, select:focus {
  outline: none;
  border-color: rgba(34, 197, 94, .65);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}

input[type="checkbox"] {
  width: 17px;
  height: 17px;
  min-height: 0;
  padding: 0;
  accent-color: var(--green);
  box-shadow: none;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 18px, calc(100% - 10px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.form-error { min-height: 18px; color: var(--rose); font-size: 12px; font-weight: 600; }

/* ── Panels / badges ───────────────────────────────────────────────────── */

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head .eyebrow { margin-bottom: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.badge.online, .badge.running {
  border-color: rgba(34, 197, 94, .24);
  background: var(--green-soft);
  color: var(--green-ink);
}
.badge.offline { color: var(--faint); }
.badge.paused, .badge.pending {
  border-color: rgba(217, 119, 6, .24);
  background: var(--amber-soft);
  color: var(--amber-ink);
}
.badge.live {
  border-color: rgba(225, 29, 72, .24);
  background: var(--rose-soft);
  color: var(--rose-ink);
}
.badge.stopping { color: var(--rose); }

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--faint);
}
.status-dot.online { background: var(--green); box-shadow: 0 0 0 0 rgba(34, 197, 94, .45); animation: pulse 2.4s infinite; }
.status-dot.paused { background: var(--amber); }
.status-dot.offline { background: var(--faint); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .40); }
  65% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ── Dashboard ─────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 36px;
  align-items: end;
  padding: 16px 0 36px;
}

.hero-title {
  margin: 12px 0 12px;
  font-size: clamp(3rem, 6vw, 5.4rem);
  line-height: .94;
  letter-spacing: -.06em;
}

.hero-title span {
  background: linear-gradient(90deg, var(--green-strong), var(--green-bright));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dark .hero-title span {
  background: linear-gradient(90deg, var(--green-bright), #86efac);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-note { max-width: 560px; color: var(--muted); font-size: 15px; font-weight: 500; line-height: 1.65; }

.hero-actions { display: flex; align-items: center; gap: 16px; margin-top: 24px; flex-wrap: wrap; }
.hero-hint { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }

.hero-panel {
  padding: 20px;
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(34, 197, 94, .16), transparent 70%),
    var(--panel);
}

.hero-panel-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-panel-value {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 26px 0 8px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.03em;
}
.hero-panel p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.hero-panel-foot {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.metric {
  position: relative;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  top: 20px;
  right: 20px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, .10);
}
.metric:nth-child(2)::after { background: var(--violet); box-shadow: 0 0 0 5px rgba(124, 58, 237, .10); }
.metric:nth-child(3)::after { background: var(--sky); box-shadow: 0 0 0 5px rgba(2, 132, 199, .10); }
.metric:nth-child(4)::after { background: var(--amber); box-shadow: 0 0 0 5px rgba(217, 119, 6, .10); }

.metric-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--faint);
}
.metric-value {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 2.05rem;
  font-weight: 800;
  letter-spacing: -.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.metric-unit { margin-left: 4px; font-family: var(--font-mono); font-size: .8rem; font-weight: 600; color: var(--muted); }
.metric-sub { margin-top: 6px; font-family: var(--font-mono); font-size: 9px; color: var(--faint); }
.metric-value.positive { color: var(--green-strong); }
.metric-value.negative { color: var(--rose); }
.metric-value.muted { color: var(--muted); }
.dark .metric-value.positive { color: var(--green-bright); }

.bot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.bot-card {
  position: relative;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(460px 190px at 100% 0%, rgba(34, 197, 94, .055), transparent 65%),
    var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  animation: rise .45s cubic-bezier(.16, 1, .3, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.bot-card:hover { transform: translateY(-3px); border-color: rgba(34, 197, 94, .34); box-shadow: var(--shadow-md); }
.bot-card::after {
  content: "↗";
  position: absolute;
  top: 20px;
  right: 22px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 13px;
}

.bot-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-right: 24px; }
.bot-card h3 { font-size: 1.55rem; letter-spacing: -.045em; }
.bot-card-id { margin-top: 3px; font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.bot-card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 15px; }

.bot-card-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 22px; }
.bot-card-metric { padding: 10px 11px; border-radius: 14px; background: var(--panel-soft); border: 1px solid var(--line); }
.bot-card-metric .micro { margin-bottom: 5px; font-size: 8px; }
.bot-card-metric strong { font-family: var(--font-mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bot-card-metric strong.positive { color: var(--green-strong); }
.bot-card-metric strong.negative { color: var(--rose); }

.bot-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--faint);
}

.empty-state { padding: 54px 40px; text-align: left; }
.empty-state h2 { margin: 8px 0 10px; font-size: 2.4rem; }
.empty-state p:not(.eyebrow) { max-width: 520px; margin-bottom: 24px; color: var(--muted); }

/* ── Bot detail ────────────────────────────────────────────────────────── */

.back-btn { display: inline-flex; margin-bottom: 18px; }

.bot-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 26px;
}
.bot-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.bot-title-row h1 { font-size: clamp(2.6rem, 5vw, 4.3rem); letter-spacing: -.055em; }
#bot-subtitle { margin-top: 10px; }
.bot-head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.bot-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 14px; align-items: start; }
.bot-main { min-width: 0; display: grid; gap: 14px; }
.bot-main > *, .bot-side > * { min-width: 0; }
.bot-side { display: grid; gap: 14px; }

.strategies-panel { min-width: 0; }
.strategy-list { display: grid; }

.strategy-card {
  padding: 14px 20px 16px;
  border-top: 1px solid var(--line);
}
.strategy-card:first-child { border-top: 0; }
.strategy-card:hover { background: rgba(34, 197, 94, .025); }
.dark .strategy-card:hover { background: rgba(255, 255, 255, .02); }

.strategy-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.strategy-toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.strategy-toggle input { flex: none; }
.strategy-state {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--green-strong);
}
.dark .strategy-state { color: var(--green-bright); }
.strategy-toggle input:not(:checked) ~ .strategy-state { color: var(--amber-ink); }

.strategy-name { font-weight: 600; }
.strategy-name:disabled {
  color: var(--muted);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding-left: 0;
}

.strategy-fields {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px 10px;
}
.strategy-field { display: grid; gap: 4px; min-width: 0; }
.strategy-field > span {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
.strategy-field input, .strategy-field select {
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 11px;
}
.strategy-field select { padding-right: 22px; background-position: calc(100% - 13px) 12px, calc(100% - 8px) 12px; }
.strategy-empty { padding: 20px 20px 24px; }

.strategy-card .row-remove {
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 17px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.strategy-card .row-remove:hover { color: var(--rose); background: var(--rose-soft); }

.panel-note { padding: 13px 22px 18px; color: var(--faint); font-size: 11px; line-height: 1.6; }

.settings-panel .form-grid { padding: 20px 22px 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px 12px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-md);
}
.dark .save-bar { background: rgba(24, 24, 27, .92); }
.save-bar > div { display: flex; gap: 8px; }
.save-bar.dirty { border-color: rgba(217, 119, 6, .45); }
.save-bar.dirty #save-state { color: var(--amber); }

.status-list { margin: 0; padding: 16px 22px 18px; display: grid; gap: 0; }
.status-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.status-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.status-list dt {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
.status-list dd { margin: 0; max-width: 190px; font-family: var(--font-mono); font-size: 11px; text-align: right; color: var(--text-soft); word-break: break-word; }
.status-list dd.negative { color: var(--rose); }
.status-list dd.positive { color: var(--green-strong); }
.dark .status-list dd.positive { color: var(--green-bright); }

.version-list, .audit-list { padding: 8px 22px 16px; display: grid; max-height: 330px; overflow-y: auto; }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.version-row:last-child { border-bottom: 0; }
.version-row .mono { font-size: 11px; font-weight: 600; }
.version-row .micro { margin-top: 2px; color: var(--faint); }
.version-row button { font-size: 9px; }

.audit-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.audit-row:last-child { border-bottom: 0; }
.audit-action { font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--green-strong); }
.dark .audit-action { color: var(--green-bright); }
.audit-meta { margin-top: 2px; font-family: var(--font-mono); font-size: 9px; color: var(--faint); }

/* ── New bot ───────────────────────────────────────────────────────────── */

.new-bot-head { max-width: 720px; padding: 16px 0 28px; }
.new-bot-head h1 { margin: 10px 0 14px; font-size: clamp(2.9rem, 6vw, 5rem); letter-spacing: -.06em; }
.new-bot-head p:not(.eyebrow) { max-width: 650px; color: var(--muted); line-height: 1.65; }
.new-bot-head code { padding: 2px 6px; border-radius: 6px; background: var(--green-soft); color: var(--green-ink); font-size: .88em; }
.new-bot-form { max-width: 880px; padding: 24px; }
.new-bot-form .form-grid { padding: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ── Bets ledger ────────────────────────────────────────────────────────── */

.bets-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0 24px;
  flex-wrap: wrap;
}

.bets-title { margin: 10px 0 10px; font-size: clamp(3rem, 6vw, 5rem); letter-spacing: -.06em; }
.bets-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.bets-date, .bets-bot {
  width: auto;
  min-height: 34px;
  padding: 5px 9px;
  border-radius: 10px;
  font-size: 11px;
}
.bets-date { width: 150px; }
.bets-bot { width: 150px; }

.bets-panel { overflow: hidden; }
.bets-panel .table-wrap { overflow-x: auto; scrollbar-width: thin; }
.bets-panel .table-wrap::-webkit-scrollbar { height: 9px; }
.bets-panel .table-wrap::-webkit-scrollbar-track { background: transparent; }
.bets-panel .table-wrap::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
.bets-table { width: 100%; min-width: 640px; border-collapse: collapse; table-layout: fixed; }
.bets-table th:nth-child(1) { width: 6%; }
.bets-table th:nth-child(2) { width: 25%; }
.bets-table th:nth-child(3) { width: 19%; }
.bets-table th:nth-child(4) { width: 5%; }
.bets-table th:nth-child(5) { width: 7%; }
.bets-table th:nth-child(6) { width: 9%; }
.bets-table th:nth-child(7) { width: 11%; }
.bets-table th:nth-child(8) { width: 8%; }
.bets-table th:nth-child(9) { width: 10%; }
.bets-table th {
  padding: 10px 7px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  text-align: left;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
.bets-table td { padding: 10px 7px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 11px; }
.bets-table tr:last-child td { border-bottom: 0; }
.bets-table tbody tr:hover td { background: rgba(34, 197, 94, .035); }
.bets-table .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.bets-table .positive { color: var(--green-strong); }
.bets-table .negative { color: var(--rose); }
.dark .bets-table .positive { color: var(--green-bright); }
.bets-table .match-cell { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.bets-table .match-score { font-family: var(--font-mono); color: var(--green-strong); }
.dark .bets-table .match-score { color: var(--green-bright); }
.bets-table .strategy-cell { min-width: 0; color: var(--muted); font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.bets-table .time-cell { color: var(--faint); font-family: var(--font-mono); font-size: 9px; white-space: nowrap; }
.bets-table .muted { color: var(--faint); }

.bets-table .odds-cell { white-space: nowrap; }
.odds-stack { display: inline-grid; gap: 2px; text-align: right; }
.odds-line { font-size: 10px; line-height: 1.25; }
.odds-line .odds-label {
  margin-right: 3px;
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
}
.odds-line.matched-value { color: var(--green-strong); }
.dark .odds-line.matched-value { color: var(--green-bright); }

.bets-table .status-cell { text-align: left; }
.status-label { display: block; line-height: 1.3; }
.status-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }

.bet-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.bet-tag.betfair { border-color: rgba(34, 197, 94, .25); background: var(--green-soft); color: var(--green-ink); }
.bet-tag.unmatched { border-color: rgba(217, 119, 6, .25); background: var(--amber-soft); color: var(--amber-ink); }
.bet-tag.paper { border-color: var(--line); color: var(--faint); }

.outcome-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--amber-soft);
  color: var(--amber-ink);
}
.outcome-badge.won { background: var(--green-soft); color: var(--green-ink); }
.outcome-badge.lost { background: var(--rose-soft); color: var(--rose-ink); }
.outcome-badge.void { background: var(--panel-soft); color: var(--muted); }
.outcome-badge.pending { background: var(--amber-soft); color: var(--amber-ink); }

/* ── Login ─────────────────────────────────────────────────────────────── */

.login-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.login-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }

.login-blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(110px);
}
.login-blob-a { top: -12%; right: -6%; width: 52%; height: 55%; background: rgba(187, 247, 208, .55); }
.login-blob-b { bottom: -18%; left: -10%; width: 44%; height: 50%; background: rgba(209, 250, 229, .55); }
.dark .login-blob-a { background: rgba(6, 78, 59, .45); }
.dark .login-blob-b { background: rgba(6, 95, 70, .28); }

.login-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(17, 24, 39, .10) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at center, black, transparent 78%);
  opacity: .5;
}
.dark .login-grid { background-image: radial-gradient(rgba(255, 255, 255, .10) 1px, transparent 1px); opacity: .4; }

.login-header {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  animation: rise .6s cubic-bezier(.16, 1, .3, 1) both;
}

.login-center { flex: 1; display: grid; place-items: center; padding: 24px 20px 64px; }

.login-card {
  width: min(460px, 100%);
  padding: 34px;
  border-radius: 28px;
  border-color: rgba(255, 255, 255, .8);
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow-lg);
  animation: rise .6s .1s cubic-bezier(.16, 1, .3, 1) both;
}
.dark .login-card { border-color: var(--line-strong); background: rgba(24, 24, 27, .84); }

.login-card-head { margin-bottom: 26px; }
.login-card-head h1 { margin: 8px 0 10px; font-size: 2.15rem; letter-spacing: -.05em; }
.login-card-head p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-card form { display: grid; gap: 15px; }
.login-card .btn { margin-top: 4px; }
.login-foot { margin-top: 22px; text-align: center; font-family: var(--font-mono); font-size: 9px; color: var(--faint); line-height: 1.6; }

/* ── Toast / modal ─────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  max-width: 430px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 14px;
  background: var(--panel-solid);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-left-color: var(--rose); }
.toast.warn { border-left-color: var(--amber); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 9, 11, .58);
  backdrop-filter: blur(8px);
}
.modal-panel { position: relative; width: min(640px, 100%); padding: 30px; border-radius: 26px; background: var(--panel-solid); box-shadow: var(--shadow-lg); }
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal h2 { margin: 6px 0 12px; font-size: 1.9rem; letter-spacing: -.045em; }
.modal p:not(.eyebrow) { margin-bottom: 14px; color: var(--muted); line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

.token-box {
  display: block;
  width: 100%;
  margin: 12px 0;
  padding: 13px;
  border: 1px dashed rgba(34, 197, 94, .45);
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
  user-select: all;
}
.command-box {
  display: block;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero-side { max-width: 520px; }
  .bot-layout { grid-template-columns: 1fr; }
  .bot-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bot-side > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-section { max-height: 200px; }
  .main { padding: 0 18px 60px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bot-grid { grid-template-columns: 1fr; }
  .bot-head { flex-direction: column; align-items: flex-start; }
  .bot-head-actions { justify-content: flex-start; }
  .bets-head { align-items: flex-start; flex-direction: column; }
  .bot-side { grid-template-columns: 1fr; }
  .login-header { padding: 20px; }
  .login-card { padding: 28px; }
  .live-clock { display: none; }
}

@media (max-width: 620px) {
  .metric-grid, .form-grid, .bot-card-metrics { grid-template-columns: 1fr; }
  .hero-title { font-size: 3.2rem; }
  .hero { gap: 20px; }
  .topbar-actions { gap: 6px; }
  .live-pill { display: none; }
  .bot-title-row h1 { font-size: 2.7rem; }
  .save-bar { flex-direction: column; align-items: stretch; }
  .save-bar > div { justify-content: flex-end; }
  .panel-head { flex-direction: column; }
  .modal-panel { padding: 22px; }
  .login-card-head h1 { font-size: 1.85rem; }
  .new-bot-form { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
