/* Tokens espelhados de css/style.css, pra intranet e portal de T.I. terem a
   mesma linguagem visual (cores, raios, sombras, vidro e movimento). */
:root {
  color-scheme: light;

  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-soft: #f1f1ee;
  --surface-sunken: #ececeb;
  --line: rgba(20, 26, 31, 0.1);
  --line-strong: rgba(20, 26, 31, 0.18);
  --text: #171c1e;
  --muted: #66717a;
  --faint: #939ea5;
  --brand-blue: #222d31;
  --brand-ink: #0b0f11;
  --brand-red: #ac2c23;
  --brand-red-dark: #842018;
  --brand-red-light: #d24438;
  --success: #12805c;
  --warning: #b45309;
  --danger: #b42318;
  --info: #1d6fb8;

  /* Vidro (glassmorphism) */
  --glass: rgba(255, 255, 255, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-line: rgba(255, 255, 255, 0.72);
  --glass-blur: saturate(1.6) blur(20px);
  --glass-blur-lg: saturate(1.8) blur(34px);

  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --radius: 11px;
  --radius-lg: 15px;
  --r-xs: 8px;
  --r-full: 999px;
  /* Escala de sombra "flutuante": camadas leves + difusas, usada nos
     paineis/cards para dar sensacao de profundidade sobre o fundo --bg. */
  --shadow-float: 0 1px 2px rgba(16,22,26,.05), 0 6px 14px -6px rgba(16,22,26,.09);
  --shadow-float-hover: 0 2px 4px rgba(16,22,26,.05), 0 14px 30px -10px rgba(16,22,26,.14);
  --sh-4: 0 4px 8px rgba(16,22,26,.06), 0 28px 56px -16px rgba(16,22,26,.2);
  --sh-brand: 0 8px 24px -10px rgba(172, 44, 35, 0.55);
  --sh-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);

  /* Movimento */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --t-1: 0.14s;
  --t-2: 0.26s;
  --t-3: 0.44s;
  --t-4: 0.7s;

  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Cores semanticas de badges/pilulas, usadas tanto em CSS quanto em
     style="" gerado via JS (admin.js), pra responder ao modo escuro. */
  --badge-green-bg: #dcfce7;
  --badge-green-text: #166534;
  --badge-blue-bg: #eff6ff;
  --badge-blue-text: #1d6fb8;
  --badge-red-bg: #fef2f2;
  --badge-red-text: #b42318;
  --badge-amber-bg: #fef3c7;
  --badge-amber-text: #92400e;
  --badge-purple-bg: #ede9fe;
  --badge-purple-text: #5b21b6;
  --badge-yellow-bg: #fefce8;
  --badge-yellow-text: #a16207;
  --badge-slate-bg: #eef2f6;
  --badge-slate-text: #475569;
}

/* Mesma paleta de modo escuro do site principal (public/style.css), pra
   manter consistencia visual entre a intranet e o Portal/Painel de T.I. */
body.dark-theme {
  color-scheme: dark;

  --bg: #10161a;
  --surface: #192125;
  --surface-soft: #202b2f;
  --surface-sunken: #131a1d;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #e6ebed;
  --muted: #93a0a6;
  --faint: #74838a;
  /* --brand-blue nao e sobrescrita aqui: e usada so como cor de fundo do
     degrade da sidebar/topbar (fixa e configuravel via white-label em
     admin.js), nao como cor de texto — inverter ela clareava a sidebar. */
  --brand-ink: #ffffff;
  --brand-red-light: #ef6a5c;

  --glass: rgba(28, 38, 42, 0.66);
  --glass-strong: rgba(28, 38, 42, 0.84);
  --glass-line: rgba(255, 255, 255, 0.1);

  --shadow: 0 16px 38px rgba(0, 0, 0, 0.32);
  --shadow-float: 0 2px 6px rgba(0,0,0,.34), 0 8px 18px -8px rgba(0,0,0,.5);
  --shadow-float-hover: 0 4px 10px rgba(0,0,0,.38), 0 18px 38px -12px rgba(0,0,0,.6);
  --sh-4: 0 8px 18px rgba(0,0,0,.42), 0 34px 64px -18px rgba(0,0,0,.7);
  --sh-inset: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  --badge-green-bg: rgba(18, 128, 92, 0.2);
  --badge-green-text: #6ee7b7;
  --badge-blue-bg: rgba(29, 111, 184, 0.2);
  --badge-blue-text: #93c5fd;
  --badge-red-bg: rgba(180, 35, 24, 0.18);
  --badge-red-text: #fca5a5;
  --badge-amber-bg: rgba(146, 64, 14, 0.2);
  --badge-amber-text: #fcd34d;
  --badge-purple-bg: rgba(91, 33, 182, 0.22);
  --badge-purple-text: #c4b5fd;
  --badge-yellow-bg: rgba(161, 98, 7, 0.2);
  --badge-yellow-text: #fde68a;
  --badge-slate-bg: rgba(71, 85, 105, 0.25);
  --badge-slate-text: #cbd5e1;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  transition: background .2s ease, color .2s ease;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; }

:focus-visible { outline: 3px solid rgba(172, 44, 35, 0.35); outline-offset: 2px; }

.sr-only {
  clip: rect(0,0,0,0); border: 0; height: 1px; margin: -1px;
  overflow: hidden; padding: 0; position: absolute; width: 1px;
}

/* ── Login ── */
body.ti-login {
  align-items: center;
  background: linear-gradient(135deg, rgba(172,44,35,.09), rgba(0,0,0,.02)), var(--bg);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.ti-login-card {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(0,0,0,.11);
  max-width: 400px;
  padding: 2.5rem;
  width: 100%;
}

.ti-login-icon {
  align-items: center;
  background: linear-gradient(135deg, var(--brand-blue), #1a2529);
  border-radius: 12px;
  color: #fff;
  display: flex;
  height: 52px;
  justify-content: center;
  margin-bottom: 1.5rem;
  width: 52px;
}

.ti-login-card .eyebrow {
  color: var(--brand-red);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.ti-login-card h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: .2rem 0 .5rem;
}

.ti-login-card .subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 1.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: 1rem;
}

.form-group label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: .625rem .75rem;
  transition: border-color .15s;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand-red);
  outline: none;
}

.form-group textarea { resize: vertical; min-height: 90px; }

.error-msg {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: var(--danger);
  display: none;
  font-size: 13px;
  margin-bottom: 1rem;
  padding: .6rem .75rem;
}

.error-msg.show { display: block; }

/* ── Buttons ── */
.btn {
  align-items: center;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  gap: .4rem;
  justify-content: center;
  padding: .6rem 1.2rem;
  transition: opacity .15s, background .15s;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { flex-shrink: 0; height: 16px; width: 16px; }

.btn-primary {
  background: var(--brand-red);
  box-shadow: 0 6px 16px -6px rgba(172,44,35,.45);
  color: #fff;
  width: 100%;
  padding: .7rem;
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-red-dark);
  box-shadow: 0 8px 20px -6px rgba(172,44,35,.55);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  color: var(--text);
  transition: background .15s, transform .15s;
}
.btn-secondary:hover:not(:disabled) { background: var(--line); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-soft); color: var(--text); }

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
}
.btn-danger-ghost:hover:not(:disabled) { background: #fef2f2; }

.btn-sm { font-size: 12px; padding: .4rem .8rem; }

.btn-small {
  font-size: 12px;
  padding: .35rem .7rem;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
  font-weight: 500;
}

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-danger:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* ── Shell layout (admin + portal) ── */
.ti-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.ti-sidebar {
  background: linear-gradient(180deg, #262f33, var(--brand-blue) 60%);
  box-shadow: 6px 0 28px rgba(0,0,0,.14);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  width: 220px;
  transition: width .18s ease;
  z-index: 30;
}

.ti-sidebar-brand {
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  gap: .65rem;
  margin-bottom: 1rem;
  padding: 0 1.25rem 1.25rem;
}

.ti-sidebar-brand-text { line-height: 1.2; min-width: 0; overflow: hidden; }
.ti-sidebar-brand-text strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ti-sidebar-collapse-btn {
  align-items: center;
  background: rgba(255,255,255,.08);
  border: none;
  border-radius: 6px;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  height: 22px;
  justify-content: center;
  margin-left: auto;
  transition: background .15s, color .15s, transform .15s;
  width: 22px;
}
.ti-sidebar-collapse-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.ti-sidebar-collapse-btn svg { height: 14px; width: 14px; transition: transform .18s; }

/* Menu retraído: só ícones, sem rótulos/textos. */
.ti-sidebar.collapsed { width: 68px; }
.ti-sidebar.collapsed .ti-sidebar-brand { justify-content: center; padding: 0 .5rem 1.25rem; }
.ti-sidebar.collapsed .ti-sidebar-brand-text,
.ti-sidebar.collapsed .ti-nav-section,
.ti-sidebar.collapsed .ti-sidebar-user-info,
.ti-sidebar.collapsed .ti-sidebar-footer-links,
.ti-sidebar.collapsed .ti-nav-badge { display: none; }
.ti-sidebar.collapsed .ti-sidebar-collapse-btn { margin-left: 0; }
.ti-sidebar.collapsed .ti-sidebar-collapse-btn svg { transform: rotate(180deg); }
.ti-sidebar.collapsed .ti-nav-item {
  font-size: 0;
  gap: 0;
  justify-content: center;
  padding: .6rem;
}
.ti-sidebar.collapsed .ti-nav-item:hover { transform: none; }
.ti-sidebar.collapsed .ti-sidebar-user { justify-content: center; padding: .25rem 0; }

.ti-nav { display: flex; flex-direction: column; flex: 1; gap: .25rem; padding: 0 .75rem; }

.ti-nav-section {
  color: rgba(255,255,255,.4);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  margin: .9rem 0 .15rem;
  padding: 0 .75rem;
  text-transform: uppercase;
}
.ti-nav-section:first-child { margin-top: 0; }

.ti-nav-item {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 9px;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 500;
  gap: .6rem;
  padding: .6rem .75rem;
  text-align: left;
  transition: background .15s, color .15s, transform .15s;
  width: 100%;
}

.ti-nav-item:hover { background: rgba(255,255,255,.08); transform: translateX(2px); }
.ti-nav-item.active {
  background: rgba(255,255,255,.14);
  box-shadow: 0 4px 14px rgba(0,0,0,.18), inset 0 0 0 1px rgba(255,255,255,.06);
  color: #fff;
  font-weight: 600;
}
.ti-nav-item svg { flex-shrink: 0; height: 16px; opacity: .8; width: 16px; }
.ti-nav-item.active svg { opacity: 1; }
/* Só o ícone fica colorido no hover — o texto mantém a cor de descanso. */
.ti-nav-item:hover svg { color: var(--accent, var(--brand-red)); opacity: 1; }

.ti-nav-badge {
  align-items: center;
  background: var(--brand-red);
  border-radius: 10px;
  color: #fff;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  justify-content: center;
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
}

.ti-sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.1);
  margin-top: auto;
  padding: 1rem .75rem 0;
}

.ti-sidebar-user {
  align-items: center;
  display: flex;
  gap: .5rem;
  margin-bottom: .75rem;
  padding: .25rem .5rem;
}

.ti-sidebar-user-avatar {
  align-items: center;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.ti-sidebar-user-info { min-width: 0; }
.ti-sidebar-user-name {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ti-sidebar-user-role { color: rgba(255,255,255,.5); font-size: 11px; }

/* ── Main content ── */
.ti-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.ti-topbar {
  align-items: center;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 20px -8px rgba(20,26,31,.10);
  display: flex;
  flex-shrink: 0;
  gap: 1rem;
  padding: .875rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.ti-topbar h1 {
  font-size: 1rem;
  font-weight: 700;
}

.ti-topbar .eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.ti-topbar-actions {
  align-items: center;
  display: flex;
  gap: .5rem;
  margin-left: auto;
}

.ti-content { flex: 1; min-height: 0; overflow-y: auto; padding: 1.5rem; }

/* ── Views ── */
.ti-view { display: none; }
.ti-view.active {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── Metric cards ── */
.metric-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--surface);
  border: 1px solid rgba(20,26,31,.04);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  padding: 1.25rem;
  transition: box-shadow .2s ease, transform .2s ease;
}

.metric-card:hover {
  box-shadow: var(--shadow-float-hover);
  transform: translateY(-3px);
}

.dashboard-alert-item {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: var(--radius);
  color: #9a3412;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: .65rem .9rem;
  text-align: left;
}

.dashboard-alert-item:hover {
  background: #ffedd5;
}

.metric-card-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  margin-bottom: .4rem;
  text-transform: uppercase;
}

.metric-card-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: .3rem;
}

