/* Results and Works Desk — Spec 032 UI aprovada Roger 2026-06-28 */

.shell--v2 .main:has(#view-tickets.view.active) > .page-header {
  display: none !important;
}

#view-tickets.view.active {
  max-width: none;
  width: 100%;
  min-width: 0;
}

#view-tickets.view.active #tickets-rwd-root,
#view-tickets.view.active .rwd-page {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.rwd-header h2 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a3328;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}

.rwd-header__label {
  margin: 0 0 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
}

.rwd-header__sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.rwd-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.rwd-header__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.rwd-kpi-section__title,
.rwd-kpi-section h3 {
  margin: 0 0 0.55rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #3d3027;
}

.rwd-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.2rem;
  width: 100%;
}

@media (max-width: 1100px) {
  .rwd-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .rwd-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.rwd-kpi-card {
  background-color: #f4efe9;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(92, 74, 62, 0.05) 0,
    rgba(92, 74, 62, 0.05) 1px,
    transparent 1px,
    transparent 4px
  );
  border: 1px solid #d4c9bc;
  border-radius: 10px;
  padding: 0.55rem 0.65rem 0.65rem;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 1px 4px rgba(61, 48, 39, 0.06);
  min-width: 0;
  max-width: none;
  width: 100%;
}

.rwd-kpi-card__label {
  display: block;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1f150f;
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.rwd-kpi-card__body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.rwd-kpi-card__body--gauge {
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0.05rem;
}

.rwd-kpi-card__body--metric {
  align-items: center;
  justify-content: center;
}

.rwd-kpi-card__body--bars {
  align-items: flex-end;
  justify-content: stretch;
}

.rwd-kpi-card__value {
  font-size: 2.35rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #1a1410;
  line-height: 1;
  text-align: center;
}

.rwd-kpi-card__value--danger {
  color: #c0392b;
  font-size: 2.75rem;
}

.rwd-gauge {
  position: relative;
  width: 100%;
  max-width: none;
  height: 58px;
  margin: 0 auto;
}

.rwd-gauge__svg {
  width: 100%;
  height: 100%;
  display: block;
}

.rwd-gauge__pct {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  font-size: 1.45rem;
  font-weight: 900;
  color: #1a1410;
  line-height: 1;
}

/* Barras verticais — mockup KPI Overview */
.rwd-vbars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.3rem;
  width: 100%;
  align-items: end;
  height: 78px;
}

.rwd-vbars__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-width: 0;
}

.rwd-vbars__count {
  font-size: 0.7rem;
  font-weight: 900;
  color: #1a1410;
  margin-bottom: 0.12rem;
  line-height: 1;
}

.rwd-vbars__track {
  flex: 1;
  width: 100%;
  max-width: 36px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-bottom: 1px solid rgba(61, 48, 39, 0.25);
}

.rwd-vbars__bar {
  width: 100%;
  min-height: 4px;
  border-radius: 2px 2px 0 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 2px 0 rgba(61, 48, 39, 0.15);
}

.rwd-vbars__bar--critical { background: linear-gradient(180deg, #e74c3c 0%, #922b21 100%); }
.rwd-vbars__bar--high { background: linear-gradient(180deg, #f39c12 0%, #d35400 100%); }
.rwd-vbars__bar--warn { background: linear-gradient(180deg, #f1c40f 0%, #d4ac0d 100%); }
.rwd-vbars__bar--info { background: linear-gradient(180deg, #85c1e9 0%, #3498db 100%); }

.rwd-vbars__label {
  margin-top: 0.18rem;
  font-size: 0.48rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #3d3027;
  text-align: center;
  line-height: 1.1;
}

#view-tickets .toolbar {
  display: none !important;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.35rem;
}
#view-tickets.rwd-filters-open .toolbar {
  display: flex !important;
}

#view-tickets .grid-2 {
  display: none !important;
}

.rwd-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  width: 100%;
}

.rwd-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
}

#view-tickets.view.active .rwd-kpi-section,
#view-tickets.view.active .rwd-kpi-grid {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.rwd-table-wrap {
  background: #fffdf9;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  box-shadow: 0 2px 12px rgba(92, 46, 46, 0.05);
}

.rwd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.rwd-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid var(--border);
  background: rgba(245, 240, 232, 0.6);
  white-space: nowrap;
}

.rwd-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid rgba(224, 213, 200, 0.65);
  vertical-align: top;
}

.rwd-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.rwd-table tbody tr:hover { background: rgba(92, 46, 46, 0.04); }
.rwd-table tbody tr.selected { background: rgba(92, 46, 46, 0.08); }

.rwd-score-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 7rem;
}

