:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;

  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  /* System fonts only: no requests to third-party font CDNs (GDPR). Outfit / JetBrains
     Mono are used when installed locally. */
  --font-sans: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --shadow-glow: 0 0 20px rgba(6, 182, 212, 0.35);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(6, 182, 212, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */
.app-header {
  height: 68px;
  background: rgba(11, 15, 25, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo-badge {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #f9fafb, #9ca3af);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent-cyan);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 20px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background 0.3s;
}

.status-dot.connected {
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

.status-dot.disconnected {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.nav-tab.active {
  color: #fff;
  background: var(--accent-blue);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

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

.user-pill {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 14px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 24px;
  font-weight: 700;
}

.subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.device-search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 280px;
}

.device-search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
  z-index: 1;
}

.device-search-box:focus-within .search-icon {
  color: var(--accent-cyan);
}

.device-search-box input,
.device-search-box input[type="text"],
#device-search-input {
  width: 100%;
  padding: 8px 32px 8px 38px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}

.device-search-box input:focus,
.device-search-box input[type="text"]:focus,
#device-search-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.device-search-box .clear-search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  transition: all 0.15s ease;
  z-index: 1;
}

.device-search-box .clear-search-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.15);
}

.show-revoked-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.show-revoked-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.show-revoked-toggle input[type="checkbox"] {
  display: none;
}

.show-revoked-toggle .toggle-slider {
  position: relative;
  width: 32px;
  height: 18px;
  background: #374151;
  border-radius: 9999px;
  transition: background 0.25s ease;
  flex-shrink: 0;
}

.show-revoked-toggle .toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.show-revoked-toggle input[type="checkbox"]:checked + .toggle-slider {
  background: var(--accent-red);
}

.show-revoked-toggle input[type="checkbox"]:checked + .toggle-slider::after {
  transform: translateX(14px);
}

.show-revoked-toggle .toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.show-revoked-toggle:hover .toggle-label {
  color: var(--text-primary);
}

.badge-revoked-count {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  margin-left: 2px;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}

/* ==========================================================================
   Device Cards Grid
   ========================================================================== */
.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 24px;
}

.device-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

.device-card:hover {
  transform: translateY(-2px);
  border-color: rgba(6, 182, 212, 0.3);
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.6);
}

.device-card.faulted {
  border-color: var(--accent-red);
}

.device-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.device-title-box h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.device-id-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-top: 4px;
}

.online-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 9999px;
}

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

.online-tag.offline {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Alarm Banner */
.alarm-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-red);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: pulseAlarm 2s infinite ease-in-out;
}

@keyframes pulseAlarm {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.alarm-icon {
  font-size: 20px;
}

.alarm-info h4 {
  font-size: 14px;
  font-weight: 700;
  color: #fca5a5;
  margin-bottom: 2px;
}

.alarm-info p {
  font-size: 12px;
  color: #fecaca;
  line-height: 1.4;
}

.alarm-canons-list {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.canon-fail-tag {
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

/* Key Metrics Tiles */
.metrics-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 12px;
}

.metric-tile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin-top: 4px;
}

.metric-value.cyan { color: var(--accent-cyan); }
.metric-value.amber { color: var(--accent-amber); }
.metric-value.green { color: var(--accent-green); }

.metric-value.state-name {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

/* Air Canons Matrix (0..9) */
.matrix-container {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.matrix-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.canons-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.canon-cell {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  position: relative;
  transition: all 0.2s ease;
}

.canon-cell.firing {
  background: rgba(6, 182, 212, 0.25);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.5);
}

.canon-cell.has-fail {
  border-color: var(--accent-red);
}

.canon-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.canon-shots {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.canon-fail-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-red);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: 9999px;
  padding: 1px 5px;
  font-family: var(--font-mono);
}

.canon-cell.service-needed {
  border-color: rgba(245, 158, 11, 0.7);
  background: rgba(245, 158, 11, 0.12);
}

.canon-service-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: var(--accent-amber);
  color: #000;
  font-size: 8px;
  font-weight: 800;
  border-radius: 9999px;
  padding: 1px 4px;
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}

