/* ========================================================================
 * SPECTRUM THEME  ·  Shared dark glassmorphic design system
 * ------------------------------------------------------------------------
 * Colors, typography, base components, utility helpers.
 * Every portal/page imports this as its baseline.
 * ==================================================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* v1.4.0 — TENANT BRAND VARIABLES. JS overrides these at SX.tenant.applyBranding()
   * time, falling back to Spectrum defaults below if no tenant is configured. */
  --brand-primary:      #00B5E2;
  --brand-primary-dark: #0A4A8A;
  --brand-accent:       #8DC63F;
  --brand-text:         #e8f4fc;
  --brand-font:         -apple-system,BlinkMacSystemFont,'SF Pro Display',system-ui,Segoe UI,Roboto,sans-serif;

  /* Brand — legacy aliases (every spectrum-* CSS still uses these). At runtime
   * the JS layer keeps them in sync with --brand-primary so existing styles
   * automatically pick up the tenant palette. */
  --cy:  var(--brand-primary);
  --cy2: #33C6E8;
  --cy3: rgba(0,181,226,.12);
  --cy4: rgba(0,181,226,.28);
  --cy5: rgba(0,181,226,.06);
  --gr:  var(--brand-accent);
  --gr2: #A5D85F;
  --or:  #E8622A;
  --or2: #F0976A;

  /* Surfaces */
  --bg:  #03080f;
  --s1:  #06101c;
  --s2:  #0a1828;
  --s3:  #0e2035;
  --s4:  #132840;
  --s5:  #1a334d;

  /* Borders */
  --bd:  rgba(0,181,226,.12);
  --bd2: rgba(0,181,226,.28);
  --bd3: rgba(0,181,226,.42);

  /* Text */
  --tx:  #e8f4fc;
  --tx2: #b8d0dc;
  --mt:  #5a7a8e;
  --mt2: #2a4055;

  /* States */
  --ok:  #30d158;
  --er:  #ff453a;
  --wa:  #ff9f0a;
  --in:  #64d2ff;

  /* Gradients — v1.4.2 base off brand vars so the same gradient repaints
   * with the active tenant's palette. --gd-brand is the primary CTA gradient;
   * legacy aliases keep working for code still using --gd-cy. */
  --gd-brand: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  --gd-cy:    var(--gd-brand);
  --gd-cy2:   linear-gradient(135deg, #33C6E8, #0090b8);
  --gd-gr:    linear-gradient(135deg, var(--brand-accent), #5a8a1a);
  --gd-or:    linear-gradient(135deg, #E8622A, #b03a10);
  --gd-pu:    linear-gradient(135deg, #7b68ee, #4a3abf);

  /* Shadows */
  --sh1: 0 4px 16px rgba(0,0,0,.3);
  --sh2: 0 12px 36px rgba(0,0,0,.45);
  --sh3: 0 24px 60px rgba(0,0,0,.6);
  --sh-cy: 0 4px 18px rgba(0,181,226,.35);
  --sh-cy2:0 12px 36px rgba(0,181,226,.25);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* Timing */
  --t-fast: .15s;
  --t-mid:  .25s;
  --t-slow: .4s;
}

html, body {
  font-family: -apple-system, 'SF Pro Display', 'Segoe UI', system-ui, Inter, sans-serif;
  background: var(--bg);
  color: var(--tx);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: var(--tx); }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* ==========================================================================
   FORM FIELDS — sx-input, sx-textarea, sx-select, sx-label
   All fields use a dark-theme-safe background. Text and placeholders have
   guaranteed contrast. Numeric spinners are suppressed for a clean look.
   ========================================================================== */
.sx-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--mt);
  margin-bottom: 6px;
}
.sx-input,
.sx-textarea,
.sx-select {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  color: var(--tx);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
.sx-textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.sx-input:focus,
.sx-textarea:focus,
.sx-select:focus {
  border-color: var(--cy);
  background: rgba(0, 181, 226, .05);
  box-shadow: 0 0 0 3px rgba(0, 181, 226, .12);
}
.sx-input::placeholder,
.sx-textarea::placeholder {
  color: rgba(255, 255, 255, .34);
  opacity: 1;
}
.sx-input:disabled,
.sx-textarea:disabled,
.sx-select:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.sx-input[readonly] {
  background: rgba(255, 255, 255, .02);
  color: var(--mt);
}
.sx-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%23888' d='M6 9L1 4h10z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.sx-select option {
  background: #1a1f2e;
  color: #fff;
}
.sx-input[type="number"]::-webkit-outer-spin-button,
.sx-input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sx-input[type="number"] { -moz-appearance: textfield; }

/* Light theme variant for any portal that opts into a light form background */
.sx-input.light,
.sx-textarea.light,
.sx-select.light {
  background: #fff;
  border-color: rgba(0, 0, 0, .15);
  color: #0f172a;
}
.sx-input.light::placeholder,
.sx-textarea.light::placeholder { color: rgba(15, 23, 42, .4); }

/* Datalist/autofill guard against browser-default white text on white bg */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px rgba(14, 20, 33, .95) inset !important;
  -webkit-text-fill-color: var(--tx) !important;
  caret-color: var(--tx);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--s1); }