.metric-card-sub { color: var(--muted); font-size: 12px; }

.metric-card.red .metric-card-value { color: var(--brand-red); }
.metric-card.blue .metric-card-value { color: var(--info); }
.metric-card.green .metric-card-value { color: var(--success); }
.metric-card.orange .metric-card-value { color: var(--warning); }

/* ── Filters bar ── */
.filters-bar {
  align-items: center;
  background: var(--surface);
  border: 1px solid rgba(20,26,31,.04);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.25rem;
  padding: .75rem 1rem;
}

.filter-search {
  align-items: center;
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex: 1;
  gap: .4rem;
  min-width: 180px;
  padding: .4rem .65rem;
}

.filter-search svg { color: var(--muted); flex-shrink: 0; height: 14px; width: 14px; }

.filter-search input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  outline: none;
  width: 100%;
}

.filter-select {
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  padding: .4rem .65rem;
}

.filter-checkbox {
  align-items: center;
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  gap: .4rem;
  padding: .4rem .65rem;
  user-select: none;
  white-space: nowrap;
}

.filter-checkbox input {
  cursor: pointer;
  margin: 0;
}

/* ── Table ── */
.ti-table-wrap {
  background: var(--surface);
  border: 1px solid rgba(20,26,31,.04);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.ti-table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}

.ti-table th {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  padding: .65rem 1rem;
  text-align: left;
  text-transform: uppercase;
}

.ti-table td {
  border-bottom: 1px solid var(--line);
  padding: .75rem 1rem;
  vertical-align: middle;
}

.ti-table tr:last-child td { border-bottom: none; }

.ti-table tbody tr {
  cursor: pointer;
  transition: background .12s;
}

.ti-table tbody tr:hover { background: var(--surface-soft); }
.ti-table tbody tr.selected { background: rgba(172,44,35,.05); }

.ticket-numero { color: var(--muted); font-family: monospace; font-size: 12px; }
.ticket-titulo { font-weight: 500; }
.ticket-solicitante { color: var(--muted); font-size: 12px; }

.empty-state {
  color: var(--muted);
  padding: 3rem;
  text-align: center;
}
.empty-state svg { height: 40px; margin-bottom: .75rem; opacity: .35; width: 40px; }
.empty-state p { font-size: 13px; }

/* ── Status badges ── */
.badge {
  border-radius: 20px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 600;
  gap: .25rem;
  padding: .2rem .6rem;
  white-space: nowrap;
}

.badge-aberto { background: #fef2f2; color: #b42318; }
.badge-em_atendimento { background: #eff6ff; color: #1d6fb8; }
.badge-aguardando { background: #fffbeb; color: #b45309; }
.badge-resolvido { background: #f0fdf4; color: #12805c; }
.badge-fechado { background: var(--surface-soft); color: var(--muted); }

.badge-urgente { background: #fef2f2; color: #991b1b; }
.badge-alta { background: #fff7ed; color: #c2410c; }
.badge-media { background: #fffbeb; color: #b45309; }
.badge-baixa { background: #f0fdf4; color: #166534; }

/* ── Resize handle entre a lista e o painel de detalhe ── */
.detail-resize-handle {
  background: transparent;
  cursor: col-resize;
  flex-shrink: 0;
  position: relative;
  width: 6px;
  z-index: 11;
}

.detail-resize-handle.hidden { display: none; }

.detail-resize-handle::after {
  background: var(--line);
  border-radius: 2px;
  bottom: 0;
  content: '';
  left: 2px;
  position: absolute;
  top: 0;
  transition: background .15s ease;
  width: 2px;
}

.detail-resize-handle:hover::after,
.detail-resize-handle.dragging::after {
  background: var(--brand-red);
}

/* ── Detail panel ── */
.detail-panel {
  background: var(--surface-soft);
  border-left: 1px solid var(--line);
  box-shadow: -10px 0 28px -14px rgba(20,26,31,.16);
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 380px;
  overflow-y: auto;
  z-index: 10;
}

.detail-panel.hidden { display: none; }

/* Barra com o botao de fechar, fora dos cards — fecha o painel inteiro,
   nao um card especifico (antes ficava dentro so do card de titulo). */
.detail-panel-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: -.5rem;
}

.detail-close {
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  padding: .35rem;
  transition: background .15s ease, color .15s ease;
}
.detail-close:hover { background: var(--surface-soft); color: var(--text); }
.detail-close svg { height: 18px; width: 18px; }

/* Card do topo: titulo, badges e informacoes do chamado juntos no mesmo bloco */
.detail-header-card { padding-top: 1.25rem; }

.detail-header-top { margin-bottom: .8rem; }

.detail-numero { color: var(--muted); font-family: monospace; font-size: 12px; margin-bottom: .3rem; }
.detail-titulo { font-size: 17px; font-weight: 700; line-height: 1.3; }

.detail-meta { display: flex; flex-wrap: wrap; gap: .4rem; }

.detail-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .85rem;
}

.sla-bar-track {
  background: var(--surface-soft);
  border-radius: 99px;
  height: 5px;
  margin-top: .35rem;
  overflow: hidden;
  width: 100%;
}

.sla-bar-fill {
  border-radius: 99px;
  height: 100%;
  transition: width .3s ease;
}

.detail-header-info {
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: .4rem;
  margin-top: 1rem;
  padding-top: 1rem;
}

.detail-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.5rem 1.75rem;
}

/* Card do topo (titulo/badges/info) e Gerenciar lado a lado; cada um exige
   pelo menos 260px, entao quebram para baixo sozinhos quando o painel fica
   estreito demais para os dois (resize manual ou tela pequena). */
.detail-top-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.detail-top-row > .detail-section {
  flex: 1 1 260px;
  min-width: 260px;
}

.detail-section {
  background: var(--surface);
  border: 1px solid rgba(20,26,31,.05);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  padding: 1.1rem 1.25rem;
}

.detail-section-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  margin-bottom: .85rem;
  text-transform: uppercase;
}

.detail-description {
  background: var(--surface-soft);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
  padding: .85rem .9rem;
  white-space: pre-wrap;
}

.detail-row {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: .4rem;
}

.detail-row + .detail-row { margin-top: .9rem; }

.detail-row-label { color: var(--muted); font-size: 12px; font-weight: 600; }

.detail-select {
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: .55rem .7rem;
  transition: border-color .15s ease;
  width: 100%;
}

.detail-select:focus { border-color: var(--brand-red); outline: none; }

/* ── Comments ── */
/* ── Historico do chamado: linha do tempo horizontal ── */
.history-list {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  padding-bottom: .25rem;
}

.history-item {
  display: flex;
  flex: 0 0 200px;
  flex-direction: column;
  gap: .5rem;
}

.history-dot-row { height: 12px; position: relative; }

.history-dot-row::before {
  background: var(--line);
  content: '';
  height: 2px;
  left: 0;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.history-item:first-child .history-dot-row::before { left: 50%; }
.history-item:last-child .history-dot-row::before { right: 50%; }

.history-dot {
  background: var(--brand-red);
  border: 2px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
  height: 10px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  z-index: 1;
}

.history-card {
  background: var(--surface-soft);
  border-radius: var(--radius);
  font-size: 13px;
  padding: .6rem .75rem;
}

.history-item-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 11px;
  gap: .3rem .5rem;
  justify-content: space-between;
  margin-bottom: .25rem;
}

.history-item-meta strong { color: var(--text); }

.comment-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }

.comment-item {
  background: var(--surface-soft);
  border-radius: var(--radius);
  font-size: 13px;
  padding: .7rem .85rem;
}

.comment-item.internal {
  background: #fffbeb;
  border-left: 3px solid var(--warning);
}

.comment-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: .4rem;
  margin-bottom: .3rem;
}

.comment-meta strong { color: var(--text); }

.comment-internal-label {
  background: #fef9c3;
  border-radius: 10px;
  color: #854d0e;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
}

.comment-text { line-height: 1.5; white-space: pre-wrap; }

.comment-form { display: flex; flex-direction: column; gap: .6rem; }

.comment-form textarea {
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  min-height: 70px;
  padding: .65rem .8rem;
  resize: vertical;
  width: 100%;
}

.comment-form textarea:focus { border-color: var(--brand-red); outline: none; }

.comment-form-actions {
  align-items: center;
  display: flex;
  gap: .5rem;
}

.comment-tipo-toggle {
  align-items: center;
  display: flex;
  font-size: 12px;
  gap: .3rem;
  margin-right: auto;
}

/* ── Tickets layout with detail ── */
.tickets-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 180px);
  min-height: 400px;
}

.tickets-list-wrap {
  flex-basis: 380px;
  flex-grow: 1;
  flex-shrink: 1;
  min-width: 260px;
  overflow-y: auto;
}

/* Com o painel de detalhe aberto, a lista para de crescer (vira a coluna
   estreita, tipo Gmail) e o painel de detalhe (flex-grow:1) absorve o
   espaco extra. flex-basis da lista fica ajustavel via o resize handle. */
#tickets-list-area.detail-open .tickets-list-wrap { flex-grow: 0; }

