/* Tema claro (padrão). A cor da marca (--primary/--primary-2/--sidebar e as
   variantes --brand-*) é definida pelo JavaScript a partir do painel Empresa. */
:root {
  color-scheme: light;
  --bg: #f1f4f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f3f5f9;
  --hover: #f8faff;
  --topbar-bg: rgba(255, 255, 255, .92);
  --border: #e3e7ee;
  --row-border: #eef1f5;
  --input-border: #d0d5dd;
  --text: #1f2937;
  --text-2: #374151;
  --text-3: #4b5563;
  --muted: #6b7280;
  --primary: #1e3a8a;
  --primary-2: #2546a8;
  --primary-soft: var(--brand-soft-l, #e8eefc);
  --link: var(--primary);
  --danger: #b91c1c;
  --success: #15803d;
  --warning: #b45309;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

/* Tema escuro: superfícies em degraus de cinza-azulado, textos claros e
   versões claras da cor da marca para links e destaques. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1218;
  --surface: #171b23;
  --surface-2: #1c212b;
  --surface-3: #222834;
  --hover: #232a38;
  --topbar-bg: rgba(23, 27, 35, .92);
  --border: #2b3240;
  --row-border: #242a36;
  --input-border: #3a4252;
  --text: #e6e9ef;
  --text-2: #c9ced8;
  --text-3: #aab1bd;
  --muted: #8b93a1;
  --primary-soft: var(--brand-soft-d, #1c2847);
  --link: var(--brand-link-d, #8fb0ff);
  --danger: #f87171;
  --success: #4ade80;
  --warning: #fbbf24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar, #0f1e47); color: #c9d4f2; display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; font-weight: 700; font-size: 19px; padding: 4px 10px 18px; display: flex; gap: 8px; align-items: center; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: #3b5bdb; display: grid; place-items: center; font-size: 15px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7d8cb8; margin: 16px 10px 6px; }
.nav a { display: block; color: #c9d4f2; padding: 8px 10px; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover { background: rgba(255, 255, 255, .07); text-decoration: none; }
.nav a.active { background: var(--primary-2); color: #fff; }
.nav .count { float: right; background: #f59e0b; color: #111; border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 600; }
main#view { padding: 24px 28px 48px; max-width: 1280px; width: 100%; min-width: 0; }
main#view:has(.kanban) { max-width: none; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.back { color: var(--muted); display: inline-block; margin-bottom: 6px; }

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.error { color: var(--danger); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.loading { color: var(--muted); padding: 40px; text-align: center; }
.empty { color: var(--muted); padding: 32px; text-align: center; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--danger); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { background: #991b1b; }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=url], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; border: 1px solid var(--input-border); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d4fb; border-color: var(--primary-2); }
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 3px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-bottom: 8px; cursor: pointer; }
.check input { margin: 0; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px 4px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 6px; font-size: 13px; }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--row-border); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--hover); }
.table-wrap { overflow-x: auto; }
.id { color: var(--muted); font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.st-open { background: #dbeafe; color: #1e40af; }
.st-in_progress { background: #e0e7ff; color: #3730a3; }
.st-awaiting_approval, .ap-pending { background: #fef3c7; color: #92400e; }
.st-pending_customer { background: #fce7f3; color: #9d174d; }
.st-awaiting_vendor { background: #cffafe; color: #155e75; }
.st-resolved, .ap-approved { background: #dcfce7; color: #166534; }
.st-closed, .ap-expired, .ap-cancelled { background: #e5e7eb; color: var(--text-2); }
.st-rejected, .ap-rejected { background: #fee2e2; color: #991b1b; }
.prio { font-size: 12px; font-weight: 600; }
.pr-low { color: #6b7280; } .pr-normal { color: var(--text); } .pr-high { color: #c2410c; } .pr-urgent { color: #b91c1c; }
.pr-urgent::before { content: "● "; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 4px; background: var(--surface-3); color: var(--text-3); margin-right: 4px; }

/* ---------- indicadores ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; }
.stat:hover { border-color: #b9c6ef; }
.stat .n { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat.warn .n { color: var(--warning); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px; border-bottom: 1px solid var(--border); }
.filters select, .filters input { width: auto; min-width: 150px; }
/* Mostrar/ocultar indicadores e filtros */
.toggle-btn .ico, .filters-toggle .ico { width: 16px; height: 16px; }
.toggle-btn[aria-pressed="false"], .filters-toggle[aria-pressed="false"] { color: var(--muted); background: var(--surface-3); }
.filters-toggle { flex: 0 0 auto; align-self: center; }
.filters-toggle.has-active { color: var(--link); border-color: var(--primary-2); background: var(--primary-soft); }
.hide-stats .stats, .hide-kpis .kpis { display: none; }
.filters.collapsed select { display: none; }
.filter-summary { display: none; align-items: center; gap: 6px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; font-size: 13px; }
.filter-summary .ico { width: 15px; height: 15px; color: var(--muted); }
.dash-filters.collapsed > label, .dash-filters.collapsed > .range { display: none !important; }
.dash-filters.collapsed .filter-summary { display: inline-flex; }
.m-only { display: none; }
.filters input[type=search] { flex: 1; min-width: 200px; border: 1px solid var(--input-border); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--surface); color: var(--text); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--muted); }

