/* ==========================================================================
   REGISTRO FERMI MACCHINA - DESIGN SYSTEM & STYLES
   ========================================================================== */

:root {
  --color-header-bg: #0b3546;
  --color-header-dark: #072532;
  --color-nav-bg: #092c39;
  --color-nav-active: #051d27;
  --color-sidebar-bg: #07222e;
  --color-sidebar-item-hover: #0d3b4e;
  --color-sidebar-item-active: #134e68;
  --color-accent-gold: #ebaa34;
  --color-accent-gold-hover: #d89620;
  --color-bg-main: #edf2f6;
  --color-card-bg: #ffffff;
  --color-text-main: #1a202c;
  --color-text-muted: #64748b;
  --color-text-light: #e2e8f0;
  --color-border: #cbd5e1;
  --color-border-dotted: #94a3b8;
  --color-kpi-bg: #0a3344;
  --color-danger-border: #d93838;
  --color-success-border: #27ae60;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--color-bg-main);
  color: var(--color-text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* LOGIN SCREEN */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #072532 0%, #0b3546 60%, #134e68 100%);
  padding: 20px;
}

.login-card {
  background: var(--color-card-bg);
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-header {
  background-color: var(--color-header-bg);
  color: white;
  padding: 30px 25px;
  text-align: center;
  border-bottom: 3px solid var(--color-accent-gold);
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-header p {
  color: #94a3b8;
  font-size: 0.875rem;
}

.login-body {
  padding: 28px 25px;
}

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

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.925rem;
  font-family: inherit;
  color: var(--color-text-main);
  background-color: #f8fafc;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-header-bg);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(11, 53, 70, 0.15);
}

.btn-primary-gold {
  width: 100%;
  padding: 12px;
  background-color: var(--color-accent-gold);
  color: #072532;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-primary-gold:active {
  transform: translateY(1px);
}

/* SYSTEM TOP NAV */
.system-navbar {
  background-color: var(--color-header-dark);
  color: white;
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
}

.system-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-accent-gold);
}

.system-user-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-nav-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--color-text-light);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-nav-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-color: white;
}

.btn-nav-admin {
  background-color: rgba(235, 170, 52, 0.15);
  border: 1px solid var(--color-accent-gold);
  color: var(--color-accent-gold);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-nav-admin:hover {
  background-color: var(--color-accent-gold);
  color: #072532;
}

/* MACHINERY GRID SELECTION SCREEN */
.grid-view-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 130px 20px;
  width: 100%;
  flex: 1;
}

.grid-view-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
}

.grid-title h2 {
  font-size: 1.6rem;
  color: var(--color-header-bg);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.grid-title p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.grid-search-filter {
  display: flex;
  gap: 12px;
}

.grid-search-input {
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  min-width: 240px;
}

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

@media (max-width: 1024px) {
  .machinery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .machinery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* MACHINERY CARDS WITH HIGH-VISIBILITY 5PX GLOWING BORDERS */
.machine-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: 5px solid #22c55e !important;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.2);
}

.machine-card.border-in-funzione {
  border: 5px solid #22c55e !important;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.2) !important;
}

.machine-card.border-fermo {
  border: 5px solid #ef4444 !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.5) !important;
}

.machine-card.border-manutenzione {
  border: 5px solid #eab308 !important;
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.5) !important;
}

.machine-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.machine-card-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-bottom: 2px solid var(--color-border);
  background-color: #f1f5f9;
}

.machine-card-header {
  background-color: var(--color-header-bg);
  color: white;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.banco-tag {
  background-color: rgba(235, 170, 52, 0.15);
  border: 1px solid var(--color-accent-gold);
  color: var(--color-accent-gold);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge.in-funzione {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.status-badge.fermo {
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.status-badge.manutenzione {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

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

.machine-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-header-bg);
  line-height: 1.3;
}

.machine-info-item {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.machine-info-item span {
  font-weight: 600;
  color: #334155;
}

.machine-card-stats {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--color-border);
  display: flex;
  justify-content: space-between;
  font-size: 0.775rem;
}

.machine-card-footer {
  padding: 10px 16px;
  background-color: #f8fafc;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-card-action {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--color-header-bg);
}

.btn-open-kpi {
  background: transparent;
  border: 1px solid var(--color-border);
  color: #475569;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-open-kpi:hover {
  background: #e2e8f0;
  color: var(--color-header-bg);
}

/* GLOBAL SUMMARY FOOTER BAR */
.global-summary-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--color-header-dark);
  border-top: 3px solid var(--color-accent-gold);
  color: white;
  padding: 16px 32px;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.summary-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.summary-title-label {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent-gold);
  display: flex;
  align-items: center;
  gap: 10px;
}

.summary-cards-container {
  display: flex;
  gap: 18px;
  flex: 1;
  justify-content: flex-end;
}

.summary-rect-card {
  background-color: #0a3344;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
}

.summary-rect-card.danger {
  border-bottom: 4px solid var(--color-danger-border);
}

.summary-rect-card.success {
  border-bottom: 4px solid var(--color-success-border);
}

.summary-card-label {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.summary-card-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: white;
  line-height: 1.2;
  margin-top: 4px;
}

.summary-card-value span {
  font-size: 0.9rem;
  font-weight: 500;
  color: #cbd5e1;
  margin-left: 2px;
}

@media (max-width: 900px) {
  .summary-content {
    flex-direction: column;
    align-items: stretch;
  }
  .summary-cards-container {
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .summary-rect-card {
    min-width: 45%;
    flex: 1;
  }
}

/* MACHINERY DETAIL VIEW */
.detail-view-container {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg-main);
  padding-bottom: 40px;
}

.detail-header-banner {
  background-color: var(--color-header-bg);
  color: white;
  padding: 24px 32px 18px 32px;
  border-bottom: 3px solid var(--color-accent-gold);
}

.detail-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.back-to-grid-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.back-to-grid-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.detail-title-group h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.detail-title-group p {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-top: 4px;
}

.banco-badge-large {
  border: 1px solid var(--color-accent-gold);
  color: var(--color-accent-gold);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 6px 14px;
  border-radius: 3px;
  letter-spacing: 0.08em;
  background-color: rgba(7, 37, 50, 0.6);
  white-space: nowrap;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.2);
  padding-top: 16px;
}

