:root{
  --bg1:#0b1020;
  --bg2:#0f172a;
  --card: rgba(255,255,255,0.06);
  --card2: rgba(255,255,255,0.08);
  --stroke: rgba(255,255,255,0.10);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.72);
  --muted2: rgba(255,255,255,0.58);
  --accent:#7c3aed; /* violet */
  --accent2:#22c55e; /* green */
  --shadow: 0 20px 60px rgba(0,0,0,0.35);
  --radius: 18px;
  --radius2: 22px;

  /* pastel badges */
  --ok-bg: rgba(34,197,94,0.18);
  --warn-bg: rgba(234,179,8,0.18);
  --bad-bg: rgba(239,68,68,0.18);
  --ok-br: rgba(34,197,94,0.35);
  --warn-br: rgba(234,179,8,0.35);
  --bad-br: rgba(239,68,68,0.35);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background: radial-gradient(1200px 800px at 20% 15%, rgba(124,58,237,0.25), transparent 60%),
              radial-gradient(1000px 700px at 90% 20%, rgba(34,197,94,0.18), transparent 55%),
              linear-gradient(180deg, var(--bg1), var(--bg2));
}

.bg{min-height:100%; padding:24px;}
.container{max-width:1100px; margin:0 auto;}
.container.wide{max-width:1400px;}
a{color:inherit; text-decoration:none}

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:18px;
}
.brand{display:flex; align-items:center; gap:12px;}
.brand-link{display:flex; align-items:center; gap:12px;}
.logo{
  width:44px; height:44px; object-fit:contain;
  border-radius:12px;
  background: rgba(255,255,255,0.04);
  border:1px solid var(--stroke);
  padding:6px;
}
.logo.logo-lg{
  width: 90px;
  height: 90px;
  padding: 8px;
  border-radius: 16px;
}
.brand-name{font-weight:700; letter-spacing:0.2px}
.brand-sub{font-size:12px; color:var(--muted2); margin-top:2px}

.pill{
  font-size:12px; color:var(--muted);
  border:1px solid var(--stroke);
  background: rgba(255,255,255,0.05);
  padding:8px 10px; border-radius:999px;
  backdrop-filter: blur(12px);
}

.card{
  background: linear-gradient(180deg, var(--card), rgba(255,255,255,0.03));
  border:1px solid var(--stroke);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero{padding:28px}
.hero h1{margin:0 0 12px; font-size:34px; line-height:1.1}
.accent{color: #c4b5fd;}
.lead{color:var(--muted); font-size:16px; line-height:1.55; margin:0 0 18px}

.grid-2{display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:10px}
.feature{
  padding:14px; border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.04);
}
.feature-title{font-weight:650; margin-bottom:6px}
.feature-text{color:var(--muted2); font-size:13px; line-height:1.5}

.cta-row{display:flex; align-items:center; justify-content:space-between; gap:14px; margin-top:18px; flex-wrap:wrap}
.cta-row.cta-center{
  justify-content: center;
}
.cta-center a{
  justify-content: center;
}
.btn.xl{
  padding: 14px 20px;
  font-size: 16px;
  border-radius: 16px;
  min-width: 190px;
}
.btn{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,0.06);
  color:var(--text);
  padding:10px 12px;
  border-radius: 14px;
  cursor:pointer;
  font-weight:650;
  transition: transform .06s ease, background .2s ease;
}
.btn:hover{background: rgba(255,255,255,0.09)}
.btn:active{transform: translateY(1px)}
.btn.primary{
  border-color: rgba(124,58,237,0.35);
  background: linear-gradient(180deg, rgba(124,58,237,0.30), rgba(124,58,237,0.18));
}
.btn.ghost{
  background: rgba(255,255,255,0.03);
}

.tiny-note{font-size:12px; color:var(--muted2); line-height:1.4}
.footer{margin-top:16px; color:var(--muted2); font-size:12px; display:flex; gap:8px; align-items:center; justify-content:center}
.dot{opacity:.55}

.split{
  display:grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap:16px;
  align-items:stretch;
}

.panel{overflow:hidden}
.panel-head{
  padding:16px 16px 12px;
  border-bottom:1px solid var(--stroke);
  display:flex; justify-content:space-between; gap:14px; align-items:flex-start;
}
.panel-head h2{margin:0; font-size:16px}
.panel-sub{margin-top:6px; font-size:12px; color:var(--muted2); max-width:680px}