::-webkit-scrollbar-thumb { background: var(--s4); border-radius: 5px; border: 2px solid var(--s1); }
::-webkit-scrollbar-thumb:hover { background: var(--s5); }

::selection { background: var(--cy4); color: #fff; }

/* ---- animated background orbs ---- */
.sx-bg-orbs { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.sx-orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .22; animation: sxOrbFloat 14s ease-in-out infinite; }
.sx-orb-1 { width: 500px; height: 500px; background: radial-gradient(circle, var(--cy), transparent); top: -100px; left: -100px; animation-duration: 16s; }
.sx-orb-2 { width: 400px; height: 400px; background: radial-gradient(circle, var(--gr), transparent); bottom: -80px; right: -80px; animation-duration: 20s; animation-delay: -6s; }
.sx-orb-3 { width: 300px; height: 300px; background: radial-gradient(circle, #0a4a8a, transparent); top: 40%; left: 50%; animation-duration: 24s; animation-delay: -3s; }
@keyframes sxOrbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-40px) scale(1.08); }
}

.sx-grid-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(rgba(0,181,226,.03) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(0,181,226,.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ---- NAV ---- */
.sx-nav {
  position: fixed; top: 0; left: 0; right: 0; height: 64px;
  background: rgba(3,8,15,.88); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--bd);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; z-index: 100;
}
.sx-nav-brand { display: flex; align-items: center; gap: 12px; }
.sx-logo-sq {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--gd-cy);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 900; color: #fff; letter-spacing: -1px;
  box-shadow: 0 4px 16px rgba(0,181,226,.4);
}
.sx-nav-brand-tx { font-size: 16px; font-weight: 800; color: var(--tx); }
.sx-nav-brand-tx span { color: var(--cy); }
.sx-nav-sub { font-size: 10px; color: var(--mt); margin-top: 2px; letter-spacing: .3px; }
.sx-nav-right { display: flex; align-items: center; gap: 14px; }
.sx-nav-live {
  display: flex; align-items: center; gap: 7px;
  background: rgba(48,209,88,.08); border: 1px solid rgba(48,209,88,.22);
  border-radius: 20px; padding: 5px 12px;
  font-size: 11px; font-weight: 700; color: var(--ok);
}
.sx-nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: sxBlink 2s ease-in-out infinite; }
@keyframes sxBlink { 0%,100% {opacity:1} 50% {opacity:.3} }