/* Service Maintenance Banner & Card */
.device-card.maintenance-card {
  border-color: rgba(245, 158, 11, 0.4);
}

.service-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.service-banner .alarm-info h4 {
  font-size: 13px;
  font-weight: 700;
  color: #fcd34d;
  margin-bottom: 2px;
}

.service-banner .alarm-info p {
  font-size: 11px;
  color: #fde68a;
  line-height: 1.4;
}

/* System Auxiliary Indicators (Main Ventil, Compressor) */
.aux-indicators {
  display: flex;
  gap: 12px;
}

.aux-badge {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

.aux-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #374151;
}

.aux-led.active {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.card-actions .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ==========================================================================
   Buttons & Forms
   ========================================================================== */
.btn {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: var(--border-color);
}

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

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.3);
}

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

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

.btn-block {
  width: 100%;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* ==========================================================================
   Modals & Glassmorphism
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.hidden {
  display: none !important;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  animation: modalScale 0.2s ease-out;
}

.modal-card.modal-large {
  max-width: 750px;
}

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

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

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

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.brand-header {
  text-align: center;
  margin-bottom: 24px;
}

.brand-header .logo-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px auto;
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
}

.error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.error-msg.hidden { display: none; }

.success-msg {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.success-msg.hidden { display: none; }

/* ==========================================================================
   Data Tables & Streams
   ========================================================================== */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.status-badge.sent { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.status-badge.simulated { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.status-badge.failed { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* Live Stream Box */
.stream-container {
  background: #060911;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: var(--font-mono);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

.stream-header-row {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.col-time { width: 140px; }
.col-dev { width: 140px; }
.col-changes { flex: 1; }

.stream-body {
  height: 500px;
  overflow-y: auto;
  padding: 8px 16px;
}

.stream-item {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 13px;
  animation: streamIn 0.2s ease-out;
}

@keyframes streamIn {
  from { opacity: 0; background: rgba(6, 182, 212, 0.1); }
  to { opacity: 1; background: transparent; }
}

.stream-item .col-time { color: var(--text-muted); }
.stream-item .col-dev { color: var(--accent-cyan); font-weight: 600; }
.stream-item .col-changes { color: #e2e8f0; }

.empty-feed {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ==========================================================================
   Coherent Hardware Settings Viewer
   ========================================================================== */
.settings-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 72vh;
  overflow-y: auto;
  padding: 4px 6px 12px 4px;
}

.settings-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-card-icon {
  font-size: 16px;
}

.settings-card-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  margin: 0;
}

/* Chips / Status Pills */
.settings-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-chip {
  display: inline-flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-width: 140px;
}

.chip-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.chip-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.chip-active { border-color: rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.08); }
.chip-active .chip-val { color: var(--accent-green); }
.chip-inactive { border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); }
.chip-inactive .chip-val { color: var(--accent-red); }
.chip-warning { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); }
.chip-warning .chip-val { color: #f59e0b; }
.chip-info { border-color: rgba(59, 130, 246, 0.4); background: rgba(59, 130, 246, 0.08); }
.chip-info .chip-val { color: var(--accent-blue); }
.chip-primary { border-color: rgba(139, 92, 246, 0.4); background: rgba(139, 92, 246, 0.08); }
.chip-primary .chip-val { color: #a78bfa; }
.chip-cyan { border-color: rgba(6, 182, 212, 0.4); background: rgba(6, 182, 212, 0.08); }
.chip-cyan .chip-val { color: #22d3ee; }
.chip-purple { border-color: rgba(217, 70, 239, 0.4); background: rgba(217, 70, 239, 0.08); }
.chip-purple .chip-val { color: #e879f9; }

/* Metrics Grid for Timers */
.settings-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.settings-metric-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}

.sm-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.sm-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 4px 0 2px 0;
  font-family: var(--font-mono);
}

.sm-unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.sm-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Alert Banner */
.settings-alert-banner {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
}

.settings-alert-banner.info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.settings-alert-banner.muted {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

/* Group Cards */
.settings-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.settings-group-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.group-badge {
  font-size: 12px;
  font-weight: 700;
  color: #a78bfa;
}

.group-mask-text {
  font-size: 10px;
  color: var(--text-muted);
}

.group-canons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.canon-pill {
  display: inline-block;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.group-delay-footer {
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 6px;
  margin-top: 2px;
}

/* Single Canon Mode Flow */
.single-canons-flow {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.single-delays-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.single-delay-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.sd-label {
  font-size: 11px;
  color: var(--text-muted);
}

.sd-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* Calendar Grid */
.calendar-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

/* Raw Details */
.raw-settings-details {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.raw-settings-summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.raw-settings-summary:hover {
  color: var(--text-primary);
}

.summary-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.raw-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  max-height: 250px;
  overflow-y: auto;
}

.raw-setting-row {
  display: flex;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.raw-k { color: var(--text-muted); }
.raw-v { color: var(--text-primary); font-weight: 700; }

/* Settings Modal Tabs & Live Badge */
.settings-nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.settings-nav-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-nav-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.settings-nav-tab.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.modal-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--accent-green);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  margin-left: 8px;
  transition: transform 0.2s ease;
  animation: pulse-dot 2.5s infinite;
}

@keyframes pulse-dot {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

/* Delays Grouping */
.delays-grid-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.delays-subgroup-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 4px;
  margin-bottom: 2px;
}

.delays-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.delay-item-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.delay-item-card.active-mode {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.08);
}

.delay-item-card.bypassed {
  opacity: 0.45;
}

.delay-item-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.delay-item-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  margin-top: 3px;
}

/* 12-Month Calendar Schedule */
.months-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.month-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.month-card.has-off-days {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.08);
}

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

.month-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.month-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.month-badge.all-work {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.month-badge.off-scheduled {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.month-off-list {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.month-regs-hint {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.email-meta-box {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.email-body-box {
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.email-body-box pre {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #cbd5e1;
  white-space: pre-wrap;
}

.loading-cell, .loading-spinner {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

/* ==========================================================================
   Danger / Revocation Styles
   ========================================================================== */
.modal-danger {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 25px 50px -12px rgba(239, 68, 68, 0.25);
}

.danger-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.danger-title-box h3 {
  color: #f87171;
  margin: 0;
}

.danger-icon {
  font-size: 22px;
}

.danger-warning-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: #fca5a5;
  line-height: 1.5;
  margin-bottom: 20px;
}

.code-highlight {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.device-card.revoked-card {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.05) 0%, rgba(17, 24, 39, 0.85) 100%);
}

.online-tag.revoked {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid var(--accent-red);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.7);
}

/* Role Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 9999px;
  margin-left: 6px;
}
.badge-admin {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-service {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}
.badge-operator {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.badge-employee {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Employee management */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.forced-password-notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  font-size: 13px;
}
.badge-viewer {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Language Selector Header Component */
.lang-selector-box {
  display: flex;
  align-items: center;
}
.lang-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}
.lang-select:hover, .lang-select:focus {
  border-color: var(--accent-blue);
  background: rgba(255, 255, 255, 0.1);
}

/* Next Inspection Date Badges on Device Card */
.inspection-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.inspection-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
}
.inspection-badge.overdue {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.inspection-badge.due-soon {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.inspection-badge.normal {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.inspection-badge.none {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Inspection & Records Modal Styles */
.inspection-header-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.inspection-header-box .date-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inspection-form-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
}
.inspection-form-box h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.records-container {
  margin-top: 14px;
}
.records-container h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}
.inspection-records-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.record-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color 0.2s ease;
}
.record-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}
.record-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.record-name {
  font-weight: 600;
  color: #f0f6fc;
  font-size: 14px;
}
.record-date {
  font-size: 12px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}
.record-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  white-space: pre-wrap;
  margin-bottom: 6px;
}
.record-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Online Status Group & Subtitle */
.online-status-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.status-lastseen {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: default;
}

.status-lastseen .lastseen-icon {
  font-size: 10px;
  opacity: 0.85;
}

.status-lastseen .lastseen-label {
  color: var(--text-muted);
}

.status-lastseen .lastseen-value {
  color: var(--accent-cyan);
  font-weight: 600;
}

.status-subtime {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.2px;
}

.card-footer-last-seen {
  width: 100%;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.05);
}

.device-modal-status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-status-lastseen {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* Status Summary Box inside Modal */
.status-summary-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.summary-stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-stat-tile .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.summary-stat-tile .stat-value {
  font-size: 15px;
  font-weight: 700;
  color: #f0f6fc;
  font-family: var(--font-mono);
}

/* Status History Table */
.status-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 10px;
}

.status-history-table th {
  text-align: left;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.status-history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.status-history-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.status-badge.offline {
  background: rgba(107, 114, 128, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

.status-badge.outage {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Sync Button Animation & Cooldown */
.sync-btn {
  position: relative;
  transition: all 0.2s ease;
}

.sync-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

/* Floating Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 99999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

.toast.toast-success {
  background: rgba(16, 185, 129, 0.92);
  color: #ffffff;
  border: 1px solid #10b981;
}

.toast.toast-warning {
  background: rgba(245, 158, 11, 0.92);
  color: #1e1e24;
  border: 1px solid #f59e0b;
}

.toast.toast-error {
  background: rgba(239, 68, 68, 0.92);
  color: #ffffff;
  border: 1px solid #ef4444;
}

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

/* ==========================================================================
   Device Credentials & Passwords
   ========================================================================== */
.credentials-box {
  background: rgba(22, 27, 34, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm, 6px);
  padding: 8px 12px;
  margin: 10px 0 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.credential-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.cred-label {
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.cred-value-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.cred-value {
  font-family: var(--font-mono, monospace, 'SF Mono', Consolas);
  font-size: 12px;
  color: #93c5fd;
  user-select: all;
}

.cred-masked {
  letter-spacing: 2px;
  color: var(--text-muted, #64748b);
  user-select: none;
}

.cred-toggle-btn,
.cred-copy-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 13px;
  border-radius: 3px;
  opacity: 0.75;
  transition: opacity 0.15s ease, transform 0.1s ease;
  line-height: 1;
}

.cred-toggle-btn:hover,
.cred-copy-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.cred-toggle-btn:active,
.cred-copy-btn:active {
  transform: scale(0.95);
}

.modal-section-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 18px 0 14px 0;
}

.modal-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  margin-bottom: 12px;
}

.input-password-wrap {
  display: flex;
  align-items: center;
  position: relative;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding-right: 6px;
}

.input-password-wrap input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 8px 12px;
  color: #f0f6fc;
}

.input-password-wrap .btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 14px;
  opacity: 0.75;
  transition: opacity 0.15s ease, transform 0.1s ease;
  line-height: 1;
}

.input-password-wrap .btn-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}



/* --- Device assignment checklists (device modal) --- */
.assign-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .assign-grid {
    grid-template-columns: 1fr;
  }
}

.assign-list {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #161b22;
  padding: 4px;
}

.assign-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}

.assign-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.assign-item small {
  color: var(--text-muted);
}

.assign-item.assign-disabled {
  opacity: 0.6;
}

.assign-empty {
  padding: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.assigned-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* --- Disabled accounts --- */
.badge-disabled {
  background: rgba(107, 114, 128, 0.2);
  color: var(--text-muted);
  border: 1px solid rgba(107, 114, 128, 0.4);
}

.row-disabled td {
  opacity: 0.6;
}

/* --- Open alerts badge on device cards --- */
.open-alerts-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.open-alerts-badge:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* --- Audit log details --- */
.audit-details {
  margin: 0;
  max-width: 420px;
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}
