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

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* —— Prototype chrome —— */
.proto-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--proto-bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: #1c1c1c;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.proto-bar a { color: #A4EDC9; }
.proto-bar .muted { color: #9aa3a8; font-weight: 500; }
.proto-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(50, 239, 126, 0.18);
  color: var(--lime);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
}

/* —— Hub —— */
.hub {
  min-height: calc(100vh - var(--proto-bar));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 60px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(50, 239, 126, 0.28), transparent 55%),
    linear-gradient(180deg, #f3faf6 0%, #fff 45%, #f8f8f8 100%);
}
.hub-brand {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-deep);
  margin: 0 0 6px;
}
.hub-brand .brand-text {
  color: var(--primary-deep);
}
.hub h1 {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
}
.hub-lead {
  margin: 0 0 28px;
  max-width: 520px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}
.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(200px, 260px));
  gap: 16px;
  width: 100%;
  max-width: 860px;
}
.hub-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px;
  transition: border-color .15s, transform .15s;
}
.hub-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.hub-card .ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--vs-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 14px;
}
.hub-card h2 { margin: 0 0 6px; font-size: 18px; }
.hub-card p { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.hub-meta {
  margin-top: 28px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  max-width: 520px;
}
.hub-walk {
  margin-top: 20px;
  width: 100%;
  max-width: 860px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.hub-walk h3 { margin: 0 0 10px; font-size: 14px; }
.hub-walk ol { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.hub-walk li { margin-bottom: 6px; }
.hub-walk a { color: var(--primary-deep); font-weight: 600; }

@media (max-width: 800px) {
  .hub-grid { grid-template-columns: 1fr; max-width: 360px; }
}

/* —— Shared UI —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  background: var(--canvas);
  color: var(--ink);
}
.btn.primary { background: var(--vs-gradient); color: #fff; }
.btn.ghost { background: var(--primary-soft); color: var(--primary-deep); }
.btn.outline { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}
.field input, .field .fake-input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  font-size: 14px;
  color: var(--ink);
}
.field textarea { min-height: 110px; resize: vertical; }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
}
.pill.on { background: var(--primary-soft); color: var(--primary-deep); }
.pill.warn { background: var(--amber-soft); color: #7a4a0a; }
.pill.danger { background: var(--danger-soft); color: var(--danger); }

.credit {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-deep);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.lang-seg {
  display: inline-flex;
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.lang-seg span {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.lang-seg span.on { background: var(--primary); color: #fff; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--vs-gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.amber { background: linear-gradient(135deg, #FFC04A, #FFAA22); }
.avatar.cyan { background: linear-gradient(135deg, #4ad8de, #1BCAD1); }

.progress {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  background: var(--vs-gradient);
  border-radius: 999px;
}

.tip {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.45;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #fff;
  border: 1px dashed #cfe9d8;
  border-radius: 10px;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
  vertical-align: -1px;
}

.banner {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}
.banner.ok { background: var(--primary-soft); border: 1px solid var(--mint); color: var(--primary-deep); }
.banner.warn { background: var(--amber-soft); border: 1px solid #ffd89a; color: #7a4a0a; }
.banner.danger { background: var(--danger-soft); border: 1px solid #ffc9b8; color: var(--danger); }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
}
.card.selected { border: 2px solid var(--primary); }
.card.dashed { border-style: dashed; text-align: center; }
.card .name { font-weight: 700; font-size: 15px; }
.card .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 8px;
}
.list-row.active { border-color: var(--primary); background: var(--primary-soft); }
.list-row .t { font-weight: 600; font-size: 14px; }
.list-row .s { color: var(--muted); font-size: 12px; margin-top: 2px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.check-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  margin: 8px 0 14px;
}
.check-list [data-gate],
.check-list [data-toggle] {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  user-select: none;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.check-list [data-gate]:hover,
.check-list [data-toggle]:hover {
  border-color: rgba(50, 239, 126, 0.55);
  background: rgba(50, 239, 126, 0.06);
}
.check-list [data-gate][data-on="1"],
.check-list [data-toggle][data-on="1"] {
  border-color: rgba(14, 107, 58, 0.28);
  background: linear-gradient(180deg, rgba(50, 239, 126, 0.12), rgba(50, 239, 126, 0.04));
  box-shadow: inset 0 0 0 1px rgba(50, 239, 126, 0.12);
}
.check-list .tog {
  position: relative;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid #9aa3ad;
  background: #fff;
  color: transparent;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.check-list [data-on="1"] .tog {
  border-color: #0e6b3a;
  background: linear-gradient(180deg, #32ef7e, #1fbf5c);
  box-shadow: 0 1px 0 rgba(14, 107, 58, 0.2);
}
.check-list [data-on="1"] .tog::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

/* Native checkboxes (auth / forms) */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0 10px 0 0;
  vertical-align: middle;
  border-radius: 6px;
  border: 2px solid #9aa3ad;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}
input[type="checkbox"]:hover {
  border-color: rgba(14, 107, 58, 0.7);
}
input[type="checkbox"]:checked {
  border-color: #0e6b3a;
  background: linear-gradient(180deg, #32ef7e, #1fbf5c);
}
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
label.check-list {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  padding: 10px 0;
  cursor: pointer;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.h1 { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.h2 { font-size: 16px; font-weight: 700; margin: 0 0 10px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 4px; }

/* —— Web app shells —— */
.app-shell {
  min-height: calc(100vh - var(--proto-bar));
  display: grid;
  grid-template-columns: 220px 1fr;
}
.proto-main .app-shell {
  min-height: calc(100vh - var(--proto-bar));
}
.app-shell.auth-shell {
  grid-template-columns: 1fr;
  place-items: center;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(50, 239, 126, 0.22), transparent 50%),
    var(--canvas);
}
.side-nav {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-nav .brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary-deep);
  padding: 4px 10px 16px;
}
.side-nav .brand .brand-text {
  color: var(--primary-deep);
}
.side-nav .label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 12px 10px 6px;
}
.side-nav a {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.side-nav a:hover { background: var(--canvas); color: var(--ink); }
.side-nav a.on { background: var(--primary-soft); color: var(--primary-deep); }
.side-nav .spacer { flex: 1; }
.side-nav .user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
}

.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.app-top .title { font-weight: 700; font-size: 16px; }
.app-top-right { display: flex; align-items: center; gap: 8px; }
.app-body {
  padding: 22px;
  max-width: 920px;
}
.app-body.narrow { max-width: 520px; }
.app-body.wide { max-width: 1100px; }

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px;
  margin: 40px 16px;
}
.auth-card .logo {
  font-weight: 700;
  font-size: 22px;
  color: var(--primary-deep);
  text-align: center;
}
.auth-card .sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 20px;
}
.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-deep);
}

