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

:root {
  --bg: #0F1A17;
  --surface: #16221E;
  --surface-2: #1C2A24;
  --border: #263A32;
  --text: #EAF2EE;
  --text-muted: #8FA69C;
  --accent: #3ECF8E;
  --accent-dim: #2A9D6C;
  --amber: #F2A93B;
  --danger: #E5646A;
  --radius-sm: 6px;
  --radius-md: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  margin: 0 0 0.4em 0;
  letter-spacing: -0.01em;
}

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

p { color: var(--text-muted); max-width: 60ch; }

/* ---------- Auth screens ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 10%, rgba(62, 207, 142, 0.10), transparent 40%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 36px 32px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #06231A; font-weight: 700; font-family: 'Space Grotesk', sans-serif;
}

.auth-brand span { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 17px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px;
}
input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
}
textarea { resize: vertical; min-height: 90px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent);
  color: #06231A;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
}
.btn:hover { background: var(--accent-dim); text-decoration: none; }
.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: auto;
}
.btn.danger { background: var(--danger); color: #2B0709; }
.btn.small { width: auto; padding: 7px 12px; font-size: 13px; }

.error-banner {
  background: rgba(229, 100, 106, 0.12);
  border: 1px solid rgba(229, 100, 106, 0.4);
  color: #FFB4B8;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.helper-text { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 20px 10px;
}
.sidebar .brand .mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #06231A; font-weight: 700; font-family: 'Space Grotesk', sans-serif; font-size: 13px;
}
.sidebar .brand span { font-family: 'Space Grotesk', sans-serif; font-weight: 600; }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-link.active { background: var(--surface-2); color: var(--accent); }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.sidebar-footer form { width: 100%; }
.sidebar-footer .btn.secondary { width: 100%; }

.main {
  flex: 1;
  padding: 28px 36px;
  max-width: 1100px;
}

.page-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 24px;
}
.page-header .btn { width: auto; }

/* ---------- Stat strip ---------- */
.stat-strip {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 28px;
}
.stat {
  flex: 1;
  padding: 18px 20px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.stat:last-child { border-right: none; }
.stat .value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}
.stat .label { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; color: var(--text-muted);
  font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
tr:last-child td { border-bottom: none; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}
.badge.connected, .badge.sent, .badge.completed, .badge.active { background: rgba(62,207,142,0.15); color: var(--accent); }
.badge.qr, .badge.pending, .badge.scheduled, .badge.running { background: rgba(242,169,59,0.15); color: var(--amber); }
.badge.disconnected, .badge.failed, .badge.logged_out, .badge.suspended { background: rgba(229,100,106,0.15); color: var(--danger); }
.badge.draft, .badge.paused { background: var(--surface-2); color: var(--text-muted); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 20px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---------- QR box ---------- */
.qr-box {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 30px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); text-align: center;
}
.qr-box img { width: 220px; height: 220px; background: #fff; padding: 10px; border-radius: 8px; }

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

.section-title {
  font-size: 13px; text-transform: none; color: var(--text-muted);
  margin: 28px 0 10px 0;
}

.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; flex: 1; min-width: 160px; }

@media (max-width: 800px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
  .sidebar-footer { display: none; }
  .two-col { grid-template-columns: 1fr; }
  .main { padding: 20px; }
}