/* ---- Sync status pill ---- */
.sx-sync-pill {
  display: flex; align-items: center; gap: 7px;
  border-radius: 20px; padding: 5px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  cursor: pointer; transition: all var(--t-fast);
  background: rgba(128,144,170,.08); border: 1px solid rgba(128,144,170,.22); color: var(--mt);
}
.sx-sync-pill:hover { filter: brightness(1.18); }
.sx-sync-pill .sx-sync-dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.sx-sync-pill.sx-sync-connected {
  background: rgba(48,209,88,.08); border-color: rgba(48,209,88,.22); color: var(--ok);
}
.sx-sync-pill.sx-sync-connected .sx-sync-dot { animation: sxBlink 2s ease-in-out infinite; }
.sx-sync-pill.sx-sync-connecting {
  background: rgba(255,193,7,.10); border-color: rgba(255,193,7,.25); color: #ffc107;
}
.sx-sync-pill.sx-sync-connecting .sx-sync-dot { animation: sxBlink 1s ease-in-out infinite; }
.sx-sync-pill.sx-sync-error {
  background: rgba(255,69,58,.10); border-color: rgba(255,69,58,.28); color: var(--bad);
}
.sx-sync-pill.sx-sync-disconnected {
  background: rgba(128,144,170,.08); border-color: rgba(128,144,170,.22); color: var(--mt);
}
.sx-sync-menu {
  position: fixed; z-index: 1200;
  background: var(--s1); border: 1px solid var(--bd); border-radius: 14px;
  padding: 16px; min-width: 320px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  color: var(--tx);
}
.sx-sync-menu h4 { font-size: 13px; font-weight: 800; margin: 0 0 10px; color: var(--cy); }
.sx-sync-menu .sx-sync-info { font-size: 11px; color: var(--mt); margin-bottom: 12px; line-height: 1.6; }
.sx-sync-menu .sx-sync-info b { color: var(--tx); }
.sx-sync-menu input[type=text] {
  width: 100%; padding: 8px 10px; font-size: 12px;
  background: var(--s0); border: 1px solid var(--bd); border-radius: 8px;
  color: var(--tx); margin-bottom: 8px;
}
.sx-sync-menu .sx-sync-actions { display: flex; gap: 8px; }
.sx-sync-menu button {
  flex: 1; padding: 7px 12px; border-radius: 8px;
  font-size: 11px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--bd); background: var(--s0); color: var(--tx);
  transition: all var(--t-fast);
}
.sx-sync-menu button.primary { background: var(--gd-cy); border-color: transparent; color: #fff; }
.sx-sync-menu button:hover { filter: brightness(1.2); }
.sx-nav-btn {
  padding: 9px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 700;
  background: var(--gd-cy); color: #fff;
  transition: all var(--t-fast);
}
.sx-nav-btn:hover { box-shadow: var(--sh-cy); transform: translateY(-1px); }
.sx-nav-ghost {
  padding: 8px 16px; border-radius: 10px;
  font-size: 12px; font-weight: 700;
  background: transparent; color: var(--mt);
  border: 1px solid var(--bd);
  transition: all var(--t-fast);
}
.sx-nav-ghost:hover { color: var(--cy); border-color: var(--bd2); }

/* ---- User chip ---- */
.sx-user-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--s1); border: 1px solid var(--bd);
  border-radius: 20px; padding: 4px 14px 4px 4px;
  cursor: pointer; transition: all var(--t-fast);
}
.sx-user-chip:hover { border-color: var(--bd2); }
.sx-user-av {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gd-cy);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff;
}
.sx-user-name { font-size: 12px; font-weight: 700; color: var(--tx); }
.sx-user-role { font-size: 10px; color: var(--mt); }
.sx-user-menu {
  position: absolute; top: 64px; right: 32px;
  background: var(--s1); border: 1px solid var(--bd2);
  border-radius: 14px; padding: 8px;
  box-shadow: var(--sh3);
  min-width: 220px; z-index: 200;
  display: none;
}
.sx-user-menu.open { display: block; animation: sxFadeIn .2s ease; }
.sx-user-menu a, .sx-user-menu button {
  display: block; width: 100%; text-align: left;
  padding: 10px 14px; border-radius: 10px;
  font-size: 13px; color: var(--tx2); font-weight: 600;
  transition: all var(--t-fast);
}
.sx-user-menu a:hover, .sx-user-menu button:hover { background: var(--s3); color: var(--cy); }
.sx-user-menu .sx-menu-danger:hover { background: rgba(255,69,58,.1); color: var(--er); }
.sx-user-menu hr { border: 0; border-top: 1px solid var(--bd); margin: 6px 0; }

