:root {
  --bg: #f5f7fa; --panel: #ffffff; --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e2e8f0; --line-2: #f1f5f9;
  --brand: #0d9488; --brand-600: #0f766e; --brand-50: #f0fdfa; --brand-100: #ccfbf1;
  --navy: #0b1324; --navy-2: #131d33; --navy-ink: #cbd5e1;
  --ok: #16a34a; --ok-50: #f0fdf4; --warn: #d97706; --warn-50: #fffbeb; --bad: #dc2626; --bad-50: #fef2f2;
  --info: #2563eb; --info-50: #eff6ff; --violet: #7c3aed; --violet-50: #f5f3ff;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-600); text-decoration: none; }
h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: var(--navy-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; color: #fff; font-weight: 700; font-size: 16px; }
.logo i { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-size: 19px; }
.logo small { display: block; font-size: 11px; font-weight: 500; color: #5eead4; letter-spacing: .04em; text-transform: uppercase; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--navy-ink); font-weight: 500; }
.nav a i { font-size: 18px; opacity: .85; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.active { background: rgba(13,148,136,.18); color: #fff; }
.nav a.active i { color: #2dd4bf; opacity: 1; }
.nav a .count { margin-left: auto; background: var(--warn); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; }
.side-foot { margin-top: auto; border-top: 1px solid #1e293b; padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-100); color: var(--brand-600); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.side-foot .who { line-height: 1.3; min-width: 0; }
.side-foot .who b { color: #fff; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 12px; color: #64748b; }
.side-foot button { margin-left: auto; }
.main { padding: 28px 36px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- primitives ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.mt { margin-top: 18px; }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; font: 500 13.5px Inter, sans-serif; cursor: pointer; background: var(--brand); color: #fff; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--brand-600); }
.btn i { font-size: 16px; }
.btn.secondary { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn.secondary:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.ghost { background: transparent; color: var(--muted); padding: 6px 8px; }
.btn.ghost:hover { background: var(--line-2); color: var(--ink); }
.btn.danger { background: #fff; color: var(--bad); border-color: #fecaca; }
.btn.danger:hover { background: var(--bad-50); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.lg { padding: 11px 18px; font-size: 14.5px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn.live { background: var(--bad); } .btn.live:hover { background: #b91c1c; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; color: var(--ink-2); }
input, select, textarea { font: 14px Inter, sans-serif; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,148,136,.12); }
textarea { min-height: 120px; resize: vertical; }
input[type=file] { padding: 7px; }
input[type=checkbox] { width: auto; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-50); color: var(--ok); } .badge.warn { background: var(--warn-50); color: var(--warn); }
.badge.bad { background: var(--bad-50); color: var(--bad); } .badge.info { background: var(--info-50); color: var(--info); }
.badge.brand { background: var(--brand-50); color: var(--brand-600); } .badge.violet { background: var(--violet-50); color: var(--violet); }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 20px; background: #f8fafc; border-bottom: 1px solid var(--line); }
table.t td { padding: 13px 20px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #fafcff; }
.person { display: flex; align-items: center; gap: 10px; } .person b { font-weight: 600; display: block; } .person span { font-size: 12.5px; color: var(--muted); }

.bar { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }
.bar.sm { height: 6px; }

.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; }
.stat .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; flex: none; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ico.brand { background: var(--brand-50); color: var(--brand); } .ico.info { background: var(--info-50); color: var(--info); }
.ico.warn { background: var(--warn-50); color: var(--warn); } .ico.violet { background: var(--violet-50); color: var(--violet); }
.ico.ok { background: var(--ok-50); color: var(--ok); }

.todo { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.todo:last-child { border-bottom: 0; } .todo:hover { background: #fafcff; }
.todo .n { margin-left: auto; font-weight: 700; font-size: 18px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty i { font-size: 34px; color: var(--faint); display: block; margin-bottom: 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tabs a.active { color: var(--brand-600); border-color: var(--brand); }
.tabs a .badge { margin-left: 6px; }

/* ---------- journey ---------- */
.journey { display: grid; grid-template-columns: repeat(6, 1fr); position: relative; padding: 8px 0 4px; }
.journey .step { position: relative; text-align: center; padding: 0 6px; }
.journey .step::before { content: ""; position: absolute; top: 22px; left: -50%; width: 100%; height: 4px; background: var(--line); z-index: 0; }
.journey .step:first-child::before { display: none; }
.journey .step.done::before, .journey .step.current::before, .journey .step.waiting::before { background: var(--brand); }
.journey .dot { position: relative; z-index: 1; width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; font-size: 21px; background: #fff; border: 2px solid var(--line); color: var(--faint); }
.journey .done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.journey .current .dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 6px rgba(13,148,136,.14); }
.journey .waiting .dot { border-color: var(--warn); color: var(--warn); box-shadow: 0 0 0 6px rgba(217,119,6,.12); }
.journey .lbl { font-weight: 600; font-size: 13px; }
.journey .det { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.journey .locked .lbl { color: var(--faint); }
.ring { width: 112px; height: 112px; flex: none; }
.ring circle { fill: none; stroke-width: 10; }
.ring .bg { stroke: var(--line-2); } .ring .fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .6s; }
.ring text { font: 700 24px Inter, sans-serif; fill: var(--ink); }
.hero { display: flex; gap: 26px; align-items: center; padding: 24px; }
.hero .next { background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 10px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.hero .next i.big { font-size: 26px; color: var(--brand); }

.skill { margin-bottom: 14px; } .skill:last-child { margin-bottom: 0; }
.skill .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; gap: 8px; }
.skill .bar { position: relative; overflow: visible; }
.skill .target { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink-2); border-radius: 2px; }

.course-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.course-card .cover { height: 84px; border-radius: 10px; background: linear-gradient(135deg, var(--brand) 0%, #0e7490 100%); color: #fff; display: flex; align-items: flex-end; padding: 12px; font-size: 26px; }
.course-card h3 { font-size: 14.5px; line-height: 1.35; }

/* ---------- chat ---------- */
.chat-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 520px; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.chat-head .bot { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-size: 20px; }
.msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: #fbfcfe; }
.msg { max-width: 78%; padding: 11px 14px; border-radius: 14px; white-space: pre-wrap; line-height: 1.55; }
.msg.assistant { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: var(--brand); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg .meta { font-size: 11px; opacity: .6; margin-top: 4px; display: flex; gap: 4px; align-items: center; }
.composer { display: flex; gap: 8px; padding: 14px; border-top: 1px solid var(--line-2); }
.typing span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; background: var(--faint); border-radius: 50%; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.check { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 13px; }
.check i { font-size: 18px; color: var(--faint); } .check.on i { color: var(--ok); }
pre.crm { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 12px; white-space: pre-wrap; margin: 0; max-height: 340px; overflow: auto; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: var(--navy); color: #e2e8f0; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login .art h2 { font-size: 34px; line-height: 1.2; font-weight: 700; color: #fff; max-width: 460px; letter-spacing: -.02em; }
.login .art p { color: #94a3b8; max-width: 440px; font-size: 15px; }
.login .feat { display: flex; gap: 12px; align-items: center; margin: 12px 0; color: #cbd5e1; }
.login .feat i { width: 34px; height: 34px; border-radius: 9px; background: rgba(13,148,136,.2); color: #2dd4bf; display: grid; place-items: center; font-size: 18px; }
.login .form { display: grid; place-items: center; padding: 40px; }
.login .box { width: 100%; max-width: 380px; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0; }
.role-pick button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px; text-align: left; cursor: pointer; font: inherit; }
.role-pick button.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,148,136,.12); }
.role-pick b { display: block; font-size: 13.5px; } .role-pick span { font-size: 12px; color: var(--muted); }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ---------- modal / drawer / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; justify-content: center; align-items: flex-start; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; }
.drawer-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 50; display: flex; justify-content: flex-end; }
.drawer { width: min(760px, 100%); height: 100%; background: #fff; overflow-y: auto; box-shadow: -10px 0 30px rgba(15,23,42,.12); }
.drawer .card-head { position: sticky; top: 0; background: #fff; z-index: 1; }
.lesson { padding: 16px 0; border-bottom: 1px solid var(--line-2); } .lesson:last-child { border-bottom: 0; }
.lesson p { white-space: pre-wrap; margin: 8px 0; color: var(--ink-2); }
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; max-width: 380px; animation: up .2s; }
.toast.bad { background: var(--bad); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: rot .8s linear infinite; display: inline-block; }
.spin.dark { border-color: var(--line); border-top-color: var(--brand); }
@keyframes rot { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 80px; }
.skill-row { display: grid; grid-template-columns: 1.2fr 2fr 90px 70px 40px; gap: 8px; align-items: center; margin-bottom: 8px; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g-side, .chat-wrap { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; }
  .main { padding: 20px 16px; } .g2, .g3 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; } .login .art { display: none; }
  .journey { grid-template-columns: repeat(3, 1fr); row-gap: 20px; } .journey .step::before { display: none; }
}
