/* TecnoGuide - estilos globais */
:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f5f8fc;
  --text: #0b1f3b;
  --muted: #52627a;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-soft: #dbeafe;
  --cyan: #06b6d4;
  --cyan-soft: #cffafe;
  --accent: #10b981;
  --accent-soft: #d1fae5;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --sidebar: #0b1f3b;
  --sidebar-text: #cbd5e1;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11, 31, 59, .04), 0 12px 32px rgba(11, 31, 59, .07);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
code, pre { font-family: var(--mono); }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: .05em .35em; font-size: .9em; }
pre { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 10px; overflow: auto; font-size: .85rem; line-height: 1.5; }
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
img { max-width: 100%; }
.brand-logo { display: block; width: auto; max-width: none; object-fit: contain; }
.brand-logo-inverse { filter: grayscale(1) brightness(0) invert(1); }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(37, 99, 235, .3); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: fixed; top: .75rem; left: .75rem; z-index: 200; transform: translateY(-150%); background: var(--text); color: #fff; padding: .65rem 1rem; border-radius: 8px; font-weight: 700; }
.skip-link:focus { transform: translateY(0); }
.eyebrow { color: var(--primary-600); font-size: .72rem; line-height: 1.2; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .35rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; font-size: .92rem; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-1 { margin-bottom: .5rem; }
.hidden { display: none !important; }
.flex { display: flex; gap: .75rem; align-items: center; }
.flex-between { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 1rem; }

/* Layout admin */
.layout-admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; color: #fff; width: fit-content; }
.sidebar .brand small { display: block; font-weight: 500; font-size: .7rem; color: #94a3b8; letter-spacing: .02em; }
.sidebar nav { display: flex; flex-direction: column; gap: .15rem; }
.sidebar nav .label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin: .9rem .6rem .3rem; }
.sidebar nav a { color: var(--sidebar-text); padding: .5rem .65rem; border-radius: 8px; display: flex; align-items: center; gap: .6rem; font-size: .92rem; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar .user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: 1rem; font-size: .85rem; }
.sidebar .user strong { color: #fff; display: block; }
.sidebar .user form { margin-top: .5rem; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 2rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.topbar h1 { font-size: 1.25rem; margin: 0; }
.topbar .crumbs { font-size: .8rem; color: var(--muted); margin-bottom: .15rem; }
.topbar .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.content { padding: 1.5rem 2rem 3rem; max-width: 1400px; }

/* Layout app (cliente) */
.layout-app { min-height: 100vh; display: flex; flex-direction: column; }
.appbar { background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); padding: .7rem 2rem; display: flex; align-items: center; gap: 1.5rem; position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px); }
.appbar .brand { display: flex; align-items: center; color: var(--text); flex: none; }
.appbar .brand:hover, .sidebar .brand:hover { text-decoration: none; }
.appbar nav { display: flex; gap: .25rem; }
.appbar nav a { padding: .45rem .8rem; border-radius: 8px; color: var(--muted); font-weight: 500; }
.appbar nav a.active, .appbar nav a:hover { background: var(--primary-soft); color: var(--primary-600); text-decoration: none; }
.appbar .spacer { flex: 1; }
.appbar-actions { display: flex; align-items: center; gap: .75rem; }
.account-link { display: flex; align-items: center; gap: .55rem; color: var(--text); min-width: 0; }
.account-link:hover { text-decoration: none; }
.account-link strong, .account-link small { display: block; line-height: 1.2; }
.account-link strong { font-size: .82rem; }
.account-link small { font-size: .7rem; color: var(--muted); margin-top: .15rem; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid !important; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary-600); font-size: .72rem; font-weight: 800; }
.app-content { padding: 2rem 2rem 4rem; max-width: 1240px; width: 100%; margin: 0 auto; }
.app-content.narrow { max-width: 1180px; }
.app-content:focus { outline: none; }