/* ---- Cards ---- */
.sx-card {
  background: var(--s1); border: 1px solid var(--bd);
  border-radius: var(--r-lg); padding: 22px;
  transition: all var(--t-mid);
}
.sx-card-hover:hover { border-color: var(--bd2); transform: translateY(-2px); box-shadow: var(--sh2); }
.sx-card-title { font-size: 13px; font-weight: 700; color: var(--tx); display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sx-card-sub { font-size: 11px; color: var(--mt); }

/* ---- Buttons ---- */
.sx-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 11px;
  font-size: 13px; font-weight: 700;
  background: var(--gd-cy); color: #fff;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.sx-btn:hover { box-shadow: var(--sh-cy); transform: translateY(-1px); }
.sx-btn:disabled { opacity: .5; cursor: not-allowed; }
.sx-btn-ghost {
  background: transparent; color: var(--mt);
  border: 1.5px solid var(--bd);
}
.sx-btn-ghost:hover { color: var(--cy); border-color: var(--bd2); box-shadow: none; transform: none; }
.sx-btn-ok { background: linear-gradient(135deg, #30d158, #1e8e3e); }
.sx-btn-er { background: linear-gradient(135deg, #ff453a, #b71818); }
.sx-btn-wa { background: linear-gradient(135deg, #ff9f0a, #b06b00); }
.sx-btn-sm { padding: 7px 14px; font-size: 11px; }

/* ---- Forms ---- */
.sx-field { margin-bottom: 14px; }
.sx-field label {
  display: block; font-size: 10px; font-weight: 700;
  color: var(--mt); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 6px;
}
.sx-field input, .sx-field select, .sx-field textarea {
  width: 100%; background: var(--s2);
  border: 1.5px solid var(--bd); border-radius: 10px;
  padding: 12px 14px;
  /* v1.3.9.6 — 16px font-size prevents iOS Safari from auto-zooming on focus. */
  font-size: 16px; color: var(--tx);
  outline: none; transition: border-color var(--t-fast);
}
/* v1.3.9.6 — minimum tap-target sizes per HIG / Material guidelines */
.sx-btn { min-height: 44px; }
.sx-btn-sm { min-height: 36px; }
.sx-field input:focus, .sx-field select:focus, .sx-field textarea:focus { border-color: var(--cy); }
.sx-field textarea { resize: vertical; min-height: 88px; }

/* ---- Badges / pills ---- */
.sx-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 8px;
  font-size: 10px; font-weight: 700;
  background: var(--s3); color: var(--mt);
  border: 1px solid var(--bd);
}
.sx-badge-ok { background: rgba(48,209,88,.12); color: var(--ok); border-color: rgba(48,209,88,.25); }
.sx-badge-wa { background: rgba(255,159,10,.12); color: var(--wa); border-color: rgba(255,159,10,.25); }
.sx-badge-er { background: rgba(255,69,58,.12); color: var(--er); border-color: rgba(255,69,58,.25); }
.sx-badge-in { background: var(--cy3); color: var(--cy); border-color: var(--bd2); }
.sx-badge-pu { background: rgba(123,104,238,.12); color: #b8a7ff; border-color: rgba(123,104,238,.3); }

/* ---- Stat cell ---- */
.sx-stat { text-align: center; padding: 12px; }
.sx-stat-val { font-size: 32px; font-weight: 900; color: var(--cy); line-height: 1; }
.sx-stat-val.gr { color: var(--gr); }
.sx-stat-val.or { color: var(--or); }
.sx-stat-lbl { font-size: 11px; color: var(--mt); margin-top: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }

/* ---- Table ---- */
.sx-table { width: 100%; border-collapse: collapse; }
.sx-table th {
  text-align: left; padding: 12px 14px;
  font-size: 10px; font-weight: 700; color: var(--mt);
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--bd);
}
.sx-table td {
  padding: 14px 14px; font-size: 13px; color: var(--tx2);
  border-bottom: 1px solid var(--bd);
}
.sx-table tr:hover td { background: var(--s2); }
.sx-table tr:last-child td { border-bottom: 0; }

/* ---- Empty states ---- */
.sx-empty {
  padding: 60px 24px; text-align: center;
}
.sx-empty-icon { font-size: 48px; opacity: .4; margin-bottom: 12px; }
.sx-empty-title { font-size: 15px; font-weight: 700; color: var(--tx2); margin-bottom: 4px; }
.sx-empty-sub { font-size: 12px; color: var(--mt); }

/* ---- Modal / overlay ---- */
.sx-modal-backdrop {
  position: fixed; inset: 0; background: rgba(3,8,15,.85);
  backdrop-filter: blur(12px); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: sxFadeIn .2s ease;
}
.sx-modal {
  background: var(--s1); border: 1px solid var(--bd2);
  border-radius: 22px; padding: 32px;
  max-width: 520px; width: 100%; max-height: 92vh; overflow-y: auto;
  box-shadow: var(--sh3); animation: sxModalIn .3s cubic-bezier(.4,0,.2,1);
}
.sx-modal-title {
  font-size: 20px; font-weight: 800; color: var(--tx);
  margin-bottom: 6px;
}
.sx-modal-sub {
  font-size: 13px; color: var(--mt); margin-bottom: 20px;
}
@keyframes sxModalIn {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes sxFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---- Tabs ---- */
.sx-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bd); margin-bottom: 20px; }
.sx-tab {
  padding: 12px 18px; font-size: 12px; font-weight: 700;
  color: var(--mt); border-bottom: 2px solid transparent;
  transition: all var(--t-fast); cursor: pointer;
}
.sx-tab:hover { color: var(--tx2); }
.sx-tab.active { color: var(--cy); border-bottom-color: var(--cy); }

/* ---- Grids ---- */
.sx-grid { display: grid; gap: 18px; }
.sx-grid-2 { grid-template-columns: repeat(2, 1fr); }
.sx-grid-3 { grid-template-columns: repeat(3, 1fr); }
.sx-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .sx-grid-3, .sx-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .sx-grid-2, .sx-grid-3, .sx-grid-4 { grid-template-columns: 1fr; }
}

/* ---- Progress bar ---- */
.sx-bar {
  height: 6px; background: var(--s3); border-radius: 3px; overflow: hidden;
}
.sx-bar-fill {
  height: 100%; background: var(--gd-cy); border-radius: 3px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

/* ---- Toast (shared) ---- */
#sx-toast { font-family: inherit; }

/* ---- Auth overlay (shared) ---- */
#sx-auth {
  position: fixed; inset: 0;
  background: rgba(3,8,15,.97); backdrop-filter: blur(32px);
  z-index: 9999; display: flex; align-items: center; justify-content: center;
  padding: 24px; transition: opacity .3s;
}
#sx-auth.hidden { opacity: 0; pointer-events: none; }
.sx-auth-box {
  background: var(--s1); border: 1px solid var(--bd2);
  border-radius: 24px; padding: 36px 38px;
  width: 100%; max-width: 430px;
  box-shadow: 0 40px 120px rgba(0,0,0,.6), 0 0 60px rgba(0,181,226,.08);
  animation: sxModalIn .4s cubic-bezier(.4,0,.2,1);
}
.sx-auth-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 22px;
}
.sx-auth-s {
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--gd-cy);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900; color: #fff;
  box-shadow: 0 4px 20px rgba(0,181,226,.4);
}
.sx-auth-brand-name { font-size: 17px; font-weight: 800; color: var(--tx); }
.sx-auth-brand-sub  { font-size: 11px; color: var(--or2); margin-top: 2px; }
.sx-auth-hd { font-size: 22px; font-weight: 800; color: var(--tx); margin-bottom: 5px; }
.sx-auth-p  { font-size: 13px; color: var(--mt); margin-bottom: 18px; }
.sx-auth-demo {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--bd);
}
.sx-auth-demo-title {
  font-size: 10px; font-weight: 700; color: var(--mt);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px;
}
.sx-auth-demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sx-auth-demo-card {
  padding: 10px 12px; background: var(--s2);
  border: 1px solid var(--bd); border-radius: 10px;
  cursor: pointer; transition: all var(--t-fast);
  text-align: left;
}
.sx-auth-demo-card:hover { border-color: var(--cy); background: var(--s3); }
.sx-auth-demo-n { font-size: 12px; font-weight: 700; color: var(--tx); }
.sx-auth-demo-r { font-size: 10px; color: var(--mt); margin-top: 2px; }
.sx-auth-err {
  min-height: 20px; font-size: 12px; color: var(--er);
  margin-bottom: 10px; font-weight: 600; text-align: center;
}

/* ---- Utility ---- */
.sx-flex { display: flex; }
.sx-flex-center { display: flex; align-items: center; justify-content: center; }
.sx-flex-between { display: flex; align-items: center; justify-content: space-between; }
.sx-gap-4 { gap: 4px; } .sx-gap-8 { gap: 8px; } .sx-gap-12 { gap: 12px; } .sx-gap-16 { gap: 16px; } .sx-gap-24 { gap: 24px; }
.sx-mb-4 { margin-bottom: 4px; } .sx-mb-8 { margin-bottom: 8px; } .sx-mb-12 { margin-bottom: 12px; } .sx-mb-16 { margin-bottom: 16px; } .sx-mb-24 { margin-bottom: 24px; }
.sx-mt-4 { margin-top: 4px; } .sx-mt-8 { margin-top: 8px; } .sx-mt-16 { margin-top: 16px; } .sx-mt-24 { margin-top: 24px; }
.sx-hidden { display: none !important; }
.sx-muted { color: var(--mt); }
.sx-muted2 { color: var(--mt2); }
.sx-bold { font-weight: 700; }
.sx-tx-cy { color: var(--cy); } .sx-tx-gr { color: var(--gr); } .sx-tx-or { color: var(--or2); }
.sx-tx-ok { color: var(--ok); } .sx-tx-er { color: var(--er); } .sx-tx-wa { color: var(--wa); }
.sx-sm { font-size: 11px; } .sx-xs { font-size: 10px; }

/* ---- Korevra powered-by badge ---- */
.sx-kor-badge {
  display: inline-flex; align-items: center; gap: 9px;
  background: rgba(232,98,42,.08);
  border: 1px solid rgba(232,98,42,.22);
  border-radius: 10px; padding: 7px 14px;
}
.sx-kor-sq { display: flex; flex-direction: column; gap: 2px; }
.sx-kor-r { display: flex; gap: 2px; }
.sx-kor-s { width: 5px; height: 5px; border-radius: 1.5px; background: var(--or); }
.sx-kor-tx { font-size: 11px; font-weight: 700; color: var(--or2); }

/* ---- Loading spinner ---- */
.sx-spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--bd); border-top-color: var(--cy);
  border-radius: 50%; animation: sxSpin .8s linear infinite;
}
@keyframes sxSpin { to { transform: rotate(360deg); } }

