/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #f8fafc;
  --surface: #ffffff;
  --border:  #e2e8f0;
  --text:    #1e293b;
  --muted:   #64748b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --danger:  #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius:  8px;
  --shadow:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
}

body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: .25rem;
}
.sidebar-brand { font-weight: 700; font-size: 1.1rem; color: var(--primary); padding: .5rem .75rem 1.25rem; }
.sidebar a {
  display: block; padding: .5rem .75rem; border-radius: var(--radius);
  color: var(--text); font-size: .9rem;
}
.sidebar a:hover, .sidebar a.active { background: #ede9fe; color: var(--primary); text-decoration: none; }
.sidebar-spacer { flex: 1; }
.sidebar-logout form { margin: 0; }
.sidebar-logout button {
  width: 100%; text-align: left; padding: .5rem .75rem; border-radius: var(--radius);
  background: none; border: none; cursor: pointer; font-size: .9rem; color: var(--muted);
}
.sidebar-logout button:hover { background: #fee2e2; color: var(--danger); }

.main { flex: 1; padding: 2rem; overflow: auto; }
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }

/* ── Auth pages (centered) ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 400px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.auth-links { margin-top: 1rem; font-size: .875rem; color: var(--muted); }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .375rem; }
input[type=email], input[type=password], input[type=text], select {
  width: 100%; padding: .5rem .75rem; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .9rem; background: var(--surface);
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }

/* ── Buttons ── */
.btn { display: inline-block; padding: .5rem 1.25rem; border-radius: var(--radius); border: none; cursor: pointer; font-size: .9rem; font-weight: 500; transition: background .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #dc2626; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.btn-block { width: 100%; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card-title { font-size: .8rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.card-value { font-size: 2rem; font-weight: 700; color: var(--text); }
.card-sub   { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }

/* ── Packages ── */
.packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.package-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.package-card h3 { font-size: 1.1rem; margin-bottom: .25rem; }
.package-price { font-size: 1.6rem; font-weight: 700; color: var(--primary); margin: .5rem 0; }
.package-desc  { font-size: .8rem; color: var(--muted); margin-bottom: 1rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { text-align: left; padding: .6rem .75rem; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
td { padding: .65rem .75rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Badges ── */
.badge { display: inline-block; padding: .2rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-active  { background: #dcfce7; color: #166534; }
.badge-revoked { background: #fee2e2; color: #991b1b; }
.badge-confirmed { background: #dcfce7; color: #166534; }
.badge-pending   { background: #fef9c3; color: #854d0e; }
.badge-failed    { background: #fee2e2; color: #991b1b; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-processing { background: #dbeafe; color: #1e40af; }

/* ── Flash messages ── */
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .9rem; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Key reveal box ── */
.key-box { background: #1e1e2e; color: #cdd6f4; font-family: monospace; padding: 1rem 1.25rem; border-radius: var(--radius); word-break: break-all; font-size: .875rem; margin: 1rem 0; }
.key-box-label { font-size: .75rem; color: var(--muted); margin-bottom: .5rem; }

/* ── Docs ── */
.docs-section { margin-bottom: 2rem; }
.docs-section h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: .75rem; }
.docs-section h3 { font-size: .95rem; font-weight: 600; margin: .75rem 0 .375rem; color: var(--muted); }
.docs-section pre { background: #1e1e2e; color: #cdd6f4; padding: 1rem; border-radius: var(--radius); overflow-x: auto; font-size: .8rem; }
.endpoint-method { display: inline-block; padding: .2rem .5rem; border-radius: 4px; font-size: .75rem; font-weight: 700; margin-right: .5rem; }
.method-post { background: #dcfce7; color: #166534; }
.method-get  { background: #dbeafe; color: #1e40af; }

/* ── Charts ── */
.chart-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.5rem; }
.chart-wrap h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

/* ── Public pages ── */
.public-nav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.public-nav-inner { max-width: 1100px; margin: 0 auto; padding: .875rem 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.public-nav-brand { font-size: 1.125rem; font-weight: 700; color: var(--text); text-decoration: none; }
.public-nav-brand:hover { text-decoration: none; }
.public-nav-links { display: flex; gap: 1.5rem; align-items: center; font-size: .9rem; }
.public-nav-links a { color: var(--muted); text-decoration: none; }
.public-nav-links a:hover, .public-nav-links a.active { color: var(--primary); }

.public-main { min-height: calc(100vh - 56px - 72px); }

.public-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 1.5rem; }
.public-footer-inner { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.public-footer-legal { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: center; font-size: .875rem; }
.public-footer-owner { font-size: .8rem; color: var(--muted); }

/* Hero */
.hero { max-width: 1100px; margin: 0 auto; padding: 5rem 1.5rem 4rem; text-align: center; }
.hero-headline { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 800; line-height: 1.2; margin-bottom: 1.25rem; }
.hero-sub { font-size: 1.1rem; color: var(--muted); max-width: 680px; margin: 0 auto 2rem; }
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-cta a { padding: .75rem 1.75rem; border-radius: var(--radius); font-weight: 600; font-size: .95rem; text-decoration: none; }
.hero-cta .cta-primary { background: var(--primary); color: #fff; }
.hero-cta .cta-primary:hover { background: var(--primary-hover); }
.hero-cta .cta-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.hero-cta .cta-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* Feature grid */
.feature-grid { max-width: 1100px; margin: 0 auto; padding: 3rem 1.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .5rem; }
.feature-card p { font-size: .9rem; color: var(--muted); }

/* Pricing */
.pricing-wrap { max-width: 860px; margin: 0 auto; padding: 4rem 1.5rem; }
.pricing-wrap h1 { font-size: 2rem; font-weight: 800; margin-bottom: 2rem; text-align: center; }
.pricing-table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.pricing-table th { background: var(--bg); padding: .875rem 1.25rem; text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--border); }
.pricing-table td { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); font-size: .95rem; }
.pricing-table tr:last-child td { border-bottom: none; }
.pricing-highlight { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.pricing-billing { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem 1.75rem; margin-bottom: 2rem; }
.pricing-billing h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: .75rem; }
.pricing-billing p { font-size: .95rem; color: var(--muted); line-height: 1.6; }
.enterprise-cta { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem 1.75rem; text-align: center; }
.enterprise-cta h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: .5rem; }
.enterprise-cta p { font-size: .9rem; color: var(--muted); }

/* Legal prose */
.legal-wrap { max-width: 800px; margin: 0 auto; padding: 3rem 1.5rem; }
.legal-wrap h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: .5rem; }
.legal-wrap .effective { font-size: .875rem; color: var(--muted); margin-bottom: 2rem; }
.legal-prose h2 { font-size: 1.1rem; font-weight: 700; margin: 2rem 0 .75rem; }
.legal-prose p { font-size: .95rem; color: var(--muted); line-height: 1.7; margin-bottom: .75rem; }
.legal-prose ul { padding-left: 1.5rem; margin-bottom: .75rem; }
.legal-prose ul li { font-size: .95rem; color: var(--muted); line-height: 1.7; margin-bottom: .25rem; }
