* {
  box-sizing: border-box;
}

:root {
  --bg: #f3f6fb;
  --sidebar: #111827;
  --sidebar-hover: #1f2937;
  --card: #ffffff;
  --border: #dbe3ee;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --nav: #ffffff;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

html.dark,
body.dark {
  --bg: #0f172a;
  --sidebar: #020617;
  --sidebar-hover: #1e293b;
  --card: #111827;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #cbd5e1;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --nav: #111827;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
}

body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

h1, h2, h3, h4, h5, h6,
p, span, label,
td, th, a, div {
  color: var(--text);
}

.subtitle,
.stock-meta,
.history-meta,
.pc-meta,
.brand p,
.meta-line,
.empty-state p,
.section-subtitle {
  color: var(--muted);
}

.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--sidebar);
  color: white;
  padding: 24px 18px;
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: auto;
}

.sidebar h2,
.brand h2 {
  margin: 0;
  font-size: 24px;
  color: white;
}

.brand p {
  margin: 8px 0 24px;
  font-size: 14px;
}

.sidebar a,
.menu-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: white;
  text-decoration: none;
  text-align: left;
  font-size: 15px;
  cursor: pointer;
  transition: 0.2s;
  margin-bottom: 10px;
}

.sidebar a:hover,
.sidebar a.active,
.menu-btn:hover,
.menu-btn.active {
  background: var(--sidebar-hover);
  color: white;
}

.main {
  margin-left: 260px;
  width: calc(100% - 260px);
  padding: 32px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.page {
  display: none;
}

.active-page {
  display: block;
}

.topbar {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.topbar h1,
.main h1 {
  margin: 0 0 8px;
  font-size: 32px;
  color: var(--text);
}

.subtitle {
  margin: 0;
  font-size: 15px;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card,
.panel,
.stock-card,
.history-card,
.pc-card,
.dashboard-card,
.card,
.box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px;
  color: var(--text);
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 14px;
}

.stat-card strong {
  font-size: 34px;
  color: var(--text);
  line-height: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--text);
}

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

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 50px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
}

button,
.primary-btn,
.secondary-btn,
.top-link {
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 14px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

button:hover,
.primary-btn:hover,
.secondary-btn:hover,
.top-link:hover,
.small-btn:hover,
.action-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
}

