/* ===========================
   CSS Variables & Reset
=========================== */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2230;
  --bg-card-hover: #242d3e;
  --bg-sidebar: #0d1117;
  --border: #30363d;
  --border-light: #21262d;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;

  --accent-blue: #58a6ff;
  --accent-blue-dim: #1f6feb;
  --accent-green: #3fb950;
  --accent-green-dim: #238636;
  --accent-yellow: #d29922;
  --accent-red: #f85149;
  --accent-purple: #bc8cff;
  --accent-orange: #fb8500;

  --status-working: #3fb950;
  --status-stopped: #f85149;
  --status-setup: #d29922;
  --status-offline: #6e7681;

  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --topbar-height: 60px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);

  --transition: 0.2s ease;
}

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

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ===========================
   SIDEBAR
=========================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-height);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-blue-dim), var(--accent-blue));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  animation: spin-slow 8s linear infinite;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.logo-text {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  color: var(--accent-blue);
  white-space: nowrap;
  transition: opacity var(--transition);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .company-details {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.sidebar-toggle:hover { color: var(--text-primary); background: var(--border); }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.nav-item.active {
  color: var(--accent-blue);
  background: rgba(88, 166, 255, 0.08);
  border-left-color: var(--accent-blue);
}

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

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.company-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.company-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue-dim));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  color: white;
}

.company-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.company-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ===========================
   MAIN WRAPPER
=========================== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

.main-wrapper.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

/* ===========================
   TOPBAR
=========================== */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.last-update {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.refresh-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.refresh-btn:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  transform: rotate(180deg);
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.3);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-green);
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ===========================
   CONTENT
=========================== */
.content {
  flex: 1;
  padding: 24px;
}

/* ===========================
   VIEWS
=========================== */
.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===========================
   STATS ROW
=========================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.working {
  background: rgba(63, 185, 80, 0.15);
  color: var(--status-working);
}
.stat-icon.stopped {
  background: rgba(248, 81, 73, 0.15);
  color: var(--status-stopped);
}
.stat-icon.setup {
  background: rgba(210, 153, 34, 0.15);
  color: var(--status-setup);
}
.stat-icon.offline {
  background: rgba(110, 118, 129, 0.15);
  color: var(--status-offline);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===========================
   SECTION HEADER
=========================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===========================
   MACHINES GRID
=========================== */
.machines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.machine-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.machine-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.machine-card.status-working::before { background: var(--status-working); }
.machine-card.status-stopped::before { background: var(--status-stopped); }
.machine-card.status-setup::before { background: var(--status-setup); }
.machine-card.status-offline::before { background: var(--status-offline); }

.machine-card:hover {
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

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

.machine-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.machine-ip {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: monospace;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.status-badge.working {
  background: rgba(63, 185, 80, 0.15);
  color: var(--status-working);
  border: 1px solid rgba(63, 185, 80, 0.3);
}
.status-badge.stopped {
  background: rgba(248, 81, 73, 0.15);
  color: var(--status-stopped);
  border: 1px solid rgba(248, 81, 73, 0.3);
}
.status-badge.setup {
  background: rgba(210, 153, 34, 0.15);
  color: var(--status-setup);
  border: 1px solid rgba(210, 153, 34, 0.3);
}
.status-badge.offline {
  background: rgba(110, 118, 129, 0.15);
  color: var(--status-offline);
  border: 1px solid rgba(110, 118, 129, 0.3);
}

.machine-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.machine-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.info-label {
  color: var(--text-muted);
  min-width: 80px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.info-value {
  color: var(--text-primary);
  font-weight: 500;
  font-family: monospace;
  font-size: 0.85rem;
}

.info-value.program {
  color: var(--accent-blue);
  font-weight: 700;
}

.info-value.stop {
  color: var(--accent-red);
}

.machine-card-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.machine-value {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.machine-value span {
  color: var(--accent-green);
  font-weight: 700;
}

.machine-timestamp {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ===========================
   PROGRESS BARS (OVR)
=========================== */
.ovr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.ovr-item {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.ovr-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 5px;
}

.ovr-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.ovr-set { color: var(--text-secondary); }
.ovr-actual { color: var(--accent-blue); font-weight: 700; }

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.progress-fill.feed { background: var(--accent-blue); }
.progress-fill.speed { background: var(--accent-green); }
.progress-fill.rapid { background: var(--accent-yellow); }

/* ===========================
   TABLE
=========================== */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table thead {
  background: var(--bg-secondary);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.loading-cell {
  text-align: center;
  padding: 40px !important;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge.working {
  background: rgba(63, 185, 80, 0.15);
  color: var(--status-working);
}
.badge.stopped {
  background: rgba(248, 81, 73, 0.15);
  color: var(--status-stopped);
}
.badge.setup {
  background: rgba(210, 153, 34, 0.15);
  color: var(--status-setup);
}
.badge.offline {
  background: rgba(110, 118, 129, 0.15);
  color: var(--status-offline);
}
.badge.ended {
  background: rgba(63, 185, 80, 0.15);
  color: var(--status-working);
}
.badge.pending {
  background: rgba(210, 153, 34, 0.15);
  color: var(--status-setup);
}
.badge.admin {
  background: rgba(188, 140, 255, 0.15);
  color: var(--accent-purple);
}
.badge.normal {
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent-blue);
}

/* ===========================
   USERS GRID
=========================== */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.user-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--transition);
}

.user-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue-dim), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; }

.user-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.user-email {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  word-break: break-all;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-phone {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===========================
   FORM CONTROLS
=========================== */
.date-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition);
  cursor: pointer;
}

.date-input:focus {
  border-color: var(--accent-blue);
}

.date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
  cursor: pointer;
}

.select-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  min-width: 160px;
}

.select-input:focus {
  border-color: var(--accent-blue);
}

.select-input option {
  background: var(--bg-secondary);
}

.btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent-blue-dim);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-blue);
  transform: translateY(-1px);
}

/* ===========================
   LOADING STATE
=========================== */
.loading-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  opacity: 0.4;
}

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

.error-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--accent-red);
  font-size: 0.88rem;
}

/* ===========================
   MODAL
=========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--border);
}

.modal-body {
  padding: 24px;
}

/* Modal Sections */
.modal-section {
  margin-bottom: 24px;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.modal-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.modal-info-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.modal-info-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.modal-info-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 600;
}

.modal-info-value.highlight {
  color: var(--accent-blue);
  font-family: monospace;
  font-size: 1rem;
}

/* Modal History Table */
.modal-table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  overflow-x: auto;
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.modal-table th {
  background: var(--bg-primary);
  padding: 10px 12px;
  text-align: left;
  color: var(--text-secondary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.modal-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

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

.modal-table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* ===========================
   TOOLTIP
=========================== */
[title] { cursor: help; }

/* ===========================
   SCROLLBAR
=========================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

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

  .sidebar.mobile-open {
    transform: translateX(0);
    width: var(--sidebar-width);
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .menu-btn {
    display: flex;
  }

  .sidebar-toggle {
    display: none;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .content {
    padding: 16px;
  }

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

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

  .modal-info-grid {
    grid-template-columns: 1fr;
  }

  .last-update { display: none; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.6rem; }
  .users-grid { grid-template-columns: 1fr; }
  .ovr-grid { grid-template-columns: 1fr; }
}

/* ===========================
   MOBILE OVERLAY
=========================== */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.mobile-overlay.active {
  display: block;
}