/* Orya Atendimento — mesma identidade do Orya Flow: preto, laranja #FB4328, degradê da marca, Space Grotesk */
@font-face { font-family:"Space Grotesk"; font-weight:400; src:url(/fonts/space-grotesk-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family:"Space Grotesk"; font-weight:500; src:url(/fonts/space-grotesk-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family:"Space Grotesk"; font-weight:700; src:url(/fonts/space-grotesk-latin-700-normal.woff2) format("woff2"); }
:root {
  --p:#fb4328; --bg:#060607; --side:rgba(12,12,14,.86); --card:rgba(20,20,23,.78); --card2:#1a1a1e; --line:rgba(255,255,255,.07); --line2:rgba(255,255,255,.12);
  --text:#f3f0ea; --muted:#8a8690; --accent:#ffa24c; --ok:#3fbf91; --warn:#f5b041; --bad:#f87171; --glow:rgba(251,67,40,.22);
  --grad:linear-gradient(100deg,#e00a12 0%,#f5301e 35%,#fb5a22 65%,#ff8a1f 100%);
  --r:14px; --ease:cubic-bezier(.2,.8,.2,1);
  --bubble-in:#17171b; --bubble-out:#2a1712;
}
* { box-sizing:border-box; }
html, body { height:100%; }
body { margin:0; font-family:"Space Grotesk", system-ui, sans-serif; font-size:14px; color:var(--text); letter-spacing:.005em;
  background: radial-gradient(900px 500px at 12% -10%, rgba(251,67,40,.10), transparent 60%), radial-gradient(700px 500px at 110% 110%, rgba(255,138,31,.06), transparent 60%), var(--bg);
  background-attachment:fixed; }
::selection { background:rgba(251,67,40,.35); }
* { scrollbar-width:thin; scrollbar-color:#2a2a30 transparent; }
.hidden { display:none !important; }
.muted { color:var(--muted); font-size:13px; }
.error { color:var(--bad); min-height:18px; margin:0; font-size:13.5px; }
input, select, textarea { width:100%; padding:9px 11px; border:1px solid var(--line2); border-radius:10px; font:inherit; background:var(--card2); color:var(--text); }
input:focus, select:focus, textarea:focus { outline:1px solid var(--p); border-color:transparent; }
textarea { resize:none; }
button { font:inherit; color:inherit; cursor:pointer; }
a { color:var(--accent); }
.btn { background:var(--grad); background-size:180% 100%; color:#fff; border:0; padding:9px 16px; border-radius:10px; font-weight:600;
  box-shadow:0 6px 22px rgba(251,67,40,.22), inset 0 1px 0 rgba(255,255,255,.18); transition:background-position .5s var(--ease), transform .12s; }
.btn:hover { background-position:100% 0; }
.btn:active { transform:scale(.97); }
.btn:disabled { opacity:.5; cursor:default; }
.btn.ghost { background:transparent; box-shadow:none; border:1px solid var(--line2); color:var(--text); }
.btn.ghost:hover { background:rgba(255,255,255,.05); }
.btn.ok { background:linear-gradient(100deg,#1f9c70,#3fbf91); box-shadow:0 6px 18px rgba(63,191,145,.18); }
.btn.small { padding:6px 11px; font-size:12.5px; border-radius:8px; }
.icon-btn { background:none; border:0; color:var(--muted); width:32px; height:32px; border-radius:8px; font-size:16px; display:inline-flex; align-items:center; justify-content:center; flex:none; }
.icon-btn:hover { background:rgba(255,255,255,.06); color:var(--text); }
.chip { border:1px solid var(--line2); background:rgba(255,255,255,.03); border-radius:99px; padding:4px 11px; font-size:12px; color:var(--muted); white-space:nowrap; max-width:220px; overflow:hidden; text-overflow:ellipsis; }
.chip.linked { color:var(--text); border-color:rgba(251,67,40,.45); background:rgba(251,67,40,.08); }
.chip:hover { color:var(--text); }
.badge { min-width:18px; height:18px; padding:0 5px; border-radius:99px; background:var(--grad); color:#fff; font-size:10.5px; font-style:normal; font-weight:700; display:inline-flex; align-items:center; justify-content:center; }
.badge.soft { background:rgba(245,176,65,.18); color:var(--warn); }
.seg { display:inline-flex; gap:2px; padding:3px; border:1px solid var(--line); border-radius:11px; background:rgba(255,255,255,.02); }
.seg button { border:0; background:none; padding:5px 10px; border-radius:8px; font-size:12.5px; color:var(--muted); }
.seg button.on { background:rgba(251,67,40,.14); color:var(--text); }
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--r); padding:26px; backdrop-filter:blur(14px); }

/* Login */
.center { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:16px; }
#loginForm { width:340px; max-width:100%; display:flex; flex-direction:column; gap:12px; }
.login-logo { width:170px; height:auto; align-self:center; }
.login-sub { text-align:center; font-size:12px; letter-spacing:.3em; text-transform:uppercase; color:var(--accent); margin-top:-6px; }
#loginForm .muted { text-align:center; margin:0 0 4px; }

/* Estrutura */
#app { display:flex; height:100vh; overflow:hidden; }
#rail { width:76px; flex:none; background:var(--side); border-right:1px solid var(--line); display:flex; flex-direction:column; align-items:center; padding:14px 6px 10px; gap:4px; backdrop-filter:blur(14px); }
.rail-logo { width:34px; height:34px; margin-bottom:12px; }
.rail-btn { position:relative; width:64px; border:0; background:none; color:#b9b5bd; border-radius:12px; padding:8px 2px 6px; display:flex; flex-direction:column; align-items:center; gap:3px; font-size:10.5px; text-decoration:none; }
.rail-btn svg { width:21px; height:21px; }
.rail-btn:hover { background:rgba(255,255,255,.05); color:var(--text); }
.rail-btn.on { background:linear-gradient(180deg, rgba(251,67,40,.18), rgba(251,67,40,.04)); color:var(--text); }
.rail-btn.on svg { color:#ff7a4d; }
.rail-btn .badge { position:absolute; top:3px; right:9px; }
.rail-btn.small { padding:6px 2px; }
.rail-fill { flex:1; }
.dot { position:absolute; top:7px; right:16px; width:8px; height:8px; border-radius:50%; background:#666; box-shadow:0 0 0 2px #0c0c0e; }
.dot.open { background:var(--ok); } .dot.close, .dot.erro, .dot.missing { background:var(--bad); } .dot.connecting { background:var(--warn); }
.rail-me { width:36px; height:36px; margin:6px 0 2px; }
.avatar { width:38px; height:38px; border-radius:50%; flex:none; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; color:#fff; background:#333; overflow:hidden; background-size:cover; background-position:center; }
.avatar.sm { width:28px; height:28px; font-size:11px; }
.avatar.group { border-radius:12px; }
.sim-banner { position:fixed; top:0; left:76px; right:0; z-index:30; text-align:center; font-size:11.5px; padding:3px; background:rgba(245,176,65,.14); color:var(--warn); border-bottom:1px solid rgba(245,176,65,.25); }
.sim-on .view { padding-top:22px; }
.view { flex:1; min-width:0; display:flex; height:100vh; }

/* Lista de conversas */
.col-list { width:340px; flex:none; border-right:1px solid var(--line); display:flex; flex-direction:column; background:rgba(10,10,12,.55); }
.list-head { padding:16px 14px 10px; display:flex; flex-direction:column; gap:10px; border-bottom:1px solid var(--line); }
.list-head h2 { margin:0; font-size:20px; letter-spacing:-.02em; }
.list-head .seg { align-self:flex-start; }
#chatItems { list-style:none; margin:0; padding:6px; overflow:auto; flex:1; }
#chatItems li { display:flex; gap:11px; align-items:center; padding:9px 10px; border-radius:12px; cursor:pointer; transition:background .15s; }
#chatItems li:hover { background:rgba(255,255,255,.035); }
#chatItems li.on { background:rgba(251,67,40,.10); box-shadow:inset 2px 0 0 var(--p); }
.ci-main { flex:1; min-width:0; }
.ci-top { display:flex; gap:6px; align-items:baseline; }
.ci-name { flex:1; font-weight:600; font-size:13.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ci-time { font-size:11px; color:var(--muted); flex:none; }
.ci-bottom { display:flex; gap:6px; align-items:center; margin-top:2px; }
.ci-last { flex:1; font-size:12.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
li.unread .ci-name { color:#fff; } li.unread .ci-last { color:#cfcbd2; } li.unread .ci-time { color:var(--accent); }
.ci-client { font-size:10.5px; color:var(--accent); border:1px solid rgba(255,162,76,.3); border-radius:99px; padding:0 7px; white-space:nowrap; max-width:110px; overflow:hidden; text-overflow:ellipsis; flex:none; }
.ci-pend { font-size:10.5px; color:var(--warn); flex:none; }
.list-empty { padding:30px 16px; text-align:center; color:var(--muted); }

/* Conversa */
.col-conv { flex:1; min-width:0; display:flex; flex-direction:column; }
.conv-empty { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; color:var(--muted); gap:8px; }
.conv-empty img { width:54px; opacity:.35; }
#convMain { flex:1; display:flex; flex-direction:column; min-height:0; }
.conv-head { display:flex; align-items:center; gap:11px; padding:10px 14px; border-bottom:1px solid var(--line); background:rgba(12,12,14,.6); backdrop-filter:blur(12px); }
.conv-title { flex:1; min-width:0; display:flex; flex-direction:column; }
.conv-title b { font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.conv-title span { font-size:12px; }
.msgs { flex:1; overflow:auto; padding:16px 6% 10px; display:flex; flex-direction:column; gap:3px;
  background: linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px) 0 0 / 100% 36px, linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px) 0 0 / 36px 100%; }
.day-sep { align-self:center; font-size:11.5px; color:var(--muted); background:rgba(255,255,255,.04); border:1px solid var(--line); border-radius:99px; padding:2px 11px; margin:12px 0 6px; }
.more-btn { align-self:center; margin-bottom:8px; }
.m { display:flex; flex-direction:column; max-width:min(560px, 78%); position:relative; }
.m.in { align-self:flex-start; } .m.out { align-self:flex-end; align-items:flex-end; }
.m.gap { margin-top:8px; }
.bubble { position:relative; padding:7px 10px 6px; border-radius:14px; background:var(--bubble-in); border:1px solid var(--line); line-height:1.4; word-wrap:break-word; overflow-wrap:anywhere; min-width:80px; }
.m.out .bubble { background:var(--bubble-out); border-color:rgba(251,67,40,.18); }
.m.in .bubble { border-top-left-radius:5px; } .m.out .bubble { border-top-right-radius:5px; }
.m.flash .bubble { animation:flash 1.4s var(--ease); }
@keyframes flash { 0%,40% { box-shadow:0 0 0 2px var(--p); } 100% { box-shadow:0 0 0 0 transparent; } }
.who { font-size:12px; font-weight:700; margin-bottom:2px; }
.by { font-size:10.5px; color:var(--muted); margin:0 4px 2px; }
.txt { white-space:pre-wrap; }
.meta { font-size:10.5px; color:var(--muted); text-align:right; margin-top:2px; }
.quote { border-left:3px solid var(--accent); background:rgba(255,255,255,.04); border-radius:6px; padding:4px 8px; margin-bottom:5px; font-size:12.5px; color:#cfcbd2; cursor:pointer; max-height:60px; overflow:hidden; }
.media img, .media video { display:block; max-width:100%; max-height:340px; border-radius:9px; margin:-1px -3px 4px; background:#000; }
.media img { cursor:zoom-in; min-height:60px; min-width:120px; }
.media audio { width:260px; max-width:100%; }
.doc { display:flex; align-items:center; gap:9px; padding:8px 10px; background:rgba(255,255,255,.04); border-radius:9px; margin-bottom:4px; text-decoration:none; color:var(--text); }
.doc span { font-size:22px; }
.media-err { font-size:12px; color:var(--muted); padding:16px 10px; border:1px dashed var(--line2); border-radius:9px; margin-bottom:4px; }
.reacts { display:flex; gap:3px; margin:-6px 8px 0; position:relative; z-index:1; }
.reacts span { background:#202025; border:1px solid var(--line2); border-radius:99px; padding:0 6px; font-size:12px; }
.m-actions { position:absolute; top:2px; display:none; gap:2px; background:#1c1c21; border:1px solid var(--line2); border-radius:9px; padding:2px; z-index:2; }
.m-actions { top:-13px; box-shadow:0 4px 14px rgba(0,0,0,.4); }
.m.in .m-actions { left:10px; } .m.out .m-actions { right:10px; }
.m:hover .m-actions { display:flex; }
.m-actions button { border:0; background:none; border-radius:7px; padding:3px 7px; font-size:12px; color:var(--muted); white-space:nowrap; }
.m-actions button:hover { background:rgba(255,255,255,.07); color:var(--text); }
.ap-tag { margin-top:4px; border-radius:10px; padding:7px 9px; font-size:12px; border:1px solid var(--line2); background:rgba(255,255,255,.03); max-width:100%; }
.ap-tag b { display:block; font-size:12.5px; margin-bottom:2px; }
.ap-tag.pendente { border-color:rgba(245,176,65,.4); background:rgba(245,176,65,.07); }
.ap-tag.aprovado { border-color:rgba(63,191,145,.4); background:rgba(63,191,145,.07); }
.ap-tag.ajuste { border-color:rgba(248,113,113,.4); background:rgba(248,113,113,.07); }
.ap-row { display:flex; gap:6px; flex-wrap:wrap; margin-top:6px; }
.ap-reply { margin-top:5px; padding:5px 8px; border-radius:7px; background:rgba(0,0,0,.25); font-size:12px; }
.reply-bar { display:flex; align-items:center; gap:10px; margin:0 14px; padding:7px 10px; border-left:3px solid var(--accent); background:rgba(255,255,255,.04); border-radius:8px 8px 0 0; }
.reply-bar div { flex:1; min-width:0; font-size:12.5px; display:flex; flex-direction:column; }
.reply-bar span { color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.composer { display:flex; gap:8px; align-items:flex-end; padding:10px 14px 14px; }
.composer textarea { max-height:160px; min-height:40px; line-height:1.4; padding:10px 12px; }
.composer .send { height:40px; }
.composer .icon-btn { height:40px; width:40px; }
.drop-hint { position:absolute; inset:0; background:rgba(251,67,40,.08); border:2px dashed var(--p); border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:16px; z-index:5; pointer-events:none; }

/* Painel do cliente */
.col-side { width:320px; flex:none; border-left:1px solid var(--line); overflow:auto; padding:16px 14px; background:rgba(10,10,12,.55); }
.col-side h3 { font-size:12px; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); margin:18px 0 8px; font-weight:500; }
.col-side h3:first-child { margin-top:0; }
.side-client { display:flex; gap:10px; align-items:center; padding:10px; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.02); }
.side-client b { flex:1; }
.task { padding:9px 10px; border:1px solid var(--line); border-radius:11px; margin-bottom:6px; background:rgba(255,255,255,.02); }
.task-t { font-size:13px; font-weight:600; line-height:1.3; }
.task-m { display:flex; gap:6px; align-items:center; margin-top:5px; flex-wrap:wrap; }
.st { font-size:10.5px; padding:1px 8px; border-radius:99px; background:rgba(255,255,255,.06); color:#cfcbd2; }
.st.aprovacao { background:rgba(245,176,65,.16); color:var(--warn); } .st.veiculacao { background:rgba(63,191,145,.15); color:var(--ok); }
.st.edicao, .st.para_editar { background:rgba(124,92,255,.17); color:#b7a6ff; }
.task .btn { margin-left:auto; }
.side-note { font-size:12px; color:var(--muted); line-height:1.45; }
details.more summary { cursor:pointer; color:var(--muted); font-size:12.5px; margin:6px 0; }

/* Páginas */
.page { flex-direction:column; overflow:auto; padding:24px 32px 40px; }
.page-head { display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-bottom:8px; }
.page-head h2 { font-size:24px; letter-spacing:-.02em; margin:0; }
.page-hint { max-width:760px; line-height:1.5; margin:4px 0 18px; }
.widget { border:1px solid var(--line); background:var(--card); border-radius:var(--r); padding:18px 20px; margin-bottom:14px; max-width:760px; }
.widget h3 { margin:0 0 10px; font-size:16px; }
.ap-list { display:flex; flex-direction:column; gap:8px; max-width:900px; }
.ap-item { display:flex; gap:12px; align-items:center; padding:12px 14px; border:1px solid var(--line); border-radius:12px; background:var(--card); cursor:pointer; }
.ap-item:hover { border-color:var(--line2); }
.ap-item .ap-main { flex:1; min-width:0; }
.ap-item .ap-main b { display:block; font-size:13.5px; }
.ap-st { font-size:11.5px; padding:2px 10px; border-radius:99px; flex:none; }
.ap-st.pendente { background:rgba(245,176,65,.16); color:var(--warn); } .ap-st.aprovado { background:rgba(63,191,145,.15); color:var(--ok); }
.ap-st.ajuste { background:rgba(248,113,113,.15); color:var(--bad); } .ap-st.cancelado { background:rgba(255,255,255,.06); color:var(--muted); }
.qr { display:flex; gap:20px; align-items:center; flex-wrap:wrap; margin-top:12px; }
.qr img { width:230px; height:230px; background:#fff; border-radius:12px; padding:10px; image-rendering:pixelated; }
.state { display:inline-flex; align-items:center; gap:7px; font-weight:600; }
.state i { width:9px; height:9px; border-radius:50%; background:#666; }
.state.open i { background:var(--ok); } .state.close i, .state.missing i, .state.erro i { background:var(--bad); } .state.connecting i { background:var(--warn); }
.row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:8px 0; }
.switch { display:flex; gap:10px; align-items:center; cursor:pointer; }
.switch input { width:auto; }

/* Janela */
#modalBg { position:fixed; inset:0; background:rgba(0,0,0,.6); backdrop-filter:blur(4px); display:flex; align-items:center; justify-content:center; z-index:50; padding:16px; }
#modal { width:460px; max-width:100%; max-height:90vh; overflow:auto; display:flex; flex-direction:column; gap:12px; padding:22px; }
#modal h3 { margin:0; font-size:17px; }
#modal .actions { display:flex; justify-content:flex-end; gap:8px; margin-top:4px; }
#modal label { font-size:12.5px; color:var(--muted); display:flex; flex-direction:column; gap:5px; }
.pick-list { max-height:280px; overflow:auto; display:flex; flex-direction:column; gap:5px; }
.pick-list label { flex-direction:row !important; align-items:center; gap:9px !important; padding:8px 10px; border:1px solid var(--line); border-radius:10px; color:var(--text) !important; cursor:pointer; }
.pick-list label:has(input:checked) { border-color:var(--p); background:rgba(251,67,40,.07); }
.pick-list input { width:auto; }
.lightbox { position:fixed; inset:0; background:rgba(0,0,0,.88); z-index:60; display:flex; align-items:center; justify-content:center; cursor:zoom-out; }
.lightbox img { max-width:94vw; max-height:94vh; border-radius:8px; }

/* Avisos */
#toasts { position:fixed; right:18px; bottom:18px; display:flex; flex-direction:column; gap:8px; z-index:70; }
.toast { background:#1c1c21; border:1px solid var(--line2); border-left:3px solid var(--p); border-radius:10px; padding:10px 14px; max-width:340px; font-size:13px; box-shadow:0 10px 30px rgba(0,0,0,.4); animation:tin .3s var(--ease); cursor:pointer; }
.toast.ok { border-left-color:var(--ok); } .toast.bad { border-left-color:var(--bad); }
@keyframes tin { from { opacity:0; transform:translateY(8px); } }
.mob-only { display:none; }

/* Celular */
@media (max-width: 900px) {
  .col-side { position:fixed; right:0; top:0; bottom:0; z-index:20; width:min(340px, 90vw); background:#0c0c0e; box-shadow:-10px 0 40px rgba(0,0,0,.5); }
}
@media (max-width: 720px) {
  #app { flex-direction:column-reverse; }
  #rail { width:100%; height:62px; flex-direction:row; padding:4px 8px; justify-content:space-around; border-right:0; border-top:1px solid var(--line); }
  .rail-logo, .rail-fill, .rail-me { display:none; }
  .rail-btn { width:auto; flex:1; }
  .view { height:calc(100vh - 62px); }
  .sim-banner { left:0; }
  .col-list { width:100%; border-right:0; }
  .chat-open .col-list { display:none; }
  .col-conv { display:none; }
  .chat-open .col-conv { display:flex; }
  .mob-only { display:inline-flex; }
  .msgs { padding:12px 10px; }
  .m { max-width:88%; }
  .m-actions { position:static; display:flex; background:none; border:0; padding:0; margin-top:2px; }
  .page { padding:16px; }
  .form-grid { grid-template-columns:1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation:none !important; transition:none !important; } }
.link-btn { background:none; border:0; color:var(--accent); padding:0; font-size:12px; text-decoration:underline; }
.side-close { display:none; float:right; margin:-6px -6px 0 0; }
@media (max-width: 900px) { .side-close { display:inline-flex; } .sim-on .col-side { padding-top:34px; } }