/* ---------- chamado ---------- */
.ticket-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.msg.requester { border-left: 4px solid #60a5fa; }
.msg.staff { border-left: 4px solid #34d399; }
.msg.internal { background: #fffbeb; border-color: #fde68a; border-left: 4px solid #f59e0b; }
.thread.hide-log .msg.system { display: none; }
.thread-tools { display: flex; justify-content: flex-end; margin-bottom: -4px; }
.thread-tools .ico { width: 15px; height: 15px; }
.msg.system { background: transparent; border: 0; padding: 2px 16px; color: var(--muted); font-size: 13px; }
.msg.system .body { white-space: pre-wrap; }
.msg-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 13px; flex-wrap: wrap; }
.msg-head .author { font-weight: 600; }
.msg .body { white-space: pre-wrap; word-wrap: break-word; }
.reply { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.reply.internal textarea { background: #fffbeb; }
.side .card h3 { display: flex; justify-content: space-between; align-items: center; }
dl.props { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; word-break: break-word; }
.approval { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: 13px; }
.approval .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.approval .comment { margin-top: 6px; font-style: italic; white-space: pre-wrap; }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #0f1e47 0%, #1e3a8a 60%, #3b5bdb 100%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 14px; padding: 30px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.auth-card .brand { color: var(--link); padding: 0 0 6px; }
.auth-card .brand-mark { color: #fff; }
.auth-card p.lead { color: var(--muted); margin: 0 0 20px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 10px; }

/* ---------- modal e toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-head h2 { margin: 0; }
.modal-head .x { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); max-width: 380px; }
.toast.err { background: var(--danger); }
.keybox { font-family: Consolas, monospace; background: #0f172a; color: #a5f3fc; padding: 12px; border-radius: 8px; word-break: break-all; user-select: all; }
pre.out { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 12px; margin: 6px 0 0; }

[hidden] { display: none !important; }
.brand-mark { background: var(--primary-2); color: #fff; }
.brand-logo { max-height: 38px; max-width: 190px; background: var(--surface); border-radius: 6px; padding: 4px 8px; display: block; }
.auth-wrap { background: linear-gradient(135deg, var(--sidebar, #0f1e47) 0%, var(--primary) 60%, var(--primary-2) 100%); }
.auth-card .brand-logo { padding: 0; max-height: 56px; max-width: 240px; }

/* ---------- empresa ---------- */
.company-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
.company-grid > .btn-row { grid-column: 1 / -1; }
.company-grid .card + .card { margin-top: 0; }
.logo-box { border: 1px dashed var(--input-border); border-radius: 10px; min-height: 90px; display: grid; place-items: center; padding: 12px; background: repeating-conic-gradient(#f8fafc 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.logo-box img { max-height: 80px; max-width: 100%; }
.color-input { width: 56px; height: 38px; padding: 2px; border: 1px solid var(--input-border); border-radius: 8px; background: var(--surface); cursor: pointer; }
.pv-mail { border: 1px solid var(--border); border-top: 5px solid; border-radius: 8px; overflow: hidden; }
.pv-head { padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; }
.pv-head img { max-height: 32px; max-width: 160px; display: block; }
.pv-body { padding: 14px; }
.pv-btn { display: inline-block; color: #fff; padding: 7px 14px; border-radius: 6px; font-weight: 600; font-size: 13px; }
.req { color: var(--danger); }
.modal.wide { max-width: 860px; }

/* ---------- tipos de solicitação e campos ---------- */
.type-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.type-card { text-align: left; border: 1px solid var(--input-border); background: var(--surface); border-radius: 10px; padding: 12px 14px; cursor: pointer; font: inherit; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.type-card span { color: var(--muted); font-size: 12px; }
.type-card:hover { border-color: #9fb3ee; }
.type-card.sel { border-color: var(--primary-2); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary-2); }
.opt-group { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.req-data { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 4px 0 10px; }
.req-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; }
dl.cf dd { white-space: pre-wrap; }
.field-row { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.field-main { display: grid; grid-template-columns: 1fr 190px auto auto; gap: 10px; align-items: center; }

.sector-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--row-border); padding: 2px 0; }
.sector-row .check { margin: 6px 0; }
.tag.mgr { background: #fef3c7; color: #92400e; }

/* ---------- aprovadores ---------- */
.approver-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.approver-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; font-weight: 400; margin: 0; }
.approver-opt:has(input:checked) { border-color: var(--primary-2); background: var(--primary-soft); }
.approver-opt input { margin-top: 3px; }

/* ---------- imagens ---------- */
.img-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.img-preview img { height: 72px; border-radius: 6px; border: 1px solid var(--border); object-fit: cover; }
.inline-img { display: block; max-width: 100%; max-height: 420px; border-radius: 8px; border: 1px solid var(--border); margin: 8px 0; cursor: zoom-in; }
textarea.drop { outline: 2px dashed var(--primary-2); background: var(--primary-soft); }

/* ---------- SLA ---------- */
.sla { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.sla-ok, .sla-met { background: #dcfce7; color: #166534; }
.sla-warning { background: #fef3c7; color: #92400e; }
.sla-breached, .sla-missed { background: #fee2e2; color: #991b1b; }
.stat.bad .n { color: var(--danger); }
.dur { display: flex; gap: 8px; }
.dur input { max-width: 120px; }
.dur select { width: auto; }

/* ---------- kanban ---------- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 8px 14px; font: inherit; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--primary); color: #fff; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; padding: 14px; overflow-x: auto; min-height: 420px; }
.kcol { background: var(--surface-3); border-radius: 10px; display: flex; flex-direction: column; min-height: 200px; transition: background .15s; }
.kcol.over { background: #e3e9fb; outline: 2px dashed var(--primary-2); }
.kcol-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 6px; }
.kcount { font-size: 12px; color: var(--muted); font-weight: 600; }
.kcol-body { display: flex; flex-direction: column; gap: 8px; padding: 6px 10px 12px; flex: 1; max-height: 70vh; overflow-y: auto; }
.kempty { color: #9ca3af; font-size: 12px; text-align: center; padding: 18px 6px; border: 1px dashed var(--input-border); border-radius: 8px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--input-border); border-radius: 8px; padding: 10px 12px; cursor: grab; display: flex; flex-direction: column; gap: 5px; box-shadow: var(--shadow); }
.kcard:hover { border-color: #b9c6ef; }
.kcard.dragging { opacity: .45; }
.kcard.pb-high { border-left-color: #f97316; } .kcard.pb-urgent { border-left-color: #dc2626; } .kcard.pb-low { border-left-color: var(--border); }
.kc-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.kc-title { font-weight: 600; line-height: 1.3; }
.kc-meta { font-size: 12px; color: var(--muted); }
.kc-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-3); gap: 6px; }
.kc-move { display: none; margin-top: 4px; font-size: 13px; padding: 6px 8px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--primary-2); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }

/* ---------- login ---------- */
.btn.google { width: 100%; justify-content: center; padding: 10px; gap: 10px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.alert { background: #fee2e2; color: #991b1b; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.signup-cta { margin-top: 20px; padding: 14px; border-radius: 10px; background: var(--primary-soft); display: flex; flex-direction: column; gap: 6px; text-align: center; }
.signup-cta span { color: var(--text-2); font-size: 13px; }
.signup-cta .btn { margin-top: 4px; background: var(--surface); }

/* ---------- abertura de chamado ---------- */
.new-ticket-single { max-width: 760px; }
.new-ticket-single .new-ticket-actions { margin-top: 16px; }
/* Interna (equipe): formulário à esquerda, solicitante e acompanhantes à direita */
.new-ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; max-width: 1180px; }
.new-ticket-grid > .card { grid-column: 1; grid-row: 1; }
.new-ticket-grid > .new-ticket-side { grid-column: 2; grid-row: 1 / span 2; }
.new-ticket-grid > .new-ticket-actions { grid-column: 1; grid-row: 2; }
.new-ticket-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 76px; }
.new-ticket-side .card + .card { margin-top: 0; }
.new-ticket-side h3 { margin-bottom: 10px; }
.new-ticket-side .hint { margin-top: 6px; }

/* ---------- base de conhecimento ---------- */
.kb-hero { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%); color: #fff; border-radius: 14px; padding: 28px 28px 24px; margin-bottom: 22px; }
.kb-hero h1 { color: #fff; font-size: 24px; }
.kb-hero p { margin: 4px 0 16px; opacity: .9; }
.kb-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 10px; padding: 6px 6px 6px 14px; max-width: 720px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); }
.kb-search .ico { color: var(--muted); width: 20px; height: 20px; }
.kb-search input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 15px; padding: 8px 4px; min-width: 0; background: transparent; }
.kb-actions { margin-top: 14px; }
.kb-actions .btn:not(.primary) { background: rgba(255, 255, 255, .15); color: #fff; border-color: rgba(255, 255, 255, .35); }
.kb-actions .btn.primary { background: var(--surface); color: var(--link); border-color: #fff; }
.kb-section { font-size: 16px; margin: 6px 0 12px; }
.kb-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 22px; }
.kb-cat { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; color: var(--text); }
.kb-cat:hover { border-color: #b9c6ef; text-decoration: none; box-shadow: var(--shadow); }
.kb-cat > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kb-cat-ico { font-size: 26px; line-height: 1; }
.kb-cat-count { color: var(--link); font-size: 12px; font-weight: 600; margin-top: 4px; }
.kb-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.kb-list { display: flex; flex-direction: column; }
.kb-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--row-border); color: var(--text); }
.kb-item:last-child { border-bottom: 0; }
.kb-item:hover { background: var(--hover); text-decoration: none; }
.kb-item-ico { color: var(--link); padding-top: 2px; }
.kb-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kb-item-title { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kb-item-sum { color: var(--text-3); font-size: 13px; }
.kb-item-meta { color: var(--muted); font-size: 12px; }
.kb-cta { margin-top: 12px; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.kb-article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.kb-article { padding: 26px 30px; }
.kb-article-head h1 { font-size: 26px; line-height: 1.25; margin-bottom: 6px; }
.kb-meta { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.kb-summary { font-size: 16px; color: var(--text-2); border-left: 4px solid var(--primary-2); padding: 4px 0 4px 14px; margin: 16px 0; }
.kb-body { font-size: 15px; line-height: 1.7; color: var(--text); overflow-wrap: anywhere; }
.kb-body h2 { font-size: 20px; margin: 26px 0 8px; }
.kb-body h3 { font-size: 17px; margin: 20px 0 6px; }
.kb-body h4 { font-size: 15px; margin: 16px 0 4px; }
.kb-body p { margin: 0 0 12px; }
.kb-body ul, .kb-body ol { padding-left: 24px; margin: 0 0 12px; }
.kb-body li { margin-bottom: 4px; }
.kb-body code { background: var(--surface-3); border-radius: 4px; padding: 1px 5px; font-family: Consolas, monospace; font-size: 13px; }
.kb-body pre { background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 14px; overflow-x: auto; margin: 0 0 14px; }
.kb-body pre code { background: none; color: inherit; padding: 0; }
.kb-body blockquote { margin: 0 0 12px; padding: 10px 14px; border-left: 4px solid #f59e0b; background: #fffbeb; border-radius: 0 8px 8px 0; }
.kb-body img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); margin: 6px 0; }
.kb-body hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.kb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.kb-feedback { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.kb-feedback .btn.on { background: var(--primary-soft); border-color: var(--primary-2); color: var(--link); }
.kb-related { display: block; padding: 7px 0; border-bottom: 1px solid var(--row-border); font-size: 14px; }
.kb-related:last-child { border-bottom: 0; }
.kb-help .btn { width: 100%; justify-content: center; }
.kb-side .card + .card { margin-top: 16px; }
.kb-editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.kb-editor .card + .card { margin-top: 0; }
.kb-editor-side { position: sticky; top: 76px; }
.btn-col { display: flex; flex-direction: column; gap: 8px; }
.btn-col .btn { justify-content: center; }
.editor-tabs { display: flex; gap: 2px; margin-bottom: 6px; }
.editor-tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; font: inherit; cursor: pointer; color: var(--muted); }
.editor-tabs button.on { background: var(--primary-soft); color: var(--link); font-weight: 600; }
.md-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--input-border); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--surface-2); }
.md-toolbar button { border: 1px solid transparent; background: none; border-radius: 6px; padding: 4px 9px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text-2); }
.md-toolbar button:hover { background: var(--surface); border-color: var(--border); }
.md-input { border-radius: 0 0 8px 8px !important; font-family: Consolas, "Segoe UI", monospace; font-size: 14px; min-height: 360px; }
.md-preview { border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; min-height: 360px; }
.kb-suggest { border: 1px solid #c7d4fb; background: var(--primary-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.kb-suggest-head { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--link); margin-bottom: 6px; }
.kb-suggest-head .ico { width: 16px; height: 16px; }
.kb-suggest-item { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-top: 1px solid rgba(37, 70, 168, .12); }
.kb-suggest-item:first-of-type { border-top: 0; }
.kb-suggest-item .btn { align-self: flex-start; margin-top: 4px; }
.kb-suggest.in-ticket { background: none; border: 0; padding: 0; margin: 0; }
.kb-suggest.in-ticket .kb-suggest-head { display: none; }
.kb-check-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.kb-check-item { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.kb-login-link { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; font-size: 13px; }
.kb-login-link .ico { width: 16px; height: 16px; }
.kc-row { display: grid; grid-template-columns: 56px 1fr 1.4fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.kc-row .kc-count { grid-column: 2 / -1; margin-top: -4px; }
.kc-icon { text-align: center; }
.public-layout { min-height: 100vh; background: var(--bg); }
.public-top { justify-content: flex-start; }
.public-top .brand { padding: 0; color: var(--link); }
.public-top .brand-logo { height: 34px; width: auto; max-width: none; padding: 0; background: none; }
.public-nav { margin-left: 18px; flex: 1; }
.public-nav a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 500; }
.public-nav .ico { width: 16px; height: 16px; }
.public-layout main#view { margin: 0 auto; }

/* ---------- busca de usuários e chips ---------- */
.picker { position: relative; }
.picker-input { width: 100%; border: 1px solid var(--input-border); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--surface); }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 12px 28px rgba(16, 24, 40, .14); z-index: 70; max-height: 280px; overflow-y: auto; padding: 4px; }
.picker-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.picker-item.on, .picker-item:hover { background: var(--primary-soft); }
.picker-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:not(:empty) { margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-3); border-radius: 999px; padding: 3px 4px 3px 11px; font-size: 13px; max-width: 100%; }
.chip button { border: 0; background: rgba(0, 0, 0, .08); width: 20px; height: 20px; border-radius: 50%; cursor: pointer; line-height: 1; color: var(--text-2); flex-shrink: 0; }
.chip button:hover { background: rgba(0, 0, 0, .16); }
.chip-err { background: #fee2e2; color: #991b1b; }
.selected-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; background: var(--surface-2); }
.selected-user > span:nth-child(2) { flex: 1; min-width: 0; }
.selected-user .avatar { background: var(--primary); }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--link); cursor: pointer; font: inherit; font-size: 13px; text-decoration: underline; margin: 6px 0 2px; }

/* ---------- anexos ---------- */
.att-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.att-picker .hint { margin: 0; }
.att-btn { margin: 0; cursor: pointer; }
.att-pending { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.att-pending:empty { display: none; }
form.drop-zone { outline: 2px dashed var(--primary-2); outline-offset: 4px; border-radius: 10px; }
.spin { width: 12px; height: 12px; border: 2px solid var(--input-border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.att { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 8px 8px; background: var(--surface); color: var(--text); max-width: 100%; }
.att:hover { border-color: #b9c6ef; text-decoration: none; background: var(--hover); }
.att-ico { width: 36px; height: 36px; border-radius: 6px; background: var(--primary-soft); color: var(--link); font-size: 10px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.att-text { display: flex; flex-direction: column; min-width: 0; }
.att-name { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.att-img { flex-direction: column; align-items: stretch; padding: 4px; gap: 4px; width: 140px; }
.att-img img { width: 100%; height: 90px; object-fit: cover; border-radius: 5px; }
.att-img span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px 2px; }

/* ---------- e-mail e SMS ---------- */
.notify-opt { align-items: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.notify-opt input { margin-top: 3px; }
.test-box { display: flex; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.test-box input { flex: 1; min-width: 180px; }
.test-out { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--surface-3); font-size: 13px; }
.test-out.sent { background: #dcfce7; color: #166534; }
.test-out.simulated { background: #fef3c7; color: #92400e; }
.test-out.failed { background: #fee2e2; color: #991b1b; word-break: break-word; white-space: pre-line; }
.chart-head h2 .tag, .card h2 .tag { vertical-align: middle; margin-left: 6px; font-weight: 500; }

/* ---------- dashboard de SLA ---------- */
:root {
  --series-1: #2a78d6;      /* 1ª resposta (validado com o par abaixo) */
  --series-2: #eb6834;      /* resolução */
  --series-1-track: #dbe8f8;
  --series-2-track: #fbe1d6;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --chart-grid: #e1e0d9;
  --chart-axis: #c3c2b7;
  --chart-muted: #898781;
}
.dash-filters { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-filters label { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; }
.dash-filters select { width: auto; min-width: 190px; }
.dash-filters input[type=month], .dash-filters input[type=date] { width: auto; }
.dash-filters input[type=month] { border: 1px solid var(--input-border); border-radius: 8px; padding: 7px 10px; font: inherit; }
.dash-filters .range { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.dash-filters #export { margin-left: auto; }
.dash-filters #export .ico { width: 16px; height: 16px; }
.dash-body { transition: opacity .15s; }
.dash-body.refreshing { opacity: .55; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi-label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 28px; font-weight: 600; line-height: 1.2; margin: 4px 0 2px; }
.kpi-sub { color: var(--muted); font-size: 12px; }
.kpi.st-crit { border-color: #f3c2c2; }
.status-ico { width: 16px; height: 16px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.status-ico.warn { background: var(--status-warning); color: #3d2a00; }
.status-ico.crit { background: var(--status-critical); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; margin-right: 6px; vertical-align: -1px; }
.key.k1 { background: var(--series-1); } .key.k2 { background: var(--series-2); }
.chart-card { margin-bottom: 16px; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-head h2 { margin: 0 0 2px; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; }
.trend { position: relative; width: 100%; }
.trend svg { display: block; max-width: 100%; overflow: visible; }
.trend .grid { stroke: var(--chart-grid); stroke-width: 1; }
.trend .base { stroke: var(--chart-axis); stroke-width: 1; }
.trend .ax { fill: var(--chart-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.trend .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .line.k1 { stroke: var(--series-1); } .trend .line.k2 { stroke: var(--series-2); }
.trend .dot { stroke: #fff; stroke-width: 2; }
.trend .dot.k1 { fill: var(--series-1); } .trend .dot.k2 { fill: var(--series-2); }
.trend .end-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.trend .cross { stroke: var(--chart-axis); stroke-width: 1; }
.trend .tip { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(16, 24, 40, .12); padding: 8px 10px; font-size: 12px; pointer-events: none; white-space: nowrap; display: flex; flex-direction: column; gap: 3px; }
.trend .tip .key { margin-right: 5px; }
td.num, th.num, span.num { font-variant-numeric: tabular-nums; }
th.num, td.num { text-align: right; }
.meter-cell { display: flex; align-items: center; gap: 8px; }
.meter { width: 120px; height: 8px; border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.meter span { display: block; height: 100%; border-radius: 4px; }
.meter.m1 { background: var(--series-1-track); } .meter.m1 span { background: var(--series-1); }
.meter.m2 { background: var(--series-2-track); } .meter.m2 span { background: var(--series-2); }

/* ---------- menu lateral recolhível ---------- */
.sidebar { overflow-y: auto; overflow-x: hidden; transition: padding .2s; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 14px; }
.sidebar-top .brand { padding: 4px 6px; min-width: 0; flex: 1 1 auto; overflow: hidden; white-space: nowrap; }
/* Altura fixa e largura proporcional: % dentro de flex faz a imagem colapsar. */
.sidebar-top .brand-logo { height: 38px; width: auto; max-width: none; flex-shrink: 0; }
.icon-btn { background: rgba(255, 255, 255, .08); border: 0; color: #c9d4f2; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.icon-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.collapse-btn .ico { transition: transform .2s; }
.ico { width: 18px; height: 18px; flex-shrink: 0; }
.nav a { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.nav .count { float: none; margin-left: auto; }
.avatar.lg { width: 32px; height: 32px; font-size: 12px; }
.sidebar-backdrop { display: none; }

/* ---------- barra superior com o perfil ---------- */
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 28px; background: var(--topbar-bg); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); }
.topbar-left { display: none; align-items: center; gap: 12px; }
.topbar-left .icon-btn { background: var(--primary-soft); color: var(--link); }
.topbar-left .brand { padding: 0; color: var(--link); }
.topbar .brand-logo { height: 32px; width: auto; max-width: none; padding: 0; background: none; }
.user-menu { position: relative; }
.notif-menu { position: relative; margin-left: auto; }
.notif-btn { background: transparent; color: var(--text-3); width: 40px; height: 40px; position: relative; border-radius: 10px; }
.notif-btn:hover, .notif-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.notif-btn .ico { width: 20px; height: 20px; }
.notif-count { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--status-critical, #d03b3b); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; line-height: 1; }
.notif-dropdown { position: absolute; right: 0; top: calc(100% + 6px); width: 360px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); z-index: 60; overflow: hidden; }
.nd-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.nd-head .link-btn { margin: 0; text-decoration: none; }
.nd-list { max-height: 420px; overflow-y: auto; }
.nd-item { display: flex; gap: 10px; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--row-border); }
.nd-item:hover { background: var(--hover); text-decoration: none; }
.nd-item.unread { background: var(--primary-soft); }
.nd-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: transparent; }
.nd-item.unread .nd-dot { background: var(--primary); }
.nd-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.nd-title { font-weight: 600; font-size: 13px; }
.nd-body { color: var(--text-3); font-size: 12px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nd-time { color: var(--muted); font-size: 11px; }
.nd-empty { padding: 24px 14px; color: var(--muted); text-align: center; font-size: 13px; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: 10px; padding: 5px 8px 5px 5px; cursor: pointer; font: inherit; color: var(--text); }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-3); border-color: var(--border); }
.user-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: left; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { color: var(--muted); font-size: 12px; }
.user-btn .caret { width: 16px; height: 16px; color: var(--muted); }
.user-btn .avatar, .ud-head .avatar { background: var(--primary); }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); padding: 6px; z-index: 60; }
.ud-head { display: flex; gap: 10px; align-items: center; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.ud-head > div { min-width: 0; }
.ud-head .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.user-dropdown a:hover { background: var(--surface-3); text-decoration: none; }
.user-dropdown .ico { color: var(--muted); }

/* ================= responsividade =================
   desktop  >= 1201px  menu completo (recolhível pelo usuário)
   tablet   961–1200px menu só com ícones
   tablet   601–960px  menu em gaveta, formulários ainda em 2 colunas
   celular  <= 600px   uma coluna, listas em cartões, modais em tela cheia */

/* Menu recolhido (escolha do usuário no desktop ou automático no tablet horizontal) */
@media (min-width: 961px) {
  .layout { transition: grid-template-columns .2s; }
  .layout.collapsed { grid-template-columns: 68px minmax(0, 1fr); }
  .layout.collapsed .sidebar { padding: 16px 10px; }
  .layout.collapsed .lbl, .layout.collapsed .sidebar-top .brand { display: none; }
  .layout.collapsed .sidebar-top { justify-content: center; }
  .layout.collapsed .collapse-btn .ico { transform: rotate(180deg); }
  /* Títulos de seção viram divisórias */
  .layout.collapsed .nav-section { font-size: 0; height: 1px; background: rgba(255, 255, 255, .12); margin: 10px 6px; }
  .layout.collapsed .nav a { justify-content: center; padding: 10px; position: relative; }
  .layout.collapsed .nav .count { position: absolute; top: 2px; right: 2px; font-size: 10px; padding: 0 5px; }
}

@media (min-width: 961px) and (max-width: 1200px) {
  .layout, .layout.collapsed { grid-template-columns: 68px minmax(0, 1fr); }
  .sidebar { padding: 16px 10px; }
  .lbl, .sidebar-top .brand, .collapse-btn { display: none; }
  .sidebar-top { justify-content: center; }
  .nav-section { font-size: 0; height: 1px; background: rgba(255, 255, 255, .12); margin: 10px 6px; }
  .nav a { justify-content: center; padding: 10px; position: relative; }
  .nav .count { position: absolute; top: 2px; right: 2px; font-size: 10px; padding: 0 5px; }
  main#view { padding: 20px 22px 40px; }
  .ticket-grid { grid-template-columns: 1fr 290px; }
  .col-opt { display: none; }
  table.list .sla { white-space: normal; }
  .field-main { grid-template-columns: 1fr 160px auto auto; }
}

@media (max-width: 960px) {
  .company-grid { grid-template-columns: 1fr; }
  .kb-two, .kb-article-grid, .kb-editor, .new-ticket-grid { grid-template-columns: 1fr; }
  .new-ticket-side { position: static; }
  .new-ticket-grid > .card, .new-ticket-grid > .new-ticket-side, .new-ticket-grid > .new-ticket-actions { grid-column: 1; grid-row: auto; }
  .kb-editor-side { position: static; }
  .layout, .layout.collapsed { grid-template-columns: minmax(0, 1fr); }
  /* Menu vira gaveta sobre o conteúdo */
  .topbar { padding: 0 16px; height: 56px; }
  .topbar-left { display: flex; }
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; height: 100dvh; width: 272px; max-width: 86vw; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .layout.mobile-open .sidebar { transform: none; }
  .layout.mobile-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; }
  .collapse-btn { display: none; }
  .nav a { padding: 11px 10px; }
  .ticket-grid { grid-template-columns: 1fr; }
  .side { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .side .card + .card { margin-top: 0; }
  main#view { padding: 18px; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .col-opt { display: none; }
  table.list .sla { white-space: normal; }
  .kanban { grid-auto-columns: minmax(240px, 42vw); scroll-snap-type: x mandatory; }
  .kcol { scroll-snap-align: start; }
  .kcol-body { max-height: none; }
}

@media (max-width: 600px) {
  body { font-size: 15px; }
  /* 16px evita o zoom automático do iOS ao focar campos */
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=url], input[type=date], input[type=search], select, textarea { font-size: 16px; }
  main#view { padding: 14px 12px 32px; }
  h1 { font-size: 19px; }
  .page-head { margin-bottom: 14px; }
  .page-head > .btn, .page-head > .btn-row { width: 100%; }
  .page-head > .btn-row > .btn.primary { flex: 1; justify-content: center; }
  .card { padding: 14px; }
  .grid2, .grid3, .side { grid-template-columns: 1fr; }
  .user-text, .user-btn .caret { display: none; }
  .topbar .brand-logo { height: 28px; }
  .kb-hero { padding: 20px 16px; border-radius: 12px; }
  .kb-search { flex-wrap: wrap; padding: 6px; }
  .kb-search .btn { width: 100%; justify-content: center; }
  .kb-article { padding: 18px 16px; }
  .kb-article-head h1 { font-size: 21px; }
  .kc-row { grid-template-columns: 48px 1fr; }
  .kc-row > input[name=description], .kc-row > .btn-row, .kc-row > .btn { grid-column: 1 / -1; }
  .public-nav { display: none; }
  .public-top .btn { margin-left: auto; }
  .notif-dropdown { position: fixed; left: 10px; right: 10px; top: 60px; width: auto; max-width: none; }
  .nd-list { max-height: 70vh; }

  /* Indicadores em faixa com rolagem lateral, para a lista aparecer logo */
  .stats { display: flex; overflow-x: auto; gap: 8px; scroll-snap-type: x proximity; padding-bottom: 4px; margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  .stat { padding: 10px 12px; flex: 0 0 132px; scroll-snap-align: start; }
  table.list.stack td.col-opt { display: flex; }
  .stat .n { font-size: 22px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 22px; }

  .filters { padding: 10px; gap: 8px; }
  .filters select, .filters input[type=search] { flex: 1 1 100%; min-width: 0; width: 100%; }
  /* Busca e botão de filtros na mesma linha; os filtros abrem abaixo */
  .filters-toggle { order: 2; }
  .filters input[type=search] { order: 1; flex: 1 1 0; }
  .filters select { order: 3; }
  .toggle-btn span, .seg button span, #export-tickets span { display: none; }
  .kcols-dropdown { position: fixed; left: 10px; right: 10px; top: auto; min-width: 0; }
  .seg button { white-space: nowrap; }
  .page-head > .btn-row { flex-wrap: wrap; }
  .dash-filters { flex-direction: column; gap: 8px; }
  .dash-filters label { justify-content: space-between; }
  .dash-filters select, .dash-filters input { flex: 1; min-width: 0; }
  .dash-filters .range { flex-direction: column; gap: 8px; }
  .dash-filters #export { margin-left: 0; width: 100%; justify-content: center; }
  .att-name { max-width: 170px; }
  .pager { flex-direction: column; gap: 8px; }

  /* Listas principais viram cartões (cada célula mostra seu rótulo) */
  table.list.stack thead { display: none; }
  table.list.stack, table.list.stack tbody, table.list.stack tr, table.list.stack td { display: block; width: 100%; }
  table.list.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.list.stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.list.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex-shrink: 0; }
  table.list.stack td.cell-main { display: block; text-align: left; padding-bottom: 6px; }
  table.list.stack td.cell-main::before { content: none; }
  table.list.stack td:empty, table.list.stack td.id { display: none; }
  table.list.stack .m-only { display: inline; }

  .kanban { grid-auto-columns: 84vw; padding: 10px; gap: 10px; }
  .seg button { padding: 8px 10px; }

  .msg { padding: 12px; }
  .reply .btn-row { flex-direction: column; align-items: stretch; }
  .reply .btn-row > .btn-row { flex-direction: column; align-items: stretch; }
  .reply select { width: 100% !important; }
  .reply .btn.primary { justify-content: center; }

  .type-cards { grid-template-columns: 1fr; }
  .approver-list { grid-template-columns: 1fr; }
  .field-main { grid-template-columns: 1fr; }
  .test-box .btn { width: 100%; justify-content: center; }
  .sector-row { flex-wrap: wrap; }
  .meter { width: 70px; }

  /* Modais em tela cheia */
  .modal-bg { padding: 0; place-items: stretch; }
  .modal, .modal.wide { max-width: none; max-height: none; height: 100%; border-radius: 0; }
  .modal-foot { position: sticky; bottom: 0; background: var(--surface); padding: 10px 0; flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; justify-content: center; }

  #toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .auth-card { padding: 22px; }
}

/* Telas de toque: alvos maiores e sem dependência de arrastar no Kanban */
@media (pointer: coarse) {
  .btn.sm { padding: 7px 12px; }
  .kc-move { display: block !important; }
}

/* =================== tema escuro: cores de status e destaques =================== */
:root[data-theme="dark"] .st-open { background: #1e2f55; color: #93b4ff; }
:root[data-theme="dark"] .st-in_progress { background: #29285a; color: #b4b2ff; }
:root[data-theme="dark"] .st-awaiting_approval, :root[data-theme="dark"] .ap-pending { background: #3d3112; color: #fcd34d; }
:root[data-theme="dark"] .st-pending_customer { background: #3f1d33; color: #f9a8d4; }
:root[data-theme="dark"] .st-awaiting_vendor { background: #123a44; color: #67e8f9; }
:root[data-theme="dark"] .st-resolved, :root[data-theme="dark"] .ap-approved { background: #163524; color: #86efac; }
:root[data-theme="dark"] .st-closed, :root[data-theme="dark"] .ap-expired, :root[data-theme="dark"] .ap-cancelled { background: #2a303c; color: #c9ced8; }
:root[data-theme="dark"] .st-rejected, :root[data-theme="dark"] .ap-rejected { background: #3f1d1d; color: #fca5a5; }
:root[data-theme="dark"] .pr-low { color: #9aa3b2; }
:root[data-theme="dark"] .pr-high { color: #fb923c; }
:root[data-theme="dark"] .pr-urgent { color: #f87171; }
:root[data-theme="dark"] .tag.mgr { background: #3d3112; color: #fcd34d; }
:root[data-theme="dark"] .sla-ok, :root[data-theme="dark"] .sla-met { background: #163524; color: #86efac; }
:root[data-theme="dark"] .sla-warning { background: #3d3112; color: #fcd34d; }
:root[data-theme="dark"] .sla-breached, :root[data-theme="dark"] .sla-missed { background: #3f1d1d; color: #fca5a5; }
:root[data-theme="dark"] .alert, :root[data-theme="dark"] .chip-err { background: #3f1d1d; color: #fca5a5; }
:root[data-theme="dark"] .msg.internal { background: #2e2714; border-color: #5c4a16; border-left-color: #f59e0b; }
:root[data-theme="dark"] .reply.internal textarea { background: #2e2714; }
:root[data-theme="dark"] .kb-body blockquote { background: #2e2714; }
:root[data-theme="dark"] .test-out.sent { background: #163524; color: #86efac; }
:root[data-theme="dark"] .test-out.simulated { background: #3d3112; color: #fcd34d; }
:root[data-theme="dark"] .test-out.failed { background: #3f1d1d; color: #fca5a5; }
:root[data-theme="dark"] .kb-suggest { border-color: #2f3d66; }
:root[data-theme="dark"] .kpi.st-crit { border-color: #5c2626; }
:root[data-theme="dark"] .kcol.over { background: #1f2a44; }
:root[data-theme="dark"] .logo-box { background: repeating-conic-gradient(#222834 0 25%, #1c212b 0 50%) 0 0 / 16px 16px; }
/* A logo na barra lateral fica sobre fundo branco para manter a legibilidade. */
:root[data-theme="dark"] .sidebar .brand-logo { background: #fff; }
:root[data-theme="dark"] .notif-count { border-color: var(--surface); }
:root[data-theme="dark"] .att-ico { color: var(--link); }
:root[data-theme="dark"] .toast { background: #2b3240; }
:root[data-theme="dark"] .kb-hero { background: linear-gradient(135deg, var(--sidebar, #0f1e47) 0%, var(--primary) 100%); }
/* Gráficos: degraus escuros da mesma paleta validada */
:root[data-theme="dark"] {
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-1-track: #1d2c44;
  --series-2-track: #3a2419;
  --chart-grid: #2c2c2a;
  --chart-axis: #4a4a46;
  --chart-muted: #898781;
}
:root[data-theme="dark"] .trend .dot { stroke: var(--surface); }
:root[data-theme="dark"] .trend .end-label { fill: var(--text); }

/* Kanban: as etapas visíveis dividem a largura disponível (sem rolagem lateral no desktop) */
@media (min-width: 961px) {
  .kanban { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(var(--kcols, 7), minmax(0, 1fr)); gap: 8px; padding: 12px; overflow-x: visible; }
  .kcol-head { padding: 8px 8px 4px; gap: 6px; }
  .kcol-head .badge { white-space: normal; line-height: 1.25; }
  .kcol-body { padding: 4px 6px 10px; gap: 6px; }
  .kcard { padding: 8px 9px; gap: 4px; }
  .kc-title { font-size: 13px; overflow-wrap: anywhere; }
  .kc-meta, .kc-foot { font-size: 11px; }
  .kc-foot { flex-wrap: wrap; }
  .kcard .sla { white-space: normal; font-size: 11px; }
  .kempty { padding: 12px 4px; font-size: 11px; }
}
/* Seletor de etapas */
.kanban-cols-menu { position: relative; }
.kcols-dropdown { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); padding: 10px 12px; min-width: 260px; }
.kcols-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 13px; }
.kcols-head .link-btn { margin: 0; font-size: 12px; }
.kcols-dropdown .check { margin: 6px 0; }
#export-tickets .ico { width: 16px; height: 16px; }

/* Decisão de aprovação pela plataforma */
.approval-decision { border: 1px solid #f5d38a; border-left: 4px solid #f59e0b; background: linear-gradient(0deg, var(--surface), var(--surface)); margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.ad-head { display: flex; gap: 10px; align-items: flex-start; }
.ad-head .ico { color: #d97706; width: 22px; height: 22px; margin-top: 1px; }
.ad-message { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; white-space: pre-wrap; }
.ad-comment { min-height: 60px; }
.decision-list { display: flex; flex-direction: column; margin-bottom: 18px; }
.decision-list .approval-decision { margin-bottom: 12px; }
.nav .count.mine { background: #ef4444; color: #fff; }
:root[data-theme="dark"] .approval-decision { border-color: #5c4a16; border-left-color: #f59e0b; }

/* ---------- reserva de veículos ---------- */
.vr-pending { background: #fef3c7; color: #92400e; }
.vr-approved { background: #dbeafe; color: #1e40af; }
.vr-in_use { background: #ede9fe; color: #5b21b6; }
.vr-returned, .vr-free { background: #dcfce7; color: #166534; }
.vr-cancelled, .vr-expired { background: #e5e7eb; color: var(--text-2); }
.vr-rejected { background: #fee2e2; color: #991b1b; }
:root[data-theme="dark"] .vr-pending { background: #3d3112; color: #fcd34d; }
:root[data-theme="dark"] .vr-approved { background: #1e2f55; color: #93b4ff; }
:root[data-theme="dark"] .vr-in_use { background: #2e2350; color: #c4b5fd; }
:root[data-theme="dark"] .vr-returned, :root[data-theme="dark"] .vr-free { background: #163524; color: #86efac; }
:root[data-theme="dark"] .vr-cancelled, :root[data-theme="dark"] .vr-expired { background: #2a303c; color: #c9ced8; }
:root[data-theme="dark"] .vr-rejected { background: #3f1d1d; color: #fca5a5; }

.vh-img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; background: var(--surface-3); }
.vh-ph { display: grid; place-items: center; color: var(--muted); }
.vh-ph .ico { width: 42%; height: 42%; max-width: 64px; max-height: 64px; stroke-width: 1.3; }
.vh-img.xs { width: 56px; height: 40px; aspect-ratio: auto; border-radius: 6px; flex-shrink: 0; }
.vh-img.sm { width: 84px; height: 56px; aspect-ratio: auto; flex-shrink: 0; }
.vh-img.lg { width: 220px; flex-shrink: 0; }
.vh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.vh-card { padding: 0; overflow: hidden; color: inherit; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.vh-card + .vh-card { margin-top: 0; }
.vh-card:hover { text-decoration: none; border-color: var(--primary-2); box-shadow: 0 6px 18px rgba(16, 24, 40, .08); }
.vh-card .vh-img { border-radius: 0; }
.vh-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.vh-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.vh-ids { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vh-pending { color: var(--warning); font-weight: 600; }
.plate { display: inline-block; font: 700 13px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .08em; padding: 4px 8px; border: 2px solid #1f2937; border-top-width: 5px; border-top-color: #1d4ed8; border-radius: 4px; background: #fff; color: #111; }
.plate.sm { font-size: 11px; padding: 2px 6px; border-top-width: 4px; }
.vh-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 16px; }
.vh-head-info { flex: 1; min-width: 0; }
.vh-head-info h1 { margin-bottom: 6px; }
.vh-mini { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.vh-side .vh-img { margin: -2px 0 0; }
.vh-form { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.on { color: var(--link); border-bottom-color: var(--primary-2); }
.tab .count { border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 600; background: #ef4444; color: #fff; }

.cal-card { padding: 14px; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-nav h2 { margin: 0 6px; min-width: 170px; text-align: center; }
.cal-legend { margin-left: auto; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal-wd { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; padding: 6px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-day { min-height: 104px; padding: 4px 5px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-day:hover { background: var(--hover); }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .cal-num { opacity: .45; }
.cal-day.past { cursor: default; background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(127, 127, 127, .04) 8px 16px); }
.cal-day.past:hover { background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(127, 127, 127, .04) 8px 16px); }
.cal-num { font-size: 12px; font-weight: 600; color: var(--text-3); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-chip { display: block; font-size: 11.5px; line-height: 1.35; padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; }
a.cal-chip:hover { text-decoration: none; filter: brightness(.96); }
.cal-chip b { font-weight: 700; }
.cal-chip.mine { box-shadow: inset 3px 0 0 currentColor; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }

.vr-agenda { display: flex; flex-direction: column; }
.vr-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--row-border); color: inherit; }
a.vr-row:hover { background: var(--hover); text-decoration: none; }
.vr-row-main { flex: 1; min-width: 0; }
.vr-action { background: var(--primary-soft); color: var(--link); font-weight: 600; }
.card-pad { padding: 14px 16px; }
.info-card { display: flex; gap: 10px; align-items: center; color: var(--text-2); background: var(--primary-soft); border-color: transparent; }
.info-card .ico { width: 20px; height: 20px; flex-shrink: 0; }
.vr-notes { margin-top: 12px; white-space: pre-wrap; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.field-label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.nowrap { flex-wrap: nowrap; }

.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.photo-slot { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; border: 2px dashed var(--input-border); border-radius: 10px; background: var(--surface-2); cursor: pointer; overflow: hidden; margin: 0; font-weight: 400; color: var(--muted); }
.photo-slot:hover { border-color: var(--primary-2); color: var(--link); text-decoration: none; }
.photo-slot.has { border-style: solid; border-color: var(--border); }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot.busy { opacity: .7; cursor: progress; }
.ps-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; text-align: center; padding: 0 6px 18px; }
.ps-empty .ico { width: 28px; height: 28px; }
.ps-label { position: absolute; left: 0; right: 0; bottom: 0; font-size: 12px; font-weight: 600; padding: 4px 8px; background: rgba(15, 23, 42, .62); color: #fff; text-align: center; }
.ps-clear { font-size: 12px; margin-top: 4px; }
.vh-form .photo-slot { aspect-ratio: 16 / 10; }

@media (max-width: 960px) {
  .vh-head { flex-wrap: wrap; }
  .vh-img.lg { width: 100%; max-width: 360px; }
}
@media (max-width: 700px) {
  .cal-day { min-height: 54px; padding: 3px; gap: 2px; }
  .cal-wd { padding: 4px 2px; text-align: center; font-size: 10px; }
  /* No celular, os dias mostram só marcas coloridas; os detalhes ficam na lista do mês. */
  .cal-chip { font-size: 0; height: 6px; padding: 0; border-radius: 3px; }
  .cal-chip.mine { box-shadow: none; outline: 1px solid currentColor; }
  .cal-more { font-size: 10px; padding: 0; }
  .cal-legend { margin-left: 0; width: 100%; }
  .cal-nav h2 { min-width: 0; flex: 1; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vh-form { grid-template-columns: 1fr; }
  .vr-row { padding: 10px 12px; gap: 10px; flex-wrap: wrap; }
}

/* ---------- horário de trabalho do setor ---------- */
.bh-table { border-collapse: collapse; width: 100%; }
.bh-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 8px 6px 0; }
.bh-table td { padding: 4px 8px 4px 0; border-top: 1px solid var(--row-border); white-space: nowrap; }
.bh-pair { display: inline-flex; align-items: center; gap: 6px; }
.bh-pair span { color: var(--muted); font-size: 12px; }
.bh-pair input[type=time] { width: 104px; border: 1px solid var(--input-border); border-radius: 7px; padding: 5px 6px; font: inherit; background: var(--surface); color: var(--text); }
#bh-body.bh-off { opacity: .45; }
.bh-fieldset .btn-row .btn.sm { font-size: 12px; }

/* ---------- portal: escolha do setor em botões (cartões com ícone de traço) ---------- */
.sector-step { max-width: 1120px; }
.sector-step-lead { font-size: 16px; font-weight: 600; margin: 0 0 14px; }
.sector-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 290px)); gap: 20px 22px; }
.sector-btn { display: flex; align-items: flex-start; gap: 16px; text-align: left; background: var(--surface); border: 1px solid #dfe1e6; border-radius: 8px; padding: 20px 16px 18px 18px; font: inherit; color: var(--text); cursor: pointer; min-height: 96px; transition: box-shadow .15s, border-color .15s; }
.sector-btn:hover { box-shadow: 0 4px 12px rgba(9, 30, 66, .15); border-color: #c1c7d0; }
.sector-btn:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; }
.sector-btn:active { box-shadow: 0 1px 3px rgba(9, 30, 66, .2); }
.sector-ico { flex-shrink: 0; width: 44px; height: 44px; color: var(--primary); margin-top: 6px; }
.sector-ico.sm { width: 32px; height: 32px; margin-top: 0; }
.sector-btn-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sector-btn-text strong { font-size: 14.5px; font-weight: 600; color: var(--text); line-height: 1.3; }
.sector-btn-desc { color: var(--text-2); font-size: 12.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sector-chosen { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.sector-chosen .sector-btn-text > span { font-size: 12px; color: var(--muted); }
:root[data-theme="dark"] .sector-btn { border-color: var(--border); }
:root[data-theme="dark"] .sector-ico { color: var(--link); }
@media (max-width: 1100px) { .sector-buttons { grid-template-columns: repeat(2, minmax(0, 290px)); gap: 16px; } }
@media (max-width: 640px) { .sector-buttons { grid-template-columns: 1fr; gap: 12px; } .sector-btn { min-height: 0; } }

/* Escolha do ícone no cadastro do setor */
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.icon-pick label { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 4px; cursor: pointer; font-size: 10.5px; font-weight: 400; text-align: center; color: var(--text-3); margin: 0; line-height: 1.2; }
.icon-pick label:hover { border-color: var(--primary-2); }
.icon-pick input { position: absolute; opacity: 0; pointer-events: none; }
.icon-pick input:checked + label, .icon-pick label.on { border-color: var(--primary-2); background: var(--primary-soft); color: var(--link); }
.icon-pick .sector-ico { width: 30px; height: 30px; margin: 0; }
/* ---------- aplicativo instalado (PWA) ---------- */
.offline-card { text-align: center; }
.offline-card h1 { margin-bottom: 8px; }
@media (display-mode: standalone) {
  /* Celulares com recorte na tela: o conteúdo não fica embaixo da barra do sistema. */
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
  .sidebar { padding-top: max(16px, env(safe-area-inset-top)); }
  main#view { padding-bottom: max(48px, env(safe-area-inset-bottom)); }
}

/* ---------- texto formatado e editor ---------- */
.msg .body.rich { white-space: normal; }
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p { margin: 0 0 8px; }
.rich h3 { font-size: 16px; margin: 12px 0 6px; }
.rich h4 { font-size: 14.5px; margin: 10px 0 4px; }
.rich ul, .rich ol { margin: 0 0 8px; padding-left: 22px; }
.rich li { margin: 2px 0; }
.rich blockquote { margin: 6px 0 8px; padding: 4px 12px; border-left: 4px solid var(--input-border); color: var(--text-3); }
.rich pre { background: var(--surface-3); border-radius: 6px; padding: 10px 12px; white-space: pre-wrap; font: 12.5px/1.5 ui-monospace, Consolas, monospace; margin: 6px 0 8px; }
.rich code { background: var(--surface-3); border-radius: 4px; padding: 1px 5px; font: 12.5px ui-monospace, Consolas, monospace; }
.rich pre code { background: none; padding: 0; }
.rich hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
.rich img { max-width: 100%; max-height: 420px; border: 1px solid var(--border); border-radius: 6px; margin: 4px 0; vertical-align: middle; }
.rte { border: 1px solid var(--input-border); border-radius: 8px; background: var(--surface); }
.rte:focus-within { outline: 2px solid #c7d4fb; border-color: var(--primary-2); }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; padding: 5px 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: 8px 8px 0 0; }
.rte-b { border: 1px solid transparent; background: transparent; color: var(--text-2); border-radius: 6px; padding: 3px 8px; font: inherit; font-size: 13px; cursor: pointer; min-width: 30px; }
.rte-b:hover { background: var(--surface); border-color: var(--border); }
.rte-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.rte-area { position: relative; text-align: left; padding: 10px 12px; outline: none; overflow-y: auto; max-height: 60vh; line-height: 1.55; cursor: text; }
.rte-area.empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; position: absolute; left: 12px; right: 12px; top: 10px; text-align: left; }
.rte-area.drop { background: var(--primary-soft); }
.rte-area div { min-height: 1.4em; }
.rte-uploading { color: var(--muted); font-size: 12px; background: var(--surface-3); border-radius: 4px; padding: 2px 6px; }
.rte + .hint, .rte .hint { padding: 0 10px 6px; }

/* ---------- objetos emprestados ---------- */
.emp-chosen { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--primary-soft); border-radius: 8px; padding: 8px 12px; margin-top: 8px; font-size: 13.5px; }
.asset-head { display: flex; gap: 6px; margin-bottom: 10px; }
.loan-list { display: flex; flex-direction: column; gap: 8px; }
.loan { border: 1px solid var(--border); border-left: 4px solid #94a3b8; border-radius: 8px; padding: 10px 12px; }
.loan.open { border-left-color: #7c3aed; }
.loan-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.loan-top .badge { margin-left: auto; }
.cc-new { display: grid; grid-template-columns: 160px 1fr auto; gap: 8px; margin-bottom: 12px; }
#jtf.cc-new { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
@media (max-width: 700px) { .cc-new, #jtf.cc-new { grid-template-columns: 1fr; } }
.sale-box { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 14px; background: var(--surface-2); }
.quote-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.quote-grid > div { display: flex; flex-direction: column; gap: 1px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.quote-grid b { font-size: 15px; }
.quote-grid .quote-main { border-color: var(--primary-2); background: var(--primary-soft); }
.agree-box { border-left: 4px solid #f59e0b; background: #fffbeb; border-radius: 8px; padding: 10px 12px; color: #78350f; }
:root[data-theme="dark"] .agree-box { background: #2b2410; color: #fcd34d; }
.err-text { color: var(--danger); font-size: 13px; margin-bottom: 8px; }
@media (max-width: 700px) { .quote-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.term-box { white-space: pre-wrap; line-height: 1.6; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 16px; max-height: 50vh; overflow: auto; font-size: 14px; }

/* ---------- ajuda do sistema ---------- */
.help-btn { color: var(--text-3); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; }
.help-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.help-btn .ico { width: 20px; height: 20px; }
.help-search { flex: 0 1 420px; }
.help-search input { width: 100%; border: 1px solid var(--input-border); border-radius: 8px; padding: 9px 12px; font: inherit; background: var(--surface); color: var(--text); }
.help-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.help-side { padding: 10px; position: sticky; top: 76px; }
.help-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 8px 4px; font-weight: 600; }
.help-group:first-child, .help-link + .help-group { margin-top: 12px; }
.help-link { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; color: var(--text-2); font-size: 13.5px; }
.help-link:hover { background: var(--hover); text-decoration: none; }
.help-link.on { background: var(--primary-soft); color: var(--link); font-weight: 600; }
.help-link .ico { width: 16px; height: 16px; flex-shrink: 0; }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.help-card { display: flex; flex-direction: column; gap: 6px; color: inherit; transition: border-color .15s; }
.help-card + .help-card { margin-top: 0; }
.help-card:hover { border-color: var(--primary-2); text-decoration: none; }
.help-card .ico { width: 24px; height: 24px; color: var(--primary-2); }
.help-head { display: flex; gap: 14px; align-items: flex-start; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 8px; }
.help-head > .ico { width: 30px; height: 30px; color: var(--primary-2); flex-shrink: 0; margin-top: 2px; }
.help-head h2 { margin: 0 0 2px; font-size: 20px; }
.help-head p { margin: 0; }
.help-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.help-toc a { font-size: 12.5px; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; color: var(--text-2); }
.help-toc a:hover { border-color: var(--primary-2); color: var(--link); text-decoration: none; }
.help-sec { padding: 14px 0 4px; border-radius: 8px; scroll-margin-top: 80px; transition: background .4s; }
.help-sec + .help-sec { border-top: 1px solid var(--row-border); }
.help-sec h3 { font-size: 15px; margin: 0 0 8px; }
.help-sec p, .help-sec li { line-height: 1.6; color: var(--text-2); }
.help-sec ul, .help-sec ol { padding-left: 20px; margin: 6px 0; }
.help-sec li { margin-bottom: 4px; }
.help-sec code { background: var(--surface-3); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; }
.help-sec.flash { background: var(--primary-soft); }
.help-table { border-collapse: collapse; width: 100%; margin: 6px 0; }
.help-table td { border-top: 1px solid var(--row-border); padding: 7px 10px 7px 0; vertical-align: top; color: var(--text-2); }
.help-table td:first-child { white-space: nowrap; width: 1%; padding-right: 16px; }
.help-result { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--row-border); color: inherit; }
.help-result:hover { text-decoration: none; }
.help-result:hover strong { color: var(--link); }
@media (max-width: 860px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-side { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .help-group { width: 100%; margin: 6px 4px 0; }
  .help-table td:first-child { white-space: normal; }
}

/* ---------- automação (workflows) ---------- */
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
textarea.mono { line-height: 1.45; tab-size: 2; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; margin: 0; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--input-border); border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary-2); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.switch-label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; cursor: pointer; }
.wr-running { background: #dbeafe; color: #1e40af; }
.wr-waiting { background: #fef3c7; color: #92400e; }
.wr-success, .job-success { background: #dcfce7; color: #166534; }
.wr-failed, .job-failed, .job-timeout { background: #fee2e2; color: #991b1b; }
.wr-cancelled, .job-cancelled { background: #e5e7eb; color: var(--text-2); }
.job-queued { background: #fef3c7; color: #92400e; }
.job-running { background: #dbeafe; color: #1e40af; }
:root[data-theme="dark"] .wr-running, :root[data-theme="dark"] .job-running { background: #1e2f55; color: #93b4ff; }
:root[data-theme="dark"] .wr-waiting, :root[data-theme="dark"] .job-queued { background: #3d3112; color: #fcd34d; }
:root[data-theme="dark"] .wr-success, :root[data-theme="dark"] .job-success { background: #163524; color: #86efac; }
:root[data-theme="dark"] .wr-failed, :root[data-theme="dark"] .job-failed, :root[data-theme="dark"] .job-timeout { background: #3f1d1d; color: #fca5a5; }
:root[data-theme="dark"] .wr-cancelled, :root[data-theme="dark"] .job-cancelled { background: #2a303c; color: #c9ced8; }
.err-cell { color: var(--danger); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error-card { border-color: #fecaca; background: #fef2f2; color: #991b1b; margin-bottom: 16px; }
:root[data-theme="dark"] .error-card { background: #2a1717; border-color: #5b2323; color: #fca5a5; }
.ok-text { color: var(--success); }
.dot-status { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9ca3af; margin-right: 3px; }
.dot-status.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.copy-row { display: flex; gap: 8px; align-items: flex-start; }
.copy-row input, .copy-row pre { flex: 1; min-width: 0; margin: 0; }
pre.term, pre.json-view { background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 10px 12px; font: 12px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; margin: 4px 0 10px; }
pre.json-view { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
pre.term.err { color: #fca5a5; }
.install-steps { padding-left: 20px; margin: 8px 0; }
.install-steps li { margin-bottom: 12px; }
.local-runner { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.local-runner h3 { display: flex; align-items: center; gap: 8px; }
.local-runner h3 .ico { width: 18px; height: 18px; }
.tw-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--row-border); }
.tw-row:first-of-type { border-top: 0; }
.tw-run { display: flex; gap: 6px; align-items: center; padding: 4px 0; color: inherit; font-size: 13px; }

main#view:has(.wf-editor) { max-width: none; padding: 12px 16px 12px; }
.wf-editor { display: flex; flex-direction: column; height: calc(100vh - 90px); min-height: 520px; }
.wf-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.wf-name { flex: 1; min-width: 200px; max-width: 460px; font-size: 17px !important; font-weight: 600; border-color: transparent !important; background: transparent !important; padding: 6px 8px !important; }
.wf-name:hover, .wf-name:focus { border-color: var(--input-border) !important; background: var(--surface) !important; }
.wf-actions { margin-left: auto; }
.wf-dirty { color: var(--warning); }
.issue-link { color: var(--warning); text-decoration: none; font-weight: 600; margin: 0; }
.wf-body { flex: 1; display: grid; grid-template-columns: 210px minmax(0, 1fr) 340px; gap: 10px; min-height: 0; }
.wf-palette, .wf-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow-y: auto; }
.wf-pg { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
.wf-pal { display: flex; gap: 9px; align-items: flex-start; width: 100%; text-align: left; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 7px 9px; margin-bottom: 6px; cursor: pointer; font: inherit; }
.wf-pal:hover { border-color: var(--primary-2); background: var(--primary-soft); }
.wf-pal .ico { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--nc, var(--primary-2)); }
.wf-pal strong { display: block; font-size: 13px; font-weight: 600; }
.wf-pal small { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; }
.wf-panel h3 { margin-top: 0; }
.wf-ph { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.wf-ph > .ico { width: 22px; height: 22px; margin-top: 4px; flex-shrink: 0; color: var(--primary-2); }
.wf-ph > div { flex: 1; min-width: 0; }
.wf-label-in { font-weight: 600; margin-top: 2px; }
.wf-panel .field { margin-bottom: 11px; }
.wf-panel textarea { min-height: 0; }
.grid-m { display: grid; grid-template-columns: 96px 1fr; gap: 0 8px; }
.wd-list { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-bottom: 10px; }
.wd-list .check { margin-bottom: 2px; }
.wf-vars { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.wf-vars summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.wf-vg { font-size: 11px; color: var(--muted); margin: 8px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.wf-vlist { display: flex; flex-wrap: wrap; gap: 4px; }
.wf-var { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 5px; font: 11px ui-monospace, Consolas, monospace; padding: 2px 6px; cursor: pointer; }
.wf-var:hover { border-color: var(--primary-2); color: var(--link); }
.wf-issue-list { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 12px; color: #92400e; }
.wf-issue-list ul { margin: 4px 0 0; padding-left: 18px; }
.wf-issue-list li[data-goto] { cursor: pointer; text-decoration: underline dotted; }
:root[data-theme="dark"] .wf-issue-list { background: #2b2410; border-color: #5c4a16; color: #fcd34d; }

.wf-canvas { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); touch-action: none; cursor: grab; user-select: none;
  background-color: var(--surface-2); background-image: radial-gradient(circle, rgba(120, 130, 150, .28) 1px, transparent 1.3px); background-size: 22px 22px; }
.wf-canvas:active { cursor: grabbing; }
.wf-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.wf-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.wf-edge .line { fill: none; stroke: #94a3b8; stroke-width: 2; }
.wf-edge .hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.wf-edge.p-true .line { stroke: #16a34a; }
.wf-edge.p-false .line { stroke: #64748b; stroke-dasharray: 6 4; }
.wf-edge.p-error .line { stroke: #dc2626; stroke-dasharray: 5 4; }
.wf-edge.sel .line { stroke: var(--primary-2); stroke-width: 3.5; }
.wf-edge.taken .line { stroke: #2563eb; stroke-width: 3.5; }
.wf-arrowhead { fill: #94a3b8; }
.wf-temp { fill: none; stroke: var(--primary-2); stroke-width: 2.5; stroke-dasharray: 6 4; }
.wf-node { position: absolute; background: var(--surface); border: 1.5px solid var(--border); border-left: 4px solid var(--nc, #64748b); border-radius: 10px; box-shadow: 0 2px 6px rgba(16, 24, 40, .08); padding: 8px 10px 14px; cursor: pointer; }
.wf-node:hover { box-shadow: 0 4px 14px rgba(16, 24, 40, .14); }
.wf-node.sel { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(37, 70, 168, .25); border-left-color: var(--nc, #64748b); }
.wf-node.drop { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .3); }
.wf-node.has-issue { border-color: #f59e0b; border-style: dashed; border-left-style: solid; }
.wf-nh { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; }
.wf-nh .ico { width: 16px; height: 16px; color: var(--nc, #64748b); flex-shrink: 0; }
.wf-nl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-ns { color: var(--muted); font-size: 11.5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; }
.wf-st { font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 7px; background: var(--surface-3); }
.wf-port { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid #94a3b8; }
.wf-port.in { top: -8px; left: calc(50% - 7px); }
.wf-outs { position: absolute; left: 0; right: 0; bottom: -8px; height: 14px; display: flex; justify-content: space-evenly; }
.wf-port.out { position: relative; cursor: crosshair; }
.wf-port.out:hover { background: var(--primary-2); border-color: var(--primary-2); transform: scale(1.25); }
.wf-port.out i { position: absolute; top: 13px; left: 50%; transform: translateX(-50%); font-size: 10px; font-style: normal; font-weight: 700; white-space: nowrap; color: var(--muted); }
.wf-port.p-true { border-color: #16a34a; } .wf-port.p-true i { color: #16a34a; }
.wf-port.p-error { border-color: #dc2626; } .wf-port.p-error i { color: #dc2626; }
.t-start { --nc: #7c3aed; } .t-http_request { --nc: #0891b2; } .t-run_script { --nc: #0f172a; } .t-condition { --nc: #d97706; }
.t-delay { --nc: #a16207; } .t-set_variable { --nc: #4f46e5; } .t-update_ticket, .t-add_comment, .t-create_ticket { --nc: #2563eb; }
.t-send_email, .t-send_sms { --nc: #db2777; }
:root[data-theme="dark"] .t-run_script { --nc: #cbd5e1; }
.wf-node.t-start { background: linear-gradient(180deg, rgba(124, 58, 237, .07), transparent), var(--surface); }
.wf-node.st-success { border-color: #16a34a; } .wf-node.st-success .wf-st { background: #dcfce7; color: #166534; }
.wf-node.st-failed { border-color: #dc2626; } .wf-node.st-failed .wf-st { background: #fee2e2; color: #991b1b; }
.wf-node.st-waiting, .wf-node.st-running { border-color: #f59e0b; } .wf-node.st-waiting .wf-st, .wf-node.st-running .wf-st { background: #fef3c7; color: #92400e; }
.wf-node.st-cancelled .wf-st { background: #e5e7eb; }
.run-canvas .wf-node:not([class*="st-"]) { opacity: .5; }
.wf-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px; box-shadow: var(--shadow); }
.wf-zoom button { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; padding: 3px 9px; border-radius: 6px; cursor: pointer; }
.wf-zoom button:hover { background: var(--surface-3); }
.wf-zl { font-size: 12px; color: var(--muted); min-width: 40px; text-align: center; }

.run-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 16px; align-items: start; }
.run-canvas { height: calc(100vh - 260px); min-height: 420px; border: 0; border-radius: 0; }
.run-steps { display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 220px); overflow-y: auto; padding-right: 2px; }
.run-steps .card + .card { margin-top: 0; }
.step-card { padding: 10px 14px; border-left: 4px solid #94a3b8; }
.step-card.st-success { border-left-color: #16a34a; }
.step-card.st-failed { border-left-color: #dc2626; }
.step-card.st-waiting, .step-card.st-running { border-left-color: #f59e0b; }
.step-card summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.step-card summary::-webkit-details-marker { display: none; }
.step-card[open] summary { margin-bottom: 8px; }
.step-ico .ico { width: 18px; height: 18px; color: var(--muted); }
.step-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.step-err { color: var(--danger); background: #fef2f2; border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; font-size: 13px; }
:root[data-theme="dark"] .step-err { background: #2a1717; }
.step-card.flash { box-shadow: 0 0 0 3px rgba(37, 99, 235, .45); }

@media (max-width: 1100px) {
  .wf-body { grid-template-columns: 170px minmax(0, 1fr) 300px; }
  .wf-pal small { display: none; }
}
@media (max-width: 860px) {
  .wf-editor { height: auto; }
  .wf-body { grid-template-columns: 1fr; }
  .wf-palette { display: flex; flex-wrap: wrap; gap: 6px; max-height: none; }
  .wf-palette > .muted, .wf-pg { width: 100%; margin: 4px 0 0; }
  .wf-pal { width: auto; margin: 0; }
  #wf-canvas { height: 60vh; }
  .run-grid { grid-template-columns: 1fr; }
  .run-canvas { height: 50vh; }
  .run-steps { max-height: none; }
}

/* Fotos de usuário */
.avatar-img { object-fit: cover; padding: 0; display: inline-block; background: var(--surface-3); }
.avatar.xs { width: 18px; height: 18px; font-size: 8px; }
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; flex-shrink: 0; }
.avatar.xl .spin { width: 22px; height: 22px; }
.msg-who { display: inline-flex; align-items: center; gap: 7px; }
.chip-user { padding-left: 4px; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.photo-edit { display: flex; align-items: center; gap: 16px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.picker-item .avatar, .selected-user .avatar { flex-shrink: 0; }

/* Botão de alternar tema */
.theme-toggle { background: transparent; color: var(--text-3); width: 40px; height: 40px; border-radius: 10px; }
.theme-toggle:hover { background: var(--surface-3); color: var(--text); }
.theme-toggle .ico { width: 19px; height: 19px; }
.auth-theme { position: fixed; top: 14px; right: 14px; background: rgba(255, 255, 255, .15); color: #fff; }
.auth-theme:hover { background: rgba(255, 255, 255, .25); color: #fff; }
.theme-options { display: flex; gap: 4px; padding: 6px 10px 8px; border-top: 1px solid var(--border); margin-top: 6px; }
.theme-options .ud-label { width: 100%; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.theme-options { flex-wrap: wrap; }
.theme-options button { flex: 1; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 6px; padding: 5px 6px; font: inherit; font-size: 12px; cursor: pointer; }
.theme-options button.on { background: var(--primary-soft); border-color: var(--primary-2); color: var(--link); font-weight: 600; }

/* Prioridade em botões coloridos (abertura e propriedades do chamado) */
.prio-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; max-width: 520px; }
.prio-opt { --pc: #2563eb; position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 12px;
  border: 1.5px solid color-mix(in srgb, var(--pc) 35%, var(--border)); border-radius: 8px; background: color-mix(in srgb, var(--pc) 6%, var(--surface, #fff));
  color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; user-select: none; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.prio-opt input { position: absolute; opacity: 0; pointer-events: none; }
.prio-opt span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--pc); margin-right: 8px; vertical-align: 0; }
.prio-opt:hover { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 12%, var(--surface, #fff)); }
.prio-opt:has(input:checked) { background: var(--pc); border-color: var(--pc); color: #fff; box-shadow: 0 1px 3px color-mix(in srgb, var(--pc) 40%, transparent); }
.prio-opt:has(input:checked) span::before { background: #fff; }
.prio-opt:has(input:focus-visible) { outline: 2px solid var(--pc); outline-offset: 2px; }
.po-low { --pc: #16a34a; } .po-normal { --pc: #2563eb; } .po-high { --pc: #ea580c; } .po-urgent { --pc: #dc2626; }
.side .prio-pick, .card .prio-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#prio-box .prio-pick { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 520px) { #prio-box .prio-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Sugestões da base de conhecimento logo abaixo do assunto */
.field .kb-suggest { margin: 8px 0 0; }
#kb-suggest .kb-suggest-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }
#kb-suggest .kb-suggest-item > a, #kb-suggest .kb-suggest-item > span { grid-column: 1; }
#kb-suggest .kb-suggest-item .btn { grid-column: 2; grid-row: 1 / span 2; margin: 0; align-self: center; }

/* Chamado no fornecedor */
.side .vendor-fields { grid-template-columns: 1fr; gap: 0; }
.vendor-info { margin: -4px 0 12px; font-size: 13px; }
.vendor-link a { font-weight: 600; }

/* Transferência de item entre funcionários */
.transfer-from { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
