/* ==========================================================================
   Sentinela MSP Dashboard — Tema Escuro Profissional
   Todas as variáveis de cores, tipografia e espaçamento centralizadas.
   ========================================================================== */

/* ---------- Variáveis globais ---------- */
:root {
  --bg-body: #0f1117;
  --bg-card: #1a1d26;
  --bg-sidebar: #13151c;
  --bg-input: #22252f;
  --bg-hover: #252830;
  --bg-table-alt: #1e2029;
  --bg-modal-overlay: rgba(0, 0, 0, 0.6);

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --orange: #f97316;
  --purple: #a855f7;
  --cyan: #06b6d4;

  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: #2d3041;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

  --sidebar-w: 250px;
  --header-h: 0px;
  --transition: 0.25s ease;

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ---------- Tipografia ---------- */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.4rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-accent { color: var(--accent); }

/* ---------- Layout principal ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-logo span {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
  font-size: 0.92rem;
}

.sidebar-nav a:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.sidebar-nav a.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
}

.sidebar-nav a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-nav .nav-separator {
  height: 1px;
  background: var(--border);
  margin: 0.75rem 0;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-footer .user-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-footer .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-footer .user-info .user-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer .user-info .user-role {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.sidebar-footer .btn-logout {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}

.sidebar-footer .btn-logout:hover {
  color: var(--red);
}

/* Botão toggle mobile */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
}

/* ---------- Main ---------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2rem;
  min-width: 0;
}

.main-content .page-header {
  margin-bottom: 1.5rem;
}

.main-content .page-header h1 {
  margin-bottom: 0.25rem;
}

.main-content .page-header .breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.main-content .page-header .breadcrumb a {
  color: var(--text-muted);
}

.main-content .page-header .breadcrumb a:hover {
  color: var(--accent);
}

.main-content .page-header .breadcrumb .sep {
  color: var(--text-dim);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.card-header h3 {
  font-size: 1rem;
}

.card-body {
  /* espaço reservado para conteúdo */
}

/* Card de estatísticas rápidas */
.stat-card {
  text-align: center;
  padding: 1.25rem 1rem;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Card de cliente */
.cliente-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

.cliente-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-card);
}

.cliente-card .cliente-nome {
  font-weight: 600;
  font-size: 1.05rem;
}

.cliente-card .cliente-maquinas {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cliente-card .cliente-maquinas .tipo-icon {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.cliente-card .cliente-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cliente-card .alertas-count {
  font-size: 0.8rem;
  font-weight: 600;
}

/* ---------- Grid helpers ---------- */
.grid {
  display: grid;
  gap: 1rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* ---------- Flex helpers ---------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-05 { gap: 0.5rem; }
.gap-1 { gap: 1rem; }
.gap-15 { gap: 1.5rem; }
.gap-2 { gap: 2rem; }

/* ---------- Tabelas ---------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table thead {
  background: var(--bg-sidebar);
}

table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table tbody tr { transition: background var(--transition); }
table tbody tr:nth-child(even) { background: var(--bg-table-alt); }
table tbody tr:hover { background: var(--bg-hover); }

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

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-online { background: var(--green-dim); color: var(--green); }
.badge-offline { background: var(--red-dim); color: var(--red); }
.badge-warning { background: var(--yellow-dim); color: var(--yellow); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge-critical { background: var(--red-dim); color: var(--red); }
.badge-alta { background: rgba(249, 115, 22, 0.15); color: var(--orange); }
.badge-media { background: var(--yellow-dim); color: var(--yellow); }
.badge-baixa { background: rgba(59, 130, 246, 0.15); color: var(--accent); }

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { opacity: 0.9; }

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

.btn-warning { background: var(--yellow); color: #000; }
.btn-warning:hover { opacity: 0.9; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--text-dim);
}

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
}

.btn-icon {
  padding: 0.4rem;
  width: 32px;
  height: 32px;
}

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

/* ---------- Formulários ---------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-input::placeholder { color: var(--text-dim); }
.form-textarea { min-height: 80px; resize: vertical; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group { flex: 1; }

/* ---------- Banner de alertas críticos ---------- */
.banner-critical {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  animation: pulse-border 2s infinite;
}

.banner-critical .banner-icon {
  font-size: 1.3rem;
  color: var(--red);
  flex-shrink: 0;
}

.banner-critical .banner-text {
  font-weight: 600;
  color: var(--red);
  font-size: 0.92rem;
}

.banner-critical .banner-text span {
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(239, 68, 68, 0.3); }
  50% { border-color: rgba(239, 68, 68, 0.6); }
}

/* ---------- Score em círculo SVG ---------- */
.score-circle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.score-circle svg {
  transform: rotate(-90deg);
}

.score-circle .score-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.score-circle .score-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.score-circle .score-value {
  position: absolute;
  font-weight: 700;
  font-size: 1.1rem;
}

.score-circle.score-sm .score-value { font-size: 0.75rem; }
.score-circle.score-lg .score-value { font-size: 1.5rem; }

/* ---------- Barras de uso ---------- */
.usage-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
}

.usage-bar .usage-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s ease;
}