.secondary-btn,
.top-link {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 12px;
  align-items: center;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.cards-list {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.stock-card,
.history-card,
.pc-card,
.dashboard-card {
  position: relative;
  overflow: hidden;
}

.stock-card::before,
.history-card::before,
.pc-card::before,
.dashboard-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 5px;
  height: 100%;
  background: var(--primary);
}

.history-card::before {
  background: var(--warning);
}

.pc-card::before {
  background: var(--success);
}

.stock-id,
.history-id,
.pc-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.meta-line {
  margin-bottom: 6px;
  font-size: 14px;
}

.meta-value {
  color: var(--text);
  font-weight: 600;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.small-btn {
  min-width: 128px;
  min-height: 42px;
  padding: 10px 15px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.btn-use {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: white;
}

.btn-delete {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn-edit {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.checkItem {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  color: var(--text);
}

.checkItem input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.checkItem span {
  flex: 1;
  color: var(--text);
}

.checkItem input:checked + span {
  color: var(--success);
  font-weight: 700;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.switch-row input {
  width: 20px;
  height: 20px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  color: var(--text);
  vertical-align: middle;
}

th {
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 1;
}

table a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}

table a:hover {
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  padding: 30px 20px;
}

.toast-app {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 18px;
  border-radius: 12px;
  color: white;
  font-weight: 700;
  z-index: 9999;
  display: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.toast-app.sucesso {
  background: #16a34a;
}

.toast-app.erro {
  background: #dc2626;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.section-header h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.panel-pro {
  padding: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.badge.ok {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.badge.pendente {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.badge.reparacao {
  background: rgba(245, 158, 11, 0.18);
  color: #d97706;
}

.badge.resolvido {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.badge.livre {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.badge.ocupado {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.badge.aviso {
  background: rgba(245, 158, 11, 0.20);
  color: #d97706;
}

.badge.reserva {
  background: rgba(168, 85, 247, 0.16);
  color: #7c3aed;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  min-height: 36px;
  padding: 9px 12px;
  border-radius: 11px;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.action-btn.ip {
  background: #dbeafe;
  color: #1d4ed8;
}

.action-btn.manut {
  background: #fee2e2;
  color: #991b1b;
}

.manut-card {
  border-left: 5px solid var(--primary);
}

.manut-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

/* =========================
   TABELAS EMPRESA EXTREMO
========================= */
.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border-radius: 18px;
}

.pro-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
}

.pro-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.pro-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  vertical-align: middle;
  background: transparent;
  white-space: nowrap;
}

.pro-table tbody td:nth-child(2),
.pro-table tbody td:nth-child(3),
.pro-table tbody td:nth-child(7) {
  white-space: normal;
}

.pro-table tbody tr {
  transition: background 0.18s ease, transform 0.18s ease;
}

.pro-table tbody tr:hover td {
  background: rgba(37, 99, 235, 0.04);
}

html.dark .pro-table tbody tr:hover td,
body.dark .pro-table tbody tr:hover td {
  background: rgba(59, 130, 246, 0.08);
}

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

.pro-table td:first-child,
.pro-table th:first-child {
  padding-left: 18px;
}

.pro-table td:last-child,
.pro-table th:last-child {
  padding-right: 18px;
}

.panel input[type="text"] {
  width: 100%;
}

/* filtros pro */
.portas-stats-grid,
.pistolas-stats-grid,
.users-stats-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.portas-toolbar,
.pistolas-toolbar,
.users-toolbar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 14px;
  align-items: center;
}

/* versão da app */
.app-version-mini {
  position: fixed;
  right: 14px;
  bottom: 12px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  z-index: 1000;
  backdrop-filter: blur(6px);
}

html.dark .app-version-mini,
body.dark .app-version-mini {
  background: rgba(2, 6, 23, 0.75);
}

@media (max-width: 980px) {
  body {
    display: block;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
    position: static;
  }

  .main {
    margin-left: 0;
    width: 100%;
    padding: 18px;
  }

  .stats-grid,
  .form-grid,
  .checklist-grid,
  .toolbar,
  .portas-stats-grid,
  .pistolas-stats-grid,
  .users-stats-grid,
  .portas-toolbar,
  .pistolas-toolbar,
  .users-toolbar {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-header {
    flex-direction: column;
  }

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

  .table-actions {
    flex-direction: column;
  }

  .small-btn,
  .action-btn {
    width: 100%;
  }

  .pro-table {
    min-width: 760px;
  }

  .pro-table thead th,
  .pro-table tbody td {
    font-size: 13px;
    padding: 12px 10px;
  }

  .app-version-mini {
    right: 10px;
    bottom: 10px;
  }
.printer-toner-box {
  display: grid;
  grid-template-columns: 52px 1fr 48px;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.printer-toner-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.printer-toner-bar-wrap {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
  border: 1px solid var(--border);
}

.printer-toner-bar {
  height: 100%;
  border-radius: 999px;
  background: #16a34a;
  transition: width 0.25s ease;
}

.printer-toner-bar-empty {
  background: rgba(148, 163, 184, 0.35);
}

.printer-toner-value {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  color: var(--text);
}
}

/* ===== Upgrade Premium Seguro ===== */
.premium-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--primary), #1e40af);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.30);
  flex-shrink: 0;
}

.nav-group-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin: 18px 8px 10px;
}

.premium-topbar {
  align-items: center;
}

.topbar-main {
  flex: 1;
}

.topbar-status {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.status-pill,
.version-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  margin-right: 8px;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.version-pill {
  color: var(--muted);
}

.stats-grid .stat-card {
  position: relative;
  overflow: hidden;
}

.stats-grid .stat-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  opacity: 0.95;
}

.topbar h1 {
  letter-spacing: -0.02em;
}

@media (max-width: 980px) {
  .premium-topbar {
    align-items: flex-start;
  }

  .topbar-status {
    width: 100%;
  }
}


.printer-toner-box {
  min-width: 220px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
}

.printer-toner-head,
.printer-toner-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.printer-toner-head { margin-bottom: 8px; }
.printer-toner-foot { margin-top: 8px; }
.printer-toner-title { font-size: 12px; font-weight: 700; color: var(--text); }
.printer-toner-status { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,0.08); color: var(--text); }
.printer-toner-status.is-muted { color: var(--muted); }


.printer-toners-grid {
  display: grid;
  gap: 8px;
}

.printer-toner-status.is-good {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.14);
}

.printer-toner-status.is-medium {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
}

.printer-toner-status.is-critical {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.14);
}

.printer-toner-status.is-muted {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.14);
}

.printer-toner-box {
  min-width: 220px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
}

.printer-toner-head,
.printer-toner-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.printer-toner-head {
  margin-bottom: 8px;
}

.printer-toner-foot {
  margin-top: 8px;
}

.printer-toner-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.printer-toner-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.printer-toner-bar-wrap {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
  border: 1px solid var(--border);
}

.printer-toner-bar {
  height: 100%;
  border-radius: 999px;
  background: #16a34a;
  transition: width 0.25s ease;
}

.printer-toner-bar-empty {
  background: rgba(148, 163, 184, 0.35);
}

.printer-toner-value {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}


/* Tablet responsive tweaks */
@media (max-width: 1100px) {
  body {
    overflow-x: hidden;
  }
  .sidebar {
    width: 220px;
    min-width: 220px;
  }
  .main, main, .content {
    min-width: 0;
  }
  .panel, .card, .dashboard-card, .stock-card, .history-card, .pc-card {
    max-width: 100%;
  }
  table {
    font-size: 14px;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 180px;
    min-width: 180px;
  }
}


.status-pill.offline {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.22);
}

.scanner-box {
  width: 100%;
  max-width: 520px;
  min-height: 120px;
  margin-top: 12px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  padding: 10px;
  background: var(--card);
}

#reader video {
  width: 100% !important;
  border-radius: 14px;
}

.ocr-status {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(59,130,246,0.08);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

#dataFolha[readonly] {
  opacity: 0.9;
  background: rgba(148, 163, 184, 0.08);
}


.backup-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.summary-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.summary-card .summary-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
}

.summary-card .summary-list {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 13px;
}

.printer-history-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.printer-history-items {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.printer-history-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(148,163,184,0.05);
}

.history-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}