.controls{display:flex; flex-direction:column; gap:10px; align-items:flex-end}
.input{
  width: 340px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  padding: 10px 12px;
  background: rgba(0,0,0,0.22);
  color: var(--text);
  outline:none;
}
.input::placeholder{color: rgba(255,255,255,0.40)}
.filter{display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end}
.chip{
  font-size:12px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,0.04);
  cursor:pointer;
}
.chip.active{outline: 2px solid rgba(124,58,237,0.35)}
.chip.ok{border-color: var(--ok-br); background: var(--ok-bg)}
.chip.warn{border-color: var(--warn-br); background: var(--warn-bg)}
.chip.bad{border-color: var(--bad-br); background: var(--bad-bg)}

.table-wrap{height: calc(100vh - 190px); overflow:auto;}
.table{width:100%; border-collapse:separate; border-spacing:0}
.table thead th{
  position: sticky; top:0; z-index:5;
  background: rgba(10,14,30,0.92);
  border-bottom: 1px solid var(--stroke);
  text-align:left;
  font-size:12px;
  color: var(--muted);
  padding:12px 10px;
}
.table tbody td{
  padding:12px 10px;
  border-bottom:1px solid rgba(255,255,255,0.06);
  vertical-align:top;
  font-size:12px;
  color: rgba(255,255,255,0.82);
}
.table tbody tr:hover{background: rgba(255,255,255,0.03)}
.td-small{max-width: 220px}
.td-medium{max-width: 320px}
.td-large{max-width: 420px}

.badge{
  display:inline-flex; align-items:center; gap:6px;
  font-size:12px;
  border-radius:999px;
  padding:6px 10px;
  border:1px solid var(--stroke);
  white-space:nowrap;
}
.badge.ok{border-color: var(--ok-br); background: var(--ok-bg)}
.badge.warn{border-color: var(--warn-br); background: var(--warn-bg)}
.badge.bad{border-color: var(--bad-br); background: var(--bad-bg)}
.badge .dot{
  width:7px; height:7px; border-radius:999px; background: rgba(255,255,255,0.6);
}

.more{
  color: rgba(196,181,253,0.95);
  cursor:pointer;
  font-weight:650;
  border:1px solid rgba(124,58,237,0.25);
  background: rgba(124,58,237,0.10);
  padding:6px 10px;
  border-radius:12px;
  white-space:nowrap;
}

.chat{display:flex; flex-direction:column}
.chat-status{font-size:12px; color:var(--muted2)}
.chat-body{
  padding:14px 14px 0;
  height: calc(100vh - 270px);
  overflow:auto;
}
.msg{
  margin-bottom:12px;
  padding:12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}
.msg.user{
  background: rgba(124,58,237,0.10);
  border-color: rgba(124,58,237,0.22);
}
.msg .meta{
  font-size:11px; color: rgba(255,255,255,0.55);
  margin-bottom:8px;
}
.msg .content{
  font-size:13px; line-height:1.55; color: rgba(255,255,255,0.90);
}
.msg .content :is(h1,h2,h3){margin:10px 0 6px}
.msg .content p{margin:6px 0}
.msg .content ul{margin:6px 0 6px 20px}
.msg .content code{background: rgba(0,0,0,0.25); padding:2px 6px; border-radius:8px; border:1px solid rgba(255,255,255,0.10)}
.msg .content pre{
  background: rgba(0,0,0,0.35);
  padding:10px; border-radius:14px;
  border:1px solid rgba(255,255,255,0.10);
  overflow:auto;
}

.chat-footer{
  padding:12px 14px 14px;
  border-top: 1px solid var(--stroke);
}
.quick{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px}
.composer{display:flex; gap:10px; align-items:flex-end}
.textarea{
  flex:1;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  padding: 10px 12px;
  background: rgba(0,0,0,0.22);
  color: var(--text);
  outline:none;
  resize: none;
}
.textarea::placeholder{color: rgba(255,255,255,0.40)}
.textarea:disabled{opacity:.55; cursor:not-allowed}
.btn:disabled{opacity:.55; cursor:not-allowed}