/* ── Portal specific ── */
.portal-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.portal-topbar {
  align-items: center;
  background: linear-gradient(135deg, #262f33, var(--brand-blue) 70%);
  box-shadow: 0 6px 24px -8px rgba(0,0,0,.28);
  color: #fff;
  display: flex;
  gap: .75rem;
  padding: .875rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.portal-brand {
  align-items: center;
  display: flex;
  gap: .6rem;
}

.portal-brand-icon {
  align-items: center;
  background: var(--brand-red);
  border-radius: 7px;
  display: flex;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.portal-brand-text { line-height: 1.2; }
.portal-brand-text .eyebrow {
  color: rgba(255,255,255,.55);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.portal-brand-text strong { display: block; font-size: 13px; font-weight: 700; }

.portal-user {
  align-items: center;
  display: flex;
  gap: .5rem;
  margin-left: auto;
}

.portal-user-name { color: rgba(255,255,255,.9); font-size: 13px; }

.portal-main {
  display: grid;
  flex: 1;
  gap: 1.75rem;
  grid-template-columns: 380px 1fr;
  padding: 1.75rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .portal-main { grid-template-columns: 1fr; }
  .ti-sidebar { display: none; }
  .detail-panel { width: 100%; min-width: 0; position: fixed; inset: 0; z-index: 100; }
  .detail-resize-handle { display: none; }
}

.portal-panel {
  background: var(--surface);
  border: 1px solid rgba(20,26,31,.04);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.portal-panel-header {
  background: linear-gradient(180deg, var(--surface-soft), rgba(241,241,238,.4));
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 1.4rem;
}

.portal-panel-header h2 { font-size: 15px; font-weight: 700; }
.portal-panel-header p { color: var(--muted); font-size: 12px; margin-top: .2rem; }

.portal-panel-body { padding: 1.4rem; }

.new-ticket-form .form-group { margin-bottom: .875rem; }

.my-tickets-list { display: flex; flex-direction: column; }

.my-ticket-item {
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  padding: .95rem 1.4rem;
  transition: background .15s, padding-left .15s;
}
.my-ticket-item:last-child { border-bottom: none; }
.my-ticket-item:hover { background: var(--surface-soft); padding-left: 1.65rem; }

.my-ticket-top {
  align-items: flex-start;
  display: flex;
  gap: .5rem;
  margin-bottom: .35rem;
}

.my-ticket-titulo { flex: 1; font-size: 13px; font-weight: 600; }
.my-ticket-meta { color: var(--muted); font-size: 11px; }
.my-ticket-numero { color: var(--muted); font-family: monospace; font-size: 11px; margin-bottom: .25rem; }

/* ── Modal ── */
.modal-overlay {
  align-items: center;
  background: rgba(15,20,24,.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 1rem;
  position: fixed;
  z-index: 200;
}

.modal-overlay.hidden { display: none; }

.modal {
  animation: modal-float-in .18s ease-out;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,.1), 0 32px 72px -12px rgba(0,0,0,.28);
  max-height: 90vh;
  max-width: 500px;
  overflow-y: auto;
  padding: 1.75rem;
  width: 100%;
}

@keyframes modal-float-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Variante "drawer": desliza da direita, ocupando a altura toda da tela. */
.modal-overlay--drawer { align-items: stretch; justify-content: flex-end; padding: 0; }
.modal--drawer {
  animation: drawer-slide-in .22s ease-out;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  height: 100%;
  max-height: none;
  max-width: 440px;
}
@keyframes drawer-slide-in {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}

.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ── Section heading ── */
.section-heading {
  align-items: center;
  display: flex;
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.section-heading h2 { font-size: 1rem; font-weight: 700; }
.section-heading .muted { color: var(--muted); font-size: 13px; }

/* ── Category bar ── */
.cat-bars { display: flex; flex-direction: column; gap: .5rem; }

.cat-bar-row { align-items: center; display: flex; gap: .5rem; font-size: 12px; }

.cat-bar-label { color: var(--muted); min-width: 80px; text-transform: capitalize; }

.cat-bar-track {
  background: var(--surface-soft);
  border-radius: 4px;
  flex: 1;
  height: 8px;
  overflow: hidden;
}

.cat-bar-fill {
  background: var(--brand-red);
  border-radius: 4px;
  height: 100%;
  transition: width .4s ease;
}

.cat-bar-count { color: var(--text); font-weight: 600; min-width: 24px; text-align: right; }

/* ── Spinner ── */
.spinner {
  animation: spin .7s linear infinite;
  border: 2px solid var(--line);
  border-top-color: var(--brand-red);
  border-radius: 50%;
  height: 18px;
  width: 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ── */
.flex { display: flex; }
.gap-sm { gap: .5rem; }
.mt-1 { margin-top: 1rem; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.font-mono { font-family: monospace; }

/* ── Kanban ── */
.kanban-board {
  display: flex;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-col {
  background: var(--surface-soft);
  border: 1px solid rgba(20,26,31,.04);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 272px;
}

.kanban-col-header {
  align-items: center;
  display: flex;
  gap: .5rem;
  padding: .875rem 1rem .75rem;
}

.kanban-col-title {
  font-size: 13px;
  font-weight: 700;
  flex: 1;
}

.kanban-col-count {
  align-items: center;
  background: var(--line);
  border-radius: 10px;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  justify-content: center;
  min-width: 22px;
  padding: 1px 6px;
}

.kanban-col-dot {
  border-radius: 50%;
  flex-shrink: 0;
  height: 8px;
  width: 8px;
}

.kanban-col-dot.backlog     { background: var(--muted); }
.kanban-col-dot.a_fazer     { background: var(--info); }
.kanban-col-dot.em_andamento{ background: var(--warning); }
.kanban-col-dot.teste       { background: #7c3aed; }
.kanban-col-dot.concluido   { background: var(--success); }

.kanban-cards {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: .5rem;
  min-height: 80px;
  overflow-y: auto;
  padding: 0 .625rem .625rem;
}

.kanban-cards.drag-over {
  background: rgba(172, 44, 35, .05);
  border-radius: 8px;
  outline: 2px dashed var(--brand-red);
  outline-offset: -3px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid rgba(20,26,31,.05);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(20,26,31,.05);
  cursor: grab;
  padding: .75rem;
  transition: box-shadow .18s ease, transform .18s ease;
}

.kanban-card:hover {
  box-shadow: var(--shadow-float-hover);
  transform: translateY(-2px);
}

.kanban-card:active { cursor: grabbing; }

.kanban-card.dragging {
  opacity: .45;
  transform: scale(.97);
}

.kanban-card-titulo {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: .5rem;
}

.kanban-card-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: .5rem;
}

.kanban-card-footer {
  align-items: center;
  display: flex;
  gap: .4rem;
  justify-content: space-between;
  margin-top: .4rem;
}

.kanban-card-prazo {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: .25rem;
}

.kanban-card-prazo.vencido { color: var(--danger); font-weight: 600; }
.kanban-card-prazo.hoje { color: var(--warning); font-weight: 600; }
.kanban-card-prazo svg { height: 11px; width: 11px; }

.kanban-card-resp {
  align-items: center;
  background: var(--surface-soft);
  border-radius: 50%;
  color: var(--muted);
  display: flex;
  font-size: 10px;
  font-weight: 700;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.kanban-card-anexos {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 10px;
  font-weight: 600;
  gap: .2rem;
}

.kanban-card-actions {
  align-items: center;
  display: flex;
  gap: .25rem;
  opacity: 0;
  transition: opacity .15s;
}

.kanban-card:hover .kanban-card-actions { opacity: 1; }

.kanban-card-btn {
  align-items: center;
  background: var(--surface-soft);
  border: none;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.kanban-card-btn:hover { background: var(--line); color: var(--text); }
.kanban-card-btn.danger:hover { background: #fef2f2; color: var(--danger); }
.kanban-card-btn svg { height: 12px; width: 12px; }

.kanban-add-btn {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 12px;
  font-weight: 500;
  gap: .35rem;
  margin: .25rem .625rem .625rem;
  padding: .45rem .5rem;
  transition: background .12s, color .12s;
  width: calc(100% - 1.25rem);
}

.kanban-add-btn:hover { background: rgba(0,0,0,.05); color: var(--text); }
.kanban-add-btn svg { height: 14px; width: 14px; }

/* ── Sub-tarefas (modal) ── */
.subtarefa-row {
  align-items: center;
  border-radius: 6px;
  display: flex;
  gap: .4rem;
  margin-bottom: .35rem;
  padding: .3rem .35rem;
  transition: background .1s;
}
.subtarefa-row:hover { background: var(--surface-soft); }
.subtarefa-row.concluida .subtarefa-input { color: var(--muted); text-decoration: line-through; }

.subtarefa-check { accent-color: var(--brand-red); cursor: pointer; flex-shrink: 0; height: 15px; width: 15px; }

.subtarefa-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text);
  flex: 1;
  font-family: var(--font);
  font-size: 12px;
  min-width: 0;
  outline: none;
  padding: .15rem .2rem;
  transition: border-color .15s;
}
.subtarefa-input:focus { border-bottom-color: var(--brand-red); }

.subtarefa-resp {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  flex-shrink: 0;
  font-family: var(--font);
  font-size: 11px;
  max-width: 110px;
  padding: .2rem .3rem;
}

.subtarefa-del {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  padding: .2rem;
  transition: background .12s, color .12s;
}
.subtarefa-del:hover { background: #fef2f2; color: var(--danger); }

/* Sub-tarefas barra de progresso no card */
.kanban-subtarefas-progress {
  align-items: center;
  display: flex;
  gap: .4rem;
  margin-bottom: .4rem;
}

.kanban-subtarefas-bar {
  background: var(--line);
  border-radius: 4px;
  flex: 1;
  height: 4px;
  overflow: hidden;
}

.kanban-subtarefas-fill {
  background: var(--brand-red);
  border-radius: 4px;
  height: 100%;
  transition: width .3s ease;
}

.kanban-subtarefas-progress span {
  color: var(--muted);
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
}

.kanban-subtarefas-quicklist {
  background: var(--surface-soft);
  border-radius: 6px;
  margin-bottom: .5rem;
  padding: .35rem .5rem;
}

.kanban-subtarefa-quickrow {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 11px;
  gap: .4rem;
  padding: .2rem 0;
}

.kanban-subtarefa-quickrow input { accent-color: var(--brand-red); cursor: pointer; flex-shrink: 0; height: 13px; width: 13px; }

.kanban-subtarefa-quickrow span.done { color: var(--muted); text-decoration: line-through; }

/* Chamado vinculado no card */
.kanban-card-chamado {
  align-items: center;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  color: #1d6fb8;
  cursor: pointer;
  display: inline-flex;
  font-size: 10px;
  font-weight: 600;
  gap: .25rem;
  margin-bottom: .4rem;
  padding: .2rem .5rem;
  transition: background .12s;
  width: fit-content;
}
.kanban-card-chamado:hover { background: #dbeafe; }

/* ── File upload ── */
.file-drop-zone {
  align-items: center;
  background: var(--surface-soft);
  border: 1.5px dashed rgba(20,26,31,.18);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: .35rem;
  padding: 1.1rem;
  text-align: center;
  transition: border-color .15s, background .15s, transform .15s;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  background: rgba(172,44,35,.04);
  border-color: var(--brand-red);
  color: var(--text);
}

.file-drop-zone svg { opacity: .5; }
.file-drop-zone:hover svg,
.file-drop-zone.drag-over svg { opacity: .8; }

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .35rem;
}

.file-pill {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--text);
  display: inline-flex;
  font-size: 11px;
  gap: .3rem;
  max-width: 220px;
  padding: .25rem .6rem;
}

.file-pill svg { flex-shrink: 0; opacity: .6; }

.file-pill span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-pill-size { color: var(--muted); flex-shrink: 0; }

.file-pill-link {
  text-decoration: none;
  transition: background .12s, border-color .12s;
}
.file-pill-link:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: var(--info);
}

/* Ticket aguardando destaque na lista */
.my-ticket-item.aguardando-pulse {
  border-left: 3px solid var(--warning);
}

/* Categoria badge colors */
.badge-cat-infraestrutura { background: #eff6ff; color: #1d6fb8; }
.badge-cat-segurança      { background: #fef2f2; color: #b42318; }
.badge-cat-projeto        { background: #f5f3ff; color: #7c3aed; }
.badge-cat-manutenção     { background: #fff7ed; color: #c2410c; }
.badge-cat-suporte        { background: #f0fdf4; color: #12805c; }
.badge-cat-gestão         { background: #fdf4ff; color: #a21caf; }
.badge-cat-outros         { background: var(--surface-soft); color: var(--muted); }

/* .ti-topbar usa um fundo translucido fixo (glass effect), nao a variavel
   --surface, entao nao acompanha o tema — some com o texto no modo escuro. */
body.dark-theme .ti-topbar { background: rgba(28,36,39,.86); }

/* ── Modo escuro: badges e destaques com cor fixa ──
   Essas cores (fundo pastel + texto saturado) sao hardcoded, nao usam
   variavel de tema, entao ficam claras demais e destoam em cima do fundo
   escuro. Aqui a mesma cor de base vira um fundo translucido + texto claro. */
body.dark-theme .badge-aberto,
body.dark-theme .badge-urgente,
body.dark-theme .badge-cat-segurança { background: rgba(220,38,38,.18); color: #fca5a5; }

body.dark-theme .badge-em_atendimento,
body.dark-theme .badge-cat-infraestrutura,
body.dark-theme .kanban-card-chamado,
body.dark-theme .file-pill-link:hover { background: rgba(29,111,184,.2); color: #93c5fd; }
body.dark-theme .kanban-card-chamado:hover { background: rgba(29,111,184,.3); }
body.dark-theme .file-pill-link:hover { border-color: rgba(29,111,184,.4); }

body.dark-theme .badge-aguardando,
body.dark-theme .badge-media,
body.dark-theme .comment-item.internal,
body.dark-theme .comment-internal-label { background: rgba(180,83,9,.2); color: #fcd34d; }

body.dark-theme .badge-resolvido,
body.dark-theme .badge-baixa,
body.dark-theme .badge-cat-suporte { background: rgba(18,128,92,.2); color: #6ee7b7; }

body.dark-theme .badge-alta,
body.dark-theme .badge-cat-manutenção,
body.dark-theme .dashboard-alert-item { background: rgba(194,65,12,.2); color: #fdba74; border-color: rgba(194,65,12,.4); }
body.dark-theme .dashboard-alert-item:hover { background: rgba(194,65,12,.3); }

body.dark-theme .badge-cat-projeto { background: rgba(124,58,237,.22); color: #c4b5fd; }
body.dark-theme .badge-cat-gestão { background: rgba(162,28,175,.22); color: #f0abfc; }

body.dark-theme .error-msg { background: rgba(180,35,24,.15); border-color: rgba(180,35,24,.4); }
body.dark-theme .btn-danger-ghost:hover:not(:disabled),
body.dark-theme .kanban-card-btn.danger:hover,
body.dark-theme .subtarefa-del:hover { background: rgba(180,35,24,.18); }

/* ═══════════════════════════════════════════════════════════════════════════
   MODERNIZACAO — camada final
   ---------------------------------------------------------------------------
   Aplica no portal e no painel de T.I. a mesma linguagem da intranet: vidro
   com desfoque, elevacao em camadas, animacoes de entrada e micro-interacoes.
   Fica no fim do arquivo de proposito: sobrescreve os blocos acima sem exigir
   reescrita das ~1.700 linhas anteriores.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Movimento ────────────────────────────────────────────────────────────── */

@keyframes ti-rise-in {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

@keyframes ti-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ti-pop-in {
  0% { opacity: 0; transform: scale(0.94); }
  60% { opacity: 1; transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes ti-aurora {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(2%, -2%, 0) scale(1.05); }
  100% { transform: translate3d(-2%, 2%, 0) scale(1.02); }
}

/* ── Ambiencia de fundo ──────────────────────────────────────────────────── */

/* Manchas de cor em deriva lenta, atras de tudo. */
body::before {
  background:
    radial-gradient(52vw 52vw at 84% -6%, rgba(172, 44, 35, 0.07), transparent 62%),
    radial-gradient(44vw 44vw at 2% 14%, rgba(34, 45, 49, 0.06), transparent 60%);
  content: "";
  inset: -12%;
  pointer-events: none;
  position: fixed;
  z-index: 0;
  animation: ti-aurora 32s var(--ease) infinite alternate;
}

body.dark-theme::before {
  background:
    radial-gradient(52vw 52vw at 84% -6%, rgba(172, 44, 35, 0.16), transparent 62%),
    radial-gradient(44vw 44vw at 2% 14%, rgba(56, 84, 96, 0.16), transparent 60%);
}

.ti-shell,
.portal-shell,
.ti-login-card {
  position: relative;
  z-index: 1;
}

/* ── Barras de rolagem ───────────────────────────────────────────────────── */

* {
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

*::-webkit-scrollbar { height: 10px; width: 10px; }
*::-webkit-scrollbar-track { background: transparent; }

*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  background-clip: content-box;
  border: 3px solid transparent;
  border-radius: var(--r-full);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  background-clip: content-box;
}

/* ── Sidebar do painel ───────────────────────────────────────────────────── */

.ti-sidebar {
  -webkit-backdrop-filter: var(--glass-blur-lg);
  backdrop-filter: var(--glass-blur-lg);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 4px 0 24px -12px rgba(0, 0, 0, 0.4);
}

/* Pilula de fundo que cresce do centro, igual a navegacao da intranet.
   `position: relative` e obrigatorio: sem ele o ::before abaixo se ancora na
   sidebar (ancestral posicionado mais proximo) em vez do botao, e cada item
   pinta um retangulo do tamanho da barra inteira — o item ativo cobria toda a
   sidebar com o gradiente vermelho. O overflow: hidden nao segura, porque
   elemento absoluto cujo bloco de contencao e um ancestral nao e recortado. */
.ti-nav-item {
  isolation: isolate;
  overflow: hidden;
  position: relative;
  transition: color var(--t-2) var(--ease), transform var(--t-2) var(--ease-spring);
}

.ti-nav-item::before {
  background: rgba(255, 255, 255, 0.09);
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  position: absolute;
  transform: scale(0.85);
  transition: opacity var(--t-2) var(--ease), transform var(--t-2) var(--ease-spring);
  z-index: -1;
}

.ti-nav-item:hover::before {
  opacity: 1;
  transform: scale(1);
}

.ti-nav-item.active::before {
  background: linear-gradient(140deg, var(--brand-red-light), var(--brand-red) 62%, var(--brand-red-dark));
  box-shadow: var(--sh-brand);
  opacity: 1;
  transform: scale(1);
}

.ti-nav-badge {
  animation: ti-pop-in var(--t-3) var(--ease-spring) both;
}

.ti-sidebar-user-avatar {
  transition: transform var(--t-3) var(--ease-spring);
}

.ti-sidebar-user:hover .ti-sidebar-user-avatar {
  transform: scale(1.07);
}

/* ── Topbars ─────────────────────────────────────────────────────────────── */

.ti-topbar {
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  background: var(--glass-strong);
  border-bottom: 1px solid var(--glass-line);
  position: sticky;
  top: 0;
  z-index: 40;
}

/* O titulo e quem cede espaco quando a barra aperta; os botoes ficam intactos.
   Sem o min-width:0 o bloco do titulo nao encolhe e a sobra vai comprimir os
   botoes. */
.ti-topbar > div:first-child {
  min-width: 0;
}

.ti-topbar h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Barra de acoes: todos os botoes com a MESMA altura e o mesmo ritmo de
   padding. O primario ("Abrir chamado") nao leva .btn-sm no HTML e por isso
   vinha com padding de .6rem 1.2rem, bem maior que os secundarios ao lado. */
.ti-topbar-actions {
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .4rem;
}

/* `width: auto` e essencial: a regra base `.btn-primary` traz width:100% (feita
   para botao de formulario, que ocupa a linha). Numa barra horizontal isso
   esticava o "Abrir chamado" para ~440px ao lado de secundarios de ~100px. */
.ti-topbar-actions .btn {
  font-size: 12.5px;
  min-height: 34px;
  padding: 0 .8rem;
  width: auto;
}

/* O primario mantem a hierarquia por largura e cor, nao por altura. */
.ti-topbar-actions .btn-primary {
  padding: 0 1.05rem;
}

/* Mesmo motivo nas acoes de modal, onde os botoes tambem ficam lado a lado.
   Ali o HTML contornava com style="width:auto" em cada primario. */
.modal-actions .btn,
.form-actions .btn,
.detail-quick-actions .btn {
  width: auto;
}

/* Botao so de icone (sem rotulo) fica quadrado em vez de esticado. */
.ti-topbar-actions .btn.btn-icon {
  padding: 0;
  width: 34px;
}

.portal-topbar {
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: 0 8px 28px -14px rgba(0, 0, 0, 0.5);
  position: sticky;
  top: 0;
  z-index: 40;
}

.portal-brand-icon {
  box-shadow: var(--sh-brand);
  transition: transform var(--t-3) var(--ease-spring);
}

.portal-brand:hover .portal-brand-icon {
  transform: rotate(-8deg) scale(1.06);
}

/* ── Paineis e cartoes ───────────────────────────────────────────────────── */

.portal-panel,
.detail-panel,
.ti-table-wrap,
.metric-card,
.ti-login-card,
.modal {
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float), var(--sh-inset);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .portal-panel,
  .detail-panel,
  .ti-table-wrap,
  .metric-card,
  .ti-login-card,
  .modal {
    background: var(--surface);
    border-color: var(--line);
  }
}

.portal-panel,
.ti-table-wrap {
  overflow: hidden;
}

/* Cartoes de metrica: elevam e revelam um fio de cor no topo. */
.metric-card {
  overflow: hidden;
  position: relative;
  transition: transform var(--t-2) var(--ease-out), box-shadow var(--t-2) var(--ease-out), border-color var(--t-2) var(--ease);
}

.metric-card::after {
  background: linear-gradient(90deg, var(--brand-red-light), var(--brand-red));
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-3) var(--ease-out);
}

.metric-card:hover {
  border-color: rgba(172, 44, 35, 0.26);
  box-shadow: var(--shadow-float-hover);
  transform: translateY(-3px);
}

.metric-card:hover::after {
  transform: scaleX(1);
}

.metric-card-value {
  font-variant-numeric: tabular-nums;
}

/* Entrada escalonada dos blocos que o JS monta. */
.metric-grid > *,
.portal-panel,
.dashboard-alert-item {
  animation: ti-rise-in var(--t-3) var(--ease-out) both;
}

.metric-grid > *:nth-child(2) { animation-delay: 0.05s; }
.metric-grid > *:nth-child(3) { animation-delay: 0.1s; }
.metric-grid > *:nth-child(4) { animation-delay: 0.15s; }
.metric-grid > *:nth-child(n + 5) { animation-delay: 0.2s; }

.ti-view.active {
  animation: ti-rise-in var(--t-3) var(--ease-out) both;
}

/* ── Botoes ──────────────────────────────────────────────────────────────── */

.btn {
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  transition:
    background var(--t-2) var(--ease),
    border-color var(--t-2) var(--ease),
    box-shadow var(--t-2) var(--ease),
    transform var(--t-1) var(--ease-spring);

  /* Sem estas tres, dentro de um flex-row o botao encolhe e o rotulo quebra em
     duas linhas: o botao fica mais alto que os vizinhos e o texto aparece
     cortado ("Atualiza" em vez de "Atualizar"). */
  flex-shrink: 0;
  line-height: 1.2;
  white-space: nowrap;
}

.btn-sm :is(svg, i) {
  height: 14px;
  width: 14px;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(140deg, var(--brand-red-light), var(--brand-red) 58%, var(--brand-red-dark));
  box-shadow: var(--sh-brand);
}

/* Brilho que atravessa o botao no hover. */
.btn-primary::after {
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.3) 50%, transparent 62%);
  content: "";
  inset: 0;
  position: absolute;
  transform: translateX(-120%);
  transition: transform var(--t-4) var(--ease-out);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 12px 30px -10px rgba(172, 44, 35, 0.7);
  transform: translateY(-2px);
}

.btn-primary:hover:not(:disabled)::after {
  transform: translateX(120%);
}

.btn-secondary {
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  background: var(--glass);
  border: 1px solid var(--line);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface);
  border-color: rgba(172, 44, 35, 0.32);
  box-shadow: var(--shadow-float);
  color: var(--brand-red);
  transform: translateY(-2px);
}

/* ── Formularios ─────────────────────────────────────────────────────────── */

.form-group input,
.form-group select,
.form-group textarea,
.filter-search,
.filter-select,
.detail-select,
.comment-form textarea {
  border-radius: var(--radius);
  transition: border-color var(--t-2) var(--ease), box-shadow var(--t-2) var(--ease), background var(--t-2) var(--ease);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.filter-search:focus-within,
.filter-select:focus,
.detail-select:focus,
.comment-form textarea:focus {
  border-color: rgba(172, 44, 35, 0.5);
  box-shadow: 0 0 0 4px rgba(172, 44, 35, 0.1);
}

.filters-bar {
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  background: var(--glass);
  border-radius: var(--radius-lg);
}

.file-drop-zone {
  border-radius: var(--radius);
  transition: background-color var(--t-2) var(--ease), border-color var(--t-2) var(--ease), color var(--t-2) var(--ease), box-shadow var(--t-2) var(--ease), transform var(--t-2) var(--ease), opacity var(--t-2) var(--ease);
}

.file-drop-zone:hover,
.file-drop-zone.is-dragging {
  background: rgba(172, 44, 35, 0.05);
  border-color: rgba(172, 44, 35, 0.5);
}

/* ── Tabela de chamados ──────────────────────────────────────────────────── */

.ti-table th {
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  background: var(--glass-strong);
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.ti-table tbody tr {
  transition: background var(--t-1) var(--ease), box-shadow var(--t-1) var(--ease);
}

.ti-table tbody tr:hover,
.ti-table tbody tr.selected {
  box-shadow: inset 2px 0 0 var(--brand-red);
}

/* ── Chamados do usuario (portal) ────────────────────────────────────────── */

.my-ticket-item {
  transition: background var(--t-2) var(--ease), padding-left var(--t-2) var(--ease-out), box-shadow var(--t-2) var(--ease);
}

.my-ticket-item:hover {
  box-shadow: inset 3px 0 0 var(--brand-red);
}

/* ── Selos ───────────────────────────────────────────────────────────────── */

.badge {
  border-radius: var(--r-full);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ── Modais e gaveta lateral ─────────────────────────────────────────────── */

.modal-overlay {
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
  background: rgba(10, 14, 16, 0.52);
  animation: ti-fade-in var(--t-2) var(--ease) both;
}

.modal {
  -webkit-backdrop-filter: var(--glass-blur-lg);
  backdrop-filter: var(--glass-blur-lg);
  background: var(--glass-strong);
  border-radius: 22px;
  box-shadow: var(--sh-4);
  animation: ti-rise-in var(--t-3) var(--ease-spring) both;
}

.modal--drawer {
  border-radius: 0;
}

.detail-close {
  border-radius: var(--r-full);
  transition: background var(--t-1) var(--ease), color var(--t-1) var(--ease), transform var(--t-2) var(--ease-spring);
}

.detail-close:hover {
  transform: rotate(90deg);
}

/* ── Historico e comentarios ─────────────────────────────────────────────── */

.history-card,
.comment-item {
  border-radius: var(--radius);
  transition: border-color var(--t-2) var(--ease), transform var(--t-2) var(--ease-out);
}

.history-card:hover,
.comment-item:hover {
  transform: translateX(2px);
}

.history-dot {
  transition: transform var(--t-2) var(--ease-spring);
}

.history-item:hover .history-dot {
  transform: scale(1.25);
}

/* ── Login do portal ─────────────────────────────────────────────────────── */

.ti-login-card {
  border-radius: 26px;
  box-shadow: var(--sh-4);
  overflow: hidden;
  padding: 2.25rem;
  animation: ti-rise-in var(--t-4) var(--ease-out) both;
}

/* Fio de luz no topo do cartao. */
.ti-login-card::before {
  background: linear-gradient(90deg, transparent, var(--brand-red), transparent);
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.ti-login-icon {
  box-shadow: var(--shadow-float);
}

/* ── Barras de progresso e SLA ───────────────────────────────────────────── */

.sla-bar-track,
.cat-bar-track {
  border-radius: var(--r-full);
  overflow: hidden;
}

.sla-bar-fill,
.cat-bar-fill {
  border-radius: var(--r-full);
  transition: width var(--t-4) var(--ease-out);
}

/* ── Foco visivel ────────────────────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* ── Respeita quem pediu menos movimento no sistema ──────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .metric-card:hover,
  .btn:hover,
  .btn-primary:hover:not(:disabled),
  .btn-secondary:hover:not(:disabled),
  .history-card:hover,
  .comment-item:hover,
  .ti-nav-item:hover,
  .detail-close:hover {
    transform: none;
  }
}

/* ───────────────────────── Redesign "bento" (painel T.I.) ─────────────────────────
   Blocos arredondados e planos, sem gradiente/vidro/sombra.
   Fica no fim para sobrescrever o tema anterior; copia do visual antigo em
   backup-ui-2026-10-05/. */
body:not(.dark-theme) {
  --bg: #ecebe7;
}

.ti-topbar {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: transparent;
  border-bottom: 0;
  box-shadow: none;
}

.metric-card,
.ti-table-wrap,
#view-dashboard [style*="border-radius:10px"] {
  background: var(--surface);
  border: 0 !important;
  border-radius: 22px !important;
  box-shadow: none;
}

.metric-card::after {
  display: none;
}

.metric-card:hover {
  border: 0;
  box-shadow: none;
  transform: translateY(-2px);
}

.metric-card-value {
  font-size: 2.1rem;
}

.metric-card.red {
  background: var(--brand-red);
}

.metric-card.red :is(.metric-card-label, .metric-card-value, .metric-card-sub) {
  color: #fff;
}

.dashboard-alert-item {
  border-radius: 16px;
  box-shadow: none;
}

.btn,
.btn-sm {
  border-radius: 999px;
}

.modal {
  border-radius: 22px;
}

/* Menu lateral em preto/grafite (fixo, independe da "cor secundaria" do /admin). */
.ti-sidebar {
  background: #111517;
}

/* ───────────────────────── Inteligência (BI): redesign + animações ───────────────────────── */
#view-bi .bi-kpi,
#view-bi .bi-card,
#view-bi .bi-slicers-wrap {
  background: var(--surface);
  border: 0;
  border-radius: 22px;
  box-shadow: none;
}

#view-bi .bi-kpi {
  padding: 1.15rem 1.35rem 1rem;
}

#view-bi .bi-kpi-value {
  font-size: 2.2rem;
  font-variant-numeric: tabular-nums;
}

#view-bi .bi-kpi.danger .bi-kpi-value { color: #dc2626; }
#view-bi .bi-kpi.warn   .bi-kpi-value { color: #d97706; }
#view-bi .bi-kpi.green  .bi-kpi-value { color: #15803d; }
#view-bi .bi-kpi.accent .bi-kpi-value { color: var(--brand-red); }

#view-bi .bi-kpi-hero {
  background: var(--brand-red);
}

#view-bi .bi-kpi.bi-kpi-hero :is(.bi-kpi-label, .bi-kpi-value, .bi-kpi-sub, .bi-trend, .bi-trend.up, .bi-trend.down) {
  color: #fff !important;
}

#view-bi .bi-sec {
  border-bottom: 0;
  color: var(--text);
  font-size: 12px;
  letter-spacing: .08em;
  margin: 2rem 0 .85rem;
  padding: 0;
}

#view-bi .bi-sec::before {
  background: var(--brand-red);
  border-radius: 99px;
  content: "";
  display: inline-block;
  height: 8px;
  margin-right: .55rem;
  width: 8px;
}

#view-bi .bi-sec-first {
  margin-top: .5rem;
}

/* Navegação por seções (fixa no topo da área rolável). */
.bi-nav {
  background: var(--bg);
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0 -1.5rem .5rem;
  padding: .5rem 1.5rem;
  position: sticky;
  top: -1.5rem;
  z-index: 5;
}

.bi-nav-chip {
  background: var(--surface);
  border: 0;
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: .35rem .9rem;
  transition: background var(--t-2) var(--ease), color var(--t-2) var(--ease), transform var(--t-2) var(--ease-out);
}

.bi-nav-chip:hover {
  background: var(--brand-blue);
  color: #fff;
  transform: translateY(-1px);
}

/* Atenção agora. */
.bi-attn {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.2fr 1.2fr 1fr;
  margin-bottom: 1rem;
}

.bi-attn-card {
  background: var(--surface);
  border-radius: 22px;
  min-width: 0;
  padding: 1rem 1.15rem;
}

.bi-attn-head {
  align-items: baseline;
  display: flex;
  font-size: 12px;
  font-weight: 600;
  justify-content: space-between;
  margin-bottom: .6rem;
}

.bi-attn-head strong {
  font-size: 1.5rem;
}

.bi-attn-card.danger .bi-attn-head strong { color: #dc2626; }
.bi-attn-card.warn .bi-attn-head strong { color: #d97706; }

.bi-attn-row {
  align-items: center;
  background: var(--surface-soft);
  border: 0;
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  font: inherit;
  font-size: 11.5px;
  gap: .5rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin-bottom: .35rem;
  padding: .4rem .65rem;
  text-align: left;
  transition: transform var(--t-2) var(--ease-out), background var(--t-2) var(--ease);
  width: 100%;
}

.bi-attn-row:hover {
  background: var(--surface-sunken);
  transform: translateX(3px);
}

.bi-attn-num {
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
}

.bi-attn-titulo {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bi-attn-quando {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.bi-attn-vazio {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.bi-attn-minis {
  display: grid;
  gap: .6rem;
  grid-template-rows: repeat(3, 1fr);
}

.bi-attn-mini {
  align-items: center;
  background: var(--surface);
  border-radius: 18px;
  display: flex;
  gap: .75rem;
  padding: .5rem 1.1rem;
}

.bi-attn-mini strong {
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
}

.bi-attn-mini span {
  color: var(--muted);
  font-size: 12px;
}

.bi-attn-mini.warn strong { color: #d97706; }
.bi-attn-mini.danger strong { color: #dc2626; }

/* Destaques automáticos. */
.bi-destaques {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.bi-destaque {
  background: var(--surface);
  border-radius: 999px;
  font-size: 12px;
  padding: .4rem .9rem;
}

/* Animações: entrada escalonada, barras que crescem e gráficos que se revelam. */
@keyframes bi-rise {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes bi-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes bi-reveal {
  from { clip-path: inset(0 100% 0 0); opacity: .4; }
  to   { clip-path: inset(0 0 0 0); opacity: 1; }
}

@keyframes bi-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .35); }
  50%      { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

#view-bi .bi-anim {
  animation: bi-rise .55s var(--ease-out) backwards;
}

#view-bi .bi-chart div[style*="transition:width"] {
  animation: bi-grow .9s var(--ease-out) backwards;
  transform-origin: left;
}

#view-bi .bi-chart svg {
  animation: bi-reveal 1s var(--ease-out) backwards;
}

#view-bi .bi-attn-card.danger:has(.bi-attn-row) .bi-attn-head strong {
  animation: bi-pulse 2s ease-in-out infinite;
  border-radius: 999px;
  padding: 0 .5rem;
}

@media (max-width: 900px) {
  .bi-attn { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #view-bi .bi-anim,
  #view-bi .bi-chart svg,
  #view-bi .bi-chart div[style*="transition:width"],
  #view-bi .bi-attn-card.danger:has(.bi-attn-row) .bi-attn-head strong {
    animation: none;
  }
}

/* Efeitos ao passar o mouse (Inteligência). O fill-mode "backwards" acima libera o transform depois da entrada. */
#view-bi .bi-kpi,
#view-bi .bi-card,
#view-bi .bi-attn-card,
#view-bi .bi-attn-mini,
#view-bi .bi-destaque {
  transition: transform var(--t-2) var(--ease-out), box-shadow var(--t-2) var(--ease-out);
}

#view-bi .bi-kpi:hover,
#view-bi .bi-card:hover,
#view-bi .bi-attn-card:hover,
#view-bi .bi-attn-mini:hover {
  box-shadow: 0 10px 28px -12px rgba(16, 22, 26, .28);
  transform: translateY(-4px);
}

#view-bi .bi-kpi.bi-kpi-hero:hover {
  box-shadow: 0 12px 30px -10px rgba(172, 44, 35, .55);
}

#view-bi .bi-destaque:hover {
  transform: translateY(-2px);
}

/* Barras e legendas reagem ao ponteiro. */
#view-bi .bi-chart div[style*="transition:width"] {
  transition: filter var(--t-2) var(--ease), transform var(--t-2) var(--ease-out);
}

#view-bi .bi-chart div[title]:hover div[style*="transition:width"] {
  filter: brightness(1.12) saturate(1.2);
  transform: scaleY(1.25);
}

#view-bi .bi-chart div[title]:hover > span:first-child {
  color: var(--brand-red);
  font-weight: 600;
}

#view-bi .bi-legend-row {
  transition: background var(--t-2) var(--ease), transform var(--t-2) var(--ease-out);
}

#view-bi .bi-legend-row:hover {
  background: var(--surface-soft);
  transform: translateX(3px);
}

#view-bi .bi-chart svg :is(rect, circle, path[fill]:not([fill="none"])) {
  transition: opacity var(--t-2) var(--ease), filter var(--t-2) var(--ease);
}

#view-bi .bi-chart svg :is(rect, circle):hover {
  filter: brightness(1.15);
}

#view-bi .bi-chart svg path[stroke-width]:hover {
  filter: brightness(1.15);
}

@media (prefers-reduced-motion: reduce) {
  #view-bi .bi-kpi:hover,
  #view-bi .bi-card:hover,
  #view-bi .bi-attn-card:hover,
  #view-bi .bi-attn-mini:hover,
  #view-bi .bi-destaque:hover,
  #view-bi .bi-legend-row:hover,
  #view-bi .bi-chart div[title]:hover div[style*="transition:width"] {
    transform: none;
  }
}

/* ───────────────────────── Efeitos globais (painel e portal de T.I.) ─────────────────────────
   Microinterações em todas as telas: botões, cartões, tabelas, campos, janelas e listas. */
.btn,
.btn-sm,
.filter-select,
.detail-select,
.bi-nav-chip {
  transition: transform var(--t-2) var(--ease-out), box-shadow var(--t-2) var(--ease-out),
    background var(--t-2) var(--ease), color var(--t-2) var(--ease), border-color var(--t-2) var(--ease);
}

.btn:hover:not(:disabled) {
  box-shadow: 0 8px 18px -8px rgba(16, 22, 26, .35);
  transform: translateY(-2px);
}

.btn.btn-primary:hover:not(:disabled) {
  box-shadow: 0 10px 22px -8px rgba(172, 44, 35, .6);
}

.btn:active:not(:disabled) {
  box-shadow: none;
  transform: translateY(0) scale(.97);
}

/* Cartões e blocos. */
.portal-panel,
.metric-card,
.history-card,
.kanban-card,
.detail-section,
.cof-card,
.bib-card,
.ti-table-wrap {
  transition: transform var(--t-2) var(--ease-out), box-shadow var(--t-2) var(--ease-out), background var(--t-2) var(--ease);
}

.portal-panel:hover,
.kanban-card:hover,
.history-card:hover,
.cof-card:hover,
.bib-card:hover {
  box-shadow: 0 12px 28px -14px rgba(16, 22, 26, .3);
  transform: translateY(-3px);
}

/* Tabelas e listas: linha ganha faixa vermelha e desliza o conteúdo. */
.ti-table tbody tr {
  transition: background var(--t-2) var(--ease), box-shadow var(--t-2) var(--ease-out);
}

.ti-table tbody tr:hover {
  box-shadow: inset 3px 0 0 var(--brand-red);
  cursor: pointer;
}

.ti-table tbody tr:hover td:first-child {
  padding-left: 1.1rem;
}

.ti-table tbody td:first-child {
  transition: padding-left var(--t-2) var(--ease-out);
}

.my-ticket-item {
  transition: background var(--t-2) var(--ease), padding-left var(--t-2) var(--ease-out), box-shadow var(--t-2) var(--ease-out);
}

.my-ticket-item:hover {
  box-shadow: inset 3px 0 0 var(--brand-red);
}

/* Selos e atalhos pequenos. */
.badge,
.file-pill,
.comment-item {
  transition: transform var(--t-2) var(--ease-spring), box-shadow var(--t-2) var(--ease), background var(--t-2) var(--ease);
}

.badge:hover,
.file-pill:hover {
  transform: scale(1.06);
}

.file-pill-link:hover {
  background: var(--surface-soft);
  box-shadow: 0 4px 10px -6px rgba(16, 22, 26, .4);
}

/* Campos: anel vermelho suave ao focar ou passar o mouse. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]),
select,
textarea {
  transition: border-color var(--t-2) var(--ease), box-shadow var(--t-2) var(--ease), background var(--t-2) var(--ease);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):focus,
select:focus,
textarea:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 4px rgba(172, 44, 35, .12);
  outline: none;
}

/* Janelas: fundo suaviza e o quadro "pula" ao abrir. */
@keyframes ti-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes ti-modal-pop {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.modal-overlay:not(.hidden) {
  animation: ti-overlay-in var(--t-2) var(--ease) both;
}

.modal-overlay:not(.hidden):not(.modal-overlay--drawer) .modal {
  animation: ti-modal-pop .32s var(--ease-spring) both;
}

.detail-close {
  transition: transform var(--t-2) var(--ease-spring), background var(--t-2) var(--ease);
}

.detail-close:hover {
  transform: rotate(90deg) scale(1.1);
}

.file-drop-zone {
  transition: transform var(--t-2) var(--ease-out), border-color var(--t-2) var(--ease), background var(--t-2) var(--ease);
}

.file-drop-zone:hover {
  transform: translateY(-2px);
}

/* Ícones do menu e do usuário reagem ao ponteiro. */
.ti-nav-item svg {
  transition: transform var(--t-2) var(--ease-spring), color var(--t-2) var(--ease), opacity var(--t-2) var(--ease);
}

.ti-nav-item:hover svg {
  transform: scale(1.18) rotate(-6deg);
}

@media (prefers-reduced-motion: reduce) {
  .btn:hover:not(:disabled),
  .portal-panel:hover,
  .kanban-card:hover,
  .history-card:hover,
  .badge:hover,
  .file-pill:hover,
  .file-drop-zone:hover,
  .detail-close:hover,
  .ti-nav-item:hover svg {
    transform: none;
  }

  .modal-overlay:not(.hidden),
  .modal-overlay:not(.hidden) .modal {
    animation: none;
  }
}


/* ───────────────────────── Configuracoes (tela do painel, antiga /admin) ───────────────────────── */
#view-configuracoes .cfg-container { margin: 0 auto; max-width: 900px; padding: 1.5rem 1.5rem 6rem; }
#view-configuracoes .cfg-subtitle { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
#view-configuracoes .card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.5rem 1.75rem; margin-bottom: 1.5rem;}
#view-configuracoes .card h2 { font-size: 1.05rem; margin-bottom: .35rem;}
#view-configuracoes .card .card-desc { color: var(--muted); font-size: .82rem; margin-bottom: 1.25rem;}
#view-configuracoes .field { margin-bottom: 1.1rem;}
#view-configuracoes .field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .4rem;}
#view-configuracoes .field input[type=text], #view-configuracoes .field textarea {
      width: 100%; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: .9rem; background: var(--surface); color: var(--text);}
#view-configuracoes .field textarea { resize: vertical; min-height: 64px;}
#view-configuracoes .colors { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem;}
#view-configuracoes .color-field { display: flex; align-items: center; gap: .6rem;}
#view-configuracoes .color-field input[type=color] { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; cursor: pointer; background: none;}
#view-configuracoes .color-field .cf-info { display: flex; flex-direction: column;}
#view-configuracoes .color-field .cf-info span { font-size: .8rem; font-weight: 600;}
#view-configuracoes .color-field .cf-info code { font-size: .72rem; color: var(--muted);}
#view-configuracoes .logo-row { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;}
#view-configuracoes .logo-preview { width: 160px; height: 72px; border: 1px dashed var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--bg); overflow: hidden;}
#view-configuracoes .logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain;}
#view-configuracoes .logo-preview.dark { background: #222d31;}
#view-configuracoes .modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem;}
#view-configuracoes .module-toggle { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--line); border-radius: 8px; padding: .55rem .75rem; cursor: pointer; font-size: .88rem; user-select: none;}
#view-configuracoes .module-toggle input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer;}
#view-configuracoes .module-toggle.off { opacity: .55;}
#view-configuracoes .banner-opts { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; margin-bottom: 1.1rem;}
#view-configuracoes .bn-slide { border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem 0; margin-bottom: 1rem;}
#view-configuracoes .bn-slide.off { opacity: .6;}
#view-configuracoes .bn-slide-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem;}
#view-configuracoes .bn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem;}
#view-configuracoes .bn-img { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem;}
#view-configuracoes .bn-img img { width: 120px; height: 40px; object-fit: cover; border-radius: 6px;}
#view-configuracoes .card { border: 0; border-radius: 22px; }
#view-configuracoes .cfg-savebar { background: var(--bg); bottom: 0; display: flex; gap: .75rem; justify-content: flex-end; padding: .85rem 1.5rem; position: sticky; z-index: 5; }
#view-configuracoes .cfg-toast { background: #12805c; border-radius: 8px; bottom: 5rem; color: #fff; font-size: .88rem; left: 50%; opacity: 0; padding: .6rem 1.2rem; pointer-events: none; position: fixed; transform: translateX(-50%); transition: opacity .3s; z-index: 200; }
#view-configuracoes .cfg-toast.show { opacity: 1; }
#view-configuracoes .cfg-toast.err { background: #b42318; }

/* Campos soltos dentro das janelas do almoxarifado (linhas da nota e inventário). */
.en-linha input,
.en-linha select,
#inv-itens input {
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: .5rem .65rem;
  width: 100%;
}

#inv-itens input {
  width: 90px;
}

#view-configuracoes .cfg-savebar .btn {
  width: auto;
}

/* Linhas de "item novo" (nota e inventário): mesmo visual dos demais campos. */
.inv-novo input,
.en-novo input {
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: .5rem .65rem;
  width: 100%;
}

.inv-novo input:focus,
.en-novo input:focus {
  background: var(--surface);
  border-color: var(--brand-red);
  box-shadow: 0 0 0 4px rgba(172, 44, 35, .12);
  outline: none;
}

.inv-novo input::placeholder,
.en-novo input::placeholder {
  color: var(--faint);
}

.en-linha input:focus,
.en-linha select:focus,
#inv-itens input:focus {
  background: var(--surface);
}

/* Selos de permissão (tela "Acesso à Frota"). */
.fp-chip { background: var(--surface-soft); border-radius: 999px; display: inline-block; font-size: 11px; margin: 0 .25rem .25rem 0; padding: .1rem .55rem; }
.fp-chip.write { background: var(--badge-green-bg); color: var(--badge-green-text); }
.fp-chip.read { background: var(--badge-blue-bg); color: var(--badge-blue-text); }
.fp-chip.none { opacity: .6; }

/* ───────────────────────── Refino visual ─────────────────────────
   Menos enfeite: sem gradiente, brilho nem fio de luz; cantos menores; grade de
   indicadores que não deixa um cartão sozinho na linha de baixo. */
.eyebrow {
  display: none;
}

.metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 900px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) {
  .metric-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.metric-card::after,
.ti-login-card::before,
.btn-primary::after {
  display: none;
}

.btn-primary {
  background: var(--brand-red);
  box-shadow: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-red-dark);
}