.word-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}


#btnMigrarPortas {
  white-space: nowrap;
}


/* ===== Auto Update Profissional ===== */
.version-pill {
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.version-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.10);
}

.update-box-appbraga {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(360px, calc(100vw - 24px));
  background: #111827;
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.26);
  padding: 16px;
  z-index: 9999;
  border: 1px solid rgba(255,255,255,0.08);
}

.update-box-appbraga .update-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.update-box-appbraga .update-subtitle {
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.45;
}

.update-box-appbraga .update-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.update-box-appbraga .update-actions button {
  flex: 1;
}


.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 20px;
}

.modal-card {
  width: min(920px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.item-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}


/* ===== MODO VISUAL ===== */
:root {
  --visual-glow: 0 18px 50px rgba(15, 23, 42, 0.12);
  --visual-glow-strong: 0 24px 64px rgba(15, 23, 42, 0.18);
}

body {
  background:
    radial-gradient(circle at top right, rgba(59,130,246,0.10), transparent 26%),
    radial-gradient(circle at top left, rgba(16,185,129,0.08), transparent 22%),
    var(--bg);
}

.topbar.premium-topbar,
.premium-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: linear-gradient(135deg, rgba(255,255,255,0.88), rgba(255,255,255,0.72));
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: var(--visual-glow);
}

html.dark .topbar.premium-topbar,
body.dark .topbar.premium-topbar,
html.dark .premium-topbar,
body.dark .premium-topbar {
  background: linear-gradient(135deg, rgba(15,23,42,0.86), rgba(15,23,42,0.72));
  border: 1px solid rgba(255,255,255,0.06);
}

.panel,
.pc-card,
.dashboard-card,
.stock-card,
.history-card {
  border-radius: 22px !important;
  border: 1px solid rgba(148,163,184,0.18);
  box-shadow: var(--visual-glow);
}

.panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.72));
}

.pc-card,
.dashboard-card,
.stock-card,
.history-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,255,255,0.80));
}

html.dark .panel,
body.dark .panel,
html.dark .pc-card,
body.dark .pc-card,
html.dark .dashboard-card,
body.dark .dashboard-card,
html.dark .stock-card,
body.dark .stock-card,
html.dark .history-card,
body.dark .history-card {
  background:
    linear-gradient(180deg, rgba(15,23,42,0.86), rgba(15,23,42,0.72));
  border: 1px solid rgba(255,255,255,0.06);
}

@media (hover: hover) and (pointer: fine) {
  .panel:hover,
  .pc-card:hover,
  .dashboard-card:hover,
  .stock-card:hover,
  .history-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--visual-glow-strong);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }
}

.brand.premium-brand,
.premium-brand {
  border-radius: 24px;
  box-shadow: var(--visual-glow);
}

.brand-badge {
  box-shadow: 0 10px 26px rgba(59,130,246,0.24);
}

