/* ==========================================================================
   PRODUTOR — sistema visual compartilhado (back-office e painel dos clientes).
   Mobile-first, claro e minimalista. Sem fontes externas, sem JavaScript inline, sem imagens de terceiros.
   Tokens no :root; o tema (claro/escuro) é definido por [data-theme] antes da pintura (theme.js).
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #0e0d0c; --surface: #171513; --surface-2: #1f1c19; --surface-3: #27231f;
  --line: rgba(243, 238, 230, .08); --line-2: rgba(243, 238, 230, .16);
  --text: #f4efe7; --muted: #a8a095; --faint: #8c8579;
  --accent: #ffb224; --accent-ink: #1c1200; --accent-text: #ffc255; --accent-soft: rgba(255, 178, 36, .14);
  --ok: #62d6b6; --warn: #ffb224; --bad: #ff8f80; --info: #86adff; --rem: #c9a2ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .35);
  --topbar-bg: rgba(14, 13, 12, .86); --bottom-bg: rgba(23, 21, 19, .94); --scrim: rgba(0, 0, 0, .6);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 18px; --r-sm: 12px; --r-xs: 8px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --side-w: 260px; --topbar-h: 56px; --bottom-h: 64px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #f4f3ef; --surface-3: #ecebe6;
  --line: rgba(24, 20, 12, .07); --line-2: rgba(24, 20, 12, .14);
  --text: #17140f; --muted: #6a655c; --faint: #8a857b;
  --accent-text: #9a5a00; --accent-soft: rgba(255, 178, 36, .18);
  --ok: #0c8a6c; --warn: #a86500; --bad: #c4402f; --info: #2f5fd0; --rem: #7a4fd6;
  --shadow-sm: 0 1px 2px rgba(24, 20, 12, .05);
  --shadow: 0 1px 2px rgba(24, 20, 12, .04), 0 10px 30px rgba(24, 20, 12, .07);
  --topbar-bg: rgba(255, 255, 255, .86); --bottom-bg: rgba(255, 255, 255, .94); --scrim: rgba(24, 20, 12, .45);
}

/* ---------------------------------------------------------------- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: 1.55rem; font-weight: 750; }
h2 { font-size: 1.02rem; font-weight: 700; margin-bottom: 12px; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
ins { text-decoration: none; font-weight: 600; }   /* o valor novo no histórico (o navegador sublinharia por padrão) */
img, svg, video { max-width: 100%; }
code { font-family: var(--mono); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i-xs { width: 12px; height: 12px; } .i-sm { width: 16px; height: 16px; } .i-lg { width: 24px; height: 24px; }
@media (min-width: 720px) { h1 { font-size: 1.8rem; } }

/* ------------------------------------------------------------- estrutura ---- */
.app { min-height: 100vh; min-height: 100dvh; }
.stage { min-width: 0; }
.main { padding: 16px 16px 40px; width: 100%; max-width: 1240px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; padding: 0 6px; }
.brand svg { width: 30px; height: 30px; flex: none; } .brand .accent { fill: var(--accent); }
.brand span { display: grid; font-weight: 800; font-size: 1.2rem; letter-spacing: -.04em; line-height: 1.05; }
.brand small { font-size: .66rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.brand-lg svg { width: 40px; height: 40px; } .brand-lg span { font-size: 1.6rem; }
.side-nav { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 8px 12px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-weight: 560; }
.nav-item .i { opacity: .9; }
.nav-item:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.nav-item.on { color: var(--accent-text); background: var(--accent-soft); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: auto; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .74rem; font-weight: 700; text-align: center; line-height: 20px; }
.side-foot { margin-top: auto; display: grid; gap: 12px; }
.who { display: grid; padding: 0 6px; min-width: 0; } .who strong { font-weight: 650; } .who span { color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; }
.side-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Barra do topo (celular/tablet) e menu lateral */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; min-height: calc(var(--topbar-h) + var(--safe-t)); padding: var(--safe-t) 12px 0; background: var(--topbar-bg); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line); }
.topbar .brand { padding: 0; }
.topbar .brand svg { width: 28px; height: 28px; } .topbar .brand span { font-size: 1.1rem; }
.topbar-title { flex: 1; min-width: 0; text-align: right; font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; background: transparent; color: var(--text); text-decoration: none; }
.icon-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.theme-btn .i-sun { display: none; } :root[data-theme="dark"] .theme-btn .i-sun { display: block; } :root[data-theme="dark"] .theme-btn .i-moon { display: none; }
.scrim { position: fixed; inset: 0; z-index: 55; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .2s; }
body.nav-open .scrim { opacity: 1; pointer-events: auto; }