/* ---- Page loader / Splash ---- */
.sx-page-loader {
  position: fixed; inset: 0; background: radial-gradient(ellipse at center, #0a1828 0%, #03080f 70%);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px; z-index: 10000;
  transition: opacity .4s;
}
.sx-page-loader.done { opacity: 0; pointer-events: none; }
.sx-page-loader .sx-spin { width: 32px; height: 32px; border-width: 3px; }
.sx-page-loader-tx { font-size: 12px; color: var(--mt); font-weight: 600; margin-top: 6px; }
.sx-splash-logo {
  width: 90px; height: 90px; border-radius: 26px;
  background: var(--gd-cy);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 60px rgba(0,181,226,.6), 0 4px 20px rgba(0,181,226,.3);
  animation: splashPulse 2s ease-in-out infinite;
  margin-bottom: 14px;
}
.sx-splash-s {
  font-size: 44px; font-weight: 900; color: #fff; letter-spacing: -2px;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.sx-splash-name { font-size: 22px; font-weight: 800; color: var(--tx); letter-spacing: -.5px; }
.sx-splash-sub  { font-size: 11px; color: var(--or2); font-weight: 600; margin-bottom: 4px; }
@keyframes splashPulse {
  0%,100% { transform: scale(1); box-shadow: 0 12px 60px rgba(0,181,226,.6); }
  50%     { transform: scale(1.04); box-shadow: 0 12px 80px rgba(0,181,226,.9); }
}

/* ---- Pills ---- */
.sx-pill {
  display: inline-block; padding: 3px 10px;
  background: var(--s3); border: 1px solid var(--bd);
  border-radius: 10px; font-size: 10px;
  color: var(--mt); font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px;
}
.sx-pill-cy { background: var(--cy3); color: var(--cy); border-color: var(--bd2); }
.sx-pill-gr { background: rgba(141,198,63,.12); color: var(--gr2); border-color: rgba(141,198,63,.3); }
.sx-pill-or { background: rgba(232,98,42,.1); color: var(--or2); border-color: rgba(232,98,42,.28); }
.sx-pill-ok { background: rgba(48,209,88,.12); color: var(--ok); border-color: rgba(48,209,88,.3); }
.sx-pill-wa { background: rgba(255,159,10,.12); color: var(--wa); border-color: rgba(255,159,10,.3); }
.sx-pill-er { background: rgba(255,69,58,.12); color: var(--er); border-color: rgba(255,69,58,.3); }

/* ---- Button variants ---- */
.sx-btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 14px; }

/* ---- Auth multi-view ---- */
.sx-auth-views { min-height: 340px; position: relative; }
.sx-auth-view { display: none; }
.sx-auth-view.active { display: block; animation: sxFadeIn .2s ease; }
.sx-auth-link {
  font-size: 12px; color: var(--cy); font-weight: 700;
  display: inline-block; cursor: pointer;
}
.sx-auth-link:hover { text-decoration: underline; }
.sx-auth-or {
  position: relative; text-align: center; margin: 18px 0 12px;
  font-size: 11px; color: var(--mt);
}
.sx-auth-or::before, .sx-auth-or::after {
  content: ''; position: absolute; top: 50%; width: 40%;
  height: 1px; background: var(--bd);
}
.sx-auth-or::before { left: 0; }
.sx-auth-or::after  { right: 0; }
.sx-auth-or span { background: var(--s1); padding: 0 12px; position: relative; }

/* ---- Sheet (mobile bottom sheet) ---- */
.sx-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(3,8,15,.75); backdrop-filter: blur(8px);
  z-index: 9998; opacity: 0; transition: opacity .25s;
  display: flex; align-items: flex-end; justify-content: center;
}
.sx-sheet-backdrop.open { opacity: 1; }
.sx-sheet {
  background: var(--s1); border: 1px solid var(--bd2);
  border-radius: 24px 24px 0 0;
  width: 100%; max-width: 720px;
  padding: 10px 24px 32px;
  max-height: 88vh; overflow-y: auto;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -24px 80px rgba(0,0,0,.5);
}
.sx-sheet-backdrop.open .sx-sheet { transform: translateY(0); }
.sx-sheet-grab {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--bd2); margin: 0 auto 12px;
}
.sx-sheet-head {
  display: flex; justify-content: space-between; align-items: start;
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 1px solid var(--bd);
}
.sx-sheet-title { font-size: 18px; font-weight: 800; color: var(--tx); }
.sx-sheet-sub { font-size: 12px; color: var(--mt); margin-top: 4px; }
.sx-sheet-x {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--s3); border: 1px solid var(--bd);
  color: var(--mt); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Notification bell + panel ---- */