.ti-nav-item.active::before {
  background: var(--brand-red);
  box-shadow: none;
}

.metric-card,
.card,
.ti-card,
.modal,
.table-card {
  border-radius: 10px;
}

.btn,
.ti-nav-item,
input,
select,
textarea {
  border-radius: 8px;
}

/* Superfícies sólidas: sem vidro/desfoque, que lavava o conteúdo dos modais. */
:root {
  --glass-strong: #ffffff;
}

body.dark-theme {
  --glass-strong: #1c262a;
}

.ti-topbar,
.ti-table th,
.modal-overlay {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.ti-topbar {
  background: var(--surface);
  box-shadow: none;
}

body.dark-theme .ti-topbar {
  background: var(--surface);
}

.modal-overlay {
  background: rgba(10, 14, 16, 0.45);
}

/* Indicadores da Inteligência: 4 por linha (8 cartões = 2 linhas cheias). */
#view-bi .bi-kpi-row:not([style]) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 1100px) {
  #view-bi .bi-kpi-row:not([style]) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Acessibilidade: foco visível por teclado em links, botões e abas (vários componentes zeravam o outline). */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand-red) !important;
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 1px;
}

/* Modais e gavetas não rolam a página por trás. */
.modal-overlay,
.modal {
  overscroll-behavior: contain;
}

