@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0f1420;
  --panel: #161d2e;
  --panel-2: #1c2438;
  --border: #2a3350;
  --text: #e8ecf4;
  --muted: #8891a7;
  --accent: #4fd1c5;
  --accent-dim: #2e5a56;
  --warn: #f2b84f;
  --danger: #e0605a;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(79, 209, 197, 0.06), transparent 45%),
    var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, .brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
}
.login-card .eyebrow {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.login-card h1 {
  font-size: 22px;
  margin: 0 0 22px 0;
}
.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(22, 29, 46, 0.6);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  color: var(--text);
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a { color: var(--muted); font-size: 13px; }
.nav-links a.active { color: var(--accent); }
.nav-links .logout { color: var(--danger); }

.container { max-width: 960px; margin: 0 auto; padding: 32px 28px 80px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-head h1 { font-size: 24px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.panel h2 { font-size: 15px; margin: 0 0 16px 0; color: var(--text); }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(79, 209, 197, 0.03); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

input[type=text], input[type=password], textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 10px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13.5px;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 70px; }
label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  margin-top: 14px;
}
label:first-child { margin-top: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #08201d;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-danger { background: var(--danger); color: #2a0a08; }
.btn-block { width: 100%; justify-content: center; margin-top: 20px; }
.btn-sm { padding: 6px 10px; font-size: 12px; }

.form-inline { display: flex; gap: 8px; }
.form-inline > * { flex: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 100px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.03em;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.badge.on { background: rgba(79,209,197,0.12); color: var(--accent); }
.badge.on .dot { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.badge.off { background: rgba(136,145,167,0.12); color: var(--muted); }
.badge.off .dot { background: var(--muted); }
.badge.status-sent { background: rgba(79,209,197,0.12); color: var(--accent); }
.badge.status-failed { background: rgba(224,96,90,0.12); color: var(--danger); }

.actions-row { display: flex; gap: 8px; align-items: center; }

.rule-row textarea { min-height: 44px; }

code, .mono { font-family: 'IBM Plex Mono', monospace; }
.media-id { color: var(--muted); font-size: 12px; }

.rule-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--panel-2);
}
.rule-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.keyword-tag {
  font-family: 'IBM Plex Mono', monospace;
  background: rgba(79,209,197,0.1);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 13px;
}

.pattern-row {
  display: flex;
  gap: 3px;
}
.pattern-square {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.pattern-square.buy {
  background: var(--accent);
}
.pattern-square.sell {
  background: var(--danger);
  opacity: 0.75;
}
