﻿:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #101622;
  --bg-card: rgba(18, 25, 38, 0.85);
  --bg-card-hover: rgba(26, 36, 54, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;

  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', monospace;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.35);
  --shadow-glow-success: 0 0 15px rgba(16, 185, 129, 0.4);
}

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

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Top Navigation Bar */
.top-nav {
  height: 60px;
  background: rgba(16, 22, 34, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

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

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.logo-text h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

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

.logo-text .sub-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-top: -2px;
}

.bus-status-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  position: relative;
}

.status-indicator.offline {
  background: rgba(244, 63, 94, 0.12);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

button.status-indicator.btn-bus-toggle {
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

button.status-indicator.btn-bus-toggle:hover {
  transform: translateY(-1px);
  filter: brightness(1.2);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

button.status-indicator.btn-bus-toggle.offline:hover {
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
}

button.status-indicator.btn-bus-toggle:active {
  transform: translateY(1px);
}

button.status-indicator.btn-bus-toggle.loading {
  opacity: 0.7;
  pointer-events: none;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse-anim 2s infinite;
}

@keyframes pulse-anim {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.endpoint-badge, .counter-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

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

/* Buttons */
.btn {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #2563eb);
  color: #fff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

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

.btn-sm {
  font-size: 0.76rem;
  padding: 5px 10px;
}

.btn-icon {
  padding: 6px;
  border-radius: 6px;
}


/* App Main Layout: Full column for catalog sidebar + right content area */
.app-main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.app-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* App Workspace */
.app-workspace {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Left Sidebar */
.catalog-sidebar {
  width: 290px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

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

.sidebar-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.badge {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.sidebar-action-bar {
  padding: 12px 14px 4px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.sidebar-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 12px 16px 6px;
}

.catalog-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.catalog-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  cursor: grab;
  transition: all 0.2s ease;
  position: relative;
}

.catalog-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.catalog-item-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.catalog-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  font-size: 1rem;
}

.catalog-item-info h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.catalog-item-info p {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.catalog-objects-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.tag-obj {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
}

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

.info-card {
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  gap: 10px;
  font-size: 0.73rem;
  color: var(--text-muted);
}
.info-card i {
  color: var(--accent-cyan);
  font-size: 1rem;
  margin-top: 2px;
}
.info-card strong {
  color: var(--text-main);
}
.info-card code {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* Installations (Impianti) Sidebar */
.installations-sidebar {
  width: 290px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.installations-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.installation-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.installation-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
}

.installation-card.active {
  background: linear-gradient(145deg, rgba(6, 182, 212, 0.12), rgba(15, 23, 42, 0.85));
  border: 1.5px solid var(--accent-cyan);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.22);
}

.inst-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.inst-card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.inst-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.installation-card.active .inst-card-icon {
  background: rgba(6, 182, 212, 0.2);
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.inst-card-info {
  min-width: 0;
  flex: 1;
}

.inst-card-info h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.inst-badge-active {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 6px;
  border-radius: 6px;
  margin-top: 3px;
}

.inst-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-inst-action {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
}

.btn-inst-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-inst-action.btn-del:hover {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-inst-action.btn-edit:hover {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.3);
}

.inst-card-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.73rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
}

.inst-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inst-detail-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
}

.inst-detail-item i {
  color: var(--accent-cyan);
  font-size: 0.75rem;
}

.inst-card-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Canvas Area */
.canvas-container {
  flex: 1;
  position: relative;
  background: radial-gradient(#1e293b 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: var(--bg-primary);
  overflow: auto;
}

.canvas-empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-dim);
  pointer-events: none;
}
.canvas-empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.4;
}
.canvas-empty-state h3 {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
}
.canvas-empty-state p {
  font-size: 0.82rem;
  margin-top: 4px;
}

.canvas-world {
  min-width: 2500px;
  min-height: 2000px;
  position: relative;
}

/* Actuator Card on Canvas */
.actuator-node {
  position: absolute;
  width: 280px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: default;
  z-index: 20;
}

.actuator-node:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

.actuator-node.active-light {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.25);
}

.node-header {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: move;
}

.node-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.node-address {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(6, 182, 212, 0.2);
  flex-shrink: 0;
}

.node-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  width: 100%;
}

.node-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-node-tool {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  transition: color 0.15s;
}
.btn-node-tool:hover {
  color: var(--text-main);
}
.btn-node-tool.delete:hover {
  color: var(--accent-rose);
}

.node-body {
  padding: 12px 14px;
}

/* Interactive Status Display */
.node-interactive-display {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.state-bulb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.state-bulb.on {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #fff;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.7);
  transform: scale(1.05);
}

.node-state-label {
  font-size: 0.85rem;
  font-weight: 600;
}
.node-state-label.on {
  color: var(--accent-amber);
}

/* Shutter Display */
.shutter-display {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.shutter-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}
.shutter-progress {
  height: 100%;
  background: var(--accent-blue);
  width: 0%;
  transition: width 0.3s;
}

/* Dimmer Slider */
.dimmer-control {
  width: 100%;
}
.dimmer-slider {
  width: 100%;
  margin-top: 6px;
  accent-color: var(--accent-amber);
}

/* Communication Objects / Pins Toggle & List */
.node-objects-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 2px 0;
  cursor: pointer;
  user-select: none;
  margin-top: 2px;
}

.node-objects-toggle .toggle-track {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.2s ease;
}

.node-objects-toggle:hover .toggle-track {
  background: rgba(56, 189, 248, 0.35);
}

.btn-toggle-chevron {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 0.72rem;
  width: 22px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s, color 0.2s, border-color 0.2s;
}

.node-objects-toggle:hover .btn-toggle-chevron {
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.12);
}

.btn-toggle-chevron.open {
  transform: rotate(180deg);
  color: var(--accent-cyan);
}

.node-objects-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.25s ease;
}