.sx-nav-bell {
  position: relative; width: 38px; height: 38px; border-radius: 11px;
  background: var(--s2); border: 1px solid var(--bd);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: all var(--t-fast);
}
.sx-nav-bell:hover { background: var(--s3); border-color: var(--bd2); }
.sx-nav-bell-dot {
  position: absolute; top: -4px; right: -4px;
  background: var(--er); color: #fff;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; display: none;
  font-size: 10px; font-weight: 800;
  align-items: center; justify-content: center;
  border: 2px solid var(--s1);
}
.sx-nav-bell-dot[style*="block"] { display: flex !important; }
.sx-nt-panel {
  position: fixed; top: 72px; right: 24px;
  background: var(--s1); border: 1px solid var(--bd2);
  border-radius: 16px; padding: 0;
  min-width: 340px; max-width: 400px; max-height: 560px;
  box-shadow: var(--sh3); z-index: 200;
  overflow: hidden; display: flex; flex-direction: column;
  animation: sxModalIn .2s ease;
}
.sx-nt-head {
  padding: 14px 16px; border-bottom: 1px solid var(--bd);
  display: flex; justify-content: space-between; align-items: center;
}
.sx-nt-title { font-size: 14px; font-weight: 800; color: var(--tx); }
.sx-nt-list { overflow-y: auto; flex: 1; }
.sx-nt-item {
  display: flex; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--bd);
  transition: background var(--t-fast);
}
.sx-nt-item:hover { background: var(--s2); }
.sx-nt-item.unread { background: rgba(0,181,226,.04); }
.sx-nt-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cy); margin-top: 6px; flex-shrink: 0;
  box-shadow: 0 0 8px rgba(0,181,226,.5);
}
.sx-nt-item:not(.unread) .sx-nt-dot { background: var(--mt2); box-shadow: none; }
.sx-nt-t { font-size: 13px; font-weight: 700; color: var(--tx); }
.sx-nt-b { font-size: 11px; color: var(--mt); margin-top: 3px; line-height: 1.5; }
.sx-nt-at { font-size: 10px; color: var(--mt2); margin-top: 4px; }

