/*
 * LummiGestão — casca administrativa.
 *
 * Reutiliza todos os tokens e componentes de main.css (tabelas, badges, botões,
 * modais, fila de chamados) e sobrescreve apenas a "casca": a barra lateral fica
 * escura para que ninguém confunda o painel interno com o portal do cliente.
 */

.sidebar {
  background: var(--night);
  border-right: 1px solid rgba(255, 255, 255, .07);
}
.sidebar .nav-label { color: rgba(255, 255, 255, .34); }
.sidebar .nav-item { color: rgba(255, 255, 255, .62); }
.sidebar .nav-item:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.sidebar .nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(114, 87, 238, .34), rgba(114, 87, 238, .12));
  box-shadow: inset 3px 0 0 var(--violet);
  font-weight: 700;
}
.sidebar .nav-count { color: rgba(255, 255, 255, .66); background: rgba(255, 255, 255, .09); }
.sidebar .nav-item.active .nav-count { color: #fff; background: rgba(255, 255, 255, .18); }

.gestao-badge {
  margin-left: 5px; padding: 4px 9px; border-radius: 7px;
  background: rgba(114, 87, 238, .25); color: #c3b4ff;
  font-size: .62rem; font-weight: 800; letter-spacing: .1em;
}
.sidebar-signature {
  margin-top: auto; padding: 15px 13px 4px; border-top: 1px solid rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .38); font-size: .68rem; line-height: 1.5;
}
.sidebar-signature strong { display: block; color: rgba(255, 255, 255, .78); font-size: .74rem; }

/* --- Cockpit: cada indicador é um atalho para a lista já filtrada --- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 26px; }
.kpi-card {
  display: block; width: 100%; text-align: left; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); transition: .18s ease; cursor: pointer;
}
.kpi-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.kpi-card[data-tone="alert"] { border-color: #f4cdd2; background: linear-gradient(180deg, #fff, var(--red-soft)); }
.kpi-card[data-tone="warn"] { border-color: #f6dcc4; background: linear-gradient(180deg, #fff, var(--orange-soft)); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-top span:first-child { color: var(--muted); font-size: .72rem; font-weight: 600; }
.kpi-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--violet); background: var(--violet-soft); }
.kpi-card[data-tone="alert"] .kpi-icon { color: var(--red); background: #fff; }
.kpi-card[data-tone="warn"] .kpi-icon { color: var(--orange); background: #fff; }
.kpi-card strong { display: block; margin: 14px 0 4px; font: 800 1.6rem "Manrope", sans-serif; letter-spacing: -.04em; }
.kpi-card small { color: var(--muted-light); font-size: .69rem; }

.attention-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.attention-list { display: flex; flex-direction: column; }
.attention-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 13px 4px; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer;
}
.attention-row:last-child { border-bottom: 0; }
.attention-row:hover { background: var(--surface-2); }
.attention-row > div { flex: 1; min-width: 0; }
.attention-row strong { display: block; color: var(--ink); font-size: .78rem; }
.attention-row small { color: var(--muted); font-size: .69rem; }

/* --- Ficha do cliente: reúne numa tela o que antes exigia cruzar 4 tabelas --- */
.sheet-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  padding: 22px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.sheet-identity { display: flex; align-items: center; gap: 15px; }
.sheet-avatar {
  width: 54px; height: 54px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 15px; color: #fff; background: linear-gradient(145deg, #2a1d63, var(--violet));
  font: 800 1.05rem "Manrope", sans-serif;
}
.sheet-identity h1 { font-size: 1.4rem; margin: 0 0 5px; }
.sheet-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: .74rem; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; align-items: start; }
.sheet-panel .panel-heading { margin-bottom: 12px; }
.sheet-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.sheet-line:last-child { border-bottom: 0; }
.sheet-line > div { min-width: 0; }
.sheet-line strong { display: block; color: var(--ink); font-size: .78rem; }
.sheet-line small { color: var(--muted); font-size: .69rem; }

/* --- Barra de filtros das listas --- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 15px 19px; }
.filter-bar select {
  min-height: 36px; padding: 0 10px; border: 1px solid var(--line-strong);
  border-radius: 9px; background: #fff; color: var(--ink); font-size: .74rem;
}
.filter-bar .search-field { flex: 1; min-width: 200px; }
.filter-bar .search-field input { width: 100%; }

/* --- Fila de chamados: no painel interno quem responde é o suporte, então a
       bolha destacada à direita é a da equipe (o inverso do portal do cliente). --- */
.gestao-thread .message.support {
  margin-left: auto; color: #fff; background: var(--violet); border-color: var(--violet);
  border-radius: 14px 5px 14px 14px;
}
.gestao-thread .message.support .message-author span { color: rgba(255, 255, 255, .62); }
.gestao-thread .message.client {
  margin-left: 0; margin-right: auto; color: var(--ink); background: #fff;
  border-color: var(--line); border-radius: 5px 14px 14px;
}
.gestao-thread .message.client .message-author span { color: var(--muted-light); }

.ticket-item .ticket-org { display: block; color: var(--violet-dark); font-size: .68rem; font-weight: 700; margin-top: 3px; }
.ticket-waiting {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 6px;
  padding: 2px 7px; border-radius: 6px; background: var(--orange-soft); color: #b76627;
  font-size: .62rem; font-weight: 800;
}
.internal-notes { padding: 14px; border-top: 1px solid var(--line); background: #fffdf5; }
.internal-notes label { display: block; margin-bottom: 7px; color: #8a6d1f; font-size: .68rem; font-weight: 800; letter-spacing: .06em; }
.internal-notes textarea {
  width: 100%; min-height: 62px; resize: vertical; padding: 10px;
  border: 1px solid #ecdcb0; border-radius: 9px; background: #fff; outline: none;
}
.internal-notes textarea:focus { border-color: var(--orange); }
.ticket-toolbar { display: flex; flex-wrap: wrap; gap: 9px; padding: 13px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.ticket-toolbar select { min-height: 34px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font-size: .72rem; }

@media (max-width: 900px) {
  .sheet-header { flex-direction: column; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
