/* Absentia customer portal — matches the MYSTIC GUI design system.
   Tokens mirror mystic/gui/frontend/src/index.css so the portal and
   deployed-mystic AccountPanel feel like one product. */

@font-face {
  font-family: "Nasalization";
  src: url("/portal/static/fonts/Nasalization-Rg.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --background: 0 0% 0%;
  --foreground: 0 0% 96%;
  --card: 0 0% 6%;
  --surface-2: 0 0% 10%;
  --muted: 0 0% 10%;
  --muted-foreground: 0 0% 42%;
  --border: 0 0% 12%;
  --input: 0 0% 12%;
  --ring: 0 0% 80%;
  --signal: 0 0% 96%;
  --dim: 0 0% 35%;
  --status-ok: 135 100% 65%;
  --status-warn: 33 100% 50%;
  --status-crit: 8 100% 50%;
  --radius: 0.5rem;
}

* { box-sizing: border-box; }

html, body { background: hsl(var(--background)); }

body {
  margin: 0;
  font-family: "Inter", "Nasalization", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: hsl(var(--foreground));
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Nasalization", "Inter", system-ui, sans-serif;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: hsl(var(--foreground));
}

a { color: hsl(var(--foreground)); text-decoration: none; border-bottom: 1px solid hsl(var(--border)); transition: border-color 150ms cubic-bezier(0.05, 0.9, 0.1, 1.0); }
a:hover { border-bottom-color: hsl(var(--foreground)); }

code {
  font-family: "JetBrains Mono", Menlo, "Roboto Mono", monospace;
  background: hsl(var(--surface-2));
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  font-size: 0.88em;
  color: hsl(var(--foreground));
}

/* ─── Spectrum strip (signature MYSTIC accent) ─── */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #C736FF, #3B5BFF, #00E5FF, #4CFF6A, #FF8C00, #FF2200);
  z-index: 100;
  pointer-events: none;
}

/* ─── Header / nav ─── */
.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem 1.25rem;
  background: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  border: none;
}
.portal-brand:hover { border: none; }

.portal-brand-logo {
  display: block;
  height: 38px;
  width: auto;
}

.portal-brand-sub {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding-left: 0.85rem;
  border-left: 1px solid hsl(var(--border));
}

.portal-nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.portal-nav a {
  font-family: "Inter", system-ui, sans-serif;
  color: hsl(var(--muted-foreground));
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  border: none;
  transition: color 150ms cubic-bezier(0.05, 0.9, 0.1, 1.0), background 150ms;
}
.portal-nav a:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--surface-2));
  border: none;
}

.portal-logout-form { margin: 0 0 0 0.5rem; }
.portal-logout-btn {
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  transition: color 150ms, border-color 150ms;
}
.portal-logout-btn:hover { color: hsl(var(--foreground)); border-color: hsl(var(--ring)); }

/* ─── Main grid ─── */
.portal-main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 2.5rem auto;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ─── Cards ─── */
.portal-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
}
.portal-card--narrow {
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}
.portal-card--inset {
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
}
.portal-card h1 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.portal-card h2 {
  margin: 1.75rem 0 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: hsl(var(--muted-foreground));
}
.portal-card h2:first-child { margin-top: 0; }
.portal-card h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--muted-foreground));
}
.portal-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--muted-foreground));
}

.portal-muted { color: hsl(var(--muted-foreground)); font-size: 0.9rem; }
.portal-error { color: hsl(var(--status-crit)); font-size: 0.9rem; }

.portal-warning {
  background: hsla(var(--status-warn) / 0.08);
  border: 1px solid hsla(var(--status-warn) / 0.3);
  border-left: 3px solid hsl(var(--status-warn));
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: hsl(var(--foreground));
}

.portal-flash {
  padding: 0.7rem 1rem;
  margin: 1rem 0;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border: 1px solid hsl(var(--border));
}
.portal-flash--ok {
  background: hsla(var(--status-ok) / 0.08);
  border-color: hsla(var(--status-ok) / 0.35);
  color: hsl(var(--foreground));
}
.portal-flash--error {
  background: hsla(var(--status-crit) / 0.08);
  border-color: hsla(var(--status-crit) / 0.35);
  color: hsl(var(--foreground));
}

/* ─── Forms ─── */
.portal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.portal-form--inline {
  flex-direction: row;
  align-items: center;
  gap: 1rem;
}
.portal-form label,
.portal-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--muted-foreground));
  border: none;
  padding: 0;
  margin: 0;
}
.portal-field-label {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.35rem;
}

