:root {
  --navy: #000069; --prussian: #000023; --twitter: #1c75bd; --bell: #0099db;
  --snow: #f8fafc; --platinum: #f1f5f9; --white: #ffffff; --slate: #64748b; --line: #dce6f0;
  --alice: #e2f0fa; --cornsilk: #fff7e0; --amber: #e98a15; --ok: #2e7d32; --err: #c1121f; --text: #1b2245;
  --wa: #1d5e2a; --wa-bg: #e3f4e8; --plaud: #59114d; --plaud-bg: #f6e9f3; --meet-bg: #fff7e0;
  --shadow: 0 1px 2px rgba(0,0,35,0.04), 0 12px 32px -12px rgba(0,0,105,0.18);
  --f-2points: #8b5cf6; --f-2points-bg: #f1ebfe; --f-on-board: #0ea5e9; --f-on-board-bg: #e4f5fd;
  --f-eb: #10b981; --f-eb-bg: #e3f7ef; --f-aneis: #f59e0b; --f-aneis-bg: #fff4dc;
  --f-itp: #e11d48; --f-itp-bg: #fde8ec; --f-pessoal: #64748b; --f-pessoal-bg: #eef1f5;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--snow); color: var(--text); font-family: 'Baloo 2', ui-rounded, 'Segoe UI', system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button, select, input, textarea { font-family: inherit; }
a { color: var(--twitter); }
[hidden] { display: none !important; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(248,250,252,0.94); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.brand { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; line-height: 1; }
.brand-eb { color: var(--navy); } .brand-os { color: var(--bell); }
.icon-btn { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.view { flex: 1; outline: none; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; justify-content: center; gap: 8px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--line); }
.tab { flex: 1; max-width: 200px; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 16px; color: var(--slate); text-decoration: none; font-size: 13px; font-weight: 700; position: relative; }
.tab.active { color: var(--navy); background: var(--alice); }
.tab-count { position: absolute; top: 4px; right: calc(50% - 30px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--err); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }

.head { padding: 12px 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.12em; color: var(--twitter); text-transform: uppercase; }
.h1 { margin: 0; font-size: 36px; line-height: 1.05; font-weight: 800; color: var(--prussian); }
.lead { margin: 0; font-size: 15px; line-height: 1.45; color: var(--slate); }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.section { padding: 10px 16px; display: flex; flex-direction: column; gap: 10px; }
.h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--navy); display: flex; align-items: baseline; gap: 8px; }
.h2 .count { font-size: 14px; font-weight: 600; color: var(--slate); }
.muted { font-size: 14px; color: var(--slate); margin: 0; }

.status-grid { background: var(--white); border-radius: 18px; padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--ok); flex: none; }
.dot.warn { background: var(--amber); } .dot.err { background: var(--err); }

