/* Bruno Starlink — versão 21 — AurumSys · All rights reserved. */
:root {
  --bg: #0a0c10;
  --bg2: #0f1217;
  --surface: #151920;
  --surface2: #1b2029;
  --line: #262c37;
  --line2: #323a47;
  --text: #e9eef5;
  --muted: #8b95a5;
  --dim: #5f6876;
  --accent: #5ab4ff;
  --accent-ink: #04121f;
  --st-aberto: #5ab4ff;
  --st-atend: #f5b84a;
  --st-aguard: #b18cff;
  --st-resolv: #3ecf8e;
  --p-urgente: #ff5d5d;
  --p-alta: #ff9a4a;
  --p-normal: #8b95a5;
  --p-baixa: #5f6876;
  --danger: #ff5d5d;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); text-align: center; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.spacer { height: 16px; }

/* ---------- topo ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(10,12,16,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .14em; font-size: 13px; color: var(--text); white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; }
.brand small { display: block; font-weight: 500; letter-spacing: .04em; color: var(--muted); font-size: 11px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; font-size: 14px; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.on { color: var(--text); background: var(--surface2); }
.who { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--line2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text); cursor: pointer; }
.menu { position: absolute; right: 16px; top: 52px; background: var(--surface); border: 1px solid var(--line2); border-radius: 10px; padding: 6px; min-width: 200px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.menu .mi { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 7px; cursor: pointer; color: var(--text); }
.menu .mi:hover { background: var(--surface2); }
.menu .meta { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 40px; }
.foot { max-width: 1200px; margin: 0 auto; padding: 20px 16px calc(28px + env(safe-area-inset-bottom)); color: var(--dim); font-size: 12px; border-top: 1px solid var(--line); }

h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 10px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .grow { min-width: 10px; }

/* ---------- botões e campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line2); background: var(--surface2); color: var(--text); padding: 9px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; min-height: 40px; }
.btn:hover { border-color: var(--dim); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ok { background: var(--st-resolv); border-color: var(--st-resolv); color: #03170d; }
.btn.danger { color: var(--danger); border-color: rgba(255,93,93,.4); background: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; }
label.f { display: block; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; letter-spacing: .02em; }
.in, select.in, textarea.in { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; padding: 10px 12px; min-height: 42px; outline: none; }
textarea.in { min-height: 96px; resize: vertical; }
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(90,180,255,.15); }
select.in { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hint { font-size: 12px; color: var(--dim); margin-top: 4px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 14px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, rgba(90,180,255,.12), transparent 60%), var(--bg); }
.login { width: 100%; max-width: 380px; }
.login .brand { justify-content: center; margin-bottom: 26px; font-size: 15px; }
.login .brand-mark { width: 40px; height: 40px; }
.login .card { padding: 22px; }
.login .foot { border: 0; text-align: center; padding: 18px 0 0; }

/* ---------- indicadores ---------- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; text-align: left; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--line2)); }
.stat:hover { border-color: var(--line2); }
.stat.on { border-color: var(--c); background: var(--surface2); }
.stat .n { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.stat.s-aberto { --c: var(--st-aberto); }
.stat.s-em_atendimento { --c: var(--st-atend); }
.stat.s-aguardando_cliente { --c: var(--st-aguard); }
.stat.s-resolvido { --c: var(--st-resolv); }
.stat.s-meus { --c: var(--accent); }

/* ---------- filtros ---------- */
.filters { display: grid; grid-template-columns: 2fr repeat(3, 1fr) 1fr 1fr auto; gap: 8px; margin-bottom: 14px; align-items: end; }
.filters .in { min-height: 40px; padding: 8px 10px; }
.filters select.in { background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; }
.filters label.f > span { font-size: 11px; margin-bottom: 3px; }

/* ---------- lista de chamados ---------- */
.tlist { display: flex; flex-direction: column; gap: 8px; }
.trow { display: grid; grid-template-columns: 112px 1fr 170px 150px 120px; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--text); position: relative; }
.trow:hover { border-color: var(--line2); background: var(--surface2); }
.trow.mine { border-left: 3px solid var(--accent); padding-left: 12px; }
.trow.mine::after { content: "Seu"; position: absolute; top: -8px; right: 12px; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 7px; border-radius: 6px; text-transform: uppercase; }
.trow .proto { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.trow .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .when { font-size: 12px; color: var(--muted); text-align: right; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--radius); }
.more { text-align: center; margin-top: 14px; }