.node-objects-list.collapsed {
  display: none !important;
}

.node-objects-list.open {
  display: flex;
  margin-top: 8px;
  animation: nodeObjectsFade 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes nodeObjectsFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.obj-pin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  font-size: 0.72rem;
}

.obj-name {
  font-family: var(--font-mono);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.obj-dpt {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.obj-ga-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.25);
  cursor: pointer;
  transition: all 0.15s;
}
.obj-ga-badge:hover {
  background: var(--accent-blue);
  color: #fff;
}
.obj-ga-badge.unbound {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border-color: var(--border-color);
}
.obj-ga-badge.unbound:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

/* Group Monitor Panel */
.bus-monitor-panel {
  height: 220px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 90;
  position: relative;
  transition: height 0.25s ease;
  overflow: hidden;
}

.bus-monitor-panel.resizing {
  transition: none !important;
  user-select: none;
}

.panel-resizer {
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 10px;
  cursor: row-resize;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: background-color 0.2s;
}

.panel-resizer:hover, .panel-resizer.active {
  background: rgba(6, 182, 212, 0.25);
}

.resizer-handle-grip {
  width: 54px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.panel-resizer:hover .resizer-handle-grip,
.panel-resizer.active .resizer-handle-grip {
  background: var(--accent-cyan);
  width: 72px;
  box-shadow: 0 0 10px var(--accent-cyan);
}

.bus-monitor-panel.collapsed {
  height: 42px;
}

.monitor-header {
  height: 42px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(16, 22, 34, 0.95);
}

.monitor-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.live-tag {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.monitor-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box i {
  position: absolute;
  left: 10px;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.search-box input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 10px 4px 28px;
  font-size: 0.75rem;
  color: var(--text-main);
  outline: none;
  width: 180px;
}
.search-box input:focus {
  border-color: var(--accent-blue);
}

.monitor-table-wrapper {
  flex: 1;
  overflow-y: auto;
  font-family: var(--font-mono);
}

.monitor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
}

.monitor-table th {
  position: sticky;
  top: 0;
  background: #131b2a;
  color: var(--text-muted);
  text-align: left;
  padding: 8px 12px;
  font-weight: 500;
  border-bottom: 1px solid var(--border-color);
}

.monitor-table td {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.monitor-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.telegram-in {
  color: var(--accent-emerald);
}
.telegram-out {
  color: var(--accent-cyan);
}
.telegram-val-on {
  color: var(--accent-amber);
  font-weight: 600;
}
.telegram-val-off {
  color: var(--text-dim);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 480px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.modal-lg {
  width: 760px;
}

@keyframes modal-pop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

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

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1rem;
}
.python-icon {
  color: #38bdf8;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
}
.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.modal-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.code-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.editor-info {
  font-size: 0.73rem;
  color: var(--text-muted);
}
.editor-info code {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.code-textarea {
  width: 100%;
  height: 380px;
  background: #06090e;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  outline: none;
  resize: vertical;
}
.code-textarea:focus {
  border-color: var(--accent-blue);
}

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

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

.form-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
}
.form-input:focus {
  border-color: var(--accent-blue);
}

.radio-toggle-group {
  display: flex;
  gap: 8px;
}

.btn-toggle {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 8px;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-toggle.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

.bindings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.binding-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}
.binding-item-info {
  display: flex;
  flex-direction: column;
}
.binding-obj-name {
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-mono);
}
.binding-obj-dpt {
  font-size: 0.7rem;
  color: var(--text-dim);
}
.binding-input {
  width: 120px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  text-align: center;
}
.binding-input:focus {
  border-color: var(--accent-blue);
}

/* Settings Modal Elements */
.input-with-action {
  display: flex;
  gap: 8px;
}

.form-select {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}
.form-select:focus {
  border-color: var(--accent-blue);
}
.form-select optgroup {
  background: #111827;
  color: var(--accent-cyan);
  font-weight: 600;
}
.form-select option {
  background: #1e293b;
  color: var(--text-main);
}

.clock-preview-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
  box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.05);
}