.card { background: var(--white); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); border: none; text-align: left; color: inherit; width: 100%; cursor: pointer; }
.card h3 { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 700; color: var(--prussian); }
.card .meta { margin: 0; font-size: 14px; color: var(--slate); }
.row-wrap { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.list { background: var(--white); border-radius: 18px; padding: 4px 16px; display: flex; flex-direction: column; }
.list-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border: none; border-bottom: 1px solid var(--line); background: none; text-align: left; width: 100%; color: inherit; cursor: pointer; font: inherit; }
.list-item:last-child { border-bottom: none; }
.list-item .main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.list-item .title { font-size: 15px; color: var(--prussian); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wait { font-size: 13px; font-weight: 700; color: var(--slate); white-space: nowrap; }
.wait.late { color: var(--err); }

.origin { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--alice); color: var(--navy); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.origin.plain { background: none; padding: 0; }
.origin.whatsapp { background: var(--wa-bg); color: var(--wa); } .origin.plain.whatsapp { background: none; }
.origin.plaud { background: var(--plaud-bg); color: var(--plaud); } .origin.plain.plaud { background: none; }
.origin.meet { background: var(--meet-bg); color: var(--prussian); } .origin.plain.meet { background: none; }
.origin svg { flex: none; }

.tag { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--slate); color: var(--prussian); background: var(--f-pessoal-bg); white-space: nowrap; }
.tag.extra { font-weight: 600; padding: 2px 8px; border-style: dashed; background: transparent; color: var(--text); }
.tag.none { border-style: dotted; color: var(--slate); background: transparent; font-weight: 600; }
.tag[data-f="2points"] { border-color: var(--f-2points); } .tag[data-f="2points"]:not(.extra) { background: var(--f-2points-bg); }
.tag[data-f="on-board"] { border-color: var(--f-on-board); } .tag[data-f="on-board"]:not(.extra) { background: var(--f-on-board-bg); }
.tag[data-f="eb"] { border-color: var(--f-eb); } .tag[data-f="eb"]:not(.extra) { background: var(--f-eb-bg); }
.tag[data-f="aneis"] { border-color: var(--f-aneis); } .tag[data-f="aneis"]:not(.extra) { background: var(--f-aneis-bg); }
.tag[data-f="itp"] { border-color: var(--f-itp); } .tag[data-f="itp"]:not(.extra) { background: var(--f-itp-bg); }
.tag[data-f="pessoal"] { border-color: var(--f-pessoal); }
.prio { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #fde8ea; color: var(--err); }
.prio.high { background: var(--cornsilk); color: #7a4a00; }

.panel { border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.panel.info { background: var(--alice); color: var(--navy); }
.panel.soft { background: var(--platinum); }
.panel.warn { background: var(--cornsilk); }
.panel .label { font-size: 13px; font-weight: 700; letter-spacing: 0.12em; color: var(--twitter); }
.prewrap { white-space: pre-wrap; font-size: 15px; line-height: 1.45; margin: 0; overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }

.chips { padding: 4px 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.chips.fronts { margin: 10px 16px 0; padding: 12px 0 10px; border-top: 1px solid var(--line); }
.chips .chips-label { flex-basis: 100%; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; color: var(--twitter); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--navy); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.front { font-size: 13px; min-height: 32px; }
.chip.front[data-f] { border-color: var(--line); }
.chip.front[data-f="2points"] { border-color: var(--f-2points); } .chip.front[data-f="on-board"] { border-color: var(--f-on-board); }
.chip.front[data-f="eb"] { border-color: var(--f-eb); } .chip.front[data-f="aneis"] { border-color: var(--f-aneis); }
.chip.front[data-f="itp"] { border-color: var(--f-itp); border-style: dashed; } .chip.front[data-f="pessoal"] { border-color: var(--f-pessoal); }
.chip.front[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

.focus { background: var(--white); border-radius: 28px; padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.focus h2 { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 700; color: var(--prussian); overflow-wrap: anywhere; }
.btn { font-size: 15px; font-weight: 600; min-height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--navy); cursor: pointer; }
.btn.primary { border: none; background: var(--navy); color: #fff; font-weight: 700; }
.btn.secondary { border-color: var(--twitter); color: var(--twitter); }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 14px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
select.prio-select { font-size: 14px; min-height: 40px; border-radius: 999px; border: 1px solid var(--line); padding: 0 12px; color: var(--navy); background: var(--white); }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--slate); }
.link-btn { background: none; border: none; color: var(--twitter); font-weight: 600; font-size: 14px; padding: 6px 0; cursor: pointer; text-align: left; }

.empty { margin: 8px 16px; padding: 24px 16px; border-radius: 18px; background: var(--white); text-align: center; color: var(--slate); }
.empty strong { display: block; color: var(--navy); font-size: 18px; margin-bottom: 4px; }
.error-box { margin: 8px 16px; padding: 14px 16px; border-radius: 18px; background: #fde8ea; color: var(--err); }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,35,0.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: var(--white); border-radius: 24px 24px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; max-height: 90dvh; overflow: auto; }
.sheet h2 { margin: 0; font-size: 22px; color: var(--prussian); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; color: var(--navy); }
.field input, .field textarea, .field select { font-size: 16px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); color: var(--prussian); background: var(--white); }
.field textarea { min-height: 90px; resize: vertical; }
.sheet .row { display: flex; gap: 8px; justify-content: flex-end; }

.login { max-width: 400px; margin: 12vh auto 0; padding: 0 16px; display: flex; flex-direction: column; gap: 14px; }
.login .brand { font-size: 44px; }
.login .err { color: var(--err); font-size: 14px; min-height: 20px; margin: 0; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 30; background: var(--prussian); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; }
.toast button { background: none; border: none; color: var(--maya, #72c5ff); font-weight: 700; font-size: 14px; cursor: pointer; padding: 0; }
.loading { padding: 40px 16px; text-align: center; color: var(--slate); }
.foot-note { padding: 8px 16px 24px; font-size: 13px; color: var(--slate); }

@media (min-width: 720px) {
  .app { max-width: 720px; }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
}

.section.tight { padding-top: 0; }
.btn-block { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.link-btn:disabled { color: var(--slate); cursor: default; }
.reopen-btn { flex: none; align-self: flex-start; display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--twitter); color: var(--twitter); background: var(--white); font-size: 14px; font-weight: 600; white-space: nowrap; }
.list-item > .wait { align-self: flex-start; }
.sort { margin-top: 4px; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 60dvh; overflow: auto; padding: 4px 0; }
.msg { flex-shrink: 0; align-self: flex-start; max-width: 88%; background: var(--platinum); border-radius: 14px 14px 14px 4px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.msg.me { align-self: flex-end; background: var(--alice); border-radius: 14px 14px 4px 14px; }
.msg.origin { outline: 2px solid var(--amber); outline-offset: 0; background: var(--cornsilk); }
.msg-meta { font-size: 12px; color: var(--slate); }
.msg-text { font-size: 15px; color: var(--prussian); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat { overflow-x: hidden; }
.msg { min-width: 0; box-sizing: border-box; }
.msg-meta { overflow-wrap: anywhere; white-space: normal; }
