/* Chaos Control — ember & mist. Shared by admin, portal, reseller, licenses, host-gate. */
:root {
  --bg: #0a090c;
  --bg-soft: #121018;
  --surface: rgba(22, 18, 28, 0.78);
  --surface-solid: #16121c;
  --surface-hover: rgba(34, 28, 42, 0.92);
  --border: rgba(232, 196, 140, 0.16);
  --border-hover: rgba(232, 196, 140, 0.38);
  --border-focus: rgba(245, 200, 120, 0.72);
  --text: #f7f2ea;
  --text-secondary: #d4c9b8;
  --text-muted: #9a8f80;
  --accent: #e8b86d;
  --accent-deep: #c4893a;
  --accent-glow: rgba(232, 184, 109, 0.4);
  --coral: #ff8a6a;
  --coral-glow: rgba(255, 138, 106, 0.35);
  --cyan: #7ec8c4;
  --cyan-glow: rgba(126, 200, 196, 0.28);
  --success: #6dcea0;
  --warning: #e8c06a;
  --danger: #f07178;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --display: "Syne", "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 80px rgba(232, 184, 109, 0.12);
}

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

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.theme-bg { position: relative; }

/* Soft aurora wash — no grid lines */
body.theme-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 50% 42% at 12% -5%, rgba(232, 184, 109, 0.2), transparent 58%),
    radial-gradient(ellipse 42% 38% at 95% 10%, rgba(255, 138, 106, 0.12), transparent 55%),
    radial-gradient(ellipse 55% 45% at 60% 100%, rgba(126, 200, 196, 0.1), transparent 58%),
    linear-gradient(168deg, #0a090c 0%, #121018 45%, #0d0b10 100%);
  animation: auroraBreath 22s ease-in-out infinite alternate;
}

body.theme-bg::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(232, 184, 109, 0.04) 0%, transparent 42%),
    radial-gradient(circle at 78% 65%, rgba(126, 200, 196, 0.035) 0%, transparent 40%);
  animation: mistDrift 26s ease-in-out infinite alternate;
}

@keyframes auroraBreath {
  0% { filter: saturate(1) brightness(1); }
  100% { filter: saturate(1.12) brightness(1.06); }
}

@keyframes mistDrift {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.85; }
  100% { transform: translate3d(-2%, 1.5%, 0) scale(1.05); opacity: 1; }
}

@keyframes riseIn {
  from { opacity: 0; transform: translate3d(0, 20px, 0) scale(0.985); }
  to { opacity: 1; transform: none; }
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.94) translateY(8px); }
  70% { opacity: 1; transform: scale(1.015); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes softFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient::before,
.ambient::after {
  display: none !important;
  content: none !important;
}

.theme-layer, .shell, .app-sidebar, .app-main,
#screenLogin, #screenDash, .app, .page {
  position: relative;
  z-index: 1;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  will-change: transform;
  animation: orbFloat 18s ease-in-out infinite;
}

.orb-a {
  width: 380px;
  height: 380px;
  background: rgba(232, 184, 109, 0.32);
  top: -16%;
  left: -8%;
}

.orb-b {
  width: 300px;
  height: 300px;
  background: rgba(255, 138, 106, 0.22);
  top: 22%;
  right: -10%;
  animation-duration: 22s;
  animation-direction: reverse;
}

.orb-c {
  width: 280px;
  height: 280px;
  background: rgba(126, 200, 196, 0.2);
  bottom: -12%;
  left: 40%;
  animation-duration: 20s;
}

@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
  body.theme-bg::before,
  body.theme-bg::after { animation: none; }
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(28px, -18px) scale(1.06); }
  66% { transform: translate(-18px, 14px) scale(0.96); }
}

.theme-layer { position: relative; z-index: 1; }

.hidden { display: none !important; }