/* Números alinhados em tabelas e indicadores. */
table,
.metric-card-value,
.bi-kpi-value,
.hero-metrics strong {
  font-variant-numeric: tabular-nums;
}

/* Títulos equilibrados e toque sem atraso. */
h1,
h2,
h3 {
  text-wrap: balance;
}

a,
button {
  touch-action: manipulation;
}

/* Portal e painel da T.I.: sem aurora de fundo nem gradientes; cores chapadas. */
body::before,
body.dark-theme::before {
  animation: none;
  background: none;
}

body.ti-login {
  background: var(--bg);
}

.ti-login-icon,
.portal-topbar {
  background: #222d31;
}

.ti-sidebar {
  background: #111517;
}

.portal-panel-header {
  background: var(--surface-soft);
}

.ti-login-card {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: var(--surface);
  border-radius: 14px;
}

/* Item ativo do menu tem fundo vermelho: o ícone fica branco também no hover (antes sumia). */
.ti-nav-item.active:hover svg,
.ti-nav-item.active svg {
  color: #fff;
}

/* ───────────────────────── Chamados: painel por blocos, menu de atalhos e detalhe em tela cheia ───────────────────────── */

/* Seletor de modo de exibição (Painel / Lista / Kanban) */
.seg {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  padding: 2px;
}

