/* SpiritVale Bot — License Admin Portal
   Palette: Black + Sky Blue, matching the desktop GUI
   (docs/superpowers/specs/2026-07-18-theme-decision.md) */

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-2: #161616;
  --border: #1c1c1c;
  --accent: #38bdf8;
  --accent-dark: #02202e;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #5a5a5a;
  --warning: #fbbf24;
  --error: #f87171;
  --success: #34d399;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Consolas", "SFMono-Regular", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
  color: inherit;
}

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

/* ---------------- Layout shells ---------------- */

.screen {
  min-height: 100vh;
}

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#app-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------------- Brand ---------------- */

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand h1 {
  font-size: 20px;
  margin: 0;
}

.brand strong {
  display: block;
  font-size: 15px;
}

.brand .tagline {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 10px;
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

.brand-compact .brand-mark {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

/* ---------------- Login card ---------------- */

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-card .brand {
  margin-bottom: 4px;
}

/* ---------------- Form fields ---------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.field.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.field.checkbox-field input {
  width: auto;
}

.field input,
.field select,
.field textarea,
.input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
  border-color: var(--accent);
}

.field small {
  color: var(--text-muted);
  font-size: 11px;
}

.field textarea {
  resize: vertical;
  font-family: inherit;
}

/* ---------------- Buttons ---------------- */

.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(1.15);
}

.btn:active {
  filter: brightness(0.95);
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.btn-accent {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-danger {
  background: transparent;
  border-color: var(--error);
  color: var(--error);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* ---------------- Top bar / tabs ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.is-active {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ---------------- Content ---------------- */

.content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar .input {
  min-width: 220px;
}

.spacer {
  flex: 1;
}

.panel-note {
  color: var(--text-muted);
  font-size: 12px;
  margin: 0;
}

.panel-note code {
  color: var(--text-secondary);
}

/* ---------------- Table ---------------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.col-actions {
  text-align: right;
}

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

.mono {
  font-family: var(--mono);
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.cell-muted {
  color: var(--text-muted);
}

.cell-note {
  color: var(--text-secondary);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expiry-relative {
  display: block;
}

.expiry-absolute {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
}

.expiry-warning .expiry-relative {
  color: var(--warning);
}

/* ---------------- Status badges ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-active {
  color: var(--success);
  background: rgba(52, 211, 153, 0.12);
}

.badge-expired {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.12);
}

.badge-revoked {
  color: var(--error);
  background: rgba(248, 113, 113, 0.12);
}

/* ---------------- Modals ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

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

.modal {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-sm {
  max-width: 360px;
}

.modal h2 {
  margin: 0 0 18px;
  font-size: 17px;
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.warning-banner {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--warning);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin: 0 0 14px;
}

.key-reveal {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.key-reveal code {
  flex: 1;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.03em;
  color: var(--accent);
  word-break: break-all;
}

/* ---------------- Misc ---------------- */

.error-text {
  color: var(--error);
  font-size: 12px;
  margin: 0;
}

.hint {
  color: var(--text-muted);
  font-size: 11px;
  margin: 0;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.toast[hidden] {
  display: none;
}

.toast.toast-error {
  border-color: var(--error);
  color: var(--error);
}
