/* DECODER — minimalista, névoa azul estilo PS2 */
:root {
  --bg: #04050c;
  --panel: rgba(12, 16, 38, 0.72);
  --panel-2: rgba(18, 24, 56, 0.66);
  --panel-solid: #0b0f24;
  --line: rgba(140, 160, 255, 0.13);
  --line-2: rgba(140, 160, 255, 0.26);
  --text: #e3e9ff;
  --muted: #8592c4;
  --dim: #56609a;
  --accent: #6c8cff;
  --accent-2: #38e1c6;
  --bg-tint: 108,140,255;
  --add: #3ee09a; --mod: #ffc35a; --del: #ff6b81;
  --danger: #ff6b81;
  --radius: 12px;
  --fs: 15px;
  --font: "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2,.8,.2,1);
  --t: 220ms;
  --tb: 36px;
}
html.contrast { --panel: #000; --panel-2: #05070f; --panel-solid: #000; --line: #8da0ff; --line-2: #c9d3ff; --text: #fff; --muted: #d6dcff; --dim: #aab4e8; }
html.legible { --font: Verdana, Tahoma, "Atkinson Hyperlegible", sans-serif; letter-spacing: .02em; word-spacing: .06em; }
html.reduce-motion { --t: 0ms; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { html:not(.force-motion) *, html:not(.force-motion) *::before { animation-duration: 1ms !important; transition-duration: 1ms !important; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 400 var(--fs)/1.5 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
#bg { position: fixed; inset: 0; z-index: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: rgba(108,140,255,.45); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(140,160,255,.18); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(140,160,255,.35); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 8px; box-shadow: 0 0 0 6px rgba(56,225,198,.15); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: #000; padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 44px; }

/* titlebar */
#titlebar { position: fixed; top: 0; left: 0; right: 0; height: var(--tb); z-index: 50; display: flex; align-items: center; gap: 10px; padding: 0 150px 0 16px; font: 600 11px/1 var(--mono); letter-spacing: .32em; color: var(--muted); }
.mac #titlebar { padding-left: 84px; }
.drag { -webkit-app-region: drag; }
.drag button, .drag input { -webkit-app-region: no-drag; }
.tb-logo { color: var(--accent); animation: spin 8s linear infinite; display: inline-block; }
.tb-status { margin-left: auto; letter-spacing: .12em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.tb-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); box-shadow: 0 0 8px currentColor; }
.tb-status.on .dot { background: var(--add); color: var(--add); }
.tb-status.off .dot { background: var(--del); color: var(--del); }
@keyframes spin { to { transform: rotate(360deg); } }

/* boot */
#boot { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; align-content: center; gap: 18px; background: radial-gradient(ellipse at 50% 60%, #0b1440 0%, #02030a 70%); transition: opacity 900ms var(--ease), visibility 900ms; }
#boot.done { opacity: 0; visibility: hidden; }
.boot-orb { width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0%, #9fb4ff 12%, #3f5cff 40%, rgba(20,30,90,0) 72%); filter: blur(.4px); box-shadow: 0 0 80px 20px rgba(108,140,255,.35); animation: orb 2.4s var(--ease) both; }
.boot-word { font: 300 30px/1 var(--mono); letter-spacing: 1.1em; padding-left: 1.1em; color: #dfe6ff; text-shadow: 0 0 24px rgba(140,170,255,.8); animation: word 2.4s var(--ease) .3s both; }
.boot-sub { font: 400 11px var(--mono); letter-spacing: .4em; color: var(--muted); animation: fade 1.2s ease 1.2s both; }
@keyframes orb { 0% { transform: scale(.2); opacity: 0; } 50% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes word { 0% { opacity: 0; letter-spacing: 2em; filter: blur(10px); } 100% { opacity: 1; letter-spacing: 1.1em; filter: blur(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.92); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes glow { 0%,100% { box-shadow: 0 0 0 0 rgba(56,225,198,0); } 50% { box-shadow: 0 0 22px 2px rgba(56,225,198,.35); } }

#app { position: fixed; inset: var(--tb) 0 0 0; z-index: 1; }

/* elementos básicos */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(108,140,255,.08); cursor: pointer; transition: background var(--t), border-color var(--t), transform var(--t), box-shadow var(--t); font-weight: 500; white-space: nowrap; }
a.btn { text-decoration: none; color: inherit; }
.btn:hover { background: rgba(108,140,255,.18); border-color: var(--accent); box-shadow: 0 0 18px rgba(108,140,255,.25); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #8a6bff); border-color: transparent; color: #fff; }
.btn.primary:hover { box-shadow: 0 0 26px rgba(120,130,255,.55); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(140,160,255,.08); }
.btn.danger { border-color: rgba(255,107,129,.4); color: var(--danger); background: rgba(255,107,129,.06); }
.btn.sm { padding: 5px 10px; font-size: .86em; border-radius: 8px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: all var(--t); font-size: 16px; }
.icon-btn:hover { background: rgba(140,160,255,.1); color: var(--text); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font: 600 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field small { color: var(--dim); }
.input, textarea.input, select.input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(4,6,16,.6); transition: border-color var(--t), box-shadow var(--t); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,140,255,.2); }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.5; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.mono { font-family: var(--mono); }
.label { font: 600 10.5px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
.err { color: var(--danger); min-height: 1.4em; font-size: .9em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(14px); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font: 600 11px var(--mono); border: 1px solid var(--line); color: var(--muted); }
.tag.add { color: var(--add); border-color: rgba(62,224,154,.35); } .tag.mod { color: var(--mod); border-color: rgba(255,195,90,.35); } .tag.del { color: var(--del); border-color: rgba(255,107,129,.35); }
.kbd { font: 600 11px var(--mono); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--muted); }

/* tela de entrada */
.gate { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; overflow: auto; }
.gate-box { width: min(440px, 100%); padding: 34px 32px 26px; animation: pop 500ms var(--ease) both; }
.gate h1 { margin: 0 0 4px; font: 300 26px var(--mono); letter-spacing: .5em; }
.gate .sub { color: var(--muted); margin: 0 0 22px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(0,0,0,.35); border: 1px solid var(--line); margin-bottom: 20px; }
.tabs button { flex: 1; padding: 8px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; transition: all var(--t); }
.tabs button[aria-selected="true"] { background: rgba(108,140,255,.18); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.addr-list { display: grid; gap: 6px; margin: 10px 0; }
.addr { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; background: rgba(0,0,0,.35); font: 13px var(--mono); }

/* layout principal */
.shell { position: absolute; inset: 0; display: grid; grid-template-columns: 76px 260px 1fr; }
.shell.with-members { grid-template-columns: 76px 260px 1fr 250px; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; border-right: 1px solid var(--line); background: rgba(2,3,10,.55); overflow-y: auto; }
.rail-sep { width: 30px; height: 1px; background: var(--line-2); margin: 4px 0; }
.room-btn { position: relative; width: 48px; height: 48px; border-radius: 16px; border: 1px solid var(--line); cursor: pointer; display: grid; place-items: center; font: 700 15px var(--mono); color: #fff; transition: border-radius var(--t) var(--ease), transform var(--t) var(--ease), box-shadow var(--t); background: var(--c, #6c8cff); background-image: linear-gradient(145deg, rgba(255,255,255,.28), rgba(0,0,0,.25)); }
.room-btn:hover { border-radius: 13px; transform: translateY(-2px) rotate(-3deg); box-shadow: 0 6px 22px -4px var(--c); }
.room-btn[aria-current="true"] { border-radius: 13px; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-2), 0 0 24px var(--c); }
.room-btn .badge { position: absolute; right: -4px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); font: 700 10px/18px var(--mono); border: 2px solid var(--bg); animation: pop 300ms var(--ease); }
.room-btn.add { background: transparent; color: var(--accent-2); font-size: 22px; border-style: dashed; }
.rail .me { margin-top: auto; }

.side { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(16px); min-height: 0; }
.side-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.side-head h2 { margin: 0; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.side-head p { margin: 4px 0 0; color: var(--muted); font-size: .85em; }
.side-scroll { flex: 1; overflow-y: auto; padding: 10px 8px 16px; }
.side-sec { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 6px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; text-align: left; transition: background var(--t), color var(--t), transform var(--t); }
.nav-item:hover { background: rgba(140,160,255,.08); color: var(--text); transform: translateX(2px); }
.nav-item[aria-current="true"] { background: rgba(108,140,255,.16); color: var(--text); box-shadow: inset 2px 0 0 var(--accent-2); }
.nav-item .ico { width: 18px; text-align: center; color: var(--dim); font-family: var(--mono); }
.nav-item .unread { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }
.nav-item .meta { margin-left: auto; font: 11px var(--mono); color: var(--dim); }
.nav-item.flash { animation: glow 1.4s ease 2; }

.mainp { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: rgba(5,7,18,.42); }
.main-head { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 54px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.main-head h3 { margin: 0; font-size: 15px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.main-head .desc { color: var(--muted); font-size: .88em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* chat */
.messages { flex: 1; overflow-y: auto; padding: 16px 0 8px; }
.msg { display: grid; grid-template-columns: 52px 1fr; padding: 3px 18px 3px 12px; position: relative; animation: rise 260ms var(--ease) both; }
.msg:hover { background: rgba(140,160,255,.04); }
.msg.cont { padding-top: 0; }
.msg.cont .avatar-wrap { visibility: hidden; height: 0; }
.msg .who { display: flex; align-items: baseline; gap: 8px; }
.msg .who b { font-weight: 600; cursor: pointer; }
.msg .who time { font: 11px var(--mono); color: var(--dim); }
.msg .text { white-space: pre-wrap; word-wrap: break-word; color: #d5dcff; }
.msg .text a { color: var(--accent-2); }
.msg .text code { font-family: var(--mono); background: rgba(0,0,0,.4); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.msg .text pre { font-family: var(--mono); background: rgba(0,0,0,.45); padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); overflow-x: auto; white-space: pre; margin: 6px 0; }
.msg .text .mention { background: rgba(108,140,255,.25); color: #fff; padding: 0 4px; border-radius: 5px; }
.msg.mentioned { background: rgba(255,195,90,.06); box-shadow: inset 2px 0 0 var(--mod); }
.msg .edited { font-size: .75em; color: var(--dim); }
.msg-tools { position: absolute; right: 16px; top: -14px; display: none; gap: 2px; padding: 3px; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--line-2); z-index: 2; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { display: flex; }
.msg-tools .icon-btn { width: 28px; height: 28px; font-size: 14px; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react { padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); background: rgba(0,0,0,.25); cursor: pointer; font-size: 13px; transition: all var(--t); }
.react.mine { border-color: var(--accent); background: rgba(108,140,255,.18); }
.react:hover { transform: scale(1.06); }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.att-img { max-width: 360px; max-height: 280px; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.att-file { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.3); }
.sys { margin: 8px 18px 8px 64px; }
.sys-line { color: var(--muted); font-size: .9em; display: flex; align-items: center; gap: 8px; }
.commit-card { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: linear-gradient(135deg, rgba(108,140,255,.12), rgba(56,225,198,.05)); cursor: pointer; transition: transform var(--t), box-shadow var(--t); max-width: 560px; }
.commit-card:hover { transform: translateY(-1px); box-shadow: 0 8px 30px -10px rgba(108,140,255,.5); }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 14px 18px 8px; font: 600 10.5px var(--mono); letter-spacing: .2em; color: var(--dim); }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.composer { padding: 0 16px 14px; flex-shrink: 0; }
.typing { height: 20px; font-size: .82em; color: var(--muted); padding: 0 6px; }
.typing .dots span { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); margin-right: 2px; animation: bounce 1s infinite; }
.typing .dots span:nth-child(2) { animation-delay: .15s; } .typing .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { transform: none; } 30% { transform: translateY(-4px); } }
.comp-box { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(4,6,16,.75); transition: border-color var(--t), box-shadow var(--t); }
.comp-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,140,255,.15), 0 0 30px -6px rgba(108,140,255,.4); }
.comp-box textarea { flex: 1; border: 0; background: transparent; resize: none; max-height: 220px; min-height: 24px; padding: 7px 6px; line-height: 1.45; }
.pending-atts { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 4px 6px; }
.reply-bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 10px; font-size: .85em; color: var(--muted); }
.reply-ref { font-size: .82em; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-bottom: 2px; }
.reply-ref::before { content: "↱"; color: var(--dim); }
.load-more { display: block; margin: 0 auto 10px; }
.empty { display: grid; place-items: center; text-align: center; padding: 40px; color: var(--muted); gap: 12px; flex: 1; }
.empty .big { font-size: 44px; filter: drop-shadow(0 0 20px rgba(108,140,255,.6)); animation: float 4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* avatar */
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font: 700 14px var(--mono); color: #fff; background: var(--c, #6c8cff); background-size: cover; background-position: center; flex-shrink: 0; position: relative; overflow: visible; }
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }
.avatar.lg { width: 96px; height: 96px; border-radius: 26px; font-size: 32px; }
.avatar .pres { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--dim); border: 3px solid var(--panel-solid); }
.avatar .pres.on { background: var(--add); box-shadow: 0 0 8px var(--add); }
.avatar-wrap { padding-top: 4px; }

/* membros */
.members { border-left: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(16px); overflow-y: auto; padding: 14px 10px; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left; transition: background var(--t); }
.member:hover { background: rgba(140,160,255,.08); }
.member.off { opacity: .5; }
.member .st { font-size: .8em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* pastas / versões */
.repo-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px 1fr; }
.timeline { border-right: 1px solid var(--line); overflow-y: auto; padding: 12px; }
.tl-item { position: relative; display: block; width: 100%; text-align: left; padding: 10px 12px 10px 30px; border-radius: 11px; border: 1px solid transparent; background: transparent; cursor: pointer; transition: all var(--t); margin-bottom: 4px; }
.tl-item::before { content: ""; position: absolute; left: 13px; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.tl-item::after { content: ""; position: absolute; left: 8px; top: 16px; width: 11px; height: 11px; border-radius: 50%; background: var(--panel-solid); border: 2px solid var(--accent); }
.tl-item.head::after { background: var(--accent-2); border-color: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }
.tl-item:hover { background: rgba(140,160,255,.06); }
.tl-item[aria-current="true"] { background: rgba(108,140,255,.13); border-color: var(--line-2); }
.tl-item .t { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-item .m { font-size: .8em; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.detail { overflow-y: auto; padding: 20px 24px 40px; }
.detail h2 { margin: 0 0 4px; font-weight: 600; font-size: 20px; }
.notes-box { margin: 16px 0; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.3); white-space: pre-wrap; line-height: 1.6; position: relative; }
.notes-box::before { content: attr(data-label); display: block; font: 600 10px var(--mono); letter-spacing: .2em; color: var(--accent-2); margin-bottom: 8px; }
.filter-row { display: flex; gap: 6px; margin: 14px 0 8px; flex-wrap: wrap; align-items: center; }
.chip { padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--muted); font-size: .85em; transition: all var(--t); }
.chip[aria-pressed="true"] { background: rgba(108,140,255,.18); color: var(--text); border-color: var(--line-2); }
.file-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); font: 13px var(--mono); width: 100%; border-left: 0; border-right: 0; border-top: 0; background: transparent; text-align: left; cursor: pointer; transition: background var(--t); }
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: rgba(140,160,255,.06); }
.file-row .st { width: 18px; text-align: center; font-weight: 700; }
.file-row .st.add { color: var(--add); } .file-row .st.mod { color: var(--mod); } .file-row .st.del { color: var(--del); }
.file-row .path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.file-row .size { color: var(--dim); font-size: 12px; }
.diff { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; overflow: auto; font: 12.5px/1.55 var(--mono); max-height: 60vh; background: rgba(0,0,0,.4); }
.diff table { border-collapse: collapse; width: 100%; }
.diff td { padding: 0 10px; white-space: pre; vertical-align: top; }
.diff td.n { color: var(--dim); text-align: right; user-select: none; width: 1%; }
.diff tr.add td { background: rgba(62,224,154,.09); } .diff tr.add td.c::before { content: "+ "; color: var(--add); }
.diff tr.del td { background: rgba(255,107,129,.09); } .diff tr.del td.c::before { content: "− "; color: var(--del); }
.diff tr.ctx td.c::before { content: "  "; }
.diff tr.hunk td { background: rgba(108,140,255,.1); color: var(--muted); padding: 3px 10px; }
.img-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.img-compare figure { margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: repeating-conic-gradient(#0b0f24 0 25%, #070a18 0 50%) 0 0/16px 16px; text-align: center; }
.img-compare img { max-width: 100%; max-height: 300px; }
.img-compare figcaption { font: 11px var(--mono); color: var(--muted); margin-top: 6px; }
.drop-hint { position: absolute; inset: 0; z-index: 30; display: none; place-items: center; background: rgba(4,6,16,.8); border: 2px dashed var(--accent-2); border-radius: 18px; margin: 12px; font: 600 15px var(--mono); letter-spacing: .2em; color: var(--accent-2); backdrop-filter: blur(6px); }
.dragging .drop-hint { display: grid; animation: fade 200ms; }

/* notas da sala */
.notes-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px; gap: 10px; }
.notes-wrap textarea { flex: 1; resize: none; font: 14.5px/1.7 var(--mono); padding: 18px; border-radius: 14px; }
.notes-meta { display: flex; justify-content: space-between; align-items: center; font-size: .85em; color: var(--muted); }

/* progresso */
.progress { height: 6px; border-radius: 6px; background: rgba(0,0,0,.4); overflow: hidden; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent)); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; transition: width 200ms; }

/* modal */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(2,3,10,.7); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 20px; animation: fade 180ms ease; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 60px); overflow: auto; padding: 24px; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.8), 0 0 60px -20px rgba(108,140,255,.4); animation: pop 260ms var(--ease) both; }
.modal.wide { width: min(820px, 100%); }
.modal h2 { margin: 0 0 4px; font-size: 19px; font-weight: 600; }
.modal .sub { color: var(--muted); margin: 0 0 18px; font-size: .92em; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.settings { display: grid; grid-template-columns: 180px 1fr; gap: 20px; min-height: 420px; }
.settings nav { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-right: 12px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle .sw { position: relative; width: 40px; height: 22px; border-radius: 22px; background: rgba(140,160,255,.15); border: 1px solid var(--line-2); flex-shrink: 0; transition: background var(--t); }
.toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform var(--t) var(--ease), background var(--t); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle input:checked + .sw { background: rgba(56,225,198,.3); }
.toggle input:checked + .sw::after { transform: translateX(18px); background: var(--accent-2); }
.toggle input:focus-visible + .sw { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 9px; border: 2px solid transparent; cursor: pointer; background: var(--c); transition: transform var(--t); }
.swatch:hover { transform: scale(1.12); }
.swatch[aria-checked="true"] { border-color: #fff; box-shadow: 0 0 14px var(--c); }
.profile-card { display: flex; gap: 18px; align-items: center; padding: 16px; border-radius: 14px; background: linear-gradient(135deg, rgba(108,140,255,.12), transparent); border: 1px solid var(--line); margin-bottom: 18px; }
.avatar-edit { position: relative; cursor: pointer; border: 0; padding: 0; background: none; border-radius: 26px; }
.avatar-edit::after { content: "TROCAR"; position: absolute; inset: 0; border-radius: 26px; display: grid; place-items: center; background: rgba(0,0,0,.55); font: 700 10px var(--mono); letter-spacing: .2em; opacity: 0; transition: opacity var(--t); }
.avatar-edit:hover::after, .avatar-edit:focus-visible::after { opacity: 1; }

/* quick switcher */
.qs-list { margin-top: 10px; max-height: 50vh; overflow-y: auto; }
.qs-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.qs-item[aria-selected="true"] { background: rgba(108,140,255,.18); }
.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,.88); display: grid; place-items: center; cursor: zoom-out; animation: fade 150ms; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 10px; }

/* toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 99; display: grid; gap: 8px; }
.toast { padding: 10px 16px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: pop 240ms var(--ease) both; max-width: 380px; display: flex; gap: 10px; align-items: center; }
.toast.err { border-color: rgba(255,107,129,.5); }
.toast.ok { border-color: rgba(62,224,154,.5); }
.toast.out { opacity: 0; transform: translateY(8px); transition: all 300ms; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent-2); animation: spin .8s linear infinite; display: inline-block; }

.only-mobile { display: none !important; }
.drawer-backdrop { display: none; }
.msg.show-tools .msg-tools { display: flex; }

/* ---------------- celular / tela estreita ---------------- */
@media (max-width: 760px) {
  :root { --tb: 0px; }
  #titlebar { display: none; }
  .only-mobile { display: inline-grid !important; }
  .hide-mobile { display: none !important; }
  input, textarea, select, .input { font-size: 16px !important; } /* evita zoom automático no iPhone */
  .shell, .shell.with-members { grid-template-columns: 1fr; }
  .shell .members { display: none; }
  .rail, .side { position: fixed; top: 0; bottom: 0; z-index: 60; transform: translateX(-110%); transition: transform 260ms var(--ease); padding-top: env(safe-area-inset-top); }
  .rail { left: 0; width: 64px; }
  .side { left: 64px; width: min(290px, calc(100vw - 104px)); background: var(--panel-solid); transform: translateX(calc(-100% - 80px)); }
  .shell.drawer-open .rail, .shell.drawer-open .side { transform: none; }
  .shell.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(2,3,10,.6); backdrop-filter: blur(3px); animation: fade 200ms; }
  .room-btn { width: 44px; height: 44px; }
  .mainp { height: 100%; }
  .main-head { padding: 0 8px; gap: 6px; height: 52px; padding-top: env(safe-area-inset-top); box-sizing: content-box; }
  .main-head .desc { display: none; }
  .main-head .btn.sm { padding: 6px 10px; }
  .icon-btn { width: 40px; height: 40px; }
  .msg { grid-template-columns: 44px 1fr; padding: 3px 10px 3px 8px; }
  .msg .avatar { width: 34px; height: 34px; }
  .msg-tools { right: 8px; top: -18px; }
  .sys { margin: 8px 10px 8px 52px; }
  .att-img { max-width: 100%; }
  .composer { padding: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  .repo-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow-y: auto; }
  .timeline { border-right: 0; border-bottom: 1px solid var(--line); max-height: 32vh; }
  .detail { padding: 14px 12px 40px; overflow: visible; }
  .filter-row input { width: 100% !important; }
  .img-compare { grid-template-columns: 1fr; }
  .notes-wrap { padding: 10px; }
  .overlay { padding: 0; align-items: end; }
  .modal, .modal.wide { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); animation: sheet 300ms var(--ease) both; }
  .settings { grid-template-columns: 1fr; min-height: 0; gap: 12px; }
  .settings nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; }
  .settings nav .nav-item { width: auto; white-space: nowrap; }
  .profile-card { flex-direction: column; text-align: center; }
  .gate { padding: 12px; align-items: start; padding-top: 8vh; }
  .gate-box { padding: 26px 18px 20px; }
  .gate h1 { font-size: 22px; letter-spacing: .4em; }
  #toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .modal-foot { flex-wrap: wrap; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 761px) and (max-width: 1150px) { .shell.with-members { grid-template-columns: 76px 240px 1fr; } .shell.with-members .members { display: none; } .repo-wrap { grid-template-columns: 260px 1fr; } }
