:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(22, 30, 49, 0.7);
  --bg-card-hover: rgba(30, 41, 67, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* BARRA DE ALERTAS CONTINUA EM MOVIMENTO (GC DE TV / TICKER) */
.btn-quick-photo-add {
  transition: transform 0.2s ease, background 0.2s ease;
}
.btn-quick-photo-add:hover {
  transform: scale(1.08);
  background: var(--accent-purple) !important;
}
.ticker-wrap {
  width: 100%;
  background: linear-gradient(90deg, #881337, #991b1b, #0f172a);
  border-bottom: 2px solid var(--accent-red);
  color: #fff;
  height: 42px;
  display: flex;
  align-items: center;
  overflow: hidden;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.ticker-label {
  background: var(--accent-red);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  letter-spacing: 0.5px;
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
  z-index: 10;
  flex-shrink: 0;
}

.ticker-move-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.ticker-move {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: ticker-anim 60s linear infinite;
}

.ticker-move:hover {
  animation-play-state: paused;
}

.ticker-item {
  font-size: 13px;
  font-weight: 600;
  padding-right: 50px;
}

.ticker-item strong {
  color: #fef08a;
}

.ticker-item .ticker-risk {
  color: #fca5a5;
}

@keyframes ticker-anim {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-100%, 0, 0); }
}

/* ESTILOS DO MAPA DO SETOR TÉCNICO (CANVAS & PINS) */
.map-stage-container {
  position: relative;
  width: 100%;
  height: 600px;
  background: radial-gradient(circle at 1px 1px, #1a2439 1px, transparent 1px) 0 0/22px 22px, #0a0f1c;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: auto;
}

.map-stage-inner {
  position: relative;
  min-width: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-image-display {
  max-width: 100%;
  max-height: 100%;
  display: block;
  user-select: none;
  pointer-events: auto;
}

.map-pin-marker {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  z-index: 25;
}

.map-pin-marker .stem {
  width: 2px;
  height: 14px;
  background: var(--accent-cyan);
}

.map-pin-marker .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #0b0f19;
  box-shadow: 0 0 0 1px var(--border-color), 0 0 12px rgba(6, 182, 212, 0.6);
  position: relative;
}

.map-pin-marker[data-status="ok"] .dot { background: var(--accent-green); color: var(--accent-green); }
.map-pin-marker[data-status="atencao"] .dot { background: var(--accent-yellow); color: var(--accent-yellow); }
.map-pin-marker[data-status="falha"] .dot { background: var(--accent-red); color: var(--accent-red); }
.map-pin-marker[data-status="unknown"] .dot { background: #64748b; color: #64748b; }

.map-pin-marker .dot::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0;
  animation: pulse-pin 2.2s infinite;
}

@keyframes pulse-pin {
  0% { opacity: 0.6; transform: scale(0.6); }
  100% { opacity: 0; transform: scale(1.8); }
}

.map-pin-marker .label {
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  background: rgba(11, 15, 25, 0.9);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.map-pin-marker.selected .dot {
  box-shadow: 0 0 0 3px var(--accent-cyan), 0 0 16px 4px rgba(6, 182, 212, 0.8);
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  padding: 20px 28px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glow);
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  font-size: 32px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
}

.brand h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand h1 span {
  color: var(--accent-cyan);
}

.subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.subtitle code {
  color: var(--accent-cyan);
  font-family: 'JetBrains Mono', monospace;
  background: rgba(6, 182, 212, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.header-stats {
  display: flex;
  gap: 12px;
}

.stat-badge {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
}

.stat-num {
  font-size: 20px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-online .stat-num { color: var(--accent-green); }
.stat-offline .stat-num { color: var(--text-secondary); }
.stat-danger .stat-num { color: var(--accent-red); }
.stat-total .stat-num { color: var(--accent-cyan); }

/* Controls Bar */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  padding: 14px 20px;
  border-radius: var(--radius-md);
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

/* TAB CONTENT DISPLAY RULES */
.tab-content {
  display: none !important;
}

.tab-content.active {
  display: block !important;
}

.filters {
  display: flex;
  gap: 12px;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 13px;
  color: var(--text-secondary);
}

select, input[type="text"], input[type="datetime-local"], textarea {
  background: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

select:focus, input:focus, textarea:focus {
  border-color: var(--accent-cyan);
}

/* Buttons */
.btn {
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #fff;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

/* Tab Contents */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Machines Grid & Cards */
.machines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.machine-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.machine-card.is-critical {
  border-left: 5px solid var(--accent-red);
}

.machine-card:hover {
  transform: translateY(-4px);
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.card-top-select {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  background: rgba(11, 15, 25, 0.7);
  padding: 4px;
  border-radius: 6px;
}

.machine-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent-cyan);
}

/* Foto da Localização Bonita e Perfeitamente Quadrada */
.machine-thumb-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
}

.machine-thumb-preview:hover {
  transform: scale(1.02);
}

.machine-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-right: 28px;
}

.machine-title h3 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.critical-tag {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.machine-meta-line {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.status-pill {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pill.online {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.offline {
  background: rgba(156, 163, 175, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(156, 163, 175, 0.3);
}

/* Metrics */
.metric-row {
  margin-bottom: 12px;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.metric-header strong {
  color: var(--text-primary);
}

.metric-bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.fill-cpu { background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple)); }
.fill-ram { background: linear-gradient(90deg, var(--accent-purple), var(--accent-yellow)); }
.fill-disk { background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan)); }
.fill-danger { background: var(--accent-red); }

.disks-section {
  margin-top: 14px;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}

.disk-item {
  margin-bottom: 8px;
}

.smart-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  display: inline-block;
  margin-left: 6px;
}

.smart-good { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.smart-warn { background: rgba(245, 158, 11, 0.2); color: var(--accent-yellow); }
.smart-bad { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }

.card-actions-bar {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.card-footer {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  border-top: 1px dashed var(--border-color);
  padding-top: 8px;
}

/* Feed de Notas Técnicas Infinito */
.notes-feed-container {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 16px;
}

.add-note-box {
  margin-bottom: 14px;
}

.notes-list-history {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-history-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
}

.note-history-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.btn-delete-note {
  background: transparent;
  border: none;
  color: var(--accent-red);
  cursor: pointer;
  font-size: 14px;
}

.note-text-body {
  font-size: 12px;
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* Manager Recommendations Container */
.section-intro {
  margin-bottom: 20px;
}

.section-intro h2 { font-size: 20px; margin-bottom: 4px; }
.section-intro p { font-size: 13px; color: var(--text-secondary); }

.recommendations-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rec-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.rec-card.DANGER, .rec-card.CRITICAL {
  border-left: 6px solid var(--accent-red);
}

.rec-card.WARNING {
  border-left: 6px solid var(--accent-yellow);
}

.rec-info h4 {
  font-size: 16px;
  color: #fff;
  margin-bottom: 4px;
}

.rec-info p {
  font-size: 13px;
  color: var(--text-secondary);
}

.rec-meta {
  font-size: 11px;
  color: var(--accent-cyan);
  margin-top: 6px;
}

.rec-action-badge {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-purple);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  text-align: right;
}

.rec-action-badge strong { color: #fff; }

/* Installer Cards */
.installer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 28px;
}

.installer-card h2 { font-size: 22px; margin-bottom: 6px; }
.installer-card p { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; }

.download-box-highlight {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
  border: 2px solid var(--accent-cyan);
  padding: 20px 24px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
}

.download-icon { font-size: 36px; }
.download-details h3 { font-size: 16px; color: #fff; margin-bottom: 4px; }
.download-details p { font-size: 12px; color: var(--text-secondary); margin-bottom: 0; }

.command-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-sm);
}

.command-box label {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
  display: block;
  margin-bottom: 10px;
}

.code-copy-wrapper {
  display: flex;
  gap: 12px;
  align-items: center;
}

.code-copy-wrapper code {
  flex: 1;
  background: rgba(0, 0, 0, 0.6);
  padding: 12px 16px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #a7f3d0;
  word-break: break-all;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.installer-info {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.installer-info h4 { font-size: 14px; margin-bottom: 8px; color: var(--accent-purple); }
.installer-info ul { padding-left: 20px; font-size: 13px; color: var(--text-secondary); }
.installer-info li { margin-bottom: 6px; }

/* Modal System */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 11, 20, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  /* Bug conhecido do Chrome: elementos com backdrop-filter às vezes "não pintam"
     quando trocam de display:none pra visível via classe JS, ficando clicáveis
     mas invisíveis até QUALQUER outra coisa forçar um repaint na página (por
     isso "só abria depois de apertar Topo" — o fetch assíncrono do Topo forçava
     esse repaint por acidente). Tiramos o backdrop-filter (era só efeito de
     blur) e forçamos o repaint direto com essa animação de 1 frame. */
  animation: modalForceRepaint 0.01s;
}

@keyframes modalForceRepaint {
  from { opacity: 0.999; }
  to { opacity: 1; }
}

.modal-content {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 500px;
  padding: 24px;
  box-shadow: var(--shadow-glow);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-large {
  max-width: 680px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.modal-header h3 {
  font-size: 18px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
}

.btn-close:hover { color: #fff; }

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  color: var(--text-secondary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkbox-group {
  margin-top: 10px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
}

.danger-text {
  color: var(--accent-red);
}

/* Photo Section inside Modal */
.photo-section {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
  margin-bottom: 16px;
}

.photo-preview-container {
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.photo-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  padding: 6px;
}

.action-buttons-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

/* Modal Report Formats */
.modal-report-content {
  max-width: 840px;
  background: #0d1322;
}

.report-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid var(--accent-cyan);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.report-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.report-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.report-single-machine {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px dashed var(--border-color);
}

.report-single-machine:last-child {
  border-bottom: none;
}

.report-grid-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.rep-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.rep-section-title {
  font-size: 14px;
  color: var(--accent-purple);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 12px;
}

.report-table th, .report-table td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}

.report-table th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-cyan);
}

.rep-notes-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.report-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.hidden { display: none !important; }

/* Campos editáveis das etiquetas em lote (nome, setor, observação etc.) */
.epson-label-printable-batch-item [contenteditable="true"] {
  outline: 1px dashed transparent;
  cursor: text;
  border-radius: 2px;
}
.epson-label-printable-batch-item [contenteditable="true"]:hover,
.epson-label-printable-batch-item [contenteditable="true"]:focus {
  outline: 1px dashed #0891b2;
}
.qr-batch-obs:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  font-style: italic;
}

/* 📱 REGRAS RESPONSIVAS MOBILE PERFEITAS (DISPOSITIVOS MÓVEIS / SMARTPHONES) */
@media (max-width: 768px) {
  .ticker-wrap {
    height: 38px;
  }
  .ticker-label {
    font-size: 10px;
    padding: 0 8px;
  }

  .main-header {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    gap: 14px;
  }

  .brand {
    justify-content: center;
    text-align: center;
    flex-direction: column;
  }

  .header-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
  }

  .stat-badge {
    min-width: 0;
    padding: 8px 10px;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 12px;
  }

  .tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    width: 100%;
  }

  .tab-btn {
    padding: 8px 14px;
    font-size: 13px;
    flex-shrink: 0;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 10px;
  }

  .filter-group {
    width: 100%;
  }

  .filter-group select, .filter-group input {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
  }

  .btn {
    min-height: 44px;
    font-size: 14px;
    width: 100%;
  }

  /* Grid de Máquinas em 1 Coluna em Smartphones */
  .machines-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .machine-card {
    padding: 14px;
  }

  .card-actions-bar {
    flex-direction: column;
  }

  .card-quick-controls {
    flex-wrap: wrap;
  }

  .rec-card {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }

  .rec-action-badge {
    text-align: left;
  }

  .download-box-highlight {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .code-copy-wrapper {
    flex-direction: column;
  }

  #modal-machine-topology .modal-content {
    padding: 12px !important;
    width: 98% !important;
    max-height: 90vh !important;
  }
  #modal-machine-topology div[style*="grid-template-columns:2fr 1fr"] {
    grid-template-columns: 1fr !important;
    height: auto !important;
    max-height: calc(90vh - 80px) !important;
    overflow-y: auto !important;
  }
  #topo-stage-container {
    height: 320px !important;
  }.form-row {
    grid-template-columns: 1fr;
  }

  .action-buttons-row {
    flex-direction: column;
  }

  .modal-content {
    width: 95%;
    max-height: 94vh;
    padding: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .action-buttons-row {
    flex-direction: column;
  }

  .report-grid-summary {
    grid-template-columns: 1fr;
  }
}

/* REGRAS DE IMPRESSÃO PROFISSIONAL (RELATÓRIOS E ETIQUETAS EPSON) */
@media print {
  * {
    box-shadow: none !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  /* Esconder TUDO que não é conteúdo imprimível.
     IMPORTANTE: .app-container NÃO entra nesta lista — os modais de relatório/etiqueta
     ficam dentro dele no HTML, então escondê-lo escondia também o conteúdo do PDF
     (causava a folha em branco ao "Salvar como PDF"). Escondemos só os filhos que
     realmente não devem ser impressos. */
  .ticker-wrap, .controls-bar, .main-header, .tabs,
  .filters, .btn-close, .btn, .btn-sm, .btn-secondary, .btn-primary,
  .card-actions-bar, .card-quick-controls, .machine-card, .machine-grid,
  label, .form-group, .form-row, #modal-qrcode .modal-header,
  #modal-machine-topology {
    display: none !important;
  }
  /* Esconder formulários e inputs dentro do modal QR */
  #modal-qrcode div[style*="background:rgba(0,0,0,0.3)"] {
    display: none !important;
  }
  #modal-qrcode div[style*="display:flex;gap:10px;margin-top:16px"] {
    display: none !important;
  }
  /* Modal de etiquetas em lote: esconder cabeçalho/texto explicativo/botão, só as etiquetas */
  #modal-qrcode-batch .modal-header,
  #modal-qrcode-batch p,
  #modal-qrcode-batch div[style*="display:flex;gap:10px;margin-top:16px"] {
    display: none !important;
  }
  #modal-qrcode-batch #qr-batch-list {
    max-height: none !important;
    overflow: visible !important;
  }
  .epson-label-printable-batch-item {
    page-break-after: always !important;
    margin: 20px auto !important;
    max-width: 420px !important;
  }
  .epson-label-printable-batch-item:last-child {
    page-break-after: auto !important;
  }
  /* Modal visível sem fundo escuro.
     IMPORTANTE: .modal tinha height:100vh e .modal-content tinha max-height:90vh +
     overflow-y:auto (herdados do CSS normal da tela) — isso cortava/escondia o
     conteúdo na impressão mesmo com o modal "visível", e era a causa real da folha
     em branco mesmo depois de corrigir o .app-container. */
  .modal {
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    width: auto !important;
    display: block !important;
  }
  .modal.hidden {
    display: none !important;
  }
  .modal-content {
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    padding: 10px !important;
    color: #000000 !important;
  }
  /* Não imprime o texto de dica "Observação..." se o campo ficou vazio */
  .qr-batch-obs:empty:before {
    content: none !important;
  }
  .epson-label-printable-batch-item [contenteditable="true"] {
    outline: none !important;
  }
  /* A ETIQUETA EPSON — centralizada e limpa */
  #epson-label-printable {
    display: flex !important;
    box-shadow: none !important;
    border: 2px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
    page-break-inside: avoid !important;
    margin: 20px auto !important;
    max-width: 420px !important;
    padding: 14px 18px !important;
  }
  /* Relatório PDF */
  .report-brand { color: #0f172a !important; font-size: 20pt !important; }
  .report-date { color: #475569 !important; }
  .report-header { border-bottom: 2px solid #0f172a !important; }
  .rep-box { background: #f8fafc !important; border: 1px solid #cbd5e1 !important; color: #0f172a !important; }
  .rep-section-title { color: #1e293b !important; border-bottom: 1px solid #94a3b8 !important; }
  .report-table th { background: #e2e8f0 !important; color: #0f172a !important; }
  .report-table th, .report-table td { border: 1px solid #94a3b8 !important; color: #0f172a !important; }
  .rep-notes-box { background: #f1f5f9 !important; border: 1px solid #cbd5e1 !important; color: #0f172a !important; }
  .smart-badge { background: #f1f5f9 !important; border: 1px solid #cbd5e1 !important; color: #0f172a !important; }
}
