* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
}

a { color: #818cf8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Nav */
.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 32px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: #e2e8f0;
  text-decoration: none;
}

.nav-brand img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.nav-links {
  display: flex;
  gap: 16px;
  margin-left: auto;
}

.nav-links a {
  color: #94a3b8;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: #334155;
  color: #e2e8f0;
  text-decoration: none;
}

.nav-links button {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-links button:hover {
  background: #334155;
  color: #e2e8f0;
}

/* Layout */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
}

.page-title {
  font-size: 1.5rem;
  margin-bottom: 24px;
}

/* Cards */
.card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 1.15rem;
  margin-bottom: 16px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #334155;
  font-size: 0.95rem;
}

.card-row:last-child {
  border-bottom: none;
}

.card-row .label {
  color: #94a3b8;
}

.card-row .value {
  font-weight: 500;
}

/* Plan cards grid */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.plan-card {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 28px 24px;
  text-align: center;
  transition: border-color 0.2s;
}

.plan-card:hover {
  border-color: #818cf8;
}

.plan-card.current {
  border-color: #22c55e;
}

.plan-card h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.plan-card .price {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.plan-card .price-note {
  color: #94a3b8;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.plan-card ul {
  list-style: none;
  text-align: left;
  margin-bottom: 20px;
}

.plan-card ul li {
  padding: 6px 0;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.plan-card ul li::before {
  content: "\2713  ";
  color: #22c55e;
  font-weight: 700;
}

.plan-badge {
  display: inline-block;
  background: #22c55e;
  color: #0f172a;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.plan-status {
  text-align: left;
  background: #0f172a;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.plan-status-row {
  font-size: 0.85rem;
  color: #94a3b8;
  padding: 2px 0;
}

.plan-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: #818cf8;
  color: #fff;
}

.btn-success {
  background: #22c55e;
  color: #fff;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid #475569;
  color: #e2e8f0;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  border-bottom: 1px solid #334155;
}

td {
  padding: 12px;
  border-bottom: 1px solid #1e293b;
  font-size: 0.9rem;
}

tr:hover td {
  background: rgba(255,255,255,0.02);
}

.member-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-cell img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
select {
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

input:focus,
select:focus {
  border-color: #818cf8;
}

/* Inline form row */
.form-inline {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.form-inline .form-group {
  flex: 1;
  margin-bottom: 0;
}

.form-inline .btn {
  flex-shrink: 0;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-active {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
}

.badge-trialing {
  background: rgba(129,140,248,0.15);
  color: #818cf8;
}

.badge-free {
  background: rgba(148,163,184,0.15);
  color: #94a3b8;
}

.badge-canceled {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}

.badge-admin {
  background: rgba(251,191,36,0.15);
  color: #fbbf24;
}

.badge-member {
  background: rgba(148,163,184,0.15);
  color: #94a3b8;
}

.badge-warning {
  background: rgba(234,179,8,0.15);
  color: #eab308;
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  vertical-align: middle;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #334155;
  border-radius: 22px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #94a3b8;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: #6366f1;
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #fff;
}

/* Toast */
.toast {
  position: fixed;
  top: 72px;
  right: 20px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.toast-success { border-left: 3px solid #22c55e; }
.toast-error { border-left: 3px solid #ef4444; }
.toast-info { border-left: 3px solid #818cf8; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

.modal h3 {
  font-size: 1.15rem;
  margin-bottom: 12px;
}

.modal p {
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Login page */
.login-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  text-align: center;
  max-width: 400px;
  padding: 48px 32px;
}

.login-box img {
  width: 80px;
  height: auto;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.3));
}

.login-box h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.login-box p {
  color: #94a3b8;
  margin-bottom: 28px;
  line-height: 1.5;
}

.btn-github {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #f0f6fc;
  color: #1e293b;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-github:hover {
  opacity: 0.9;
  text-decoration: none;
}

.btn-github svg {
  width: 20px;
  height: 20px;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #1e293b;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  width: 100%;
  justify-content: center;
}

.btn-google:hover {
  opacity: 0.9;
  text-decoration: none;
}

.btn-google svg {
  width: 20px;
  height: 20px;
}

.login-form {
  text-align: left;
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  color: #94a3b8;
  font-size: 0.85rem;
  margin-bottom: 6px;
  font-weight: 500;
}

.login-form input[type="email"],
.login-form input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.95rem;
  margin-bottom: 14px;
  box-sizing: border-box;
}

.login-form input:focus {
  outline: none;
  border-color: #6366f1;
}

.btn-primary-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #6366f1;
  color: #fff;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  width: 100%;
}

.btn-primary-login:hover {
  opacity: 0.9;
}

.btn-magic-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: #6366f1;
  padding: 10px 28px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid #6366f1;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  width: 100%;
}

.btn-magic-link:hover {
  background: rgba(99, 102, 241, 0.1);
}

.btn-passkey {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: #94a3b8;
  padding: 10px 28px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid #334155;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  width: 100%;
}

.btn-passkey:hover {
  border-color: #94a3b8;
  color: #f8fafc;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: #64748b;
  font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #334155;
}

.login-links {
  margin-top: 16px;
  font-size: 0.85rem;
  color: #64748b;
}

.login-links a {
  color: #6366f1;
  text-decoration: none;
}

.login-links a:hover {
  text-decoration: underline;
}

.login-oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}

.login-box .btn-github {
  width: 100%;
  justify-content: center;
}

/* Loading */
.loading {
  text-align: center;
  padding: 48px;
  color: #94a3b8;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 32px;
  color: #64748b;
}

/* Responsive */
@media (max-width: 600px) {
  .nav {
    padding: 12px 16px;
    gap: 12px;
    flex-wrap: wrap;
  }

  .nav-links {
    gap: 8px;
  }

  .container {
    padding: 24px 16px;
  }

  .form-inline {
    flex-direction: column;
  }

  .plan-grid {
    grid-template-columns: 1fr;
  }
}

/* Rodauth form compatibility — map Bootstrap classes to dark theme */
.login-box .form-group {
  margin-bottom: 14px;
  text-align: left;
}

.login-box .form-label {
  display: block;
  color: #94a3b8;
  font-size: 0.85rem;
  margin-bottom: 6px;
  font-weight: 500;
}

.login-box .form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.login-box .form-control:focus {
  outline: none;
  border-color: #6366f1;
}

.login-box .form-control-plaintext {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #94a3b8;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.login-box .form-control.is-invalid {
  border-color: #ef4444;
}

.login-box .invalid-feedback {
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 4px;
  display: block;
}

.login-box .btn.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #6366f1;
  color: #fff;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.15s;
}

.login-box .btn.btn-primary:hover {
  opacity: 0.9;
}

.login-box .mb-3 {
  margin-bottom: 14px;
}

.login-box ul {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  text-align: left;
}

.login-box ul li {
  padding: 4px 0;
}

.login-box ul li a {
  color: #6366f1;
  text-decoration: none;
}

.login-box ul li a:hover {
  text-decoration: underline;
}

.login-box h2 {
  font-size: 1.1rem;
  color: #94a3b8;
  margin-top: 16px;
  margin-bottom: 8px;
}

.d-none {
  display: none;
}