.grid-2 { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.continue-card {
  background: var(--vs-gradient);
  color: #fff;
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.continue-card .k { font-size: 11px; opacity: .9; font-weight: 600; letter-spacing: .04em; }
.continue-card .t { font-size: 18px; font-weight: 700; margin-top: 2px; }
.continue-card .btn { background: #fff; color: var(--primary-deep); }

.mcq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}
.mcq a, .mcq label {
  display: block;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.mcq .selected, .mcq a.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-weight: 600;
}

.video-stage {
  background: linear-gradient(155deg, #1aad55 0%, #25CC68 55%, #32EF7E 100%);
  border-radius: 14px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  position: relative;
}
.video-stage .play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.video-stage .time {
  position: absolute;
  bottom: 12px;
  left: 14px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0,0,0,.28);
  padding: 4px 10px;
  border-radius: 999px;
}

.outline-step {
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  margin-bottom: 4px;
}
.outline-step.on {
  background: var(--primary-soft);
  font-weight: 700;
  color: var(--primary-deep);
}

.chat-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
  margin-bottom: 12px;
}
.bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
}
.bubble.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.bubble.user { align-self: flex-end; background: var(--primary); color: #fff; }
.composer { display: flex; gap: 8px; }
.composer input { flex: 1; }

.split-side {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
}
.split-side.tint { background: var(--primary-soft); border-color: var(--mint); }

/* Side nav icons */
.side-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Charts & stats visuals */
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 28px;
  margin-top: 10px;
}
.sparkline i {
  flex: 1;
  display: block;
  min-height: 4px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #32EF7E, #25CC68);
  opacity: 0.85;
}
.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 110px;
  margin-top: 8px;
}
.mini-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.mini-bar-track {
  flex: 1;
  width: 100%;
  max-width: 36px;
  background: #eef2f0;
  border-radius: 8px 8px 4px 4px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.mini-bar-fill {
  width: 100%;
  background: var(--vs-gradient);
  border-radius: 6px 6px 0 0;
  min-height: 6px;
}
.mini-bar-lbl {
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--ink);
}
.mini-bar-val {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}
.ring-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}
.ring {
  --p: 70;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), #e8eee9 0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ring span {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--primary-deep);
}
.ring-meta .name { font-weight: 700; font-size: 14px; }
.ring-meta .meta { font-size: 12px; color: var(--muted); }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--line);
    gap: 4px;
  }
  .side-nav .spacer, .side-nav .user, .side-nav .label { display: none; }
  .side-nav .brand { width: 100%; padding-bottom: 8px; }
  .grid-2, .grid-3, .grid-4, .stat-grid, .mcq { grid-template-columns: 1fr; }
}