.modal{
  position: fixed; inset:0;
  background: rgba(0,0,0,0.55);
  display:none;
  align-items:center; justify-content:center;
  padding: 18px;
}
.modal.show{display:flex}
.modal-card{
  width:min(980px, 100%);
  max-height: 86vh;
  overflow:auto;
  border-radius: 18px;
  border:1px solid var(--stroke);
  background: rgba(10,14,30,0.95);
  box-shadow: var(--shadow);
}
.modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 16px;
  border-bottom:1px solid var(--stroke);
}
.modal-title{font-weight:750}
.modal-body{padding: 14px 16px; color: rgba(255,255,255,0.88); font-size:13px; line-height:1.6}
.modal-body h3{margin:14px 0 8px}
.modal-body .kv{display:grid; grid-template-columns: 180px 1fr; gap:10px; margin: 10px 0}
.modal-body .k{color: var(--muted); font-size:12px}
.modal-body .v{color: rgba(255,255,255,0.88)}
.modal-body .cit{
  border:1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  margin-top:10px;
}
.auth-modal{
  position: fixed;
  inset: 0;
  background: rgba(6,8,16,0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}
.auth-modal.show{display:flex}
.auth-card{
  width: min(520px, 100%);
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(18,24,44,0.98), rgba(12,16,28,0.98));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.auth-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--stroke);
}
.auth-title{font-weight:750; letter-spacing:0.2px}
.auth-body{padding: 14px 16px 2px}
.auth-text{color: var(--muted); font-size:13px; line-height:1.5; margin-bottom:12px}
.auth-label{display:block; font-size:12px; color: var(--muted2); margin-bottom:8px}
.auth-input-wrap{position:relative; display:flex; align-items:center}
.auth-input{
  width:100%;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  padding: 12px 44px 12px 12px;
  background: rgba(0,0,0,0.26);
  color: var(--text);
  outline: none;
  font-size:14px;
}
.auth-input.plain{letter-spacing:0}
.auth-error{
  min-height: 18px;
  font-size:12px;
  color: rgba(248,113,113,0.9);
  margin-top:8px;
  opacity:0;
  transition: opacity .2s ease;
}
.auth-error.show{opacity:1}
.auth-actions{
  padding: 12px 16px 16px;
  display:flex;
  justify-content:flex-end;
  gap:10px;
}
.icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor:pointer;
}
.icon-btn svg{width:18px; height:18px}
#togglePwd{
  position:absolute;
  right:8px;
}
#togglePwd .eye-closed{display:none}
#togglePwd.active .eye-open{display:none}
#togglePwd.active .eye-closed{display:block}
@media (max-width: 1180px){
  .split{grid-template-columns: 1fr; }
  .controls{align-items:stretch}
  .input{width:100%}
  .table-wrap{height: 52vh}
  .chat-body{height: 48vh}
}

/* Onboarding */
.onboarding{padding:24px}
.step{display:none}
.step.active{display:block}
.consent-box{
  border:1px solid var(--stroke);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  margin: 12px 0 16px;
  color: var(--muted);
  line-height:1.6;
}
.consent-title{font-weight:650; color:var(--text); margin:10px 0 4px}
.checkbox-row{
  display:flex;
  gap:10px;
  align-items:flex-start;
  font-size:13px;
  color: var(--muted);
  margin-top: 10px;
}
.checkbox-row input{margin-top:3px}

.form-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:16px;
  margin-top: 12px;
}
.form-section{
  border:1px solid var(--stroke);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.03);
}
.section-title{font-weight:700; margin-bottom:10px}
.field{margin-bottom:12px}
.field label{display:block; font-size:12px; color:var(--muted2); margin-bottom:6px}
.field-grid{display:grid; grid-template-columns: 1fr 1fr; gap:12px}
.input.input-small{margin-top:8px}
.option-grid{display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap:8px}
.option{
  border:1px solid var(--stroke);
  border-radius: 12px;
  padding:8px 10px;
  background: rgba(255,255,255,0.02);
  font-size:12px;
  color: var(--muted);
  display:flex;
  gap:8px;
  align-items:center;
}
.option input{margin:0}
.form-error{
  margin-top: 10px;
  color: rgba(239,68,68,0.85);
  font-size:12px;
}

.onboarding-chat{margin-top: 10px}
.onboarding-chat .chat-body{height: 42vh}

@media (max-width: 980px){
  .form-grid{grid-template-columns: 1fr}
}