.metadata-col {
  padding: 0 16px;
  border-right: 1px dashed rgba(255, 255, 255, 0.25);
}

.metadata-col:first-child {
  padding-left: 0;
}

.metadata-col:last-child {
  border-right: none;
  padding-right: 0;
}

.metadata-label {
  font-size: 0.675rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 2px;
}

.metadata-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.3;
}

.detail-tab-nav {
  background-color: var(--color-nav-bg);
  padding: 0 32px;
  display: flex;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 14px 24px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  transition: color 0.2s, background-color 0.2s;
}

.tab-btn:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #ffffff;
  background-color: var(--color-nav-active);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--color-accent-gold);
}

.tab-content-area {
  max-width: 1200px;
  width: 100%;
  margin: 32px auto;
  padding: 0 20px;
}

.kpi-wrapper-card, .form-wrapper-card, .history-wrapper-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  padding: 28px;
}

.kpi-card-header, .form-header-row, .history-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.kpi-card-header h2, .form-header-row h2, .history-header-row h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-header-bg);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.updated-time, .form-header-subtext {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.kpi-box {
  background-color: var(--color-kpi-bg);
  color: white;
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
  position: relative;
  overflow: hidden;
}

.kpi-box.danger-accent {
  border-bottom: 3px solid var(--color-danger-border);
}

.kpi-box.success-accent {
  border-bottom: 3px solid var(--color-success-border);
}

.kpi-box-title {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.kpi-box-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  margin-top: 10px;
  color: #ffffff;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.kpi-box-value span {
  font-size: 1rem;
  font-weight: 500;
  color: #cbd5e1;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.chart-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 20px;
  background-color: #fafbfc;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.chart-panel h3 {
  font-size: 0.775rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-header-bg);
  margin-bottom: 16px;
}

.chart-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.bar-chart-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bar-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.775rem;
  color: #334155;
  font-weight: 600;
}

.bar-track {
  height: 12px;
  background-color: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background-color: var(--color-header-bg);
  border-radius: 6px;
  transition: width 0.4s ease;
}

.bar-fill.accent {
  background-color: var(--color-accent-gold);
}

.empty-chart-placeholder {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  text-align: center;
}

.downtime-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: flex;
  gap: 20px;
}

.form-col-12 { flex: 0 0 100%; }
.form-col-6  { flex: 1; }
.form-col-4  { flex: 1; }
.form-col-3  { flex: 1; }

.form-control-static {
  background-color: #f1f5f9;
  border: 1px dashed var(--color-border-dotted);
  color: #0f172a;
  font-weight: 600;
}