.gradient-text {
  font-family: var(--display);
  background: linear-gradient(120deg, #fff8ef 0%, var(--accent) 45%, var(--coral) 100%);
  background-size: 180% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: titleShimmer 8s linear infinite;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(232, 184, 109, 0.1);
  border: 1px solid rgba(232, 184, 109, 0.22);
}

.glass {
  position: relative;
  background: linear-gradient(180deg, rgba(28, 24, 36, 0.88), rgba(14, 12, 18, 0.9));
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 248, 235, 0.06);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), border-color 0.25s, box-shadow 0.35s;
}

.glass::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--coral));
  pointer-events: none;
  opacity: 0.85;
}

.glass::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -80%;
  width: 40%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(232, 184, 109, 0.1), transparent);
  transform: rotate(18deg);
  animation: panelShine 9s ease-in-out infinite;
  pointer-events: none;
}

.glass:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(232, 184, 109, 0.1);
}

@keyframes panelShine {
  0%, 100% { left: -80%; opacity: 0; }
  12% { opacity: 1; }
  48% { left: 140%; opacity: 1; }
  58% { opacity: 0; }
}

.shine-row {
  position: relative;
  overflow: hidden;
  background: rgba(16, 14, 20, 0.78);
  border: 1px solid rgba(232, 196, 140, 0.12);
  transition: border-color 0.25s, transform 0.25s var(--ease-out);
}

.shine-row::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(232, 184, 109, 0.1), transparent);
  transform: translateX(-100%);
  animation: rowShine 7s ease-in-out infinite;
  pointer-events: none;
}

.shine-row:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

@keyframes rowShine {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

.card-shine-wrap {
  position: relative;
  padding: 1px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(232, 184, 109, 0.65), rgba(255, 138, 106, 0.45), rgba(126, 200, 196, 0.35));
  background-size: 200% 200%;
  animation: borderFlow 7s ease infinite;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5), 0 0 50px rgba(232, 184, 109, 0.12);
}

@keyframes borderFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.license-card {
  position: relative;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(90% 80% at 100% 0%, rgba(255, 138, 106, 0.18), transparent 50%),
    linear-gradient(155deg, #2a2234 0%, #16121c 55%, #0e0c12 100%);
  box-shadow: inset 0 1px 0 rgba(255, 248, 235, 0.08);
}

.license-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 180deg, transparent, rgba(232, 184, 109, 0.16), transparent 40%, rgba(255, 138, 106, 0.12), transparent 70%);
  animation: holoSpin 16s linear infinite;
  pointer-events: none;
}

.license-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--coral), transparent);
}

.card-shine-sweep {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
}

.card-shine-sweep::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -70%;
  width: 40%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  transform: rotate(18deg);
  animation: cardSweep 7s ease-in-out infinite;
}

@keyframes holoSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes cardSweep {
  0%, 100% { left: -70%; opacity: 0; }
  12% { opacity: 1; }
  50% { left: 130%; opacity: 1; }
  62% { opacity: 0; }
}

.license-card-inner {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.title-shine {
  font-family: var(--display);
  background: linear-gradient(110deg, #fff8ef 0%, var(--accent) 35%, #fff 50%, var(--coral) 70%, #fff8ef 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: titleShimmer 6s linear infinite;
}

@keyframes titleShimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.chip-shine {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f0d09a 0%, #c4893a 55%, #8a5a22 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 20px rgba(196, 137, 58, 0.35);
  color: #1a1208;
}

.chip-shine::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.45) 50%, transparent 70%);
  animation: chipGlint 3.4s ease-in-out infinite;
}

@keyframes chipGlint {
  0%, 100% { transform: translateX(-120%); }
  50% { transform: translateX(120%); }
}

