/* Estilos compartilhados pelo painel e pelo widget — mesmos tokens do design (canvas "Central de Chamados"). */
:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --border: #E2E5EA;
  --border-strong: #C4C9D2;
  --divider: #EEF0F3;
  --ink: #15171C;
  --muted: #5B6270;
  --faint: #8A919E;
  --accent: #1F4FD1;
  --accent-hover: #163A9C;
  --accent-ink: #1D46B8;
  --accent-tint: #EAF0FE;
  --accent-border: #C9D6FB;
  --good: #17713D;
  --good-tint: #E6F6EC;
  --good-border: #B7E2C6;
  --warn: #B54708;
  --warn-tint: #FEF0E6;
  --danger: #B42318;
  --danger-tint: #FDECEA;
  --note: #FFF8E6;
  --note-border: #F2D58A;
  --note-ink: #6B4600;
  --nav: #15171C;
  --nav-active: #262A33;
  --nav-ink: #C9CDD5;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-pop: 0 24px 60px rgba(10, 12, 18, 0.28);
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
button { font: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1 1 auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-success { background: var(--good); border-color: var(--good); color: #fff; font-weight: 600; }
.btn-success:hover { background: #115C31; color: #fff; }
.btn-danger { color: var(--danger); border-color: #F3C1BC; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--divider); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 22px; }
.btn-icon { width: 36px; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 500; }
.hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font: inherit; color: var(--ink); }
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 96px; }
.input[readonly] { background: var(--bg); color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent-border); border-color: var(--accent); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.error-text { color: var(--danger); font-size: 13px; }

/* Cartões e caixas */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-pad { padding: 18px 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.box-muted { padding: 12px 14px; background: var(--bg); border-radius: var(--radius); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.kpi .kpi-label { font-size: 13px; color: var(--muted); }
.kpi .kpi-value { font-size: 26px; font-weight: 600; line-height: 1.25; }
.kpi .kpi-note { font-size: 12px; color: var(--muted); }

/* Selos de status e prioridade */
.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.st-novo { background: #EEF0F3; color: #3D4452; }
.st-em_analise { background: #FFF4E0; color: #8A5300; }
.st-em_correcao { background: #E8EFFE; color: #1D46B8; }
.st-aguardando_usuario { background: #F3ECFD; color: #6A33B8; }
.st-resolvido { background: var(--good-tint); color: var(--good); }
.st-fechado { background: #EEF0F3; color: #3D4452; }
.tag { display: inline-flex; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.pr-critica { background: var(--danger-tint); color: var(--danger); }
.pr-alta { background: var(--warn-tint); color: var(--warn); }
.pr-media { background: #EEF0F3; color: #3D4452; }
.pr-baixa { background: var(--bg); color: var(--muted); }
.tag-system { background: #EEF0F3; color: #3D4452; }
.dot { width: 8px; height: 8px; border-radius: 4px; display: inline-block; flex: none; }

.avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: #DDE2EA; color: var(--ink); font-size: 12px; font-weight: 600; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.on-color { color: #fff; }

/* Abas */
.tabs { display: flex; gap: 4px; background: #E9ECF0; padding: 4px; border-radius: var(--radius); width: fit-content; }
.tabs button, .tabs a { height: 32px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.tabs [aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; }

/* Tabelas */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.table tr:hover td { background: #FAFBFF; }

/* Mensagens da conversa */
.msg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.msg.internal { background: var(--note); border-color: var(--note-border); }
.msg.internal .msg-body { color: #3B2A00; }
.msg.agent { border-color: #D9C6F5; }
.msg.system { background: var(--bg); }
.msg-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.msg-head .when { color: var(--muted); font-size: 13px; }
.files { display: flex; gap: 8px; flex-wrap: wrap; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; color: var(--ink); cursor: pointer; text-decoration: none; }
.file-chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 2px; }

/* Modal e avisos */
.overlay { position: fixed; inset: 0; background: rgba(21, 23, 28, 0.55); display: flex; align-items: center; justify-content: center; padding: 24px 16px; z-index: 50; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden; margin: auto; }
.modal.wide { max-width: 920px; }
.modal-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; align-items: flex-start; }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { padding: 14px 24px; background: var(--surface-2); border-top: 1px solid var(--border); display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 13px; max-width: 90vw; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--good); }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; flex-wrap: wrap; }
.banner.good { background: var(--good-tint); border: 1px solid var(--good-border); color: #11512C; }
.banner.purple { background: #F3ECFD; border: 1px solid #D9C6F5; color: #4F2590; }
.banner.warn { background: var(--warn-tint); border: 1px solid #F5C9A3; color: #7A3204; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }
.skeleton { color: var(--faint); padding: 24px; }
.icon { display: inline-flex; flex: none; }
.icon svg { display: block; }

.dropzone { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; border: 1.5px dashed var(--border-strong); border-radius: 10px; color: var(--muted); cursor: pointer; flex-wrap: wrap; text-align: center; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-tint); }
.stars { display: flex; gap: 6px; }
.stars button { width: 44px; height: 44px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--faint); }
.stars button.on { color: #B45309; }
.stars button.on svg { fill: #F59E0B; }