.status-pill,
.version-pill {
  border-radius: 999px !important;
  box-shadow: 0 8px 20px rgba(15,23,42,0.10);
}

.toolbar input,
input[type="text"],
input[type="date"],
input[type="search"],
select,
textarea {
  border-radius: 16px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}

.primary-btn,
.secondary-btn,
.small-btn,
.action-btn,
button {
  border-radius: 14px !important;
}

.primary-btn {
  box-shadow: 0 12px 24px rgba(59,130,246,0.22);
}

.secondary-btn,
.small-btn,
.action-btn {
  box-shadow: 0 8px 18px rgba(15,23,42,0.08);
}

.page-hero {
  margin-bottom: 18px;
  border-radius: 26px;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(59,130,246,0.12), rgba(16,185,129,0.10)),
    linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.65));
  border: 1px solid rgba(148,163,184,0.18);
  box-shadow: var(--visual-glow);
}

html.dark .page-hero,
body.dark .page-hero {
  background:
    linear-gradient(135deg, rgba(59,130,246,0.14), rgba(16,185,129,0.12)),
    linear-gradient(180deg, rgba(15,23,42,0.88), rgba(15,23,42,0.72));
  border: 1px solid rgba(255,255,255,0.06);
}

.page-hero-title {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.page-hero-subtitle {
  margin: 0;
  opacity: 0.88;
}

.visual-badge-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.visual-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(59,130,246,0.10);
  color: var(--text);
  border: 1px solid rgba(59,130,246,0.12);
}

.sidebar a.active {
  box-shadow: 0 10px 24px rgba(59,130,246,0.16);
}

.cards-list {
  gap: 14px;
}

.meta-line {
  line-height: 1.5;
}


/* ===== UPDATE OBRIGATÓRIO ===== */
.update-overlay-appbraga {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9998;
}

.update-box-appbraga.mandatory {
  position: fixed;
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 24px));
  z-index: 9999;
}

.update-box-appbraga.mandatory .update-title {
  font-size: 22px;
}

.update-box-appbraga.mandatory .update-subtitle {
  font-size: 14px;
}


/* ===== CENTRO OPERACIONAL UTIL ===== */
.operational-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.operational-item {
  border-radius: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(148,163,184,0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.70));
  box-shadow: var(--visual-glow, 0 18px 50px rgba(15, 23, 42, 0.12));
}

html.dark .operational-item,
body.dark .operational-item {
  background: linear-gradient(180deg, rgba(15,23,42,0.86), rgba(15,23,42,0.72));
  border: 1px solid rgba(255,255,255,0.06);
}

.operational-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .72;
  margin-bottom: 6px;
}

.operational-value {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.summary-card {
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(148,163,184,0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.78));
  box-shadow: var(--visual-glow, 0 18px 50px rgba(15, 23, 42, 0.12));
}

html.dark .summary-card,
body.dark .summary-card {
  background: linear-gradient(180deg, rgba(15,23,42,0.88), rgba(15,23,42,0.74));
  border: 1px solid rgba(255,255,255,0.06);
}

.summary-card h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

.summary-value {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
}

.summary-list {
  margin: 0;
  padding-left: 18px;
}

.summary-list li {
  margin-bottom: 6px;
}

@media (max-width: 980px) {
  .summary-grid,
  .operational-strip {
    grid-template-columns: 1fr;
  }
}


/* ===== MODO GESTOR EXTREMO ===== */
.gestor-panel {
  overflow: hidden;
}

.gestor-grid-hero {
  display: grid;
  grid-template-columns: 1.1fr .9fr .9fr .9fr;
  gap: 14px;
}

.gestor-hero-card,
.gestor-card,
.gestor-alert-card,
.gestor-priority-card {
  border-radius: 20px;
  padding: 18px;
  border: 1px solid rgba(148,163,184,0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,255,255,0.78));
  box-shadow: var(--visual-glow, 0 18px 50px rgba(15, 23, 42, 0.12));
}

html.dark .gestor-hero-card,
body.dark .gestor-hero-card,
html.dark .gestor-card,
body.dark .gestor-card,
html.dark .gestor-alert-card,
body.dark .gestor-alert-card,
html.dark .gestor-priority-card,
body.dark .gestor-priority-card {
  background: linear-gradient(180deg, rgba(15,23,42,0.88), rgba(15,23,42,0.74));
  border: 1px solid rgba(255,255,255,0.06);
}

.gestor-hero-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .72;
  margin-bottom: 10px;
}

.gestor-hero-value {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
}

