/* ACORE Mentoria — identidade: #0d0e0a, neon #ccff00, Anton + Poppins */
@font-face { font-family: 'Anton'; src: url('/fonts/anton-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/fonts/poppins-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/fonts/poppins-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/fonts/poppins-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --bg: #0d0e0a;
  --surface: #15170f;
  --surface-2: #1d2015;
  --line: #2b2f21;
  --text: #f1f3e8;
  --muted: #9ba18b;
  --neon: #ccff00;
  --green: #2fd36a;
  --danger: #ff6b5a;
  --grad: linear-gradient(135deg, var(--neon) 0%, var(--green) 100%);
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --display: 'Anton', 'Impact', sans-serif;
  --body: 'Poppins', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--neon); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }
::selection { background: var(--neon); color: var(--bg); }

h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: .01em; line-height: 1.1; margin: 0; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* Marca */
.mark { font-family: var(--display); font-size: 1.7rem; line-height: 1; display: inline-flex; gap: .02em; }
.mark .a { color: var(--text); }
.mark .c { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mark-sub { font-size: .75rem; color: var(--muted); letter-spacing: .02em; }

/* Botões e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: .6rem 1rem; border-radius: var(--r-sm); cursor: pointer; font-weight: 500;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--neon); color: var(--bg); border-color: var(--neon); font-weight: 600; }
.btn.primary:hover { background: #d9ff4d; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #4a2a25; background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.icon-btn { background: transparent; border: 0; color: var(--muted); padding: .4rem; border-radius: var(--r-sm); cursor: pointer; display: inline-flex; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
.input, textarea.input, select.input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: .65rem .8rem; outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--neon); }
.field { margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--line); padding: .7rem 1.1rem;
  border-radius: var(--r-md); z-index: 100; max-width: calc(100% - 2rem);
}
.toast.error { border-color: var(--danger); }

/* Login */
.login {
  min-height: 100%; display: grid; grid-template-columns: 1.15fr 1fr;
}
.login-brand {
  position: relative; overflow: hidden; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--line);
}
.login-brand .giant {
  font-family: var(--display); font-size: clamp(7rem, 19vw, 17rem); line-height: .82; margin: 0;
  letter-spacing: -.01em;
}
.login-brand .giant .a { color: var(--text); }
.login-brand .giant .c { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-brand .pillars { display: flex; gap: 2rem; flex-wrap: wrap; color: var(--muted); }
.login-brand .pillars b { display: block; font-family: var(--display); font-weight: 400; color: var(--text); font-size: 1.4rem; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-form form { width: 100%; max-width: 360px; }
.login-form h1 { margin-bottom: .4rem; }
.login-form p { margin: 0 0 2rem; }
.error-msg { color: var(--danger); font-size: .9rem; min-height: 1.3em; margin-bottom: .6rem; }

@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { border-right: 0; border-bottom: 1px solid var(--line); padding: 1.5rem; gap: 1.5rem; }
  .login-brand .giant { font-size: 6.5rem; }
}

/* Shell do app */
.shell { display: grid; grid-template-columns: 280px 1fr; height: 100%; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar-top { padding: 1.1rem 1rem .8rem; display: flex; align-items: center; justify-content: space-between; }
.sidebar .btn.new { margin: 0 1rem .8rem; }
.sidebar-section { padding: .3rem 1rem; font-size: .8rem; color: var(--muted); }
.conv-list { flex: 1; overflow-y: auto; padding: 0 .5rem; }
.conv-item {
  display: flex; align-items: center; gap: .3rem; padding: .5rem .6rem; border-radius: var(--r-sm);
  cursor: pointer; color: var(--muted); font-size: .9rem;
}
.conv-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item:hover { background: var(--surface-2); color: var(--text); }
.conv-item.active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--neon); }
.conv-item .icon-btn { opacity: 0; padding: .2rem; }
.conv-item:hover .icon-btn { opacity: 1; }
.conv-item .icon-btn svg { width: 16px; height: 16px; }
.sidebar-foot { border-top: 1px solid var(--line); padding: .8rem 1rem; display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 600; font-size: .85rem; flex: none;
}
.sidebar-foot .who { flex: 1; min-width: 0; line-height: 1.3; }
.sidebar-foot .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: .5rem; padding: .7rem 1.2rem; border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: .3rem; }
.tab {
  background: transparent; border: 0; color: var(--muted); padding: .45rem .8rem; border-radius: 999px; cursor: pointer; font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-2); color: var(--text); }
.menu-btn { display: none; }
.view { flex: 1; min-height: 0; overflow-y: auto; }
.view.chat-view { display: flex; flex-direction: column; overflow: hidden; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 84%; max-width: 300px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: .6rem .8rem; }
  .tab { padding: .4rem .6rem; font-size: .9rem; }
}

/* Chat */
.messages { flex: 1; overflow-y: auto; padding: 1.5rem 1rem 1rem; }
.messages-inner { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.4rem; }
.msg { display: flex; gap: .8rem; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 6px var(--r-lg); padding: .7rem 1rem; max-width: 85%; white-space: pre-wrap; }
.msg.assistant .bubble { flex: 1; min-width: 0; }
.msg .ai-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--grad); flex: none; display: grid; place-items: center; color: var(--bg); font-family: var(--display); font-size: .95rem; margin-top: .1rem; }
.attachments { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .4rem; justify-content: flex-end; }
.attachments img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); }
.creative { margin: .6rem 0; max-width: 420px; }
.creative img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--line); display: block; }
.creative a { font-size: .85rem; display: inline-block; margin-top: .3rem; }
.saved-note { font-size: .8rem; color: var(--muted); margin-top: .5rem; display: flex; gap: .4rem; align-items: center; }
.saved-note svg { width: 14px; height: 14px; color: var(--neon); }

/* Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { margin: 1.2em 0 .5em; }
.md h1 { font-size: 1.6rem; } .md h2 { font-size: 1.35rem; } .md h3 { font-size: 1.1rem; }
.md p, .md ul, .md ol { margin: 0 0 .8em; }
.md ul, .md ol { padding-left: 1.3em; }
.md li { margin: .2em 0; }
.md strong { color: #fff; }
.md code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.md pre { background: var(--surface); border: 1px solid var(--line); padding: .8rem; border-radius: var(--r-sm); overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 .8em; padding-left: .9rem; border-left: 2px solid var(--neon); color: #d6dac8; }
.md .table-wrap { overflow-x: auto; margin: 0 0 .9em; }
.md table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.md th, .md td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.md th { background: var(--surface); font-weight: 600; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }

.typing { display: inline-flex; gap: 4px; padding: .6rem 0; }
.typing i { width: 7px; height: 7px; 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: .25; } 40% { opacity: 1; } }

.welcome { max-width: 680px; margin: 0 auto; padding: 8vh 1rem 1rem; }
.welcome h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); margin-bottom: .6rem; }
.welcome p { color: var(--muted); max-width: 52ch; margin: 0 0 1.8rem; }
.starters { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.starter {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: .9rem 1rem; cursor: pointer; color: var(--text);
}
.starter:hover { border-color: var(--neon); }
.starter b { display: block; font-weight: 600; margin-bottom: .15rem; }
.starter span { color: var(--muted); font-size: .85rem; }
@media (max-width: 600px) { .starters { grid-template-columns: 1fr; } }

.composer-wrap { padding: .6rem 1rem 1rem; }
.composer {
  max-width: 780px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: .5rem .5rem .5rem .8rem;
}
.composer:focus-within { border-color: #4c5536; }
.composer .pending { display: flex; gap: .4rem; flex-wrap: wrap; padding: .3rem 0 .4rem; }
.composer .pending .thumb { position: relative; }
.composer .pending img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); display: block; }
.composer .pending button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); cursor: pointer; font-size: 12px; line-height: 20px; padding: 0; }
.composer-row { display: flex; align-items: flex-end; gap: .4rem; }
.composer textarea {
  flex: 1; background: transparent; border: 0; outline: none; resize: none; max-height: 220px; padding: .45rem 0; line-height: 1.5;
}
.send-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--neon); color: var(--bg); cursor: pointer; display: grid; place-items: center; flex: none; }
.send-btn:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.send-btn svg { width: 20px; height: 20px; }
.composer-hint { max-width: 780px; margin: .4rem auto 0; font-size: .75rem; color: var(--muted); text-align: center; }

/* Páginas de conteúdo (painel, clínica, admin) */
.page { max-width: 1040px; margin: 0 auto; padding: 1.8rem 1.2rem 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.page-head h1 { font-size: 2.2rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.2rem; margin-bottom: 1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .9rem; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .cols, .grid-2 { grid-template-columns: 1fr; } }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin-bottom: 1rem; }
.kpi { background: var(--surface); padding: 1rem 1.1rem; }
.kpi .v { font-family: var(--display); font-size: 2rem; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.kpi .d { font-size: .8rem; margin-top: .2rem; }
.up { color: var(--neon); } .down { color: var(--danger); }
@media (max-width: 760px) { .kpis { grid-template-columns: 1fr 1fr; } }

.chart-box { position: relative; height: 280px; }

table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; color: var(--muted); font-weight: 500; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: .6rem; border-bottom: 1px solid var(--line); }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--surface-2); }
.table-scroll { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.pill { display: inline-block; font-size: .75rem; padding: .1rem .55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.on { color: var(--neon); border-color: #4c5c12; }
.pill.off { color: var(--danger); border-color: #4a2a25; }

.task { display: flex; gap: .7rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task input { accent-color: var(--neon); width: 18px; height: 18px; margin-top: .2rem; flex: none; }
.task.done .t { text-decoration: line-through; color: var(--muted); }
.task .meta { font-size: .8rem; color: var(--muted); }

dl.facts { display: grid; grid-template-columns: 160px 1fr; gap: .5rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .9rem; }
dl.facts dd { margin: 0; }
@media (max-width: 600px) { dl.facts { grid-template-columns: 1fr; gap: .1rem; } dl.facts dd { margin-bottom: .6rem; } }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; }
.gallery figure { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.gallery figcaption { padding: .5rem .6rem; font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; gap: .5rem; }

.logo-box { width: 160px; height: 160px; border: 1px dashed var(--line); border-radius: var(--r-md); display: grid; place-items: center; background: repeating-conic-gradient(#1a1c14 0% 25%, #121409 0% 50%) 50% / 16px 16px; overflow: hidden; }
.logo-box img { max-width: 90%; max-height: 90%; }

.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: grid; place-items: center; z-index: 80; padding: 1rem; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 1.4rem; }
.modal.wide { max-width: 860px; }
.modal h2 { margin-bottom: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

.code-box { width: 100%; min-height: 360px; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
