/* MedBarão IA — Design System & Refined Styles */

:root{
  --bg:#ffffff;--panel:#faf9fc;--line:#ebe8f1;--text:#1f1c2b;--muted:#6f6b80;
  --brand:#7466b8;--brand-2:#655aa8;--brand-soft:#f3f1f9;--on-brand:#fff;
  --bubble:#f3f1f8;--shadow:0 1px 2px rgba(31,28,43,.04),0 6px 20px rgba(31,28,43,.05);
  --sb:272px;color-scheme:light;
  box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --bg:#121118;--panel:#18171f;--line:#27252f;--text:#e9e7f0;--muted:#9a96ab;
  --brand:#a79ddb;--brand-2:#c0b8e8;--brand-soft:#221f2e;--on-brand:#121118;
  --bubble:#211f2b;--shadow:0 1px 2px rgba(0,0,0,.3),0 6px 20px rgba(0,0,0,.25);color-scheme:dark;}}
:root[data-theme="dark"]{
  --bg:#121118;--panel:#18171f;--line:#27252f;--text:#e9e7f0;--muted:#9a96ab;
  --brand:#a79ddb;--brand-2:#c0b8e8;--brand-soft:#221f2e;--on-brand:#121118;
  --bubble:#211f2b;--shadow:0 1px 2px rgba(0,0,0,.3),0 6px 20px rgba(0,0,0,.25);color-scheme:dark;}
*{box-sizing:border-box;margin:0}
html{scroll-padding-top:env(safe-area-inset-top,0px);height:100%}
body{height:100%;background:var(--bg);color:var(--text);font:15px/1.5 "Plus Jakarta Sans",system-ui,-apple-system,"Segoe UI",sans-serif;overflow:hidden}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
button:focus-visible,textarea:focus-visible,a:focus-visible,select:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
.app{display:flex;height:100%}
.sb{width:var(--sb);flex:none;background:var(--panel);border-right:1px solid var(--line);display:flex;flex-direction:column;padding:14px 12px;gap:6px;transition:transform .2s}
.brand{display:flex;align-items:center;gap:10px;padding:4px 8px 14px;font-weight:600;font-size:16px}
.logo{width:28px;height:28px;border-radius:8px;background:var(--brand);color:var(--on-brand);display:grid;place-items:center;font-size:15px;font-weight:600}
.new{display:flex;align-items:center;gap:8px;padding:9px 12px;border-radius:10px;background:var(--bg);border:1px solid var(--line);color:var(--text);font-weight:500;margin-bottom:8px}
.new:hover{background:var(--brand-soft)}
.grp{font-size:12px;font-weight:600;color:var(--muted);padding:12px 12px 4px}
.nav{display:flex;align-items:center;gap:10px;width:100%;text-align:left;padding:9px 12px;border-radius:10px;color:var(--text)}
.nav svg{width:18px;height:18px;stroke:var(--muted);fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
.nav:hover{background:var(--brand-soft)}
.nav[aria-current="page"]{background:var(--brand-soft);font-weight:500}
.nav[aria-current="page"] svg{stroke:var(--brand)}
.hist{flex:1;overflow:auto;min-height:0}
.hist .nav{font-size:14px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}
.hist .nav.on{color:var(--text);background:var(--brand-soft)}
.main{flex:1;min-width:0;display:flex;flex-direction:column;position:relative}
.top{display:flex;align-items:center;gap:8px;padding:12px 16px}
.top .sp{flex:1}
.docpick{display:flex;align-items:center;gap:8px;min-width:0;max-width:min(420px,46vw);font-size:13px;color:var(--muted)}
.docpick select{flex:1;min-width:0;border:1px solid var(--line);background:var(--bg);color:var(--text);border-radius:10px;padding:8px 10px;font:inherit;font-size:13px}
.ico{width:40px;height:40px;border-radius:10px;display:grid;place-items:center}
.ico:hover{background:var(--brand-soft)}
.ico svg{width:20px;height:20px;stroke:var(--text);fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#menu{display:none}
.gbtn{display:flex;align-items:center;gap:8px;padding:8px 14px;border:1px solid var(--line);border-radius:999px;font-weight:600;font-size:14px;background:var(--bg)}
.gbtn:hover{background:var(--brand-soft)}
.gbtn svg{width:18px;height:18px}
.view{flex:1;overflow:auto;padding:8px 16px 16px;min-height:0}
.wrap{max-width:760px;margin:0 auto}
.hero{min-height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;padding:0 0 8vh}
.hero h1{font-size:clamp(24px,4.5vw,32px);font-weight:600;letter-spacing:-.02em;margin-bottom:8px}
.hero p{color:var(--muted);margin-bottom:22px}
.chips{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.chip{display:flex;align-items:center;gap:8px;padding:9px 14px;border:1px solid var(--line);border-radius:999px;font-size:14px;background:var(--bg)}
.chip svg,.card svg{stroke:var(--brand);fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.chip svg{width:18px;height:18px}
.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:32px;width:100%;text-align:left}
.card{padding:18px;border:1px solid var(--line);border-radius:14px;background:transparent;text-align:left;width:100%}
.card .ci{width:34px;height:34px;border-radius:9px;background:var(--brand-soft);display:grid;place-items:center;margin-bottom:10px}
.card svg{width:20px;height:20px}
.card h3{font-size:15px;font-weight:600;margin-bottom:4px}
.card p{font-size:14px;color:var(--muted)}
@media (max-width:820px){.cards{grid-template-columns:1fr}.docpick{max-width:none}}
.chip:hover,.card:hover{background:var(--brand-soft)}
.msg{display:flex;margin:14px 0}
.msg.me{justify-content:flex-end}
.msg .b{max-width:85%;padding:10px 14px;border-radius:16px;white-space:pre-wrap;word-wrap:break-word}
.msg.me .b{background:var(--bubble)}
.msg.ai .b{padding-left:0}
.dock{padding:8px 16px 16px}
.comp{max-width:760px;margin:0 auto;border:1px solid var(--line);border-radius:20px;background:var(--bg);box-shadow:var(--shadow);padding:10px 10px 8px 14px}
.comp:focus-within{border-color:var(--brand)}
.files{display:flex;flex-wrap:wrap;gap:6px;padding-bottom:6px}
.file{display:flex;align-items:center;gap:6px;background:var(--brand-soft);border-radius:10px;padding:4px 6px 4px 10px;font-size:13px}
.file button{width:20px;height:20px;border-radius:6px;line-height:1}
textarea{width:100%;border:0;outline:0;background:none;color:var(--text);font:inherit;resize:none;max-height:180px;padding:6px 0}
textarea::placeholder{color:var(--muted)}
.row{display:flex;align-items:center;gap:4px}
.row .sp{flex:1}
.mic.on{background:#dc2626}.mic.on svg{stroke:#fff}
.send{background:var(--brand);width:38px;height:38px;border-radius:50%;display:grid;place-items:center}
.send svg{width:18px;height:18px;stroke:var(--on-brand);fill:none;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.send:disabled{opacity:.35;cursor:default}
.note{text-align:center;font-size:12px;color:var(--muted);padding-top:8px}
.scrim{display:none}
.page{max-width:760px;margin:0 auto;padding-bottom:24px}
.page h1{font-size:22px;font-weight:600;letter-spacing:-.02em;margin:8px 0 4px}
.page .sub{color:var(--muted);margin-bottom:16px}
.item{display:flex;align-items:center;gap:12px;width:100%;text-align:left;padding:12px 14px;border:1px solid var(--line);border-radius:14px;margin-bottom:8px;background:var(--bg)}
.item:hover{background:var(--brand-soft)}
.item h3{font-size:15px;font-weight:600}
.item p{font-size:13px;color:var(--muted)}
.item .grow{flex:1;min-width:0}
.empty{color:var(--muted);padding:24px 0}
.statgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}
.stat{border:1px solid var(--line);border-radius:14px;padding:14px}
.stat b{display:block;font-size:22px;font-weight:600}
.stat span{font-size:13px;color:var(--muted)}
.q{border:1px solid var(--line);border-radius:14px;padding:14px;margin-bottom:10px}
.q h3{font-size:15px;margin-bottom:8px}
.opt{display:flex;gap:8px;align-items:flex-start;margin:6px 0;font-size:14px}
.opt input{margin-top:4px}
.actions{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}
.primary{background:var(--brand);color:var(--on-brand);border-radius:999px;padding:9px 16px;font-weight:600}
.ghost{border:1px solid var(--line);border-radius:999px;padding:9px 16px}
.fc{border:1px solid var(--line);border-radius:18px;min-height:180px;display:grid;place-items:center;padding:24px;text-align:center;font-size:18px;font-weight:500;margin:12px 0;cursor:pointer}
.ok{color:#15803d}.bad{color:#b91c1c}
.modal{position:fixed;inset:0;z-index:60;background:rgba(0,0,0,.4);display:grid;place-items:center;padding:16px}
.modal[hidden]{display:none}
.sheet{background:var(--bg);color:var(--text);border-radius:18px;padding:20px;width:min(420px,100%);box-shadow:var(--shadow);display:flex;flex-direction:column;gap:10px}
.sheet h2{font-size:18px}
.sheet input,.sheet select{border:1px solid var(--line);border-radius:10px;padding:10px 12px;font:inherit;background:var(--bg);color:var(--text);width:100%}
.err{color:#b91c1c;font-size:13px;min-height:1.2em}
.hidden{display:none!important}
@media (max-width:820px){
  .sb{position:fixed;z-index:20;inset:0 auto 0 0;padding-top:calc(14px + env(safe-area-inset-top,0px));transform:translateX(-100%);box-shadow:var(--shadow)}
  .sb.open{transform:none}
  .scrim.show{display:block;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:10}
  #menu{display:grid}
}
@media (prefers-reduced-motion:reduce){.sb{transition:none}}