@media (max-width: 959px) {
  .side { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: min(84vw, 300px); display: flex; flex-direction: column; gap: 18px; padding: calc(18px + var(--safe-t)) 14px calc(18px + var(--safe-b)); background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; transform: translateX(-104%); transition: transform .22s ease; box-shadow: var(--shadow); }
  body.nav-open .side { transform: none; }
}
@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 20px; padding: 22px 14px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
  .topbar, .scrim { display: none; }
  .main { padding: 32px clamp(22px, 4vw, 52px) 72px; }
}

/* ------------------------------------------------- cabeçalhos e cartões ---- */
.page-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 4px; }
.page-head > .row, .page-head > a.btn, .page-head > form { align-self: flex-start; }
.page-head p.muted { margin-top: 4px; }
.page-head > a.btn { white-space: nowrap; }
@media (min-width: 720px) { .page-head { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 6px; } .page-head > .row, .page-head > a.btn, .page-head > form { align-self: auto; } }
.crumb { font-size: .85rem; color: var(--faint); margin-bottom: 4px; } .crumb a { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-top: 14px; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; } .card-head h2 { margin: 0; }
@media (min-width: 720px) { .card { padding: 22px; margin-top: 18px; } }
.grid-2, .grid-3 { display: grid; grid-template-columns: 1fr; gap: 0 18px; }
.grid-3 { gap: 0 16px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0 4px; }
@media (max-width: 719px) { .stats > .stat:first-child:nth-last-child(odd) { grid-column: 1 / -1; } }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 6px; } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--shadow-sm); min-width: 0; }
.stat strong { font-size: 1.35rem; letter-spacing: -.03em; line-height: 1.2; overflow-wrap: anywhere; }
.stat-label { font-size: .72rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
@media (min-width: 720px) { .stat { padding: 18px 20px; } .stat strong { font-size: 1.9rem; } .stat-label { font-size: .8rem; } }
.bar-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); } .bar-row:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.usage { display: grid; gap: 18px; } .usage label { display: block; }
progress { display: block; width: 100%; height: 8px; margin-top: 8px; border: 0; border-radius: 999px; overflow: hidden; background: var(--surface-3); color: var(--accent); -webkit-appearance: none; appearance: none; }
progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.empty { padding: 28px 18px; color: var(--muted); text-align: center; }
.pad { padding: 16px 18px 0; }

/* ---------------------------------------------------------------- tabelas ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .74rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table th.right { text-align: right; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.table-tight th, .table-tight td { padding: 9px 12px; }
.card:not(.flush) .table th:first-child, .card:not(.flush) .table td:first-child { padding-left: 0; }
.card:not(.flush) .table th:last-child, .card:not(.flush) .table td:last-child { padding-right: 0; }
/* No celular a tabela vira lista de cartões: cada linha empilha as colunas (os rótulos vêm de data-label, preenchido por JS). */
@media (max-width: 719px) {
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table tbody tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table tbody tr:hover { background: none; }
  .card:not(.flush) .table tbody tr { padding-left: 0; padding-right: 0; }
  .table td, .table-tight td, .card:not(.flush) .table td:first-child, .card:not(.flush) .table td:last-child { padding: 3px 0; border: 0; }
  .table td:empty { display: none; }
  .table td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: .7rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-top: 4px; }
  .table td.right { text-align: left; padding-top: 8px; }
  .table td:first-child { font-size: 1.02rem; }
}