/* ---- Toast stack ---- */
.sx-toast-stack {
  position: fixed; top: 80px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 10001; pointer-events: none;
}
.sx-toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--s1); border: 1px solid var(--bd2);
  border-radius: 12px; padding: 12px 16px;
  min-width: 280px; max-width: 380px;
  box-shadow: var(--sh2);
  transform: translateX(120%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  pointer-events: auto;
}
.sx-toast.show { transform: translateX(0); }
.sx-toast-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--cy3); color: var(--cy);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  flex-shrink: 0;
}
.sx-toast-success .sx-toast-icon { background: rgba(48,209,88,.15); color: var(--ok); }
.sx-toast-error .sx-toast-icon   { background: rgba(255,69,58,.15); color: var(--er); }
.sx-toast-warn .sx-toast-icon    { background: rgba(255,159,10,.15); color: var(--wa); }
.sx-toast-title { font-size: 12px; font-weight: 800; color: var(--tx); margin-bottom: 2px; }
.sx-toast-msg { font-size: 12px; color: var(--tx2); }

/* ---- Avatar circle ---- */
.sx-av {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--gd-cy); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  flex-shrink: 0;
}
.sx-av-sm { width: 28px; height: 28px; font-size: 11px; }
.sx-av-lg { width: 56px; height: 56px; font-size: 18px; }

