@font-face { font-family: 'Open Sans'; font-weight: 400; font-display: swap; src: url(/open-sans-latin-400-normal.woff) format('woff'); }
@font-face { font-family: 'Open Sans'; font-weight: 600; font-display: swap; src: url(/open-sans-latin-600-normal.woff) format('woff'); }
@font-face { font-family: 'Open Sans'; font-weight: 700; font-display: swap; src: url(/open-sans-latin-700-normal.woff) format('woff'); }
:root {
  --bg: #f4f5f2; --card: #fff; --line: #e3e6df; --field: #dcdfd8; --ink: #1c2119; --ink2: #3f463b; --muted: #5d6458;
  --green: #15803d; --green-d: #166534; --mine: #dcfce7; --them: #f4f5f2; --err: #b91c1c; --err-bg: #fef2f2;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 15px; -webkit-text-size-adjust: 100%; }
a { color: var(--green); } a:hover { color: var(--green-d); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #86efac; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 12px 18px; background: var(--green); color: #fff; font-weight: 650; font-size: 15px; min-height: 44px; }
.btn:hover { background: var(--green-d); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--field); font-weight: 600; }
.btn.ghost:hover { background: var(--bg); }
.linkbtn { border: 0; background: none; padding: 4px; color: var(--ink2); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.err { background: var(--err-bg); color: var(--err); border-radius: 9px; padding: 9px 12px; font-size: 14px; }
.err:empty { display: none; }

/* ---------- accesso ---------- */
.login { min-height: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; padding: max(40px, env(safe-area-inset-top)) 16px 32px; gap: 22px; }
.login .brand img { height: 34px; display: block; }
.login .brand small { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
.panel { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.panel h1 { margin: 0; font-size: 20px; }
.panel p { margin: 0; color: var(--ink2); line-height: 1.5; font-size: 14.5px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.field input { font-weight: 400; font-size: 16px; border: 1px solid var(--field); border-radius: 10px; padding: 12px; background: #fff; }
.field input.code { font-size: 26px; font-weight: 700; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.login .foot { color: var(--muted); font-size: 12.5px; text-align: center; line-height: 1.5; max-width: 400px; }

/* ---------- chat ---------- */
#app { height: 100%; }
.shell { height: 100%; height: 100dvh; display: flex; flex-direction: column; }
.top { flex: none; height: 60px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 20px; padding-top: env(safe-area-inset-top); }
.top img { height: 26px; display: block; }
.top .tag { color: var(--muted); font-size: 13px; border-left: 1px solid var(--line); padding-left: 14px; }
.top .who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; min-width: 0; }
.top .who .client { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av { flex: none; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.av.sm { width: 32px; height: 32px; }
.body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: minmax(0, 1fr); }
.main { display: flex; flex-direction: column; min-height: 0; background: #fff; border-right: 1px solid var(--line); }
.head { padding: 14px 24px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.head b { font-size: 18px; }
.head small { color: var(--muted); font-size: 13px; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 24px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.day { align-self: center; font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 99px; padding: 3px 10px; margin: 4px 0; }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 360px; line-height: 1.5; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row.mine { flex-direction: row-reverse; }
.bubble { max-width: min(620px, 82%); display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-radius: 14px; background: var(--them); }
.row.mine .bubble { background: var(--mine); }
.bubble .meta { font-size: 12px; font-weight: 650; color: var(--ink2); }
.bubble .meta span { font-weight: 400; color: var(--muted); }
.bubble .text { font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .text.deleted { color: var(--muted); font-style: italic; }
.bubble.pending { opacity: .6; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--field); background: #fff; border-radius: 9px; padding: 8px 10px; font-size: 13.5px; color: var(--ink); text-decoration: none; max-width: 100%; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file small { color: var(--muted); flex: none; }
.thumb { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.thumb img { display: block; max-width: min(320px, 100%); max-height: 260px; }
.more { align-self: center; }
.compose { flex: none; border-top: 1px solid var(--line); padding: 12px 24px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; background: #fff; }
.compose .bar { display: flex; gap: 10px; align-items: flex-end; }
.compose textarea { flex: 1; min-width: 0; border: 1px solid var(--field); border-radius: 10px; padding: 10px 12px; resize: none; font-size: 16px; line-height: 1.4; max-height: 180px; min-height: 44px; }
.iconbtn { flex: none; width: 44px; height: 44px; border: 1px solid var(--field); background: #fff; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink2); }
.iconbtn:hover { background: var(--bg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border-radius: 99px; padding: 4px 6px 4px 12px; font-size: 13px; max-width: 100%; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: none; width: 26px; height: 26px; border-radius: 50%; color: var(--ink2); font-size: 16px; line-height: 1; }
.chip button:hover { background: #e4e7e0; }
.side { padding: 20px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.box h2 { margin: 0; font-size: 15px; }
.box p { margin: 0; color: var(--ink2); font-size: 13.5px; line-height: 1.5; }
.person { display: flex; align-items: center; gap: 10px; }
.person b { font-weight: 600; display: block; }
.person small { color: var(--muted); font-size: 12px; }
.box .file { border: 0; padding: 0; background: none; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 16px; font-size: 14px; z-index: 5; max-width: calc(100% - 32px); }
.drop { outline: 3px dashed #86efac; outline-offset: -8px; }

@media (max-width: 900px) {
  .body { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { border-right: 0; }
  .top { padding: 0 16px; gap: 10px; }
  .top .tag, .top .who .client { display: none; }
  .head, .msgs { padding-left: 16px; padding-right: 16px; }
  .compose { padding-left: 16px; padding-right: 16px; }
  .bubble { max-width: 86%; }
}