.rwd-status-pill {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  width: fit-content;
}
.rwd-status-pill--open { background: #ffedd5; color: #c2410c; }
.rwd-status-pill--escalated { background: #fee2e2; color: #b91c1c; }
.rwd-status-pill--assisting { background: #dbeafe; color: #1d4ed8; }
.rwd-status-pill--resolved { background: #dcfce7; color: #15803d; }
.rwd-status-pill--closed { background: #f1f5f9; color: #64748b; }
.rwd-status-pill--stale { background: #fef3c7; color: #b45309; }
.rwd-status-pill--live { background: #dcfce7; color: #15803d; }
.rwd-status-pill--off { background: #f1f5f9; color: #64748b; }

.rwd-vo-score {
  font-size: 1.35rem;
  font-weight: 800;
  color: #dc2626;
  line-height: 1;
}

.rwd-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.12rem 0.38rem;
  border-radius: 4px;
  margin-right: 0.25rem;
}
.rwd-tag--security { background: #fecaca; color: #991b1b; }
.rwd-tag--onboard { background: #dbeafe; color: #1e40af; }

.rwd-sla-line {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.2rem;
}

.rwd-detail-title {
  font-weight: 700;
  color: #1e293b;
}

.rwd-detail-sub {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.rwd-idle-warn { color: #ea580c; font-weight: 600; }
.rwd-agent-empty { color: #94a3b8; font-size: 0.75rem; }

.rwd-alerts {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 150;
  width: min(340px, calc(100vw - 2rem));
  background: #fffdf9;
  border: 1px solid #fecaca;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(92, 46, 46, 0.15);
  overflow: hidden;
}

.rwd-alerts__head {
  background: linear-gradient(90deg, #991b1b, #dc2626);
  color: #fff;
  padding: 0.45rem 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rwd-alerts__list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  max-height: 220px;
  overflow-y: auto;
}

.rwd-alerts__list li {
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(224, 213, 200, 0.5);
  cursor: pointer;
}

.rwd-alerts__list li:hover { background: rgba(92, 46, 46, 0.04); }
.rwd-alerts__list li strong { display: block; color: #1e293b; font-size: 0.8rem; }
.rwd-alerts__list li span { color: #64748b; font-size: 0.72rem; }

.rwd-detail-drawer {
  position: fixed;
  top: 58px;
  right: 0;
  width: min(420px, 96vw);
  height: calc(100vh - 58px);
  background: #fffdf9;
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(92, 46, 46, 0.1);
  z-index: 140;
  overflow-y: auto;
  padding: 1rem;
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.rwd-detail-drawer.open { transform: translateX(0); }

.rwd-detail-drawer__close {
  float: right;
}

.shell--v2 .main.main--rwd-tickets .page-header {
  display: none;
}

/* ── Ticket ASM Modal (Spec 010) — overlay centrado, não inline ── */
.ticket-drawer {
  position: fixed;
  inset: 0;
  z-index: 1450;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem;
}

.ticket-drawer.hidden {
  display: none !important;
}

body.ticket-drawer-open {
  overflow: hidden;
}

.ticket-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 12, 14, 0.58);
  backdrop-filter: blur(3px);
}

.ticket-drawer-panel {
  position: relative;
  width: min(100%, 1120px);
  max-height: min(92vh, 960px);
  background: #fffdf9;
  border: 1px solid rgba(92, 46, 46, 0.14);
  border-radius: 14px;
  box-shadow: 0 28px 70px rgba(42, 37, 32, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ticketModalIn 0.22s ease;
}

@keyframes ticketModalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.ticket-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fffdf9 0%, #faf6f0 100%);
  flex-shrink: 0;
}

.ticket-drawer-eyebrow {
  margin: 0 0 0.22rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #1d4e89;
}

.ticket-drawer-header h2 {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 700;
  color: #3a3530;
  letter-spacing: -0.02em;
}

.ticket-drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.25rem 1.35rem;
}

.ticket-modal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.65rem;
}

.ticket-modal-asm-badge {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1d4e89;
  background: #e8f0fd;
  border: 1px solid rgba(29, 78, 137, 0.22);
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
}

.ticket-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.ticket-detail-layout--assist {
  grid-template-columns: 1fr;
}

.ticket-detail-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.ticket-detail-section h4 {
  margin: 0 0 0.6rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5c2e2e;
}

.ticket-detail-section--wide .assist-panel {
  margin: 0;
}

.ticket-detail-footer-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.ticket-drawer-body .ticket-detail-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fffdf9;
  padding-top: 0.15rem;
}

.ticket-mirror {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ticket-mirror-lead {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.ticket-mirror-screen {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.ticket-mirror-screen__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: #f5f2ed;
  border-bottom: 1px solid var(--border);
}

.ticket-mirror-step {
  font-size: 0.76rem;
  font-weight: 600;
  color: #5c2e2e;
}

.ticket-mirror-kv {
  padding: 0.65rem 0.75rem;
}

.ticket-mirror-error {
  margin: 0 0.75rem 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: #fde8e8;
  border: 1px solid rgba(220, 38, 38, 0.25);
  font-size: 0.82rem;
}

.ticket-mirror-error p { margin: 0.25rem 0 0; }

.ticket-mirror-modals,
.ticket-mirror-infra {
  margin: 0 0.75rem 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.ticket-mirror-terminal {
  margin: 0 0.75rem 0.75rem;
  border: 1px solid #2a2520;
  border-radius: 8px;
  background: #1a1816;
  overflow: hidden;
}

.ticket-mirror-terminal__head {
  padding: 0.35rem 0.55rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
  background: #252220;
  border-bottom: 1px solid #333;
}

.ticket-mirror-log-list {
  list-style: none;
  margin: 0;
  padding: 0.45rem 0.55rem;
  max-height: 180px;
  overflow: auto;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
}

.ticket-mirror-log {
  color: #d1d5db;
  padding: 0.12rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ticket-mirror-log time {
  color: #6b7280;
  margin-right: 0.35rem;
}

.ticket-mirror-log--error { color: #fca5a5; }
.ticket-mirror-log--warn { color: #fcd34d; }

.ticket-mirror-hint {
  padding: 0.75rem;
  background: #eff6ff;
  border: 1px solid rgba(29, 78, 137, 0.2);
  border-radius: 8px;
  font-size: 0.84rem;
}

.ticket-mirror-updated {
  margin: 0;
  padding: 0 0.75rem 0.65rem;
}

@media (max-width: 860px) {
  .ticket-drawer-panel {
    width: 100%;
    max-height: 96vh;
    border-radius: 12px 12px 0 0;
    align-self: flex-end;
  }
  .ticket-detail-layout {
    grid-template-columns: 1fr;
  }
}