.clock-preview-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.clock-preview-time {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin: 4px 0;
  letter-spacing: 1px;
  text-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.clock-preview-tz {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-blue);
  cursor: pointer;
}
.checkbox-row code {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* Template Objects Table */
.tpl-objects-table-wrapper {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  max-height: 180px;
  overflow-y: auto;
}

.tpl-objects-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.tpl-objects-table th {
  background: #111827;
  color: var(--text-muted);
  text-align: left;
  padding: 8px 10px;
  font-weight: 500;
  border-bottom: 1px solid var(--border-color);
}

.tpl-objects-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tpl-objects-table input, .tpl-objects-table select {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 4px 8px;
  color: var(--text-main);
  font-size: 0.75rem;
  outline: none;
}

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

.btn-del-row {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
}
.btn-del-row:hover {
  color: var(--accent-rose);
}



/* Keypad / Access Control Card Styles */
.keypad-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.keypad-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  transition: all 0.3s ease;
}

.keypad-status-bar.door-open {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.2);
}

.keypad-status-bar.alarm-active {
  background: rgba(225, 29, 72, 0.25);
  border-color: #f43f5e;
  animation: pulse-alarm 1s infinite alternate;
}

@keyframes pulse-alarm {
  from { box-shadow: 0 0 4px rgba(244, 63, 94, 0.4); }
  to { box-shadow: 0 0 16px rgba(244, 63, 94, 0.9); }
}

.door-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.keypad-status-bar:not(.door-open) .door-indicator {
  color: #f87171;
}
.keypad-status-bar.door-open .door-indicator {
  color: #4ade80;
}

.keypad-badges {
  display: flex;
  align-items: center;
  gap: 5px;
}

