/* Aeglos Systems — Platform CSS  (glassmorphism edition) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --gold:        #C9A84C;
  --gold-dim:    #8a6f2e;
  --gold-light:  #e8c96a;
  --gold-glow:   rgba(201,168,76,0.18);
  --bg:          #05050c;
  --bg-deep:     #030309;
  --glass-card:  rgba(255,255,255,0.04);
  --glass-mid:   rgba(255,255,255,0.06);
  --glass-high:  rgba(255,255,255,0.09);
  --glass-border:rgba(255,255,255,0.08);
  --glass-border-bright: rgba(255,255,255,0.13);
  --glass-blur:  blur(18px) saturate(160%);
  --glass-blur-heavy: blur(28px) saturate(180%);
  --bg-hover:    rgba(255,255,255,0.06);
  --border:      rgba(255,255,255,0.08);
  --border-dim:  rgba(255,255,255,0.045);
  --text:        #e8e8f2;
  --text-dim:    #8080a0;
  --text-muted:  #484858;
  --red:         #e05555;
  --green:       #4caf7a;
  --blue:        #5599dd;
  --orange:      #e09050;
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  --radius:      7px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --shadow:      0 8px 40px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.4);
  --shadow-sm:   0 2px 12px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 80px rgba(201,168,76,0.06), 0 0 200px rgba(40,20,80,0.15);
  --inset-top:   inset 0 1px 0 rgba(255,255,255,0.06);
}

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

html { font-size: 15px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 15% 20%, rgba(50,30,100,0.22) 0%, transparent 65%),
    radial-gradient(ellipse 70% 50% at 85% 75%, rgba(20,30,80,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(15,15,40,0.15) 0%, transparent 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* ── Typography ── */
h1 { font-size: 2.4rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.7rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.2rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p  { color: var(--text-dim); }

.mono   { font-family: var(--font-mono); }
.gold   { color: var(--gold); }
.dim    { color: var(--text-dim); }
.muted  { color: var(--text-muted); font-size: 0.85rem; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
  text-decoration: none;
  position: relative;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, #b08535 100%);
  color: #06060c;
  box-shadow: 0 2px 16px rgba(201,168,76,0.25), var(--inset-top);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  color: #06060c;
  box-shadow: 0 4px 24px rgba(201,168,76,0.35);
  transform: translateY(-1px);
}
.btn-secondary {
  background: rgba(201,168,76,0.07);
  color: var(--gold);
  border: 1px solid rgba(201,168,76,0.25);
  backdrop-filter: var(--glass-blur);
}
.btn-secondary:hover {
  background: rgba(201,168,76,0.13);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(201,168,76,0.1);
}
.btn-ghost {
  background: var(--glass-card);
  color: var(--text-dim);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
}
.btn-ghost:hover {
  background: var(--glass-mid);
  color: var(--text);
  border-color: var(--glass-border-bright);
}
.btn-danger {
  background: rgba(224,85,85,0.07);
  color: var(--red);
  border: 1px solid rgba(224,85,85,0.2);
}
.btn-danger:hover { background: rgba(224,85,85,0.14); box-shadow: 0 0 12px rgba(224,85,85,0.1); }
.btn-sm  { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg  { padding: 13px 28px; font-size: 1rem; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; }

/* ── Form elements ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 0.78rem; font-weight: 500; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.6px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
select,
textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  appearance: none;
  backdrop-filter: blur(8px);
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(201,168,76,0.5);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.08), 0 0 20px rgba(201,168,76,0.04);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 80px; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238080a0' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Cards ── */
.card {
  background: var(--glass-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow), var(--inset-top);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-dim);
}
.card-header h3 { font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); }