.gestor-hero-note {
  font-size: 14px;
  opacity: .9;
  line-height: 1.4;
}

.gestor-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.gestor-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.gestor-chip.red {
  background: rgba(239,68,68,0.14);
  color: #ef4444;
}

.gestor-chip.yellow {
  background: rgba(245,158,11,0.14);
  color: #f59e0b;
}

.gestor-chip.green {
  background: rgba(34,197,94,0.14);
  color: #22c55e;
}

.gestor-list {
  margin: 0;
  padding-left: 18px;
}

.gestor-list li {
  margin-bottom: 8px;
  line-height: 1.4;
}

.gestor-priority-card h4,
.gestor-alert-card h4,
.gestor-card h4 {
  margin: 0 0 10px;
}

.gestor-mini-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}

@media (max-width: 1100px) {
  .gestor-grid-hero {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 780px) {
  .gestor-grid-hero {
    grid-template-columns: 1fr;
  }
}


/* ===== AUTO UPDATE PRO FINAL ===== */
.update-overlay-appbraga {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9998;
}

.update-box-appbraga.mandatory {
  position: fixed;
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: min(430px, calc(100vw - 24px));
  z-index: 9999;
}

.update-box-appbraga.mandatory .update-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.update-box-appbraga.mandatory .update-actions button {
  flex: 1;
}


/* ===== MELHORIAS 1 2 3 4 5 7 8 10 ===== */
.smart-status-box, .alert-inteligente-card, .stock-min-card {
  border-radius: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(148,163,184,0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.78));
}
html.dark .smart-status-box, body.dark .smart-status-box,
html.dark .alert-inteligente-card, body.dark .alert-inteligente-card,
html.dark .stock-min-card, body.dark .stock-min-card {
  background: linear-gradient(180deg, rgba(15,23,42,0.88), rgba(15,23,42,0.74));
  border: 1px solid rgba(255,255,255,0.06);
}
.hist-advanced-toolbar {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.hist-advanced-toolbar input { min-width: 140px; }
.minimo-grid {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap:12px;
}
.minimo-item {
  border-radius: 16px;
  padding: 14px;
  border:1px solid rgba(148,163,184,0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,255,255,0.80));
}
html.dark .minimo-item, body.dark .minimo-item {
  background: linear-gradient(180deg, rgba(15,23,42,0.88), rgba(15,23,42,0.74));
  border:1px solid rgba(255,255,255,0.06);
}
.minimo-item label { display:block; font-size:13px; opacity:.8; margin-bottom:8px; }
.minimo-item input { width:100%; }
.item-danger { color:#dc2626; font-weight:700; }
.item-warning { color:#d97706; font-weight:700; }
.item-ok { color:#16a34a; font-weight:700; }
@media (max-width:780px){ .hist-advanced-toolbar { flex-direction:column; } }


/* ===== DIAGNÓSTICO TONER ===== */
.toner-diagnostics-panel { margin-bottom: 18px; }
.diagnostics-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap:12px; margin-top:12px; }
.diagnostics-card .summary-value.small { font-size: 15px; line-height: 1.35; }
.diagnostics-status-row { display:flex; align-items:center; gap:10px; margin-top:6px; }
.diag-dot { width:12px; height:12px; border-radius:999px; display:inline-block; background:#64748b; box-shadow:0 0 0 3px rgba(100,116,139,.18); }
.diag-dot.is-ok { background:#22c55e; box-shadow:0 0 0 3px rgba(34,197,94,.18); }
.diag-dot.is-warn { background:#f59e0b; box-shadow:0 0 0 3px rgba(245,158,11,.18); }
.diag-dot.is-error { background:#ef4444; box-shadow:0 0 0 3px rgba(239,68,68,.18); }
.diag-dot.is-running { background:#38bdf8; box-shadow:0 0 0 3px rgba(56,189,248,.18); }
.diagnostics-log-wrap { margin-top: 12px; }
.diagnostics-log { display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.diagnostics-log-item { background: rgba(15,23,42,.78); border:1px solid rgba(148,163,184,.14); border-radius:14px; padding:10px 12px; font-size:13px; }
.diagnostics-log-item strong { color:#e2e8f0; }
.diagnostics-log-item .diag-time { color:#94a3b8; margin-right:8px; }
.diagnostics-log-item.is-muted { color:#94a3b8; }

.diagnostics-log-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.log-toggle-btn { min-width: 112px; }
.diagnostics-log-wrap.is-collapsed .diagnostics-log { display:none; }