.usage-bar .usage-fill.green { background: var(--green); }
.usage-bar .usage-fill.yellow { background: var(--yellow); }
.usage-bar .usage-fill.red { background: var(--red); }
.usage-bar .usage-fill.accent { background: var(--accent); }

/* ---------- Gauges ---------- */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.gauge-container .gauge-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ---------- Abas (tabs) ---------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tabs .tab {
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
}

.tabs .tab:hover {
  color: var(--text);
}

.tabs .tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content {
  display: none;
}

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

/* ---------- Calendário de backup ---------- */
.backup-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.backup-calendar .cal-header {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 0.25rem;
}

.backup-calendar .cal-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: default;
  position: relative;
}

.backup-calendar .cal-day.success { background: var(--green-dim); color: var(--green); }
.backup-calendar .cal-day.fail { background: var(--red-dim); color: var(--red); }
.backup-calendar .cal-day.none { background: var(--bg-input); color: var(--text-dim); }
.backup-calendar .cal-day.empty { background: transparent; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-modal-overlay);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.3rem;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 280px;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.3s ease forwards;
  font-size: 0.88rem;
}

.toast.toast-out {
  animation: toast-out 0.3s ease forwards;
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-warning { border-left: 3px solid var(--yellow); }
.toast-info { border-left: 3px solid var(--accent); }

.toast .toast-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
}

.toast-success .toast-icon { color: var(--green); }
.toast-error .toast-icon { color: var(--red); }
.toast-warning .toast-icon { color: var(--yellow); }
.toast-info .toast-icon { color: var(--accent); }

.toast .toast-msg { flex: 1; }

.toast .toast-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ---------- Spinner ---------- */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  flex-direction: column;
  gap: 1rem;
}

.loading-overlay .loading-text {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ---------- Login ---------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--bg-body);
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-card .login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-card .login-logo .logo-mark {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.75rem;
}

.login-card .login-logo h1 {
  font-size: 1.5rem;
}

.login-card .login-logo p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.25rem;
}

.login-error {
  background: var(--red-dim);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  color: var(--red);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}

/* ---------- Filtros ---------- */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  align-items: flex-end;
}

.filters-bar .form-group {
  margin-bottom: 0;
  min-width: 150px;
}

/* ---------- Página Relatório - Preview ---------- */
.relatorio-preview {
  background: #fff;
  color: #1a1a2e;
  border-radius: var(--radius);
  padding: 2.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.relatorio-preview h1,
.relatorio-preview h2,
.relatorio-preview h3 {
  color: #1a1a2e;
}

.relatorio-preview table {
  font-size: 0.82rem;
}

.relatorio-preview table th {
  background: #f1f5f9;
  color: #475569;
}

.relatorio-preview table td {
  border-bottom-color: #e2e8f0;
  color: #334155;
}

.relatorio-preview table tbody tr:nth-child(even) { background: #f8fafc; }
.relatorio-preview table tbody tr:hover { background: #f1f5f9; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.92rem;
}

/* ---------- Toolbar superior de página ---------- */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

/* ---------- Detalhes de máquina - header ---------- */
.machine-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.machine-header .machine-icon {
  width: 48px;
  height: 48px;
  background: var(--bg-input);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.machine-header .machine-info {
  flex: 1;
  min-width: 0;
}

.machine-header .machine-info h1 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.machine-header .machine-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.machine-header .machine-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ---------- Grids de gauges ---------- */
.gauges-row {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

/* ---------- Chips / tags ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  background: var(--bg-input);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---------- Scroll custom ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ---------- Utilitários ---------- */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Responsivo ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 1.25rem;
    padding-top: 4rem;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .grid-auto {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
  }

  .machine-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .machine-header .machine-actions {
    width: 100%;
  }

  .filters-bar {
    flex-direction: column;
  }

  .filters-bar .form-group {
    width: 100%;
  }

  .page-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .gauges-row {
    gap: 1rem;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
  }

  .toast {
    min-width: unset;
    max-width: unset;
  }
}

@media (max-width: 480px) {
  html { font-size: 13px; }

  .main-content {
    padding: 1rem;
    padding-top: 3.5rem;
  }

  .card {
    padding: 1rem;
  }

  .modal {
    padding: 1.25rem;
  }
}

/* ---------- Print ---------- */
@media print {
  .sidebar,
  .sidebar-toggle,
  .toast-container,
  .page-toolbar .btn,
  .filters-bar {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    background: #fff;
  }
}