/* ── Badges / Status ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}
.badge-active    { background: rgba(76,175,122,0.12); color: var(--green); border: 1px solid rgba(76,175,122,0.2); }
.badge-prospect  { background: rgba(85,153,221,0.1);  color: var(--blue);  border: 1px solid rgba(85,153,221,0.18); }
.badge-churned   { background: rgba(224,85,85,0.1);   color: var(--red);   border: 1px solid rgba(224,85,85,0.18); }
.badge-pending   { background: rgba(201,168,76,0.1);  color: var(--gold);  border: 1px solid rgba(201,168,76,0.18); }
.badge-live      { background: rgba(76,175,122,0.12); color: var(--green); }
.badge-building  { background: rgba(201,168,76,0.1);  color: var(--gold);  }
.badge-done      { background: rgba(76,175,122,0.12); color: var(--green); }
.badge-blocked   { background: rgba(224,85,85,0.1);   color: var(--red);   }
.badge-paid      { background: rgba(76,175,122,0.12); color: var(--green); }
.badge-enabled   { background: rgba(76,175,122,0.12); color: var(--green); }
.badge-disabled  { background: rgba(80,80,88,0.15);   color: var(--text-muted); }

/* ── Alert / toast ── */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  border: 1px solid;
  backdrop-filter: blur(12px);
}
.alert-error   { background: rgba(224,85,85,0.08);  border-color: rgba(224,85,85,0.25);  color: #f08080; }
.alert-success { background: rgba(76,175,122,0.08); border-color: rgba(76,175,122,0.25); color: #80e8aa; }
.alert-info    { background: rgba(201,168,76,0.08); border-color: rgba(201,168,76,0.22); color: var(--gold); }

#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast-msg {
  padding: 11px 20px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  animation: toastIn 0.22s ease;
  pointer-events: none;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.toast-ok  { background: rgba(76,175,122,0.15); border: 1px solid rgba(76,175,122,0.3); color: #80e8aa; }
.toast-err { background: rgba(224,85,85,0.15);  border: 1px solid rgba(224,85,85,0.3);  color: #f08080; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3,3,9,0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 20px;
}
.modal {
  background: rgba(8,8,20,0.88);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 32px 100px rgba(0,0,0,0.7), var(--inset-top);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h2 { font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background 0.12s, color 0.12s;
}
.modal-close:hover { background: var(--glass-mid); color: var(--text); }
.modal-form { display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ── Nav ── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5,5,12,0.75);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
  text-decoration: none;
}
.nav-logo span { color: var(--text-dim); font-weight: 400; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { color: var(--text-dim); font-size: 0.88rem; transition: color 0.15s; }
.nav-links a:hover { color: var(--text); }

/* ── Page layout ── */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}
.section { padding: 80px 0; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 12px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-dim);
  vertical-align: middle;
}
tr:hover td { background: var(--bg-hover); }
tr:last-child td { border-bottom: none; }

/* ── Progress / Feature bar ── */
.feature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-dim);
  gap: 12px;
}
.feature-row:last-child { border-bottom: none; }
.feature-label  { font-size: 0.88rem; flex: 1; }
.feature-status { display: flex; align-items: center; gap: 8px; }

/* ── Sidebar layout ── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.sidebar {
  width: 220px;
  min-width: 220px;
  background: rgba(4,4,14,0.82);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 4px 0 40px rgba(0,0,0,0.3);
}
.sidebar-logo {
  padding: 20px 20px 16px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
  border-bottom: 1px solid var(--border-dim);
  text-shadow: 0 0 20px rgba(201,168,76,0.3);
}
.sidebar-logo small { display: block; color: var(--text-muted); font-size: 0.7rem; font-weight: 400; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 10px 0; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 0.87rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.14s;
  border-left: 2px solid transparent;
  text-decoration: none;
}
.sidebar-item:hover { background: var(--glass-card); color: var(--text); }
.sidebar-item.active {
  background: linear-gradient(90deg, rgba(201,168,76,0.08) 0%, transparent 100%);
  color: var(--gold);
  border-left-color: var(--gold);
  text-shadow: 0 0 12px rgba(201,168,76,0.2);
}
.sidebar-item .icon { font-size: 1rem; width: 18px; text-align: center; }
.sidebar-section {
  padding: 16px 20px 6px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-dim);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.main-content {
  flex: 1;
  overflow-y: auto;
  background: transparent;
  display: flex;
  flex-direction: column;
}
.main-header {
  padding: 20px 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.main-header h1 { font-size: 1.25rem; font-weight: 600; }
.main-body { padding: 20px 28px 40px; flex: 1; }

/* ── Tab bar ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 20px;
  font-size: 0.88rem;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.35; }
.empty-state p { font-size: 0.9rem; }

/* ── Message thread ── */
.message-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 10px;
}
.msg-admin {
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.12);
  margin-right: auto;
}
.msg-client {
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  margin-left: auto;
}
.msg-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* ── Utility ── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-sm  { font-size: 0.85rem; }
.text-xs  { font-size: 0.75rem; font-family: var(--font-mono); }
.font-mono { font-family: var(--font-mono); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Stat card ── */
.stat-card {
  background: var(--glass-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm), var(--inset-top);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.3), transparent);
}
.stat-label { font-size: 0.7rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub   { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; }

/* ── Loading ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pill toggle ── */
.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  transition: 0.2s;
}
.toggle input:checked + .toggle-track {
  background: rgba(201,168,76,0.25);
  border-color: rgba(201,168,76,0.5);
  box-shadow: 0 0 10px rgba(201,168,76,0.15);
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 12px; height: 12px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked ~ .toggle-thumb {
  transform: translateX(16px);
  background: var(--gold);
  box-shadow: 0 0 8px rgba(201,168,76,0.4);
}

/* ── Search bar ── */
.search-bar { position: relative; }
.search-bar input { padding-left: 36px; }
.search-bar::before {
  content: '⌕';
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

/* ── Dot indicator ── */
.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-gold  { background: var(--gold);  box-shadow: 0 0 8px var(--gold);  }
.dot-red   { background: var(--red); }
.dot-muted { background: var(--text-muted); }

/* ── Glass divider ── */
.glass-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--glass-border-bright) 40%, var(--glass-border-bright) 60%, transparent 100%);
  margin: 20px 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .app-shell { flex-direction: column; }
  .main-content { height: 100vh; }
  h1 { font-size: 1.8rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .nav-inner { padding: 0 16px; }
  .page-container { padding: 0 16px; }
}