/* Layout auth */
.layout-auth { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% -10%, #dbeafe 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #cffafe 0%, transparent 55%), var(--bg); padding: 2rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 2.25rem; width: 100%; max-width: 440px; }
.auth-card .brand { display: flex; align-items: center; margin-bottom: .75rem; }
.auth-card .brand strong { font-size: 1.35rem; letter-spacing: -.02em; }
.auth-card .brand small { display: block; color: var(--muted); font-size: .8rem; }
.auth-tagline { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }

/* Cards e grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 1rem 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; }
.stat .value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.stat .label { font-size: .8rem; color: var(--muted); }
.stat.accent { border-color: #bbf7d0; background: linear-gradient(180deg, #f0fdf4, #fff); }
.stat.primary { border-color: #bfdbfe; background: linear-gradient(180deg, #eff6ff, #fff); }

/* Botões */
.btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700; font-size: .88rem; cursor: pointer; line-height: 1.2; font-family: inherit; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #059669; }
.btn-ai { background: linear-gradient(135deg, var(--primary), var(--cyan)); border-color: transparent; color: #fff; }
.btn-ai:hover { filter: brightness(1.08); }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { min-height: 34px; padding: .35rem .7rem; font-size: .78rem; border-radius: 8px; }
.btn-link { border: 0; background: none; color: var(--primary); padding: .25rem .4rem; }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn-block { width: 100%; justify-content: center; }

/* Formulários */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .3rem; }
label .hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=color], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 9px; font: inherit; font-size: .92rem; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { min-height: 96px; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: .85rem; min-height: 140px; }
.field { margin-bottom: 1rem; }
.field .help { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.checkbox input { width: auto; }
.inline-form { display: inline; }

/* Badges e alertas */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge-primary { background: var(--primary-soft); color: var(--primary-600); border-color: #bfdbfe; }
.badge-success { background: var(--accent-soft); color: #166534; border-color: #bbf7d0; }
.badge-warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.badge-danger { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.badge-ai { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.alert { padding: .8rem 1rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 1rem; font-size: .92rem; }
.alert-success { background: var(--accent-soft); border-color: #bbf7d0; color: #14532d; }
.alert-error { background: var(--danger-soft); border-color: #fecaca; color: #7f1d1d; }
.alert-info { background: var(--primary-soft); border-color: #bfdbfe; color: #1e3a8a; }
.alert-warning { background: var(--warning-soft); border-color: #fde68a; color: #78350f; }
.flashes { padding: 1rem 2rem 0; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
.progress { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--cyan), var(--accent)); border-radius: 999px; }
.progress-label { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .8rem; margin: 1rem 0 .35rem; }
.progress-label strong { color: var(--text); }
.bar-list .row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; font-size: .88rem; margin-bottom: .45rem; }
.bar-list .bar { grid-column: 1 / -1; height: 6px; background: var(--border); border-radius: 999px; }
.bar-list .bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

/* Listas de trilha / módulos */
.module { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 1rem; overflow: hidden; box-shadow: 0 3px 18px rgba(15,23,42,.035); }
.module-head { padding: 1rem 1.15rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.module-head h3 { margin: 0; }
.module-head p { color: var(--muted); font-size: .8rem; margin: .2rem 0 0; }
.module-count { font-size: .75rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.content-row { display: flex; align-items: center; gap: .9rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; transition: background .15s ease; }
.content-row:last-child { border-bottom: 0; }
.content-row:hover { background: #f8fbff; text-decoration: none; }
.content-row.current { background: #fffaf0; }
.content-row .title { font-weight: 600; }
.content-row .meta { display: flex; gap: .35rem .7rem; flex-wrap: wrap; font-size: .77rem; color: var(--muted); }
.content-row .meta span + span::before { content: "·"; margin-right: .7rem; color: #a0a9b8; }
.content-order { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: .76rem; font-weight: 800; flex: none; }
.content-row.done .content-order { background: var(--accent-soft); border-color: #bbf7d0; color: #166534; }
.content-row.current .content-order { background: var(--warning-soft); border-color: #fde68a; color: #92400e; }
.type-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-600); font-size: .62rem; letter-spacing: -.02em; white-space: nowrap; font-weight: 800; flex: none; }
.type-icon.video { background: #fee2e2; color: #991b1b; }
.type-icon.code { background: #ede9fe; color: #5b21b6; }
.type-icon.panel { background: var(--accent-soft); color: #166534; }
.type-icon.reference { background: var(--warning-soft); color: #92400e; }
.drag-handle { cursor: grab; color: var(--muted); user-select: none; }

/* Layout principal + coluna lateral (colapsa no celular) */
.split { display: grid; grid-template-columns: minmax(0, 1fr) var(--aside, 320px); gap: 1.25rem; align-items: start; }
.split > * { min-width: 0; }

/* Página de conteúdo do cliente */
.lesson-context { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.back-link { display: inline-flex; align-items: center; min-height: 36px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.lesson-position { display: flex; align-items: center; gap: .65rem; color: var(--muted); font-size: .75rem; font-weight: 700; }
.lesson-position .progress { width: 120px; height: 6px; }
.learn { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 1.5rem; align-items: start; }
.learn > * { min-width: 0; }
.learn.no-chat { grid-template-columns: minmax(0, 1fr); }
.article { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: clamp(1.4rem, 3vw, 2.5rem); overflow-wrap: anywhere; box-shadow: var(--shadow); }
.lesson-header { border-bottom: 1px solid var(--border); padding-bottom: 1.5rem; margin-bottom: 1.6rem; }
.lesson-header h1 { font-size: clamp(1.65rem, 3vw, 2.15rem); letter-spacing: -.025em; margin-bottom: .6rem; }
.lesson-header p { color: var(--muted); font-size: 1rem; max-width: 70ch; margin: 0; }
.lesson-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .7rem; color: var(--muted); font-size: .75rem; font-weight: 700; margin-bottom: .65rem; }
.lesson-meta > span + span:not(.badge)::before { content: "·"; margin-right: .7rem; color: #a0a9b8; }
.article pre, .msg pre { max-width: 100%; }
.article .body { font-size: 1.02rem; max-width: 78ch; }
.article .body h2 { margin-top: 1.5rem; font-size: 1.3rem; }
.article .body h3 { margin-top: 1.25rem; }
.article .body img { border-radius: 10px; border: 1px solid var(--border); }
.article .body blockquote { border-left: 4px solid var(--primary); background: var(--primary-soft); margin: 1rem 0; padding: .75rem 1rem; border-radius: 0 8px 8px 0; }
.article .body table { margin: 1rem 0; }
.article .body iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; margin-bottom: 1.5rem; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.code-sample { margin-top: 1.25rem; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.code-sample .head { display: flex; align-items: center; justify-content: space-between; padding: .55rem .9rem; background: var(--surface-2); font-size: .85rem; font-weight: 600; }
.code-sample pre { margin: 0; border-radius: 0; }
.code-sample .desc { padding: .5rem .9rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--border); }
.refs a { display: block; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 9px; margin-bottom: .5rem; background: var(--surface); }
.refs a small { display: block; color: var(--muted); }
.learn-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.sticky { position: sticky; top: 80px; }
.mobile-chat-launch { display: none; }
.learn-chat .chat-close { display: none; }

/* Chat */
.chat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; height: calc(100vh - 112px); height: calc(100dvh - 112px); min-height: 500px; overflow: hidden; box-shadow: var(--shadow); }
.chat.tall { height: calc(100vh - 170px); height: calc(100dvh - 170px); }
.chat-head { padding: .8rem .9rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: .65rem; background: linear-gradient(135deg, #eff6ff, #ecfeff 56%, #ecfdf5); }
.chat-identity { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.assistant-status { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(16,185,129,.13); flex: none; }
.chat-head strong { font-size: .95rem; }
.chat-head small { display: block; color: var(--muted); font-size: .72rem; line-height: 1.35; }
.chat-actions { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; flex-wrap: wrap; }
.chat-actions .btn { white-space: nowrap; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .8rem; background: #f8fafc; scroll-behavior: smooth; }
.msg { max-width: 88%; padding: .7rem .9rem; border-radius: 14px; font-size: .9rem; line-height: 1.55; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.assistant pre { font-size: .8rem; margin: .5rem 0; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant ul, .msg.assistant ol { padding-left: 1.2rem; margin: .4rem 0; }
.msg.system { align-self: center; font-size: .78rem; color: var(--muted); background: none; }
.msg.error { align-self: stretch; max-width: 100%; background: var(--danger-soft); color: #7f1d1d; border: 1px solid #fecaca; }
.msg.error .btn { display: flex; margin-top: .65rem; background: #fff; border-color: #fca5a5; color: #991b1b; }
.msg .tag { display: inline-block; font-size: .68rem; color: var(--muted); margin-top: .35rem; }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .5rem; padding: .75rem .75rem .4rem; border-top: 1px solid var(--border); background: var(--surface); }
.chat-form textarea { min-height: 44px; max-height: 140px; resize: none; }
.chat-form .btn { min-height: 44px; }
.chat-disclaimer { padding: 0 .85rem .65rem; color: var(--muted); background: var(--surface); font-size: .66rem; line-height: 1.35; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 1rem .75rem; background: var(--surface-2); }
.chat-suggestions button { font-size: .75rem; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: .25rem .6rem; cursor: pointer; color: var(--primary-600); }
.chat-page .page-heading { margin-bottom: 1rem; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-heading h1 { margin: 0; font-size: 1.65rem; }
.page-heading p { color: var(--muted); margin: .2rem 0 0; }
.chat-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1.25rem; }
.conversation-panel { min-width: 0; }
.history-toggle { display: none; }
.history-close { display: none; }
.conv-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.conv-list a { display: block; padding: .7rem .9rem; border-bottom: 1px solid var(--border); color: var(--text); font-size: .88rem; }
.conv-list a:hover, .conv-list a.active { background: var(--primary-soft); text-decoration: none; }
.conv-list a small { display: block; color: var(--muted); font-size: .72rem; }
.typing { display: inline-flex; gap: 3px; }
.typing span { width: 6px; height: 6px; background: var(--muted); 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: .2; } 40% { opacity: 1; } }
.chat.is-expanded { position: fixed; inset: 24px max(24px, calc((100vw - 1180px) / 2)); z-index: 110; height: auto !important; min-height: 0; box-shadow: 0 24px 80px rgba(15,23,42,.35); }
body.chat-expanded, body.chat-panel-open { overflow: hidden; }
body.chat-expanded::before { content: ""; position: fixed; inset: 0; z-index: 105; background: rgba(15,23,42,.58); backdrop-filter: blur(3px); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: none; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border-radius: 16px; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; padding: 1.5rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-box h2 { display: flex; align-items: center; gap: .5rem; }
.ai-status { display: none; padding: .8rem 1rem; border-radius: 10px; background: #ede9fe; color: #4c1d95; font-size: .9rem; margin-top: 1rem; }
.ai-status.show { display: block; }
.ai-status.error { background: var(--danger-soft); color: #7f1d1d; }
.ai-status.success { background: var(--accent-soft); color: #14532d; }

/* Editor */
.ql-container { font-family: var(--font); font-size: 1rem; min-height: 320px; border-bottom-left-radius: 9px; border-bottom-right-radius: 9px; }
.ql-toolbar { border-top-left-radius: 9px; border-top-right-radius: 9px; background: var(--surface-2); }
.ql-editor { min-height: 320px; }
.repeater-item { border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin-bottom: .75rem; background: var(--surface-2); position: relative; }
.repeater-item .remove { position: absolute; top: .6rem; right: .6rem; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 130px 1fr; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.timeline li time { color: var(--muted); font-size: .78rem; }

/* Trilhas (cliente) */
.dashboard-intro { position: relative; overflow: hidden; background: linear-gradient(120deg, #0b1f3b, #1646a0 54%, #06b6d4); color: #fff; border-radius: 20px; padding: clamp(1.5rem, 4vw, 2.4rem); margin-bottom: 2rem; box-shadow: 0 18px 44px rgba(37,99,235,.2); }
.dashboard-intro::after { content: ""; position: absolute; width: 260px; height: 260px; right: -90px; top: -150px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; box-shadow: 0 0 0 42px rgba(255,255,255,.035), 0 0 0 84px rgba(255,255,255,.025); pointer-events: none; }
.dashboard-intro .eyebrow { color: #a5f3fc; }
.dashboard-intro h1 { color: #fff; font-size: clamp(1.8rem, 4vw, 2.45rem); letter-spacing: -.03em; }
.dashboard-intro p { color: #dbeafe; max-width: 700px; margin: 0; font-size: 1rem; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: .9rem; }
.section-heading h2 { font-size: 1.35rem; margin: 0; }
.section-heading > p { color: var(--muted); font-size: .85rem; margin: 0; }
.track-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 1.25rem; }
.track-card { display: grid; grid-template-columns: 7px 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.track-card .stripe { background: var(--track-color, var(--primary)); }
.track-card .body { padding: 1.35rem 1.5rem; }
.track-card h3 { margin: .45rem 0 .35rem; font-size: 1.2rem; }
.track-meta { display: flex; flex-wrap: wrap; gap: .35rem; }
.track-meta span { padding: .15rem .5rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: .7rem; font-weight: 700; }
.track-description { color: var(--muted); font-size: .88rem; max-width: 72ch; }
.resume-note { display: flex; gap: .55rem; align-items: center; margin: 1rem 0 0; color: var(--text); font-size: .82rem; }
.resume-note span { color: #92400e; background: var(--warning-soft); border-radius: 999px; padding: .15rem .5rem; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.track-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.assistant-section { margin-top: 2.4rem; }
.assistant-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.assistant-card h3 { margin: 0 0 .2rem; }
.assistant-card p { color: var(--muted); font-size: .82rem; margin: 0; }
.assistant-card-actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.product-assistant-card { border-top: 4px solid var(--track-color); }
.product-assistant-card p { color: var(--muted); font-size: .88rem; }
.hero { background: linear-gradient(135deg, #0b1f3b, #2563eb 60%, #06b6d4); color: #fff; border-radius: 18px; padding: 1.75rem 2rem; margin-bottom: 1.5rem; }
.hero h1 { color: #fff; font-size: 1.6rem; }
.hero p { color: #dbeafe; max-width: 700px; margin: 0; }
.track-hero { background: linear-gradient(125deg, #0f172a, var(--track-color) 72%); margin-top: .35rem; }
.course-meta { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; color: #dbeafe; font-size: .75rem; font-weight: 700; margin-bottom: .6rem; }
.course-meta span { border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); border-radius: 999px; padding: .12rem .45rem; }
.hero-progress { display: flex; justify-content: space-between; gap: 1rem; margin: 1.3rem 0 .4rem; color: #dbeafe; font-size: .75rem; }
.track-hero .progress { background: rgba(255,255,255,.2); }
.track-hero .progress > span { background: #fff; }

.chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding: .5rem 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.chart .col span { display: block; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 2px; }
.chart .col span.ai { background: #7c3aed; margin-top: 2px; }
.chart .col:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; font-size: .7rem; padding: .25rem .5rem; border-radius: 6px; white-space: nowrap; z-index: 2; }

@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .learn { grid-template-columns: 1fr; }
  .learn-chat { position: fixed; inset: 0; z-index: 90; display: none; padding: 12px; background: rgba(15,23,42,.62); backdrop-filter: blur(3px); }
  .learn-chat.open { display: block; }
  .learn-chat .chat { height: calc(100vh - 24px); height: calc(100dvh - 24px); min-height: 0; }
  .learn-chat.open .chat-close { display: inline-flex; }
  .learn-chat .chat [data-chat-expand] { display: none; }
  .mobile-chat-launch { position: fixed; right: 1rem; bottom: 1rem; z-index: 40; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: .65rem 1rem; border: 0; border-radius: 999px; background: var(--primary); color: #fff; box-shadow: 0 12px 30px rgba(37,99,235,.35); font: 700 .88rem var(--font); cursor: pointer; }
}
@media (max-width: 800px) {
  .layout-admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: .9rem 1rem; gap: .75rem; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; gap: .3rem; }
  .sidebar nav .label { display: none; }
  .sidebar nav a { padding: .4rem .6rem; font-size: .85rem; }
  .sidebar .user { margin-top: 0; border-top: 0; padding-top: 0; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
  .sidebar .user form { margin-top: 0; }
  .appbar { flex-wrap: wrap; gap: .55rem .9rem; }
  .appbar .brand { order: 1; }
  .appbar-actions { order: 2; margin-left: auto; }
  .appbar nav { order: 3; width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .appbar nav a { text-align: center; min-height: 40px; display: grid; place-items: center; }
  .appbar .spacer { display: none; }
  .topbar { padding-top: .8rem; padding-bottom: .8rem; }
  .content, .app-content, .topbar, .appbar { padding-left: 1rem; padding-right: 1rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .article { padding: 1.25rem; }
  .timeline li { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: .25rem; }
  .assistant-card { align-items: flex-start; flex-direction: column; }
  .assistant-card-actions { justify-content: flex-start; }
  .lesson-context { align-items: flex-start; }
  .lesson-position { flex-direction: column; align-items: flex-end; gap: .2rem; }
  .chat-layout { display: block; }
  .history-toggle { display: inline-flex; }
  .conversation-panel { display: none; position: fixed; left: 1rem; right: 1rem; top: 9rem; max-height: calc(100dvh - 11rem); overflow: auto; z-index: 100; padding: 1rem; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.3); }
  .conversation-panel.open { display: block; }
  .history-close { display: inline-flex; }
  .chat-page .chat.tall { height: calc(100vh - 325px); height: calc(100dvh - 325px); min-height: 430px; }
  .chat.is-expanded { inset: 10px; }
  .chat-actions .btn { padding-left: .55rem; padding-right: .55rem; }
}
@media (max-width: 520px) {
  .account-link > span:last-child { display: none; }
  .appbar-actions { gap: .4rem; }
  .appbar-actions .btn { min-height: 34px; }
  .app-content { padding-top: 1.25rem; }
  .dashboard-intro { margin-bottom: 1.5rem; }
  .track-card .body { padding: 1.15rem; }
  .track-actions .btn { width: 100%; }
  .lesson-position .progress { width: 90px; }
  .article { border-radius: 14px; }
  .learn-nav > div, .learn-nav .btn, .learn-nav form { width: 100%; }
  .chat-head { align-items: flex-start; }
  .chat-identity small { display: none; }
  .chat-head { flex-wrap: wrap; }
  .chat-actions { width: 100%; justify-content: flex-start; }
  .chat-form { grid-template-columns: 1fr; }
  .chat-form .btn { width: 100%; }
}

/* Feedback de dentro das aulas */
.feedback-card { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 2rem; padding: 1rem 1.15rem; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface-2); }
.feedback-card p { margin: .25rem 0 0; max-width: 60ch; }
.feedback-bubble { position: absolute; z-index: 60; padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--primary); background: var(--primary); color: #fff; font-weight: 700; font-size: .78rem; box-shadow: var(--shadow); cursor: pointer; font-family: inherit; }
.feedback-bubble[hidden] { display: none; }
.type-pills { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.type-pills label { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border: 1px solid var(--border); border-radius: 999px; font-size: .82rem; font-weight: 600; cursor: pointer; background: var(--surface); }
.type-pills input { margin: 0; }
.type-pills label.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-600); }
.feedback-quote { margin: .5rem 0 .9rem; padding: .6rem .9rem; border-left: 4px solid var(--primary); background: var(--primary-soft); border-radius: 0 8px 8px 0; font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-quote[hidden] { display: none; }

/* Contraste dos botões no hover (o hover genérico clareava o fundo e apagava o texto branco) */
.btn-ai:hover { background: linear-gradient(135deg, var(--primary-600), #0891b2); color: #fff; filter: none; }
.btn-ai:focus-visible, .btn-primary:focus-visible, .btn-accent:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.btn-primary:hover, .btn-accent:hover { color: #fff; }
.btn-link:hover { background: var(--primary-soft); color: var(--primary-600); }

/* Ajuda técnica e suporte dentro da aula */
.help-strip { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 2rem; padding: 1rem 1.15rem; border: 1px solid var(--border); border-radius: 12px; background: var(--primary-soft); }
.help-strip p { margin: .25rem 0 0; max-width: 62ch; }
.help-strip + .feedback-card { margin-top: 1rem; }

/* Podcast (Spotify) e tipo de conteúdo */
.podcast-frame iframe { width: 100%; height: 232px; border: 0; border-radius: 12px; }
.type-icon.podcast { background: #fce7f3; color: #9d174d; }

/* Páginas de chat em tela cheia: sem rolagem dupla (altura ajustada em chat.js) */
.layout-admin .content:has(> .chat-page), .app-content:has(> .chat-page) { padding-bottom: 1rem; }
.chat-layout { align-items: stretch; }
.chat-layout > .conversation-panel { overflow: auto; min-height: 0; }

/* Pesquisas de módulo (positivo/negativo) e de trilha (NPS) */
.survey-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: clamp(1.4rem, 3vw, 2.25rem); box-shadow: var(--shadow); max-width: 720px; margin: 0 auto; }
.survey-card h1 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); letter-spacing: -.02em; margin: .2rem 0 .6rem; }
.survey-lessons { list-style: none; padding: 0; margin: .6rem 0 1.2rem; display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); }
.survey-lessons li::before { content: "•"; color: var(--primary); margin-right: .4rem; }
.survey-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin: .5rem 0 1rem; }
.survey-choice button { display: grid; justify-items: center; gap: .2rem; padding: 1.1rem .8rem; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; font-family: inherit; color: var(--text); }
.survey-choice button span { font-size: 2rem; line-height: 1; }
.survey-choice button small { color: var(--muted); font-size: .78rem; text-align: center; }
.survey-choice button:hover { border-color: var(--primary); background: var(--surface-2); }
.survey-choice button.active { border-color: var(--primary); background: var(--primary-soft); }
.nps-scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: .35rem; margin: .5rem 0 .3rem; }
.nps-scale button { min-height: 44px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); font-weight: 800; cursor: pointer; font-family: inherit; color: var(--text); }
.nps-scale button:hover { border-color: var(--primary); }
.nps-scale button.active.low { border-color: #dc2626; background: var(--danger-soft); color: #991b1b; }
.nps-scale button.active.mid { border-color: #d97706; background: var(--warning-soft); color: #92400e; }
.nps-scale button.active.high { border-color: #059669; background: var(--accent-soft); color: #166534; }
.nps-legend { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-bottom: 1rem; }
.survey-invite { border-color: var(--primary); background: var(--primary-soft); }
@media (max-width: 520px) { .nps-scale { grid-template-columns: repeat(6, minmax(0, 1fr)); } .survey-choice { grid-template-columns: 1fr; } }

/* Unidades de um colaborador (várias) */
.unit-checks { display: flex; flex-wrap: wrap; gap: .4rem .9rem; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.unit-checks .checkbox { margin: 0; font-size: .88rem; }