.form-control-duration {
  background-color: #f0fdf4;
  border: 1px dashed #86efac;
  color: #166534;
  font-weight: 700;
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

.form-actions-right {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.btn-submit-gold {
  background-color: var(--color-accent-gold);
  color: #072532;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-submit-gold:hover {
  background-color: var(--color-accent-gold-hover);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.history-filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-select, .filter-search {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background-color: #f8fafc;
  color: #334155;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.history-table th {
  background-color: #ffffff;
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 10px;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.history-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
  vertical-align: middle;
}

.history-table tbody tr:hover {
  background-color: #f8fafc;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.status-pill.risolto { background: #dcfce7; color: #166534; }
.status-pill.in-corso { background: #fee2e2; color: #991b1b; }
.status-pill.attesa-ricambi { background: #fef3c7; color: #92400e; }
.status-pill.sospeso { background: #f1f5f9; color: #475569; }

.empty-history-notice {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.page-footer-note {
  text-align: center;
  font-size: 0.775rem;
  color: #94a3b8;
  margin-top: 24px;
}

/* DEDICATED ADMIN PANEL PAGE LAYOUT */
.admin-page-container {
  display: flex;
  min-height: calc(100vh - 45px);
  width: 100%;
  background-color: var(--color-bg-main);
  flex: 1;
}

.admin-sidebar {
  width: 270px;
  background-color: var(--color-sidebar-bg);
  color: white;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.admin-sidebar-header {
  padding: 24px 20px;
  background-color: #051a24;
  border-bottom: 2px solid var(--color-accent-gold);
}

.admin-sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: white;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-sidebar-header p {
  color: #94a3b8;
  font-size: 0.775rem;
  margin-top: 4px;
}

.admin-vnav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.admin-vnav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #cbd5e1;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}

.admin-vnav-item:hover {
  background-color: var(--color-sidebar-item-hover);
  color: white;
}

.admin-vnav-item.active {
  background-color: var(--color-sidebar-item-active);
  color: white;
  border-left: 4px solid var(--color-accent-gold);
  font-weight: 700;
}

.admin-vnav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.admin-sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background-color: #04141c;
}

.btn-exit-admin {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-exit-admin:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: white;
}

.admin-main-workspace {
  flex: 1;
  padding: 32px 36px;
  overflow-y: auto;
  max-width: 1300px;
}

.admin-panel-card {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  padding: 28px;
  margin-bottom: 24px;
}

.admin-panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.admin-panel-title h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-header-bg);
}

.admin-panel-title p {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.725rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-badge.admin {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.role-badge.operatore {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.admin-action-btn {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.admin-action-btn.edit {
  background-color: #e2e8f0;
  color: #1e293b;
  margin-right: 6px;
}

.admin-action-btn.edit:hover {
  background-color: #cbd5e1;
}

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

.admin-action-btn.delete:hover {
  background-color: #fca5a5;
}

.admin-inline-form {
  background-color: #f8fafc;
  border: 1px solid var(--color-border);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-top: 20px;
}

.admin-inline-form h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-header-bg);
  margin-bottom: 14px;
}

/* ADMIN OPTIONS MODULES (TURNI, TIPI, GRUPPI) */
.add-item-form {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.add-item-form input {
  flex: 1;
}

.add-item-form button {
  white-space: nowrap;
  padding: 10px 20px;
  height: 42px;
}

.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
}

.btn-danger-sm {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger-sm:hover {
  background-color: #fca5a5;
  color: #7f1d1d;
}

/* DRAG AND DROP UPLOAD ZONE FOR MACHINE IMAGES */
.drag-drop-zone {
  border: 2px dashed var(--color-border-dotted);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  background-color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.drag-drop-zone.dragover {
  border-color: var(--color-accent-gold);
  background-color: rgba(235, 170, 52, 0.08);
}

.drag-drop-icon {
  font-size: 2rem;
  margin-bottom: 6px;
  color: var(--color-text-muted);
}

.drag-drop-text {
  font-size: 0.85rem;
  color: #334155;
  font-weight: 600;
}

.drag-drop-subtext {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.image-preview-thumb {
  max-height: 100px;
  max-width: 100%;
  border-radius: 4px;
  margin-top: 8px;
  object-fit: cover;
  border: 1px solid #cbd5e1;
}

.btn-remove-image {
  margin-top: 6px;
  background: #fee2e2;
  color: #991b1b;
  border: none;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* ==========================================================================
   INTERACTIVE DOWNTIME MODAL POPUP STYLES
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(7, 37, 50, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: white;
  width: 100%;
  max-width: 560px;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  border: 2px solid var(--color-header-bg);
  animation: modalPop 0.25s ease-out;
}

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

.modal-header {
  background-color: var(--color-header-bg);
  color: white;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--color-accent-gold);
}

.modal-header-title h3 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.modal-header-title p {
  font-size: 0.8rem;
  color: #94a3b8;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: white;
}

.modal-body {
  padding: 24px;
}

.auto-detected-badge-row {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  background-color: #f1f5f9;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--color-border-dotted);
}

.auto-detected-item {
  flex: 1;
  font-size: 0.8rem;
  color: #475569;
}

.auto-detected-item strong {
  display: block;
  font-size: 0.95rem;
  color: #0f172a;
}

.choice-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}

.btn-choice {
  padding: 20px;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  background: white;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.btn-choice:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-choice.resolve {
  border-color: #22c55e;
  background-color: #f0fdf4;
}

.btn-choice.resolve:hover {
  background-color: #dcfce7;
}

.btn-choice.waiting {
  border-color: #eab308;
  background-color: #fefce8;
}

.btn-choice.waiting:hover {
  background-color: #fef9c3;
}

.choice-icon {
  font-size: 2rem;
}

.choice-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--color-header-bg);
}

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

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-accent-gold);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