.seg-btn {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 22, 26, 0.12);
  color: var(--text);
}

/* Blocos por situação */
.tk-painel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.25rem 0 1.5rem;
}

.tk-bloco {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.tk-bloco-alerta {
  border-color: rgba(172, 44, 35, 0.45);
}

.tk-bloco-topo {
  align-items: center;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  gap: 0.6rem;
  padding: 0.55rem 0.9rem;
  user-select: none;
}

.tk-bloco-alerta .tk-bloco-topo {
  background: rgba(172, 44, 35, 0.1);
}

.tk-bloco-topo h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

.tk-bloco-qtd {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tk-bloco-alerta .tk-bloco-qtd {
  color: var(--brand-red);
  font-weight: 700;
}

.tk-bloco-seta {
  color: var(--muted);
  display: inline-block;
  font-size: 12px;
  transition: transform 0.15s ease;
}

.tk-bloco-seta.fechado {
  transform: rotate(-90deg);
}

/* Tabela densa dentro do bloco */
.tk-denso {
  font-size: 12.5px;
  width: 100%;
}

.tk-denso th {
  font-size: 11px;
  padding: 0.4rem 0.7rem;
  position: static;
}

.tk-denso td {
  padding: 0.32rem 0.7rem;
  vertical-align: middle;
  white-space: nowrap;
}

.tk-denso tbody tr:nth-child(even) {
  background: rgba(16, 22, 26, 0.025);
}

body.dark-theme .tk-denso tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.tk-denso tbody tr {
  cursor: pointer;
}

.tk-col-titulo {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tk-denso .badge {
  font-size: 11px;
  padding: 0.1rem 0.5rem;
}

.tk-mais {
  background: var(--surface);
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 0.5rem;
  width: 100%;
}

.tk-mais:hover {
  color: var(--brand-red);
}

/* Menu do botão direito */
.ctx-menu {
  background: var(--surface);
  border: 1px solid var(--line-strong, rgba(0, 0, 0, 0.18));
  border-radius: 8px;
  box-shadow: 0 8px 24px -8px rgba(16, 22, 26, 0.35);
  min-width: 210px;
  padding: 4px;
  position: fixed;
  z-index: 300;
}

.ctx-titulo {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.6rem;
}

.ctx-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 13px;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  text-align: left;
  width: 100%;
}

.ctx-item:hover,
.ctx-item:focus-visible,
.ctx-sub-wrap:hover > .ctx-item {
  background: var(--surface-soft);
}

.ctx-sep {
  background: var(--line);
  height: 1px;
  margin: 4px 2px;
}

.ctx-seta {
  color: var(--muted);
  margin-left: 1rem;
}

.ctx-sub-wrap {
  position: relative;
}

.ctx-sub {
  background: var(--surface);
  border: 1px solid var(--line-strong, rgba(0, 0, 0, 0.18));
  border-radius: 8px;
  box-shadow: 0 8px 24px -8px rgba(16, 22, 26, 0.35);
  display: none;
  left: 100%;
  min-width: 190px;
  padding: 4px;
  position: absolute;
  top: -5px;
}

.ctx-sub-wrap:hover > .ctx-sub,
.ctx-sub-wrap:focus-within > .ctx-sub {
  display: block;
}

.ctx-esquerda .ctx-sub {
  left: auto;
  right: 100%;
}

/* Chamado aberto em tela cheia (antes: painel lateral espremido ao lado da lista) */
.detail-resize-handle {
  display: none !important;
}

.detail-panel:not(.hidden) {
  background: var(--bg);
  border: 0;
  box-shadow: none;
  inset: 0;
  min-width: 0;
  position: fixed;
  z-index: 150;
}

.detail-panel-topbar {
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0.7rem 2rem;
  position: sticky;
  top: 0;
  z-index: 5;
}

.detail-panel .detail-body {
  margin: 0 auto;
  max-width: 1240px;
  padding: 1.25rem 2rem 2.5rem;
  width: 100%;
}

/* Colunas com a mesma largura em todos os blocos do painel de chamados. */
.tk-denso {
  table-layout: fixed;
}

.tk-denso th:nth-child(1) { width: 104px; }
.tk-denso th:nth-child(3) { width: 94px; }
.tk-denso th:nth-child(4) { width: 148px; }
.tk-denso th:nth-child(5) { width: 118px; }
.tk-denso th:nth-child(6) { width: 118px; }
.tk-denso th:nth-child(7) { width: 86px; }
.tk-denso th:nth-child(8) { width: 142px; }
.tk-denso th:nth-child(9) { width: 112px; }

.tk-denso td {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ───────────────────────── Chamado em tela cheia: conversa à esquerda, dados e gestão à direita ───────────────────────── */
.detail-panel:not(.hidden) {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tkz-topo {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex: 0 0 auto;
  gap: 1rem;
  padding: 0.65rem 1.5rem;
}

.tkz-id {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 0.75rem;
  min-width: 0;
}

.tkz-numero {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
}

.tkz-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tkz-acoes {
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

.tkz-corpo {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 0;
}

/* Coluna da conversa: rola sozinha; a caixa de resposta fica colada no fundo */
.tkz-principal {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.tkz-fio {
  margin: 0 auto;
  max-width: 880px;
  padding: 0 2rem;
  width: 100%;
}

.tkz-titulo {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin: 1.5rem 0 0.75rem;
  text-wrap: balance;
}

.tkz-conversa {
  display: flex;
  flex-direction: column;
}

.tkz-msg {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 36px minmax(0, 1fr);
  padding: 1rem 0;
}

.tkz-msg-origem {
  border-top: 0;
}

.tkz-avatar {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.tkz-avatar.tec {
  background: #222d31;
  border-color: #222d31;
  color: #fff;
}

.tkz-msg-topo {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.6rem;
  margin-bottom: 0.35rem;
}

.tkz-msg-topo time {
  color: var(--muted);
  font-size: 12px;
}

.tkz-tag {
  background: var(--surface-soft);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 0.05rem 0.45rem;
}

.tkz-texto {
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.tkz-vazio {
  color: var(--muted);
  font-size: 13px;
  padding: 1rem 0 1.5rem;
}

/* Nota interna: faixa âmbar para não ser confundida com resposta ao solicitante */
.tkz-interno .tkz-msg-corpo {
  background: rgba(194, 138, 0, 0.09);
  border-left: 3px solid #c28a00;
  border-radius: 0 6px 6px 0;
  padding: 0.6rem 0.85rem;
}

.tkz-interno .tkz-tag {
  background: rgba(194, 138, 0, 0.2);
  color: #8a5d00;
}

body.dark-theme .tkz-interno .tkz-tag {
  color: #e0b04a;
}

.tkz-msg .file-list {
  margin-top: 0.5rem;
}

/* Caixa de resposta */
.tkz-resposta {
  background: var(--bg);
  border-top: 1px solid var(--line);
  bottom: 0;
  margin-top: auto;
  padding: 0.85rem 0 1rem;
  position: sticky;
}

.tkz-form textarea {
  border-radius: 8px;
  min-height: 76px;
  resize: vertical;
}

.tkz-form:has(#dp-comment-interno:checked) textarea {
  background: rgba(194, 138, 0, 0.07);
  border-color: #c28a00;
}

.tkz-form-acoes {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tkz-interno-opcao {
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 12.5px;
  gap: 0.4rem;
}

/* Coluna lateral */
.tkz-lateral {
  background: var(--surface);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 0 1.25rem 1.5rem;
}

.tkz-bloco-lat {
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 0;
}

.tkz-bloco-lat:last-child {
  border-bottom: 0;
}

.tkz-bloco-lat h2 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 0.7rem;
}

.tkz-linha {
  display: flex;
  font-size: 13px;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.28rem 0;
}

.tkz-linha > span:first-child {
  color: var(--muted);
  flex-shrink: 0;
}

.tkz-linha > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.tkz-campo {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 600;
  gap: 0.25rem;
  margin-bottom: 0.7rem;
}

.tkz-campo .detail-select {
  width: 100%;
}

/* Histórico: lista vertical, mais recente primeiro */
.tkz-hist {
  border-left: 2px solid var(--line);
  list-style: none;
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
  padding: 0 0 0 0.9rem;
}

.tkz-hist li {
  font-size: 12.5px;
  padding-bottom: 0.8rem;
  position: relative;
}

.tkz-hist li::before {
  background: var(--brand-red);
  border: 2px solid var(--surface);
  border-radius: 50%;
  content: '';
  height: 9px;
  left: -1.2rem;
  position: absolute;
  top: 0.3rem;
  width: 9px;
}

.tkz-hist-quem {
  font-weight: 600;
}

.tkz-hist time {
  color: var(--muted);
  display: block;
  font-size: 11.5px;
}

.tkz-hist-texto {
  color: var(--muted);
  margin-top: 0.1rem;
  overflow-wrap: anywhere;
}

@media (max-width: 1000px) {
  .tkz-corpo {
    grid-template-columns: minmax(0, 1fr);
    overflow-y: auto;
  }

  .tkz-principal {
    overflow: visible;
  }

  .tkz-lateral {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .tkz-resposta {
    position: static;
  }

  .tkz-topo {
    flex-wrap: wrap;
  }
}

/* Histórico na lateral (logo abaixo de Detalhes): linha do tempo compacta, sem bolinhas cortadas. */
.tkz-hist {
  border-left: 0;
  max-height: 230px;
  padding: 0 0.25rem 0 0;
}

.tkz-hist li {
  padding: 0 0 0.7rem 1.1rem;
}

.tkz-hist li::before {
  left: 0;
  top: 0.35rem;
}

.tkz-hist li::after {
  background: var(--line);
  bottom: 0;
  content: '';
  left: 4px;
  position: absolute;
  top: 1.1rem;
  width: 2px;
}

.tkz-hist li:last-child::after {
  display: none;
}

/* Histórico: faixa horizontal entre a barra do topo e o título do chamado. */
.tkz-faixa-hist {
  margin-top: 1rem;
}

.tkz-faixa-hist h2 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 0.45rem;
}

.tkz-hist-faixa {
  display: flex;
  gap: 0.6rem;
  list-style: none;
  margin: 0;
  overflow-x: auto;
  padding: 0 0 0.4rem;
}

.tkz-hist-faixa li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  flex: 0 0 250px;
  font-size: 12.5px;
  padding: 0.5rem 0.7rem;
}

.tkz-hist-topo {
  align-items: baseline;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}

.tkz-hist-topo .tkz-hist-quem {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tkz-hist-topo time {
  color: var(--muted);
  flex-shrink: 0;
  font-size: 11.5px;
}

.tkz-hist-faixa .tkz-hist-texto {
  -webkit-box-orient: vertical;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  margin-top: 0.2rem;
  overflow: hidden;
}

.tkz-faixa-hist + .tkz-titulo {
  margin-top: 1rem;
}

.tkz-numero {
  white-space: nowrap;
}

/* Histórico em largura total da tela (entre a barra do topo e o conteúdo). */
.tkz-faixa-hist {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  margin: 0;
  padding: 0.6rem 1.5rem 0.35rem;
}

.tkz-hist-faixa li {
  flex: 1 0 260px;
}

.tkz-faixa-hist + .tkz-corpo,
.tkz-faixa-hist ~ .tkz-corpo {
  min-height: 0;
}

.tkz-faixa-hist + .tkz-titulo,
.tkz-titulo {
  margin-top: 1.5rem;
}

/* Histórico compacto: uma linha baixa, título à esquerda e eventos em etiquetas pequenas. */
.tkz-faixa-hist {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  padding: 0.3rem 1.5rem;
}

.tkz-faixa-hist h2 {
  flex: 0 0 auto;
  font-size: 11.5px;
  margin: 0;
}

.tkz-faixa-hist #dp-history {
  flex: 1;
  min-width: 0;
}

.tkz-hist-faixa {
  gap: 0.4rem;
  padding: 0;
  scrollbar-width: thin;
}

.tkz-hist-faixa li {
  align-items: baseline;
  background: var(--surface);
  border-radius: 6px;
  display: flex;
  flex: 0 0 auto;
  font-size: 11.5px;
  gap: 0.4rem;
  line-height: 1.4;
  padding: 0.18rem 0.55rem;
  white-space: nowrap;
}

.tkz-hist-faixa .tkz-hist-quem {
  font-weight: 700;
}

.tkz-hist-faixa time {
  color: var(--muted);
}

.tkz-hist-faixa .tkz-hist-texto {
  -webkit-line-clamp: unset;
  color: var(--muted);
  display: block;
  line-clamp: unset;
  margin: 0;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Histórico como linha do tempo animada (sem barra de rolagem visível). */
.tkz-faixa-hist {
  align-items: flex-start;
  padding: 0.55rem 1.5rem 0.5rem;
}

.tkz-faixa-hist h2 {
  padding-top: 0.1rem;
}

.tkz-hist-faixa {
  gap: 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.tkz-hist-faixa::-webkit-scrollbar {
  display: none;
}

.tkz-hist-faixa li {
  background: none;
  border: 0;
  border-radius: 0;
  display: block;
  flex: 1 0 210px;
  line-height: 1.35;
  padding: 1.15rem 0.9rem 0 0;
  position: relative;
  white-space: normal;
  animation: tkz-surge 0.45s ease-out both;
  animation-delay: calc(var(--i, 0) * 110ms);
}

.tkz-hist-faixa li::before {
  animation: tkz-linha 0.55s ease-out both;
  animation-delay: calc(var(--i, 0) * 110ms + 120ms);
  background: var(--line-strong, rgba(0, 0, 0, 0.18));
  content: '';
  height: 2px;
  left: 6px;
  position: absolute;
  right: 0;
  top: 5px;
  transform-origin: left center;
}

.tkz-hist-faixa li:last-child::before {
  display: none;
}

.tkz-ponto {
  animation: tkz-pop 0.4s ease-out both;
  animation-delay: calc(var(--i, 0) * 110ms + 60ms);
  background: var(--muted);
  border: 2px solid var(--bg);
  border-radius: 50%;
  box-sizing: content-box;
  height: 8px;
  left: 0;
  position: absolute;
  top: 1px;
  width: 8px;
  z-index: 1;
}

.tkz-hist-faixa li:last-child .tkz-ponto {
  background: var(--brand-red);
}

.tkz-hist-info {
  align-items: baseline;
  display: flex;
  gap: 0.45rem;
}

.tkz-hist-faixa .tkz-hist-texto {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

/* A coluna lateral rola sem mostrar a barra (a roda do mouse continua funcionando). */
.tkz-lateral {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.tkz-lateral::-webkit-scrollbar {
  display: none;
}

@keyframes tkz-surge {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes tkz-linha {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes tkz-pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .tkz-hist-faixa li,
  .tkz-hist-faixa li::before,
  .tkz-ponto {
    animation: none;
  }
}

/* Coluna lateral compacta: cabe numa tela só, sem rolar. */
.tkz-lateral {
  padding: 0 1.1rem 1rem;
}

.tkz-bloco-lat {
  padding: 0.75rem 0;
}

.tkz-bloco-lat h2 {
  margin-bottom: 0.45rem;
}

.tkz-linha {
  font-size: 12.5px;
  padding: 0.16rem 0;
}

.tkz-grade {
  display: grid;
  gap: 0.5rem 0.6rem;
  grid-template-columns: 1fr 1fr;
}

.tkz-grade .tkz-campo {
  margin-bottom: 0;
}

.tkz-campo-largo {
  grid-column: 1 / -1;
}

.tkz-campo .detail-select {
  font-size: 13px;
  padding: 0.38rem 0.55rem;
}

.tkz-pcs summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
}

.tkz-pcs summary::-webkit-details-marker {
  display: none;
}

.tkz-pcs summary::before {
  content: '▸ ';
}

.tkz-pcs[open] summary::before {
  content: '▾ ';
}

.tkz-pcs[open] summary {
  margin-bottom: 0.5rem;
}

/* ───────── Conversa do chamado: mensagens em cartões e grafismos da marca ───────── */
.tkz-principal {
  background: url('/assets/brand/grafismo-chamado.png') right 1rem center / min(860px, 92%) auto no-repeat;
  background-attachment: local;
}

body.dark-theme .tkz-principal {
  background-image: url('/assets/brand/grafismo-chamado-escuro.png');
}

.tkz-lateral {
  background: var(--surface) url('/assets/brand/grafismo-chamado.png') right -90px bottom -40px / 520px auto no-repeat;
  background-attachment: local;
}

body.dark-theme .tkz-lateral {
  background-image: url('/assets/brand/grafismo-chamado-escuro.png');
}

.tkz-titulo {
  border-left: 4px solid var(--brand-red);
  padding-left: 0.75rem;
}

.tkz-msg {
  border-top: 0;
  padding: 0.55rem 0;
}

.tkz-msg-corpo {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(16, 22, 26, 0.05);
  padding: 0.8rem 1rem;
}

.tkz-msg:has(.tkz-avatar.tec) .tkz-msg-corpo {
  border-left: 3px solid #222d31;
}

.tkz-interno .tkz-msg-corpo {
  background: rgba(194, 138, 0, 0.1);
  border-color: rgba(194, 138, 0, 0.35);
  border-left: 3px solid #c28a00;
}

.tkz-extras {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-top: 0.9rem;
}

.tkz-extras:empty {
  display: none;
}

.tkz-extra {
  background: var(--surface-soft);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.7rem;
}

.tkz-extra span {
  color: var(--muted);
  font-size: 11.5px;
}

.tkz-extra strong {
  font-size: 13px;
  font-weight: 600;
}

.tkz-vazio {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 2.5rem 0 3rem;
  text-align: center;
}

.tkz-vazio svg {
  opacity: 0.5;
}

.tkz-vazio p {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  margin: 0.4rem 0 0;
}

.tkz-vazio span {
  font-size: 12.5px;
}

/* Caixa de resposta como um cartão único */
.tkz-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(16, 22, 26, 0.06);
  padding: 0.6rem 0.75rem;
}

.tkz-form textarea {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0.25rem;
}

.tkz-form textarea:focus {
  box-shadow: none;
}

.tkz-form:has(#dp-comment-interno:checked) {
  background: rgba(194, 138, 0, 0.09);
  border-color: #c28a00;
}

.tkz-form:has(#dp-comment-interno:checked) textarea {
  background: transparent;
  border: 0;
}

/* Uma arte só: o grafismo hexagonal, maior, no fundo da conversa. Lateral sem grafismo. */
.tkz-principal {
  background-position: right -80px center;
  background-size: min(1500px, 150%) auto;
}

.tkz-lateral,
body.dark-theme .tkz-lateral {
  background: var(--surface);
}

.tkz-tag-ti {
  background: #222d31;
  color: #fff;
}

body.dark-theme .tkz-tag-ti {
  background: #e6ebed;
  color: #222d31;
}

/* Marca "T.I." nas listas: chamado aberto pela T.I. em nome da pessoa. */
.tk-ti {
  background: #222d31;
  border-radius: 4px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  margin-right: 0.4rem;
  padding: 0.05rem 0.35rem;
  vertical-align: 1px;
}

body.dark-theme .tk-ti {
  background: #e6ebed;
  color: #222d31;
}

/* ───────────────────────── Kanban de chamados ───────────────────────── */
#tickets-kanban-wrap {
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.tk-board {
  align-items: stretch;
  display: flex;
  flex: 1;
  gap: 0.85rem;
  min-height: 0;
  overflow-x: auto;
  padding: 0.15rem 0.1rem 0.6rem;
}

.tk-col {
  --col: #6b7780;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-height: 0;
  min-width: 205px;
  overflow: hidden;
}

.tk-col-aberto { --col: #ac2c23; }
.tk-col-em_atendimento { --col: #2f6fbd; }
.tk-col-aguardando { --col: #c28a00; }
.tk-col-resolvido { --col: #2e7d4f; }
.tk-col-fechado { --col: #6b7780; }

.tk-col-head {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--col);
  display: flex;
  flex: 0 0 auto;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
}

.tk-col-ponto {
  background: var(--col);
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.tk-col-head h3 {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

.tk-count {
  background: var(--surface-soft);
  border-radius: 99px;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding: 0.05rem 0.55rem;
}

.tk-col-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
  overflow-y: auto;
  padding: 0.6rem;
  scrollbar-width: thin;
}

.tk-col-body.drag-over {
  background: rgba(172, 44, 35, 0.07);
  outline: 2px dashed var(--col);
  outline-offset: -4px;
}

.tk-card {
  --prio: #c28a00;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--prio);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 22, 26, 0.05);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem 0.7rem;
  transition: box-shadow 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.tk-card[draggable='true'] {
  cursor: grab;
}

.tk-card.prio-urgente { --prio: #b42318; }
.tk-card.prio-alta { --prio: #d9640f; }
.tk-card.prio-media { --prio: #c28a00; }
.tk-card.prio-baixa { --prio: #4c8f5a; }

.tk-card:hover {
  box-shadow: 0 4px 12px rgba(16, 22, 26, 0.14);
  transform: translateY(-1px);
}

.tk-card:focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

.tk-card.dragging {
  opacity: 0.45;
  transform: rotate(1.2deg);
}

.tk-card-alerta {
  border-color: rgba(180, 35, 24, 0.55);
  border-left-color: #b42318;
}

.tk-card-topo {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tk-card-num {
  color: var(--muted);
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
}

.tk-sla {
  background: var(--surface-soft);
  border-radius: 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  margin-left: auto;
  padding: 0.05rem 0.4rem;
}

.tk-sla-atraso {
  background: rgba(180, 35, 24, 0.14);
  color: #b42318;
}

.tk-sla-perto {
  background: rgba(194, 138, 0, 0.18);
  color: #8a5d00;
}

body.dark-theme .tk-sla-atraso { color: #ff8b80; }
body.dark-theme .tk-sla-perto { color: #e0b04a; }

.tk-card-title {
  -webkit-box-orient: vertical;
  display: -webkit-box;
  font-size: 13px;
  font-weight: 600;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.35;
  overflow: hidden;
}

.tk-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tk-card-tags .badge {
  font-size: 10.5px;
  padding: 0.05rem 0.45rem;
}

.tk-tag {
  background: var(--surface-soft);
  border-radius: 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 0.05rem 0.45rem;
}

.tk-card-pe {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 11.5px;
  gap: 0.3rem 0.5rem;
  padding-top: 0.45rem;
}

.tk-pessoa {
  align-items: center;
  display: inline-flex;
  gap: 0.3rem;
}

.tk-av {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  display: inline-flex;
  font-size: 9.5px;
  font-weight: 700;
  height: 20px;
  justify-content: center;
  width: 20px;
}

.tk-av.tec {
  background: #222d31;
  border-color: #222d31;
  color: #fff;
}

body.dark-theme .tk-av.tec {
  background: #e6ebed;
  border-color: #e6ebed;
  color: #222d31;
}

.tk-sem-resp {
  font-style: italic;
}

.tk-extras-pe {
  align-items: center;
  display: inline-flex;
  gap: 0.5rem;
  margin-left: auto;
}

.tk-idade {
  font-variant-numeric: tabular-nums;
}

.tk-empty {
  border: 1px dashed var(--line-strong, rgba(0, 0, 0, 0.18));
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  padding: 1rem 0.5rem;
  text-align: center;
}

.tk-col-body .tk-mais {
  background: transparent;
  border: 0;
  border-radius: 6px;
}

/* ───────── Kanban de atividades: mesmo desenho do Kanban de chamados ───────── */
.tk-col-backlog { --col: #6b7780; }
.tk-col-a_fazer { --col: #2f6fbd; }
.tk-col-em_andamento { --col: #c28a00; }
.tk-col-teste { --col: #7a4fb0; }
.tk-col-concluido { --col: #2e7d4f; }

.tk-card {
  position: relative;
}

.tk-card-acoes {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: none;
  gap: 0.1rem;
  padding: 2px;
  position: absolute;
  right: 0.4rem;
  top: 0.4rem;
}

.tk-card:hover .tk-card-acoes,
.tk-card:focus-within .tk-card-acoes {
  display: flex;
}

.tk-card-acoes button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.tk-card-acoes button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.tk-card-acoes button.perigo:hover {
  color: #b42318;
}

.tk-chamado {
  background: var(--surface-soft);
  border-radius: 4px;
  color: var(--brand-red);
  cursor: pointer;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
}

.tk-chamado:hover {
  text-decoration: underline;
}

.tk-sub {
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  gap: 0.5rem;
}

.tk-sub-barra {
  background: var(--surface-soft);
  border-radius: 99px;
  flex: 1;
  height: 5px;
  overflow: hidden;
}

.tk-sub-fill {
  background: #2e7d4f;
  border-radius: 99px;
  height: 100%;
  transition: width 0.25s ease;
}

.tk-sublista {
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.4rem;
}

.tk-subitem {
  align-items: flex-start;
  cursor: pointer;
  display: flex;
  font-size: 12px;
  gap: 0.4rem;
}

.tk-subitem .feita {
  color: var(--muted);
  text-decoration: line-through;
}

.tk-add {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 0.55rem;
  width: 100%;
}

.tk-add:hover {
  background: var(--surface);
  color: var(--brand-red);
}

#kanban-board.tk-board {
  padding-right: 1.5rem;
}

/* ── Ausencias (aprovacao de pedidos de "Registrar ausencia") ───────────── */
.nav-contador {
  background: var(--brand-red, #ac2c23);
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  margin-left: auto;
  padding: 3px 7px;
}
/* As classes "aus-*" abaixo sao compartilhadas pelas abas Ausencias e Compras
   (mesmo visual de fila de aprovacao, modulos distintos). */
.nav-contador.hidden,
.aus-mensagem.hidden,
.aus-detalhe.hidden,
.aus-decisao.hidden { display: none; }

.aus-resumo {
  display: grid;
  gap: .6rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1rem;
}
.aus-resumo-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 2px;
  padding: .7rem .9rem;
  text-align: left;
}
.aus-resumo-item:hover { border-color: rgba(172,44,35,.35); }
.aus-resumo-item strong { font-size: 20px; }
.aus-resumo-item span { color: var(--muted); font-size: 12px; }

.aus-mensagem {
  background: var(--badge-green-bg);
  border-radius: 8px;
  color: var(--badge-green-text);
  font-size: 13px;
  margin: 0 0 .8rem;
  padding: .55rem .8rem;
}
.aus-mensagem.is-erro { background: var(--badge-red-bg); color: var(--badge-red-text); }

/* A regra base .btn-primary traz width:100%; aqui os botoes ficam do tamanho do texto. */
#view-ausencias .btn { width: auto; }
#ausencias-table-wrap { overflow-x: auto; }
.aus-tabela td { vertical-align: top; }
.aus-acoes { display: flex; flex-wrap: wrap; gap: .35rem; }
.aus-aviso { margin-top: .3rem; }
.aus-recusar:hover { color: var(--badge-red-text); }
.aus-detalhe td { background: var(--surface-soft); }
.aus-detalhe-corpo { display: grid; gap: .45rem; font-size: 13px; }
.aus-detalhe-corpo p { margin: 0; }
.aus-historico {
  border-left: 2px solid var(--line);
  display: grid;
  gap: .25rem;
  list-style: none;
  margin: 0;
  padding: 0 0 0 .7rem;
}
.aus-historico time { color: var(--muted); }
.aus-decisao { align-items: center; display: flex; flex-wrap: wrap; gap: .45rem; }
.aus-decisao input { flex: 1 1 260px; min-width: 0; width: auto; }

@media (max-width: 760px) {
  .aus-resumo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.aus-config.hidden { display: none; }
.aus-config {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
}
.aus-config h2 { font-size: 15px; margin: 0 0 .8rem; }
.aus-config-grade { display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.aus-config-rotulo { font-size: 13px; font-weight: 600; margin: 0 0 .2rem; }
.aus-config-grade p { margin: 0 0 .5rem; }
.aus-config-aprovadores { display: grid; gap: .35rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.aus-config-pessoa {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  font-size: 13px;
  gap: .45rem;
  padding: .4rem .55rem;
}
.aus-config-pessoa small { color: var(--muted); margin-left: auto; }
.aus-config-pessoa:has(input:checked) { border-color: rgba(172,44,35,.45); background: rgba(172,44,35,.05); }
.aus-config-campos { display: grid; align-content: start; gap: .35rem; }
.aus-config-campos label { display: grid; font-size: 13px; font-weight: 600; gap: .3rem; }
.aus-config-acoes { display: flex; gap: .5rem; margin-top: .4rem; }

@media (max-width: 760px) {
  .aus-config-grade { grid-template-columns: minmax(0, 1fr); }
}

.aus-config-campos label.aus-config-teste { align-items: center; display: flex; font-weight: 600; gap: .45rem; margin-top: .4rem; }