/* --------------------------------------------------- etiquetas e alertas ---- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 650; vertical-align: middle; margin-left: 4px; border: 1px solid transparent; }
.badge:first-child { margin-left: 0; }
.b-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.b-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.b-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 15%, transparent); }
.b-info { color: var(--info); background: color-mix(in srgb, var(--info) 15%, transparent); }
.b-muted { color: var(--muted); background: color-mix(in srgb, var(--text) 8%, transparent); }
.alert { padding: 12px 16px; border-radius: var(--r-sm); margin: 14px 0 0; border: 1px solid var(--line-2); }
.main > .alert:first-child { margin-top: 0; } .main > .alert + :not(.alert) { margin-top: 18px; }
.a-ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.a-err { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.a-info { border-color: color-mix(in srgb, var(--info) 45%, var(--line)); background: color-mix(in srgb, var(--info) 10%, transparent); }
.secret { padding: 16px 18px; border-radius: var(--r-sm); margin: 14px 0 0; border: 1px dashed var(--accent); background: var(--accent-soft); display: grid; gap: 10px; }
.secret-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.secret code { white-space: pre-line; word-break: break-all; line-height: 1.7; font-size: 1.05rem; font-weight: 700; letter-spacing: .04em; padding: 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-2); user-select: all; }

/* --------------------------------------------------- formulários e botões ---- */
.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; align-content: start; margin-bottom: 4px; } .field label, .fieldset legend { font-size: .88rem; font-weight: 650; }
.field-narrow { max-width: 260px; }
.hint { font-size: .84rem; color: var(--muted); }
.input { width: 100%; min-height: 48px; padding: 11px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font-size: 16px; line-height: 1.3; -webkit-appearance: none; appearance: none; }
select.input { padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }
.input::placeholder { color: var(--faint); }
.input-sm { width: 100%; min-height: 40px; padding: 7px 12px; font-size: 15px; margin: 0; }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
textarea.input { resize: vertical; min-height: 96px; }
input[type="date"].input, input[type="time"].input { min-height: 48px; }
.form-narrow { max-width: 480px; } .form-wide { max-width: 760px; }
.fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px 16px; display: grid; gap: 12px; margin: 0; } .fieldset legend { padding: 0 6px; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; } .check { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; } .check input { accent-color: var(--accent); width: 20px; height: 20px; flex: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 16px; } .filters .input { flex: 1 1 170px; max-width: 320px; }
.inline-label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; min-height: 40px; } .inline-label input { accent-color: var(--accent); width: 20px; height: 20px; }
.inline { display: inline; margin: 0; }
.inline-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; } .inline-form > * { grid-column: 1 / -1; } .inline-form > .input-sm { grid-column: auto; } .inline-form > select.input-sm:last-of-type:nth-of-type(odd) { grid-column: 1 / -1; } .inline-form select.input-sm { text-overflow: ellipsis; } .inline-form .input, .inline-form .input-sm { max-width: none; width: 100%; }
@media (min-width: 720px) { .inline-form { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; } .inline-form > * { grid-column: auto; } .inline-form .input { width: auto; flex: 1 1 220px; max-width: 360px; } .inline-form .input-sm { width: auto; flex: 0 1 190px; } .filters .input { flex: 1 1 170px; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid transparent; font: 650 .95rem/1.2 var(--font); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; user-select: none; -webkit-user-select: none; }
.btn:active { transform: scale(.985); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .86rem; }
.btn-block { width: 100%; min-height: 48px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); } .btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-2); } .btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); } .btn-danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.btn[disabled], .input[disabled] { opacity: .55; cursor: not-allowed; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }

/* ------------------------------------------------------- acesso e erros ---- */
.auth-body { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 26px; display: grid; gap: 20px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.5rem; }
.qr { width: 220px; max-width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.setup-grid { display: grid; grid-template-columns: 1fr; gap: 22px; align-items: start; }
@media (min-width: 720px) { .setup-grid { grid-template-columns: 220px 1fr; gap: 26px; } }
.keybox { font-family: var(--mono); font-size: 1rem; letter-spacing: .08em; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-2); display: inline-block; user-select: all; word-break: break-all; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.code-input { font-size: 1.35rem; letter-spacing: .25em; text-align: center; font-family: var(--mono); }
.err-code { font-size: 4rem; font-weight: 800; letter-spacing: -.05em; color: var(--accent-text); line-height: 1; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ------------------------------------------------------------------ avatar ---- */
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; object-fit: cover; background: var(--accent-soft); color: var(--accent-text); font-weight: 750; letter-spacing: -.02em; line-height: 1; user-select: none; -webkit-user-select: none; }
img.avatar { display: block; background: var(--surface-3); }
.av-xs { width: 22px; height: 22px; font-size: .56rem; }
.av-sm { width: 36px; height: 36px; font-size: .8rem; } .av-md { width: 48px; height: 48px; font-size: 1rem; }
.av-lg { width: 72px; height: 72px; font-size: 1.5rem; } .av-xl { width: 96px; height: 96px; font-size: 2rem; }
.av-xxl { width: 120px; height: 120px; font-size: 2.4rem; }
.av-side { width: 130px; height: 130px; font-size: 2.6rem; }
.av-c0 { background: color-mix(in srgb, var(--accent) 24%, var(--surface)); color: var(--accent-text); }
.av-c1 { background: color-mix(in srgb, var(--info) 20%, var(--surface)); color: var(--info); }
.av-c2 { background: color-mix(in srgb, var(--ok) 20%, var(--surface)); color: var(--ok); }
.av-c3 { background: color-mix(in srgb, var(--bad) 18%, var(--surface)); color: var(--bad); }
.av-c4 { background: color-mix(in srgb, var(--text) 10%, var(--surface)); color: var(--text); }
.av-c5 { background: color-mix(in srgb, var(--warn) 18%, var(--surface)); color: var(--warn); }

/* ================================================================ tickets de suporte (painel + back-office) ==== */
.tk-crumb { margin: 0 0 4px; font-size: .82rem; color: var(--muted); } .tk-crumb a { color: inherit; }
.tk-title { overflow-wrap: anywhere; }
.tk-tabs { display: flex; gap: 6px; margin: 14px 0 4px; overflow-x: auto; scrollbar-width: none; }
.tk-tabs::-webkit-scrollbar { display: none; }
.tk-chip { display: inline-flex; align-items: center; gap: 8px; flex: none; line-height: 1.25; padding: 6px 13px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .84rem; font-weight: 600; text-decoration: none; transition: background .15s, color .15s; }
.tk-chip:hover { color: var(--text); background: var(--surface-2); }
.tk-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tk-n { min-width: 20px; padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, currentColor 14%, transparent); font-size: .74rem; font-weight: 700; text-align: center; line-height: 20px; }
.tk-filters { margin-top: 12px; } .tk-filters .input { max-width: 380px; }

