:root {
  --bg: #070b18;
  --bg-2: #0c1226;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8ecf8;
  --muted: #8e98b8;
  --dim: #5d6788;
  --teal: #2dd4bf;
  --blue: #60a5fa;
  --violet: #a78bfa;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --grad: linear-gradient(135deg, #2dd4bf 0%, #60a5fa 50%, #a78bfa 100%);
  --radius: 18px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Outfit", "Inter", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(900px 600px at 10% -10%, rgba(45, 212, 191, 0.16), transparent 60%),
    radial-gradient(800px 600px at 110% 10%, rgba(167, 139, 250, 0.16), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(96, 165, 250, 0.12), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 270px 1fr; height: 100vh; }

.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(7, 11, 24, 0.6);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  gap: 6px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--grad);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 20px; color: #06101f;
  box-shadow: 0 8px 24px -6px rgba(45, 212, 191, 0.6);
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }
.brand-sub { font-size: 12px; color: var(--muted); }

.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--dim); padding: 16px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 500; text-align: left; width: 100%;
  transition: all .2s ease;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav-item .ico { width: 22px; text-align: center; font-size: 17px; }
.nav-item .badge { margin-left: auto; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(248, 113, 113, 0.15); color: var(--bad); }
.nav-pkg { font-size: 13.5px; padding: 8px 12px; }
.nav-pkg .mini { margin-left: auto; width: 38px; height: 5px; background: rgba(255,255,255,.08); border-radius: 9px; overflow: hidden; }
.nav-pkg .mini > i { display: block; height: 100%; background: var(--grad); border-radius: 9px; }

.sidebar-foot { margin-top: auto; padding: 14px 12px 0; font-size: 12px; color: var(--dim); display: flex; flex-direction: column; gap: 6px; }
.ai-status, .sync-status { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex-shrink: 0; }
.dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.dot.err { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.sync-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 11px; background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--muted); }


.main { overflow-y: auto; padding: 32px 40px 60px; scroll-behavior: smooth; }
.view { animation: fadeUp .45s ease both; max-width: 1280px; margin: 0 auto; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Typography ---------- */
h1 { font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
h2 { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
h3 { font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 6px; }

/* ---------- Cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.grid { display: grid; gap: 20px; }
.g-hero { grid-template-columns: 1.35fr 1fr; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-2 { grid-template-columns: 1fr 1fr; }
.g-pk { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

/* Hero */
.hero { display: flex; gap: 28px; align-items: center; position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; width: 380px; height: 380px; right: -120px; top: -140px;
  background: radial-gradient(circle, rgba(96,165,250,.18), transparent 70%);
}
.hero-rings { display: flex; gap: 18px; flex-shrink: 0; }
.hero-body { position: relative; z-index: 1; }
.hero-body h2 { font-size: 24px; margin-bottom: 8px; }
.hero-body p { color: var(--muted); margin-bottom: 18px; max-width: 420px; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-family: var(--font-display); font-size: 30px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat .ico { font-size: 20px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); margin-bottom: 8px; }

/* Donut */
.donut { position: relative; display: inline-grid; place-items: center; }
.donut svg { transform: rotate(-90deg); }
.donut .track { stroke: rgba(255,255,255,.07); }
.donut .arc { transition: stroke-dashoffset 1.2s cubic-bezier(.2,.8,.2,1); stroke-linecap: round; }
.donut .label { position: absolute; text-align: center; }
.donut .label b { display: block; font-family: var(--font-display); font-weight: 700; line-height: 1; }
.donut .label span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* Bars */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 52px 1fr 48px; align-items: center; gap: 12px; cursor: pointer; padding: 4px 6px; border-radius: 10px; transition: background .2s; }
.bar-row:hover { background: var(--panel); }
.bar-row .code { font-size: 12px; color: var(--muted); font-weight: 600; }
.bar-track { height: 10px; background: rgba(255,255,255,.06); border-radius: 99px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 99px; width: 0; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.bar-fill.c2 { position: absolute; top: 0; left: 0; opacity: .35; }
.bar-row .pct { text-align: right; font-size: 13px; font-weight: 600; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Radar */
.radar text { fill: var(--muted); font-size: 10.5px; font-family: var(--font); }
.radar .grid-l { fill: none; stroke: rgba(255,255,255,.08); }
.radar .axis { stroke: rgba(255,255,255,.06); }
.radar .area { fill: url(#radarGrad); stroke: var(--teal); stroke-width: 2; animation: radarIn 1s ease both; transform-origin: center; }
@keyframes radarIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }

/* Package cards */
.pk-card { cursor: pointer; transition: transform .25s ease, border-color .25s, box-shadow .25s; position: relative; overflow: hidden; }
.pk-card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: 0 24px 60px -24px rgba(0,0,0,.8); }
.pk-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, hsl(var(--h) 80% 60%), hsl(calc(var(--h) + 50) 80% 65%));
}
.pk-top { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.pk-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: hsla(var(--h), 80%, 60%, .13); flex-shrink: 0; }
.pk-code { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .5px; }
.pk-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; line-height: 1.3; }
.pk-desc { color: var(--muted); font-size: 13px; margin-bottom: 16px; min-height: 40px; }
.pk-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); }
.pk-progress { height: 6px; border-radius: 9px; background: rgba(255,255,255,.07); overflow: hidden; margin-bottom: 12px; }
.pk-progress i { display: block; height: 100%; background: linear-gradient(90deg, hsl(var(--h) 80% 60%), hsl(calc(var(--h) + 50) 80% 65%)); border-radius: 9px; transition: width 1s; }

