:root {
  --ink: #0a0c16;
  --muted: #5c6175;
  --line: rgba(16, 18, 45, 0.10);
  --line-soft: rgba(16, 18, 45, 0.06);
  --indigo: #4b1fe6;
  --teal: #11b3a6;
  --bg: #ffffff;
  --bg-alt: #fafafc;
  --danger: #d92d20;
  --success: #067647;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Nav */
.nav-shell { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,0.72); backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line-soft); }
nav { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; max-width: 1080px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.nav-back { font-size: 0.94rem; color: var(--muted); }
.nav-back:hover { color: var(--ink); text-decoration: none; }

/* Auth card layout */
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-head { text-align: center; margin-bottom: 32px; }
.auth-head .logo { width: 52px; height: 52px; border-radius: 13px; margin: 0 auto 18px; display: block; }
.auth-head h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.auth-head p { color: var(--muted); margin-top: 8px; font-size: 0.98rem; }

.card { border: 1px solid var(--line); border-radius: 18px; padding: 32px; background: #fff; box-shadow: 0 24px 60px -40px rgba(16,18,45,0.30); }

/* Fields */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.85rem; font-weight: 650; margin-bottom: 7px; color: var(--ink); }
.field input {
  width: 100%; font-size: 1rem; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 11px; background: #fff;
  color: var(--ink); transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.field input:focus { outline: none; border-color: rgba(75,31,230,0.55); box-shadow: 0 0 0 4px rgba(75,31,230,0.10); }
.field input[readonly] { background: var(--bg-alt); color: var(--muted); cursor: default; }
.field input[readonly]:focus { border-color: var(--line); box-shadow: none; }
.field .hint { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; }
.field-row a { font-size: 0.82rem; font-weight: 600; }

/* Two fields side by side (e.g. first / last name) */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-grid .field { margin-bottom: 0; }
@media (max-width: 480px) { .field-grid { grid-template-columns: 1fr; gap: 0; } .field-grid .field { margin-bottom: 18px; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: var(--ink); color: #fff; font-weight: 650; font-size: 1rem;
  padding: 13px 20px; border-radius: 12px; border: none; cursor: pointer;
  transition: transform .15s ease, opacity .15s ease; font-family: inherit;
}
.btn:hover { transform: translateY(-1px); opacity: 0.92; }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-indigo { background: var(--indigo); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg-alt); opacity: 1; }
.btn-danger-ghost { background: #fff; color: var(--danger); border: 1px solid rgba(217,45,32,0.35); }
.btn-danger-ghost:hover { background: rgba(217,45,32,0.05); opacity: 1; }

/* Messages */
.msg { font-size: 0.9rem; padding: 11px 14px; border-radius: 10px; margin-bottom: 18px; display: none; }
.msg.show { display: block; }
.msg.error { background: rgba(217,45,32,0.08); color: var(--danger); border: 1px solid rgba(217,45,32,0.2); }
.msg.success { background: rgba(6,118,71,0.08); color: var(--success); border: 1px solid rgba(6,118,71,0.2); }

.auth-alt { text-align: center; margin-top: 22px; color: var(--muted); font-size: 0.92rem; }

/* Divider */
.divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: var(--muted); font-size: 0.82rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Account page */
.account-wrap { flex: 1; max-width: 720px; margin: 0 auto; width: 100%; padding: 48px 24px 80px; }
.account-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.account-head h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 800; letter-spacing: -0.025em; }
.account-email { color: var(--muted); margin-top: 4px; }
.panel { border: 1px solid var(--line); border-radius: 16px; padding: 26px 28px; margin-top: 24px; background: #fff; }
.panel h2 { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; }
.panel .sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 18px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.row:first-of-type { border-top: none; }
.row .k { color: var(--muted); font-size: 0.92rem; }
.row .v { font-weight: 600; }

.badge { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem; font-weight: 650; padding: 5px 12px; border-radius: 999px; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.active { background: rgba(6,118,71,0.10); color: var(--success); }
.badge.inactive { background: rgba(92,97,117,0.12); color: var(--muted); }
.badge.past_due { background: rgba(217,45,32,0.10); color: var(--danger); }

.license-box { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 12px; }
.license-box code { flex: 1; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.78rem; word-break: break-all; color: var(--ink); line-height: 1.5; }
.copy-btn { flex-shrink: 0; font-size: 0.82rem; font-weight: 650; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink); font-family: inherit; }
.copy-btn:hover { background: #fff; border-color: var(--indigo); color: var(--indigo); }

.panel-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.panel-actions .btn { width: auto; }

.loading { color: var(--muted); font-size: 0.95rem; padding: 20px 0; text-align: center; }

.config-warn { max-width: 560px; margin: 24px auto 0; background: rgba(217,45,32,0.06); border: 1px solid rgba(217,45,32,0.25); color: var(--danger); padding: 16px 20px; border-radius: 12px; font-size: 0.9rem; display: none; }
.config-warn.show { display: block; }

footer { padding: 32px 0; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 0.88rem; }
footer .f-links { display: inline-flex; gap: 20px; }
footer .f-links a { color: var(--muted); }
footer .f-links a:hover { color: var(--ink); text-decoration: none; }

@media (max-width: 480px) {
  .card { padding: 24px; }
}