/* ---- Chip ---- */
.sx-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: var(--s2);
  border: 1px solid var(--bd); border-radius: 20px;
  font-size: 11px; color: var(--tx2); font-weight: 600;
  cursor: pointer; transition: all var(--t-fast);
}
.sx-chip:hover { border-color: var(--bd2); background: var(--s3); }
.sx-chip.active { background: var(--cy3); color: var(--cy); border-color: var(--bd2); }

/* ---- Segmented control ---- */
.sx-seg {
  display: flex; background: var(--s2);
  border: 1px solid var(--bd); border-radius: 10px;
  padding: 3px; gap: 3px;
}
.sx-seg button {
  padding: 8px 14px; font-size: 11px; font-weight: 700;
  color: var(--mt); border-radius: 7px; transition: all var(--t-fast);
}
.sx-seg button.active { background: var(--cy); color: #fff; }
.sx-seg button:hover:not(.active) { color: var(--tx2); }

/* ---- Stepper ---- */
.sx-stepper {
  display: flex; gap: 4px; margin-bottom: 18px;
}
.sx-stepper-s {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--bd); transition: background .3s;
}
.sx-stepper-s.done { background: var(--cy); }

/* ---- Module tile (mobile grid) ---- */
.sx-module {
  background: var(--s2); border: 1px solid var(--bd);
  border-radius: 18px; padding: 20px 12px;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; cursor: pointer;
  transition: all var(--t-fast);
  position: relative;
}
.sx-module:hover { border-color: var(--bd2); background: var(--s3); transform: translateY(-2px); }
.sx-module-icon { font-size: 32px; }
.sx-module-name { font-size: 13px; font-weight: 700; color: var(--tx); text-align: center; }
.sx-module-badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--er); color: #fff;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--s2);
}

/* ---- Activity item ---- */
.sx-act {
  display: flex; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--bd);
}
.sx-act:last-child { border-bottom: 0; }
.sx-act-ic {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--cy3); color: var(--cy);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.sx-act-t { font-size: 13px; font-weight: 700; color: var(--tx); }
.sx-act-s { font-size: 11px; color: var(--mt); margin-top: 2px; }
.sx-act-at { font-size: 10px; color: var(--mt2); margin-top: 4px; }

/* ---- Progress ring ---- */
.sx-ring {
  position: relative; width: 72px; height: 72px;
}
.sx-ring svg { transform: rotate(-90deg); }
.sx-ring circle { fill: none; stroke-width: 6; }
.sx-ring-bg { stroke: var(--s3); }
.sx-ring-fg { stroke: var(--cy); transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1); }
.sx-ring-val {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900; color: var(--cy);
}

/* ---- KPI progress bar (horizontal) ---- */
.sx-kpi-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sx-kpi-row:last-child { margin-bottom: 0; }
.sx-kpi-label { font-size: 12px; color: var(--tx2); min-width: 140px; font-weight: 600; }
.sx-kpi-bar-wrap { flex: 1; height: 8px; background: var(--s3); border-radius: 4px; overflow: hidden; }
.sx-kpi-bar-fill { height: 100%; background: var(--gd-cy); border-radius: 4px; transition: width .8s ease; }
.sx-kpi-score { font-size: 13px; font-weight: 800; color: var(--cy); min-width: 42px; text-align: right; }

/* ---- Module icon tint variants ---- */
.sx-module.cy .sx-module-icon { filter: drop-shadow(0 2px 12px rgba(0,181,226,.5)); }
.sx-module.gr .sx-module-icon { filter: drop-shadow(0 2px 12px rgba(141,198,63,.5)); }
.sx-module.or .sx-module-icon { filter: drop-shadow(0 2px 12px rgba(232,98,42,.5)); }

/* ---- Responsive overrides ---- */
@media (max-width: 700px) {
  .sx-nav { padding: 0 16px; }
  .sx-nav-sub { display: none; }
  .sx-nt-panel { right: 8px; left: 8px; min-width: auto; max-width: none; }
  .sx-toast-stack { right: 8px; left: 8px; }
  .sx-toast { min-width: auto; max-width: none; }
}