/* Chips & buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  background: var(--panel-2); border: 1px solid var(--border); transition: all .2s ease;
}
.btn:hover { border-color: var(--border-strong); background: rgba(255,255,255,.1); }
.btn.primary { background: var(--grad); color: #06101f; border: none; box-shadow: 0 10px 30px -10px rgba(96,165,250,.7); }
.btn.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; padding: 3px 10px; border-radius: 99px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.tag.ok { color: var(--ok); background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.25); }
.tag.warn { color: var(--warn); background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.25); }
.tag.bad { color: var(--bad); background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.25); }
.tag.info { color: var(--blue); background: rgba(96,165,250,.1); border-color: rgba(96,165,250,.25); }

/* ---------- Chat / Q&A ---------- */
.qa-layout { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
.qa-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 16px; }
.chat { display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
.msg { display: flex; gap: 12px; max-width: 88%; animation: msgIn .35s ease both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.msg .av { width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; font-size: 15px; font-weight: 700; }
.msg.bot .av { background: var(--grad); color: #06101f; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.user .av { background: var(--panel-2); border: 1px solid var(--border); }
.bubble { padding: 14px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border); }
.msg.bot .bubble { border-top-left-radius: 6px; }
.msg.user .bubble { border-top-right-radius: 6px; background: linear-gradient(135deg, rgba(45,212,191,.14), rgba(96,165,250,.14)); border-color: rgba(96,165,250,.25); }
.bubble .qn { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .4px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bubble .qt { font-weight: 500; }
.bubble .meta { font-size: 11.5px; color: var(--dim); margin-top: 6px; display: flex; gap: 10px; align-items: center; }
.bubble .meta button { color: var(--blue); font-size: 11.5px; }
.bubble .note { margin-top: 6px; font-size: 13px; color: var(--muted); border-left: 2px solid var(--border-strong); padding-left: 8px; }
.hint { margin-top: 10px; font-size: 13px; color: var(--muted); background: rgba(96,165,250,.06); border: 1px dashed rgba(96,165,250,.25); padding: 10px 12px; border-radius: 12px; }
.hint b { color: var(--blue); font-weight: 600; }

.msg.current .bubble { border-color: rgba(45,212,191,.4); box-shadow: 0 0 0 4px rgba(45,212,191,.07); }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

.ai-bubble { background: linear-gradient(135deg, rgba(167,139,250,.1), rgba(96,165,250,.08)); border-color: rgba(167,139,250,.3); }
.ai-bubble h1, .ai-bubble h2, .ai-bubble h3 { font-size: 15px; margin: 8px 0 4px; }
.ai-bubble ul, .ai-bubble ol { padding-left: 20px; margin: 6px 0; }
.ai-bubble p { margin: 6px 0; }
.ai-bubble code { background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 5px; font-size: 13px; }

.composer {
  position: sticky; bottom: -60px; margin-top: 8px;
  background: rgba(12, 18, 38, 0.85); backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong); border-radius: 20px; padding: 16px;
  box-shadow: 0 -10px 40px -10px rgba(0,0,0,.6);
}
.options { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel); transition: all .18s ease;
}
.opt:hover { border-color: rgba(45,212,191,.5); background: rgba(45,212,191,.07); transform: translateX(3px); }
.opt .k { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--muted); flex-shrink: 0; }
.opt.sel { border-color: var(--teal); background: rgba(45,212,191,.12); }
.opt.sel .k { background: var(--teal); color: #06101f; }
.opt .sc { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.input {
  width: 100%; background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; outline: none; transition: border-color .2s; resize: vertical;
}
.input:focus { border-color: var(--teal); }
textarea.input { min-height: 90px; }
.composer-bar { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.composer-bar .spacer { flex: 1; }
.note-box { margin-top: 10px; display: none; }
.note-box.open { display: block; }

.done-card { text-align: center; padding: 34px; }
.done-card .big { font-size: 46px; margin-bottom: 8px; }

/* Step dots */
.steps { display: flex; flex-wrap: wrap; gap: 6px; }
.step { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; font-weight: 600; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); transition: all .2s; }
.step:hover { border-color: var(--border-strong); color: var(--text); }
.step.s1 { background: rgba(52,211,153,.18); color: var(--ok); border-color: rgba(52,211,153,.35); }
.step.s05 { background: rgba(251,191,36,.16); color: var(--warn); border-color: rgba(251,191,36,.35); }
.step.s0 { background: rgba(248,113,113,.16); color: var(--bad); border-color: rgba(248,113,113,.35); }
.step.skip { border-style: dashed; }
.step.cur { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- Actions & Docs ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--border); transition: border-color .2s;
}
.row:hover { border-color: var(--border-strong); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 500; }
.row .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.row.done .t { text-decoration: line-through; color: var(--muted); }
.check {
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-strong); flex-shrink: 0;
  display: grid; place-items: center; transition: all .2s;
}
.check.on { background: var(--ok); border-color: var(--ok); color: #06101f; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters .btn.active { border-color: var(--teal); color: var(--teal); }

table.docs { width: 100%; border-collapse: collapse; }
table.docs th { text-align: left; font-size: 11.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.docs td { padding: 13px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
table.docs tr:hover td { background: rgba(255,255,255,.02); }
.code-pill { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; padding: 3px 8px; border-radius: 7px; background: var(--panel-2); }

/* Settings */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .help { font-size: 12px; color: var(--dim); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 50;
  background: rgba(12,18,38,.95); border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 12px 18px; box-shadow: var(--shadow); font-size: 14px;
  transform: translateY(20px); opacity: 0; transition: all .3s ease; pointer-events: none;
}
.toast.show { transform: none; opacity: 1; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* Responsive */
@media (max-width: 1100px) {
  .g-hero, .g-2 { grid-template-columns: 1fr; }
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .qa-layout { grid-template-columns: 1fr; }
  .qa-side { position: static; }
}
@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px; }
  .hero { flex-direction: column; }
}
