/*
 * Billing portal styling. Deliberately matches Client Central
 * (clients.afterdarksys.com) so moving between the two does not feel like
 * leaving the product. Self-contained: no CDN, no remote webfonts.
 */

:root {
  --bg-from: #0f172a;
  --bg-to: #1e1b4b;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.1);
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --accent: #60a5fa;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 3rem 1.5rem 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-to) 100%);
  background-attachment: fixed;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

#auth-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
#auth-bar a { color: var(--accent); text-decoration: none; }
#auth-bar a.logout { color: var(--danger); }
.auth-brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { max-width: 1100px; margin: 0 auto; padding-top: 2.5rem; }

.page-head { margin-bottom: 2.5rem; }
h1 { font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 700; margin: 0 0 0.5rem; }
.gradient-text {
  background: linear-gradient(to right, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lede { color: var(--muted); margin: 0; }

.notice, .panel, .help {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.notice h2, .panel h2, .help h2 { margin: 0; font-size: 1.25rem; }
.notice p, .help p { color: var(--muted); line-height: 1.6; margin: 0.5rem 0 0; max-width: 70ch; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.actions { margin-top: 1.25rem !important; display: flex; flex-wrap: wrap; gap: 0.75rem; }

.button {
  display: inline-block;
  padding: 0.65rem 1.05rem;
  border-radius: 0.6rem;
  background: var(--accent);
  color: #0f172a;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.button:hover { filter: brightness(1.08); }
.button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.button.secondary:hover { background: var(--surface-hover); }
.button.small { padding: 0.45rem 0.8rem; font-size: 0.8rem; }
.button[disabled] { opacity: 0.5; cursor: not-allowed; }

.filter { font-size: 0.8rem; color: var(--muted); }
.filter input {
  display: block;
  margin-top: 0.35rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.5rem 0.7rem;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  min-width: 220px;
}

/* Tables scroll inside their own container so the page never scrolls sideways. */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 560px; }
th, td { text-align: left; padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
td.amount, th.amount { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid currentColor;
}
.badge.paid, .badge.active    { color: var(--success); }
.badge.open, .badge.trialing  { color: var(--warning); }
.badge.void, .badge.cancelled,
.badge.past_due, .badge.uncollectible { color: var(--danger); }
.badge.draft, .badge.paused   { color: var(--muted); }

.row-actions { display: flex; gap: 0.5rem; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.1rem;
}
.card h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.card .price { font-size: 1.4rem; font-weight: 700; margin: 0.4rem 0; font-variant-numeric: tabular-nums; }
.card .price small { font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.card p { color: var(--muted); font-size: 0.85rem; line-height: 1.55; margin: 0; }

.muted { color: var(--muted); }
.error { color: var(--danger); }

footer {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.5rem 0;
  font-size: 0.85rem;
  color: var(--muted);
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--ink); }

@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) {
  .cards { grid-template-columns: 1fr; }
  body { padding-left: 1rem; padding-right: 1rem; }
}