.portal-form input,
.portal-form select {
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: normal;
  transition: border-color 150ms cubic-bezier(0.05, 0.9, 0.1, 1.0);
}
.portal-form input:focus,
.portal-form select:focus {
  outline: none;
  border-color: hsl(var(--ring));
}

.portal-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.92rem;
  text-transform: none;
  letter-spacing: normal;
  color: hsl(var(--foreground));
  margin-right: 1.25rem;
}
.portal-radio input[type="radio"] {
  accent-color: hsl(var(--ring));
}

/* ─── Buttons ─── */
.portal-btn {
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: border-color 150ms, background 150ms, color 150ms;
}
.portal-btn:hover {
  border-color: hsl(var(--ring));
  background: hsl(var(--surface-2));
}
.portal-btn--primary {
  background: hsl(var(--foreground));
  border-color: hsl(var(--foreground));
  color: hsl(var(--background));
  font-weight: 500;
}
.portal-btn--primary:hover {
  background: hsl(var(--ring));
  border-color: hsl(var(--ring));
  color: hsl(var(--background));
}

/* ─── Stats grid ─── */
.portal-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.portal-stat {
  background: hsl(var(--surface-2));
  border: 1px solid hsl(var(--border));
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
}
.portal-stat-label {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.65rem;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 0.45rem;
}
.portal-stat-value {
  font-family: "Nasalization", "Inter", system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: hsl(var(--foreground));
}

/* ─── Billing-status colors (mirror MYSTIC AccountStatusRow) ─── */
.portal-billing-status {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.85rem;
}
.portal-billing-active    { color: hsl(var(--status-ok)); }
.portal-billing-trial     { color: hsl(195 90% 70%); }
.portal-billing-past_due  { color: hsl(var(--status-warn)); }
.portal-billing-suspended { color: hsl(var(--status-crit)); }
.portal-billing-cancelled { color: hsl(var(--muted-foreground)); }
.portal-billing-unconfigured { color: hsl(var(--muted-foreground)); }

/* ─── Lists ─── */
.portal-list {
  padding-left: 1.1rem;
  line-height: 1.85;
  margin: 0.75rem 0;
}
.portal-list li { margin-bottom: 0.15rem; }
.portal-list a { border-bottom: 1px solid hsl(var(--border)); }
.portal-list a:hover { border-bottom-color: hsl(var(--foreground)); }

/* ─── Tables ─── */
.portal-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-family: "Inter", system-ui, sans-serif;
}
.portal-table th, .portal-table td {
  text-align: left;
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid hsl(var(--border));
  font-size: 0.9rem;
}
.portal-table th {
  font-weight: 400;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  border-bottom-color: hsl(var(--border));
}
.portal-table tbody tr:hover { background: hsla(var(--surface-2) / 0.5); }
.portal-table tbody tr:last-child td { border-bottom: none; }

/* ─── Headroom ─── */
.portal-headroom { font-variant-numeric: tabular-nums; font-family: "JetBrains Mono", Menlo, monospace; }
.portal-headroom-low { color: hsl(var(--status-warn)); font-weight: 500; }
.portal-headroom-ok { color: hsl(var(--foreground)); }

/* ─── Pills ─── */
.portal-pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border: 1px solid transparent;
}
.portal-pill-ok {
  background: hsla(var(--status-ok) / 0.12);
  border-color: hsla(var(--status-ok) / 0.35);
  color: hsl(var(--status-ok));
}
.portal-pill-muted {
  background: hsl(var(--surface-2));
  border-color: hsl(var(--border));
  color: hsl(var(--muted-foreground));
}
.portal-pill-warn {
  background: hsla(var(--status-warn) / 0.12);
  border-color: hsla(var(--status-warn) / 0.35);
  color: hsl(var(--status-warn));
}
.portal-pill-crit {
  background: hsla(var(--status-crit) / 0.12);
  border-color: hsla(var(--status-crit) / 0.35);
  color: hsl(var(--status-crit));
}

/* ─── Footer ─── */
.portal-footer {
  text-align: center;
  padding: 1.75rem;
  color: hsl(var(--muted-foreground));
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  border-top: 1px solid hsl(var(--border));
}
.portal-footer a {
  color: hsl(var(--muted-foreground));
  border-bottom: 1px solid hsl(var(--border));
}
.portal-footer a:hover { color: hsl(var(--foreground)); }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: hsl(0 0% 18%); border-radius: 4px; }

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .portal-header { padding: 1rem; flex-direction: column; gap: 1rem; align-items: flex-start; }
  .portal-nav { flex-wrap: wrap; }
  .portal-main { padding: 0 1rem; margin: 1.5rem auto; }
  .portal-card { padding: 1.25rem 1.25rem; }
  .portal-summary { grid-template-columns: 1fr 1fr; }
}
