:root {
  --bg: #0f1420;
  --surface: #161d2e;
  --surface-2: #1d2740;
  --border: #2a3550;
  --text: #e7ebf5;
  --text-muted: #9aa5bd;
  --accent: #5b8cff;
  --accent-hover: #4676ec;
  --danger: #ef5a6f;
  --danger-hover: #d8465b;
  --success: #3fcf8e;
  --warn: #f0b94a;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---- Auth page ---- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.auth-card h1 {
  font-size: 1.25rem;
  margin: 0 0 4px;
}

.auth-card .sub {
  color: var(--text-muted);
  margin: 0 0 24px;
  font-size: 0.9rem;
}

form label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
}

input:focus {
  outline: none;
  border-color: var(--accent);
}

.error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 8px 0 0;
}

/* ---- Buttons ---- */
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 500;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}
.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-small {
  padding: 6px 10px;
  font-size: 0.8rem;
  margin-right: 6px;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-hover);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
}
.icon-btn:hover {
  color: var(--accent);
}

/* ---- Topbar / layout ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

/* ---- Table ---- */
.token-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.token-table th,
.token-table td {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}

.token-table th {
  color: var(--text-muted);
  font-weight: 500;
  background: var(--surface-2);
}

.token-table tbody tr:last-child td {
  border-bottom: none;
}

.token-cell code,
.token-reveal code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
  background: var(--surface-2);
  padding: 4px 6px;
  border-radius: 6px;
  word-break: break-all;
}

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

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-active {
  background: rgba(63, 207, 142, 0.15);
  color: var(--success);
}
.badge-paused {
  background: rgba(240, 185, 74, 0.15);
  color: var(--warn);
}

.actions-cell {
  white-space: nowrap;
}

/* ---- Toast ---- */
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}
.toast-error {
  border-color: var(--danger);
  color: var(--danger);
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.modal h2 {
  margin: 0 0 16px;
  font-size: 1.05rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.hint {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: -4px 0 16px;
}

.token-reveal {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.token-reveal code {
  flex: 1;
}

@media (max-width: 640px) {
  .container {
    padding: 16px;
  }
  .token-table,
  .token-table thead {
    display: block;
    overflow-x: auto;
  }
}