.tk-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.tk-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .15s, background .15s; }
.tk-row:hover, .tk-row:focus-visible { border-color: var(--line-2); background: var(--surface-2); }
.tk-row.is-unread { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.tk-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.tk-subject { overflow-wrap: anywhere; line-height: 1.3; }
.tk-meta { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.tk-side { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; flex: none; max-width: 46%; }
.tk-side .badge { margin-left: 0; }
.tk-new { padding: 2px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 700; white-space: nowrap; }
.tk-chev { flex: none; width: 18px; height: 18px; color: var(--faint); }
@media (max-width: 560px) {
  .tk-row { flex-wrap: wrap; align-items: flex-start; }
  .tk-side { order: 3; flex-basis: 100%; max-width: none; justify-content: flex-start; }
  .tk-chev { display: none; }
}
.tk-empty { display: grid; justify-items: center; gap: 6px; padding: 34px 18px; text-align: center; margin-top: 14px; }
.tk-empty h2 { margin: 6px 0 0; font-size: 1.15rem; } .tk-empty p { margin: 0 0 10px; max-width: 46ch; }
.tk-empty-ico { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); }
.tk-empty-ico .i { width: 26px; height: 26px; }
.tk-form { margin-top: 14px; max-width: 760px; }
.tk-form textarea.input { min-height: 120px; }

.tk-info { margin-top: 14px; padding: 14px 18px; max-width: 760px; }
.tk-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 22px; margin: 0; }
.tk-facts dt { font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.tk-facts dd { margin: 3px 0 0; overflow-wrap: anywhere; }

/* conversa: cada mensagem é um balão; a equipe fica do lado do acento */
.thread { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 14px; max-width: 760px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.is-mine { flex-direction: row-reverse; }
.msg-box { min-width: 0; max-width: min(100%, 640px); padding: 11px 14px 12px; border: 1px solid var(--line); border-radius: 4px var(--r) var(--r) var(--r); background: var(--surface); }
.msg.is-mine .msg-box { border-radius: var(--r) 4px var(--r) var(--r); }
.msg.is-staff .msg-box { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.msg-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 4px; font-size: .84rem; }
.msg-head time { color: var(--muted); font-size: .76rem; }
.msg-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.av-staff { background: var(--surface-3); color: var(--text); }
.av-staff svg { width: 62%; height: 62%; } .av-staff .accent { fill: var(--accent); }

/* Ranking (2026-10-28): quem mais usa o sistema e o ranking geral da plataforma */
.rk-periods { display: flex; flex-wrap: wrap; gap: 6px; }
.rk-pos { width: 44px; text-align: center; color: var(--muted); }
.rk-medal { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: .8rem; font-weight: 750; background: var(--surface-2); color: var(--text); }
.rk-m1 { background: #f5c542; color: #3a2a00; } .rk-m2 { background: #c9ced6; color: #24272c; } .rk-m3 { background: #d8935a; color: #2b1505; }
.rk-bar { display: block; height: 4px; margin-top: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.rk-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.rk-w0 { width: 3%; } .rk-w1 { width: 10%; } .rk-w2 { width: 20%; } .rk-w3 { width: 30%; } .rk-w4 { width: 40%; } .rk-w5 { width: 50%; } .rk-w6 { width: 60%; } .rk-w7 { width: 70%; } .rk-w8 { width: 80%; } .rk-w9 { width: 90%; } .rk-w10 { width: 100%; }
.rk-stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.rk-stat { color: var(--text); text-decoration: none; transition: border-color .15s; }
.rk-stat:hover { border-color: var(--accent); }
.rk-stat .stat-label { display: flex; align-items: center; gap: 6px; }
.rk-accounts th a { color: inherit; text-decoration: none; }
.rk-accounts th a.rk-on { color: var(--accent); }
.rk-col { background: color-mix(in srgb, var(--accent) 7%, transparent); font-weight: 650; }
.rk-star { color: #f5c542; }
/* tabelas largas do Ranking rolam por dentro do cartão (a página nunca fica mais larga que a tela) */
.rk-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rk-users td:nth-child(2), .rk-accounts td:nth-child(2) { min-width: 190px; }
.rk-users td:last-child { min-width: 220px; }
.rk-accounts th, .rk-users th { white-space: nowrap; }
.card:has(.rk-scroll), .stage:has(.rk-scroll) { min-width: 0; }