.animate-in { animation: slideUp 0.7s var(--ease-out) both; }
.animate-in-delay-1 { animation-delay: 0.08s; }
.animate-in-delay-2 { animation-delay: 0.16s; }
.animate-in-delay-3 { animation-delay: 0.24s; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.988); }
  to { opacity: 1; transform: none; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

label {
  display: block;
  margin: 16px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

label:first-of-type { margin-top: 0; }

input, select, textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(232, 196, 140, 0.14);
  background: rgba(8, 6, 12, 0.72);
  color: var(--text);
  font: 500 15px/1.4 var(--font);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.2s var(--ease-out);
}

input:hover, select:hover, textarea:hover {
  border-color: rgba(232, 184, 109, 0.35);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: rgba(12, 10, 16, 0.92);
  box-shadow: 0 0 0 4px rgba(232, 184, 109, 0.16);
  transform: translateY(-1px);
}

input::placeholder, textarea::placeholder {
  color: rgba(154, 143, 128, 0.75);
}

.btn-primary {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font: 700 15px/1 var(--font);
  letter-spacing: 0.01em;
  color: #1a1208;
  padding: 14px 22px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f5d9a8 0%, #e8b86d 45%, #c4893a 100%);
  box-shadow: 0 10px 28px rgba(196, 137, 58, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.25s, filter 0.2s;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,0.4) 50%, transparent 80%);
  transform: translateX(-140%);
  transition: transform 0.55s var(--ease-out);
}

.btn-primary:hover::before { transform: translateX(140%); }

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(196, 137, 58, 0.42);
  filter: brightness(1.04);
}

.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  appearance: none;
  cursor: pointer;
  font: 600 13px/1 var(--font);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid rgba(232, 196, 140, 0.2);
  background: rgba(22, 18, 28, 0.55);
  transition: all 0.22s var(--ease-out);
}

.btn-ghost:hover {
  color: #1a1208;
  border-color: transparent;
  background: var(--accent);
  transform: translateY(-1px);
}

.btn-block { width: 100%; margin-top: 18px; }

.alert-error {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  background: rgba(240, 113, 120, 0.12);
  border: 1px solid rgba(240, 113, 120, 0.4);
  color: #fecdd3;
  animation: shake 0.4s var(--ease-out);
}

.alert-error.show { display: block; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(109, 206, 160, 0.12);
  border: 1px solid rgba(109, 206, 160, 0.35);
  color: #c6f0d8;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(109, 206, 160, 0.7);
  animation: ping 1.8s ease-out infinite;
}

@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(109, 206, 160, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(109, 206, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(109, 206, 160, 0); }
}

.toast {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 22px;
  border-radius: 14px;
  background: rgba(18, 14, 22, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(232, 184, 109, 0.12);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: transform 0.45s var(--ease-spring), opacity 0.35s;
  z-index: 9999;
  max-width: min(90vw, 380px);
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(232, 184, 109, 0.28);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(232, 184, 109, 0.5); }

::selection {
  background: rgba(232, 184, 109, 0.35);
  color: #fff;
}

html.rvjs .rv {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}
html.rvjs .rv.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body.phone-ui {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
body.phone-ui input,
body.phone-ui select,
body.phone-ui textarea,
body.phone-ui input.field {
  font-size: 16px;
}
@media (max-width: 800px) {
  body.phone-ui .side {
    padding-top: max(10px, env(safe-area-inset-top));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  body.phone-ui .nav {
    -webkit-overflow-scrolling: touch;
  }
  body.phone-ui .nav button,
  body.phone-ui .btn-primary,
  body.phone-ui .btn-ghost,
  body.phone-ui .btn {
    min-height: 44px;
  }
  body.phone-ui .main {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-bottom: max(48px, env(safe-area-inset-bottom));
  }
  body.phone-ui .auth-wrap {
    padding: max(16px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
  }
  body.phone-ui .row .btn-primary,
  body.phone-ui .row .btn-ghost {
    width: 100%;
  }
  body.phone-ui .panel {
    padding: 16px;
  }
  body.phone-ui table {
    min-width: 0;
  }
  body.phone-ui th,
  body.phone-ui td {
    padding: 10px 8px;
  }
  body.phone-ui td code {
    word-break: break-all;
  }
  body.phone-ui .table-wrap {
    -webkit-overflow-scrolling: touch;
  }
}
