:root {
  --bg: #0f1419;
  --card: #1a2332;
  --text: #e7ecf3;
  --muted: #8b98a5;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --error: #ef4444;
  --success: #22c55e;
  --border: #2d3a4d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container { max-width: 960px; margin: 0 auto; padding: 1.5rem; }
.header { border-bottom: 1px solid var(--border); background: var(--card); }
.header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.header nav { display: flex; gap: 1rem; align-items: center; }
.header a { color: var(--muted); text-decoration: none; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.card.narrow { max-width: 420px; margin: 2rem auto; }
.card.info { border-color: #1e40af; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .grid.two { grid-template-columns: 1fr; } }

h1 { margin-top: 0; font-size: 1.5rem; }
h2 { margin-top: 0; font-size: 1.1rem; }
.muted { color: var(--muted); font-size: 0.9rem; }

label { display: block; margin-bottom: 1rem; }
input[type="text"], input[type="email"], input[type="password"] {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.6rem 0.75rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
}

button, .btn {
  display: inline-block; padding: 0.6rem 1rem; background: var(--accent); color: white;
  border: none; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 0.95rem;
}
button:hover, .btn:hover { background: var(--accent-hover); }
.btn-danger { background: var(--error); font-size: 0.8rem; padding: 0.3rem 0.6rem; }

.alert { padding: 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert.error { background: rgba(239,68,68,0.15); border: 1px solid var(--error); }
.alert.inactive { background: rgba(245,158,11,0.2); border: 1px solid #f59e0b; }
.alert.inactive strong { display: block; margin-bottom: 0.35rem; font-size: 1.05rem; }
.alert.inactive p { margin: 0; }
.alert.success { background: rgba(34,197,94,0.15); border: 1px solid var(--success); }

code { background: var(--bg); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85rem; }
code.token { display: block; word-break: break-all; padding: 0.75rem; margin-top: 0.5rem; }

.token-list { list-style: none; padding: 0; }
.token-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }

a { color: var(--accent); }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge.admin { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.badge.ok { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.badge.muted { background: rgba(139, 152, 165, 0.2); color: var(--muted); }

.grid.stats { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.stat-value { font-size: 2rem; font-weight: 700; margin: 0.25rem 0 0; }
.action-list { margin: 0; padding-left: 1.25rem; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { text-align: left; padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 600; }
.data-table .actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.data-table .actions form { display: inline-flex; gap: 0.25rem; margin: 0; }
.data-table .reset-form input { width: 120px; margin: 0; padding: 0.35rem 0.5rem; font-size: 0.8rem; }

.inline-form { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 0.75rem; align-items: end; }
@media (max-width: 800px) { .inline-form { grid-template-columns: 1fr; } }
label.checkbox { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0; }
label.checkbox input { width: auto; margin: 0; }

.btn-secondary {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
