/* =============================================================================
   XMAX operator portal — shared stylesheet.
   Uses the same MUI-navy palette as the dashboard mockup on the marketing
   site, so the portal feels like a slice of the admin product the operator
   is about to buy.
   ============================================================================= */
:root {
  --bg:        #08090C;
  --surface:   #0D0F14;
  --surface-2: #12151C;
  --border:    #20242E;
  --border-2:  #2E3442;
  --text:      #EEF1F6;
  --muted:     #AEB6C4;
  --faint:     #7A8393;
  --primary:   #3AE0C6;   /* XMAX aqua — matches the landing page */
  --primary-d: #159C87;
  --secondary: #F4A93A;   /* XC amber */
  --danger:    #FF5C4D;
  --ok:        #3AE0C6;

  --f-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-mono: "Geist Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;

  --shadow-md: 0 10px 30px -10px rgba(0,0,0,.5);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.6);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size: 64px 64px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--f-mono); }
.dim { color: var(--muted); }
.tiny { font-size: 11px; letter-spacing: .04em; }
.small { font-size: 13px; }

/* ---------- shell ---------- */
.shell {
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px;
  background: rgba(8,9,12,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-weight: 600; font-size: 14px;
  letter-spacing: .05em; color: var(--text);
}
.brand svg { color: var(--text); }
.brand em { color: var(--primary); font-style: normal; }
.topbar__right { display: flex; align-items: center; gap: 14px; }
.topbar__user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: var(--bg);
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
}

/* ---------- auth pages (centered card layout) ---------- */
.auth-wrap {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 {
  font-weight: 600; font-size: 22px; margin-bottom: 6px;
  letter-spacing: -.01em;
}
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.auth-card .foot {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
  font-size: 13px; color: var(--muted); text-align: center;
}

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label {
  font-size: 12px; font-weight: 600; letter-spacing: .03em;
  color: var(--muted);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  font: inherit; font-size: 14px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(58,224,198,.12);
}
.field .hint { color: var(--faint); font-size: 11.5px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  font: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; border-radius: 6px;
  cursor: pointer;
  transition: transform .1s, background .15s, border-color .15s;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: var(--bg); }
.btn--primary:hover:not(:disabled) { background: #5DEBD5; transform: translateY(-1px); }
.btn--ghost { background: transparent; border-color: var(--border-2); color: var(--text); }
.btn--ghost:hover:not(:disabled) { border-color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 12.5px; }

/* ---------- flash ---------- */
.flash {
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13.5px;
  margin-bottom: 14px;
}
.flash--ok { background: rgba(58,224,198,.08); border: 1px solid rgba(58,224,198,.3); color: var(--primary); }
.flash--err { background: rgba(255,77,77,.08); border: 1px solid rgba(255,77,77,.3); color: #ff7878; }
.flash--info { background: rgba(125,211,252,.08); border: 1px solid rgba(125,211,252,.3); color: #7dd3fc; }

/* ---------- dashboard layout ---------- */
.page {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}
.page__head { margin-bottom: 24px; }
.page__head h1 { font-weight: 600; font-size: 26px; letter-spacing: -.01em; }
.page__head p { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 16px;
}
.card__head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card__title { font-size: 16px; font-weight: 600; letter-spacing: -.005em; }

/* ---------- stat card ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--primary);
}
.stat--secondary::before { background: var(--secondary); }
.stat__lbl { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat__big {
  display: block;
  font-size: 26px; font-weight: 700; color: var(--primary);
  line-height: 1.2; margin-top: 2px;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.stat--secondary .stat__big { color: var(--secondary); }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  border-radius: 16px;
  line-height: 1;
}
.chip--ok { background: rgba(58,224,198,.12); color: var(--primary); }
.chip--secondary { background: rgba(244,169,58,.15); color: var(--secondary); }
.chip--warn { background: rgba(255,170,50,.12); color: #ffaa32; }
.chip--err { background: rgba(255,77,77,.12); color: #ff7878; }
.chip--outline { background: transparent; border: 1px solid var(--border-2); color: var(--muted); }

/* ---------- license card ---------- */
.lic {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 22px;
  margin-bottom: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.lic:hover { border-color: var(--border-2); }
.lic__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.lic__key {
  font-family: var(--f-mono); font-size: 15px;
  color: var(--primary); letter-spacing: .02em; font-weight: 600;
  word-break: break-all;
}
.lic__meta {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-top: 10px;
  color: var(--muted); font-size: 13px;
}
.lic__meta b { color: var(--text); font-weight: 600; margin-left: 4px; }
.lic__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- key-value copy blocks ---------- */
.copybox {
  display: flex; gap: 8px; align-items: stretch;
  margin: 6px 0 14px;
}
.copybox code {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-family: var(--f-mono); font-size: 12.5px;
  color: var(--text);
  word-break: break-all;
}

/* ---------- plan tiles (checkout) ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.plan {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px 24px;
  display: flex; flex-direction: column; gap: 14px;
  position: relative;
  transition: transform .15s, border-color .15s;
}
.plan:hover { border-color: var(--border-2); transform: translateY(-2px); }
.plan--featured { border-color: rgba(58,224,198,.35); box-shadow: 0 0 0 1px rgba(58,224,198,.08), var(--shadow-md); }
.plan__ribbon {
  position: absolute; top: -10px; left: 22px;
  padding: 4px 10px;
  background: var(--primary); color: var(--bg);
  font-family: var(--f-mono);
  font-size: 10px; letter-spacing: .18em; font-weight: 700;
  border-radius: 3px;
}
.plan__name { font-family: var(--f-mono); font-size: 13px; letter-spacing: .15em; font-weight: 600; color: var(--muted); }
.plan__price {
  display: flex; align-items: baseline; gap: 6px;
  margin: 4px 0 6px;
}
.plan__price .currency { color: var(--muted); font-family: var(--f-mono); }
.plan__price .amount { font-size: 42px; font-weight: 700; letter-spacing: -.02em; color: var(--text); line-height: 1; }
.plan__price .per { color: var(--faint); font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; }
.plan__desc { color: var(--muted); font-size: 13.5px; }
.plan__feat { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; margin-bottom: 4px; font-size: 13px; }
.plan__feat li { display: flex; gap: 8px; align-items: flex-start; }
.plan__feat li::before {
  content: "+"; color: var(--primary); font-weight: 700;
  font-family: var(--f-mono);
}

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); }
.table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  font-weight: 600;
}
.table tr:last-child td { border-bottom: none; }

/* ---------- spinner + empty states ---------- */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(58,224,198,.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty {
  padding: 40px 20px;
  border: 1px dashed var(--border-2); border-radius: 8px;
  text-align: center; color: var(--muted);
}

/* ---------- responsive ---------- */
@media (max-width: 780px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 12px 18px; }
  .page { padding: 20px 16px 40px; }
}
@media (max-width: 500px) {
  .stats { grid-template-columns: 1fr; }
}

/* Selection */
::selection { background: var(--primary); color: var(--bg); }