.badge-pins {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.badge-alarm {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e11d48;
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.keypad-action-msg {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid var(--accent-blue);
}

.keypad-interactive {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.keypad-display-wrapper {
  display: flex;
  gap: 4px;
}

.keypad-screen {
  flex: 1;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 2px;
  color: #38bdf8;
  text-align: center;
  outline: none;
}

.btn-clear-keypad {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-clear-keypad:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.kp-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-radius: 6px;
  padding: 6px 0;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.kp-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}
.kp-btn:active {
  transform: translateY(1px);
  background: rgba(255, 255, 255, 0.2);
}

.kp-btn.kp-esc {
  color: var(--text-main);
  font-weight: 600;
}
.kp-btn.kp-enter {
  background: rgba(14, 165, 233, 0.2);
  border-color: rgba(14, 165, 233, 0.4);
  color: #38bdf8;
}
.kp-btn.kp-enter:hover {
  background: rgba(14, 165, 233, 0.35);
  color: #fff;
}



/* Group Monitor Header Description & Counter */
.th-desc-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.th-desc-wrapper .counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
  cursor: default;
  transition: all 0.2s ease;
}

.th-desc-wrapper .counter-badge i {
  color: var(--accent-cyan);
  font-size: 0.68rem;
}

.th-desc-wrapper .counter-badge.filtering {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.th-desc-wrapper .counter-badge.filtering i {
  color: #fbbf24;
}

/* Group Monitor Layout with Left Controls and Right Server Info Box */
.monitor-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.monitor-header-right {
  display: flex;
  align-items: center;
}

.server-info-tag {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.server-info-tag i {
  color: var(--accent-cyan);
}

.monitor-body-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.monitor-server-info-box {
  width: 330px;
  background: rgba(16, 22, 34, 0.85);
  border-left: 1px solid var(--border-color);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.72rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.server-info-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.76rem;
  color: var(--text-main);
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.server-info-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.server-info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.server-info-item .info-label {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.71rem;
}

.server-info-item .info-label i {
  color: var(--accent-cyan);
  font-size: 0.7rem;
  width: 14px;
  text-align: center;
}

.server-info-item .info-value {
  display: flex;
  align-items: center;
  gap: 4px;
}

.server-info-item .info-value code {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.71rem;
  background: rgba(6, 182, 212, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.server-info-item .info-value small {
  color: var(--text-dim);
  font-size: 0.65rem;
}

/* 3 Columns App Layout */
.app-main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* Center Column (Canvas Top + Log Bottom) */
.app-center-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* Right Sidebar: Full Height Column (Impianti Top + Server Info Bottom) */
.installations-sidebar {
  width: 330px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 10;
  height: 100%;
  flex-shrink: 0;
}

.sidebar-block-installations {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sidebar-block-server-info {
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}


/* Sidebar Catalog Search Box */
.sidebar-search-box {
  position: relative;
  padding: 8px 14px 2px;
  display: flex;
  align-items: center;
}

.sidebar-search-box .search-icon {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-dim);
  pointer-events: none;
  transition: color 0.2s;
}

.sidebar-search-box input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 30px 7px 32px;
  color: var(--text-main);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.sidebar-search-box input::placeholder {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.sidebar-search-box input:focus {
  border-color: var(--accent-blue);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15), inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

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

.sidebar-search-box .btn-clear-search {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.15s;
}

.sidebar-search-box .btn-clear-search:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.catalog-empty-search {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.catalog-empty-search i {
  font-size: 1.6rem;
  color: var(--text-dim);
  opacity: 0.5;
}

.catalog-empty-search p {
  margin: 0;
  line-height: 1.4;
}

.badge.filtering {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}


/* Catalog Item Actions (Edit / Delete) */
.catalog-item-info {
  flex: 1;
  min-width: 0;
}

.catalog-item-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

.btn-catalog-tool {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-catalog-tool:hover {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.3);
}

.btn-catalog-tool.delete:hover {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}


/* Keypad Aux Buttons (Tasti A e B per BX-E-AK12) */
.keypad-aux-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.kp-aux-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 5px 0;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.kp-aux-btn:hover {
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

.kp-aux-btn:active {
  transform: translateY(1px);
}

/* ==========================================================================
   User Profile Badge in Top Nav
   ========================================================================== */
.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  margin-left: 6px;
  font-size: 0.8rem;
  backdrop-filter: blur(8px);
}

.user-role-tag {
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.3px;
}

.user-name-text {
  color: var(--text-main);
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #fda4af;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(244, 63, 94, 0.25);
  border-color: rgba(244, 63, 94, 0.5);
  color: #fff;
  transform: translateY(-1px);
}

/* ==========================================================================
   Auth Login Modal Overlay (Full-screen Dark Glassmorphism)
   ========================================================================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 15, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: authFadeIn 0.3s ease-out;
}

@keyframes authFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: linear-gradient(135deg, rgba(22, 30, 46, 0.95) 0%, rgba(13, 19, 31, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 35px rgba(59, 130, 246, 0.12);
  overflow: hidden;
  animation: authSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-card-glow {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card-header {
  text-align: center;
  margin-bottom: 26px;
}

.auth-logo-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

.auth-card-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

.auth-card-header h2 span {
  color: var(--accent-cyan);
}

.auth-badge-role {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.4;
  margin: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  background: rgba(10, 15, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
}

.auth-input:focus {
  border-color: var(--accent-blue);
  background: rgba(14, 21, 35, 0.95);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.auth-input::placeholder {
  color: var(--text-dim);
}

.btn-toggle-pwd {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
  transition: color 0.15s ease;
}

.btn-toggle-pwd:hover {
  color: var(--text-main);
}

.auth-error-box {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fda4af;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: authShake 0.3s ease;
}

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.btn-login-submit {
  width: 100%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  color: #fff;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
}

.btn-login-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.btn-login-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-login-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.auth-footer-hint {
  text-align: center;
  margin-top: 20px;
  font-size: 0.74rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* ==========================================================================
   Sync Models Button (Figlio - Download from Helsinki)
   ========================================================================== */
.btn-sync-models {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
  animation: pulseSyncBtn 2.2s infinite ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-sync-models:hover {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%) !important;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55) !important;
  transform: translateY(-1px);
}

.btn-sync-models.loading {
  opacity: 0.75;
  pointer-events: none;
}

@keyframes pulseSyncBtn {
  0%, 100% {
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow: 0 6px 22px rgba(16, 185, 129, 0.65);
    border-color: rgba(255, 255, 255, 0.45);
  }
}

#syncCountBadge {
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 700;
}


.catalog-shared-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
}