/* ---------- etiquetas ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--c, var(--line2)); color: var(--c, var(--muted)); white-space: nowrap; background: color-mix(in srgb, var(--c, transparent) 10%, transparent); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--muted)); }
.badge.st-aberto { --c: var(--st-aberto); }
.badge.st-em_atendimento { --c: var(--st-atend); }
.badge.st-aguardando_cliente { --c: var(--st-aguard); }
.badge.st-resolvido { --c: var(--st-resolv); }
.prio { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--c); }
.prio.p-urgente { --c: var(--p-urgente); }
.prio.p-alta { --c: var(--p-alta); }
.prio.p-normal { --c: var(--p-normal); }
.prio.p-baixa { --c: var(--p-baixa); }
.tag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--surface2); border: 1px solid var(--line2); color: var(--muted); }

/* ---------- chamado ---------- */
.tk-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.tk-head .proto { font-family: var(--mono); color: var(--muted); font-size: 14px; }
.tk-head h1 { margin: 4px 0 10px; }
.desc { white-space: pre-wrap; word-wrap: break-word; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 2px; }
.kv dd { margin: 0; word-break: break-word; }
.side .btn { width: 100%; }
.side .card > * + * { margin-top: 10px; }
.resolution { border-color: color-mix(in srgb, var(--st-resolv) 50%, var(--line)); background: color-mix(in srgb, var(--st-resolv) 6%, var(--surface)); }
.resolution h2 { color: var(--st-resolv); }

.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { background: none; border: 0; padding: 7px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--surface2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }
.seg.prio-seg button.on[data-v="urgente"] { color: var(--p-urgente); }
.seg.prio-seg button.on[data-v="alta"] { color: var(--p-alta); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--bg2); border: 1px solid var(--line2); color: var(--muted); padding: 5px 10px; border-radius: 999px; font-size: 13px; cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--dim); }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.ev { position: relative; padding: 0 0 18px 40px; }
.ev .dot { position: absolute; left: 6px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--c, var(--line2)); }
.ev .h { font-size: 13px; color: var(--muted); }
.ev .h b { color: var(--text); font-weight: 600; }
.ev .body { margin-top: 6px; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; word-wrap: break-word; }
.ev.t-comentario { --c: var(--muted); }
.ev.t-procedimento { --c: var(--st-atend); }
.ev.t-verificacao { --c: var(--accent); }
.ev.t-resolvido { --c: var(--st-resolv); }
.ev.t-resolvido .body { border-color: color-mix(in srgb, var(--st-resolv) 45%, var(--line)); }
.ev.t-reaberto { --c: var(--p-alta); }
.ev.t-aberto { --c: var(--st-aberto); }
.ev.t-situacao, .ev.t-atribuicao, .ev.t-edicao { --c: var(--line2); }
.ev .kind { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--c); margin-right: 6px; }

/* ---------- clientes ---------- */
.clist { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.citem { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; color: var(--text); display: block; }
.citem:hover { border-color: var(--line2); background: var(--surface2); }
.citem .n { font-weight: 600; }
.eq { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.eq:first-child { border-top: 0; }
.eq .code { font-family: var(--mono); font-weight: 700; }
.eq.off { opacity: .5; }

/* ---------- usuários ---------- */
.ulist .u { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.ulist .u:first-child { border-top: 0; }
.ulist .u.off { opacity: .55; }
.perms { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.perm { display: flex; gap: 10px; align-items: flex-start; background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; padding: 10px; cursor: pointer; }
.perm input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.perm b { display: block; font-size: 14px; font-weight: 600; }
.perm small { color: var(--muted); font-size: 12px; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- janela ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--surface); border: 1px solid var(--line2); border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 24px 80px rgba(0,0,0,.6); }
.dialog.wide { max-width: 720px; }
.dialog-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dialog-h h2 { margin: 0; flex: 1; }
.dialog-b { padding: 18px; }
.dialog-f { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }
.x { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; padding: 4px 8px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--surface2); border: 1px solid var(--line2); padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { border-color: var(--danger); color: #ffd1d1; }

/* ---------- responsivo ---------- */
@media (max-width: 1000px) {
  .filters { grid-template-columns: 1fr 1fr 1fr; }
  .filters .q { grid-column: 1 / -1; }
  .tk-layout { grid-template-columns: 1fr; }
  .trow { grid-template-columns: 100px 1fr 150px 110px; }
  .trow .c-asg { display: none; }
}
@media (max-width: 720px) {
  html, body { font-size: 15px; }
  .top-in { flex-wrap: wrap; gap: 8px 12px; padding: 8px 16px; }
  .brand small { display: none; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -6px; }
  .who { margin-left: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats .s-meus { grid-column: 1 / -1; }
  .filters { grid-template-columns: 1fr 1fr; }
  .trow { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .trow .c-main { grid-column: 1 / -1; order: -1; }
  .trow .c-asg { display: block; grid-column: 1 / -1; }
  .trow .when { text-align: left; }
  .grid2, .grid3, .perms { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 96px 1fr; }
  .dialog-f .btn { flex: 1; }
  main { padding-top: 16px; }
  h1 { font-size: 20px; }
}
.spacer-top { margin-top: 10px; }
