@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette - TotalAgro (Green/Earthy) */
  --primary: #2d6a4f;      /* Verde bosque profundo */
  --primary-hover: #1b4332;/* Verde muy oscuro */
  --primary-light: #94C973;/* Verde oliva/lima claro */
  
  --success: #40916c;      /* Verde éxito */
  --success-hover: #2d6a4f;
  
  --danger: #b91c1c;       /* Rojo terroso */
  --danger-hover: #991b1b; 
  
  --warning: #d97706;      /* Ámbar / Naranja terroso */
  --warning-hover: #b45309;
  
  /* Backgrounds & Surfaces */
  --bg-body: #f5f5f0;      /* Beige muy claro / Gris cálido */
  --bg-surface: #ffffff;
  --bg-navbar: #1b4332;    /* Verde oscuro para Navbar */
  --bg-navbar-hover: #2d6a4f;
  
  /* Text Colors */
  --text-main: #27272a;    /* Zinc 800 */
  --text-muted: #52525b;   /* Zinc 600 */
  --text-light: #f8fafc;
  
  /* Borders & Shadows */
  --border-color: #e4e4e7; /* Zinc 200 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --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);
  
  /* Border Radius */
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-pill: 9999px;
}

/* Global Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1rem;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Navbar */
.header {
  background: var(--bg-navbar);
  color: var(--text-light);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: white;
}

.menu a {
  color: #e2e8f0;
  margin-left: 0.5rem;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
}

.menu a:hover {
  background: var(--bg-navbar-hover);
  color: white;
}

/* Typography & Cards */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

/* KPI Components */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
  text-decoration: none;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.kpi-title {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.kpi-value {
  color: var(--primary);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-value.warning { color: var(--warning); }
.kpi-value.danger { color: var(--danger); }
.kpi-value.success { color: var(--success); }

/* Buttons */
.btn, .btn-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: var(--shadow-sm);
}

.btn {
  background-color: var(--primary);
  color: white;
}
.btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success {
  background-color: var(--success);
  color: white;
}
.btn-success:hover {
  background-color: var(--success-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-red {
  background-color: var(--danger);
  color: white;
}
.btn-red:hover {
  background-color: var(--danger-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="date"],
select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: var(--bg-surface);
  transition: all 0.2s ease;
  font-family: inherit;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.2);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  margin-top: 1rem;
}

table.table-striped {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

table.table-striped th {
  background: #f4f4f5;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
}

table.table-striped td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.9rem;
}

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

table.table-striped tbody tr:nth-child(even) {
  background-color: #fafafa;
}

table.table-striped tbody tr:hover {
  background-color: #f0fdf4; /* Verde muy claro al pasar el mouse */
}

/* Badges (Pills) */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

.badge-success {
  background-color: #dcfce7; /* Verde claro */
  color: #166534; /* Verde oscuro texto */
  border: 1px solid #bbf7d0;
}

.badge-danger {
  background-color: #fee2e2; /* Rojo claro */
  color: #991b1b; /* Rojo oscuro texto */
  border: 1px solid #fecaca;
}

.badge-warning {
  background-color: #fef3c7; /* Ambar claro */
  color: #92400e; /* Ambar oscuro texto */
  border: 1px solid #fde68a;
}

.badge-primary {
  background-color: #e0e7ff; 
  color: #3730a3; 
  border: 1px solid #c7d2fe;
}

.badge-info {
  background-color: #e0f2fe; 
  color: #075985;
  border: 1px solid #bae6fd;
}

/* Glassmorphism utility */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .menu a {
    margin: 0;
  }
  
  .container {
    padding: 1rem;
  }
  
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   UX & UI ENHANCEMENTS
   ========================================= */

/* Accessibility: Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Modal Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
  backdrop-filter: blur(2px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  padding: 2rem;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease-out;
}

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

.modal-header h3 {
  margin: 0;
  color: var(--text-main);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--danger);
}

/* Toasts */
#toastContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  color: white;
  box-shadow: var(--shadow-md);
  animation: slideInToast 0.3s ease forwards;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.success { background-color: var(--success); }
.toast.error { background-color: var(--danger); }

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

/* Table Scroll Hints */
.table-wrapper {
  position: relative;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-top: 1rem;
}

/* Scroll hint shadows */
.table-wrapper::before,
.table-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s;
  opacity: 1;
}

.table-wrapper::before {
  left: 0;
  background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0));
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}

.table-wrapper::after {
  right: 0;
  background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
  border-top-right-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-surface);
  border-radius: inherit;
  border: 1px solid var(--border-color);
  /* Hide scrollbar for cleaner look if desired, but better to keep for accessibility */
}

/* Skeletons */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.skeleton {
  background: #f6f7f8;
  background-image: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
  background-repeat: no-repeat;
  background-size: 1000px 100%;
  display: inline-block;
  animation-duration: 1.5s;
  animation-fill-mode: forwards;
  animation-iteration-count: infinite;
  animation-name: shimmer;
  animation-timing-function: linear;
}

.skeleton-text {
  height: 1.2em;
  border-radius: 4px;
  width: 100%;
}

.skeleton-badge {
  height: 24px;
  border-radius: var(--radius-pill);
  width: 60px;
}

/* =========================================
   KANBAN BOARD STYLES
   ========================================= */
.kanban-board {
  display: flex;
  gap: 24px;
  margin-top: 24px;
  overflow-x: auto;
  padding-bottom: 24px;
  min-height: 60vh;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}

.kanban-board::-webkit-scrollbar {
  height: 8px;
}
.kanban-board::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.kanban-column {
  flex: 1;
  min-width: 320px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  scroll-snap-align: center;
}

.kanban-column h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 3px solid #e2e8f0;
}

.kanban-column#col-PENDIENTE h3 { border-bottom-color: var(--warning); }
.kanban-column#col-EN_PROGRESO h3 { border-bottom-color: var(--primary); }
.kanban-column#col-CERRADO h3 { border-bottom-color: var(--success); }

.kanban-card {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
  cursor: grab;
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
  position: relative;
  border: 1px solid #f1f5f9;
  border-left-width: 5px;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 12px rgba(0,0,0,0.08);
  border-right-color: #e2e8f0;
  border-top-color: #e2e8f0;
  border-bottom-color: #e2e8f0;
}
.kanban-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  box-shadow: none;
}

.kanban-dropzone {
  min-height: 100px;
  border: 2px dashed transparent;
  border-radius: 8px;
  transition: all 0.2s ease;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kanban-dropzone.drag-over {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.prioridad-ALTA { border-left-color: #ef4444; }
.prioridad-MEDIA { border-left-color: #f59e0b; }
.prioridad-BAJA { border-left-color: #10b981; }

.kanban-card .card-title {
  font-weight: bold;
  color: #1e293b;
  margin-bottom: 5px;
  font-size: 15px;
}
.kanban-card .vencimiento-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kanban-card .card-meta {
  font-size: 12px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}
.kanban-card .card-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

@media (max-width: 768px) {
  .kanban-board {
    gap: 16px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .kanban-column {
    min-width: 85vw;
  }
}

/* =========================================
   TABS & ADMIN TABLE ACTIONS
   ========================================= */
.tabs-container {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
  overflow-x: auto;
}
.tab-btn {
  background: transparent;
  border: none;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.tab-btn:hover { background: #f1f5f9; color: var(--primary); }
.tab-btn.active { background: var(--primary); color: white; }

.action-buttons {
  display: flex;
  gap: 8px;
}
.btn-edit, .btn-delete, .btn-new {
  padding: 6px 12px;
  border-radius: 4px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}
.btn-new {
  background-color: var(--primary);
  color: white;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}
.btn-new:hover { background-color: var(--primary-hover); transform: translateY(-1px); }

.btn-edit { background-color: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
.btn-edit:hover { background-color: #e2e8f0; transform: translateY(-1px); }

.btn-delete { background-color: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.btn-delete:hover { background-color: #fecaca; transform: translateY(-1px); }

.id-badge {
  background-color: #f1f5f9;
  color: #64748b;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}

.empty-state {
  padding: 40px 20px; text-align: center; color: #64748b;
}

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3); border-radius: 50%;
  border-top-color: white; animation: spin 1s ease-in-out infinite; margin-left: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================
   FORMS & INPUTS
   ========================================= */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border-color);
    border-radius: 6px; font-size: 14px; box-sizing: border-box;
    font-family: inherit; transition: all 0.2s; background: var(--bg-surface); color: var(--text-main);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* =========================================
   LOGIN PAGE
   ========================================= */
.login-page-body {
    background: linear-gradient(135deg, var(--bg-navbar), var(--text-main));
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}
.login-container {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.login-container img { height: 48px; margin-bottom: 1.5rem; border-radius: 8px; }
.login-container h2 { margin-bottom: 2rem; font-weight: 700; }
.login-btn {
    width: 100%; padding: 0.75rem; border: none; border-radius: var(--radius-md);
    background: var(--primary); color: white; font-weight: 600; font-size: 1rem;
    cursor: pointer; transition: all 0.2s; margin-top: 1rem;
}
.login-btn:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* =========================================
   REGISTRO WEB (OPERARIO)
   ========================================= */
#topbar {
  display: flex; align-items: center; justify-content: space-between; height: 56px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border-color);
  padding: 0 16px; position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
#topbar .title { font-size: 18px; font-weight: 800; color: var(--text-main); }
#topbar .title span { color: var(--primary); }

#estadoPill {
  font-size: 13px; font-weight: 700; padding: 5px 14px; border-radius: 20px;
  background: var(--bg-body); border: 1px solid var(--border-color); color: var(--text-muted); transition: all .3s;
}
#estadoPill.running { background: var(--success); color: white; }
#estadoPill.saving { background: var(--warning); color: white; }
#estadoPill.saved { background: var(--success); color: white; }
#estadoPill.error { background: var(--danger); color: white; }

.reg-main {
  flex: 1; display: flex; flex-direction: column-reverse; padding: 16px;
  gap: 16px; max-width: 800px; margin: 0 auto; width: 100%;
}
@media(min-width: 768px) {
  .reg-main { flex-direction: row; align-items: stretch; }
  .reg-left { flex: 2; } .reg-right { flex: 1; }
}

.reg-panel {
  background: var(--bg-surface); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 16px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  display: flex; flex-direction: column; gap: 12px;
}

.reg-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media(max-width: 480px) { .reg-field-row { grid-template-columns: 1fr; } }
.reg-field { display: flex; flex-direction: column; gap: 6px; }
.reg-field label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;}
.reg-field select, .reg-field input {
  height: 48px; background: var(--bg-surface); border: 1px solid var(--border-color);
  border-radius: 8px; color: var(--text-main); font-size: 15px; padding: 0 14px;
  outline: none; width: 100%; transition: all .2s; appearance: none; font-family: inherit;
}
.reg-field select:focus, .reg-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2); }
.reg-field select:disabled, .reg-field input:disabled { background: #f8fafc; color: #94a3b8; border-color: #e2e8f0; opacity: 1; }
.reg-sel-wrap { position: relative; }
.reg-sel-wrap::after { content: '▾'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; font-size: 18px; }

#timerBox {
  background: var(--bg-surface); border: 2px dashed var(--border-color); border-radius: 12px;
  text-align: center; padding: 24px 10px; margin-bottom: 8px; transition: all 0.3s;
}
#timerBox.running { border-color: var(--success); background: #f0fdf4; border-style: solid; }
#timerLabel { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 6px; letter-spacing: 0.5px;}
#cronometro { font-size: 52px; font-weight: 800; color: var(--text-main); font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -1.5px; }
#cronometro.running { color: var(--success); }

#summary { display: flex; flex-direction: column; gap: 10px; }
.sumrow { display: flex; flex-direction: column; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.sumrow:last-child { border-bottom: none; }
.sumrow strong { font-size: 11px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; letter-spacing: 0.5px;}
.sumrow span { font-size: 15px; font-weight: 600; color: var(--text-main); }

#actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.reg-btn {
  height: 52px; border: 0; border-radius: 10px; font-weight: 700; font-size: 16px; cursor: pointer;
  transition: all .2s; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.reg-btn:active { transform: scale(.96); }
.reg-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
#btnIniciar { background: var(--success); color: white; grid-column: 1 / -1; box-shadow: 0 4px 6px rgba(39, 174, 96, 0.2); }
#btnIniciar:not(:disabled):hover { background: var(--success-hover); box-shadow: 0 6px 14px rgba(39, 174, 96, 0.2); }
#btnGuardar { background: var(--primary); color: white; grid-column: 1 / 2; box-shadow: 0 4px 6px rgba(46, 125, 50, 0.2); }
#btnGuardar:not(:disabled):hover { background: var(--primary-hover); box-shadow: 0 6px 14px rgba(46, 125, 50, 0.2); }
#btnCancelar { background: white; border: 2px solid var(--danger); color: var(--danger); grid-column: 2 / 3; }
#btnRecargar { background: var(--bg-body); color: var(--text-muted); grid-column: 1 / -1; height: 44px; font-size: 14px; margin-top: 10px; }

#mensaje { display: none; padding: 12px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; margin-top: 8px; text-align: center; }
#mensaje.ok { display: block; background: var(--success); color: white; }
#mensaje.error { display: block; background: var(--danger); color: white; }

#reg-modal { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.7); backdrop-filter: blur(4px); z-index: 100; align-items: center; justify-content: center; padding: 16px; }
#reg-modal.visible { display: flex; }
#reg-modalBox { background: var(--bg-surface); border-radius: 16px; padding: 24px; width: 100%; max-width: 360px; box-shadow: 0 20px 40px rgba(0,0,0,.15); }
#reg-modalBox h2 { font-size: 20px; color: var(--text-main); margin-bottom: 8px; font-weight: 800;}
#reg-modalBox p { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
#modalCantidadInput { width: 100%; height: 64px; background: #f8fafc; border: 2px solid var(--primary); border-radius: 12px; color: var(--text-main); font-size: 36px; font-weight: 800; text-align: center; outline: none; margin-bottom: 20px; }
.modal-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-modal-cancel { background: var(--bg-body); color: var(--text-muted); border: none; border-radius: 10px; height: 48px; font-weight: 600; cursor: pointer; }
.btn-modal-ok { background: var(--primary); color: white; border: none; border-radius: 10px; height: 48px; font-weight: 600; cursor: pointer; }

#loadingOverlay { display: none; position: fixed; inset: 0; background: rgba(255,255,255,.9); backdrop-filter: blur(4px); z-index: 200; align-items: center; justify-content: center; flex-direction: column; gap: 16px; }
#loadingOverlay.visible { display: flex; }
.reg-spinner { width: 44px; height: 44px; border: 4px solid #e2e8f0; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
#loadingText { color: var(--text-main); font-size: 16px; font-weight: 700; }

/* =========================================
   BONOS / GENERIC
   ========================================= */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.titulo { font-size: 24px; font-weight: 600; color: var(--text-main); }
.simulador { margin-top:30px; padding:20px; background:#f8fafc; border-radius:12px; border: 1px solid var(--border-color); }
.info { background: #e0f2fe; padding: 15px; border-radius: 8px; margin-bottom: 20px; color: #075985; border: 1px solid #bae6fd;}
.btn-back { display: inline-flex; align-items: center; gap: 5px; margin-top: 20px; padding: 10px 15px; background: #64748b; color: white; text-decoration: none; border-radius: 6px; font-weight: 500; }
.btn-back:hover { background: #475569; }

/* =========================================
   PSEUDO-BOOTSTRAP UTILITIES (For compatibility)
   ========================================= */
/* Alerts */
.alert { padding: 1rem; border-radius: var(--radius-md); margin-bottom: 1rem; border: 1px solid transparent; }
.alert-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.alert-info { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }

/* Grid */
.row { display: flex; flex-wrap: wrap; margin: -0.75rem; }
.col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; padding: 0.75rem; }
.col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; padding: 0.75rem; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; padding: 0.75rem; }
.col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; padding: 0.75rem; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; padding: 0.75rem; }
@media (max-width: 768px) {
  .col-md-7, .col-md-5, .col-md-6, .col-md-8 { flex: 0 0 100%; max-width: 100%; }
}

/* Utilities */
.w-100 { width: 100%; }
.mb-0 { margin-bottom: 0 !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.my-4 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; gap: 0.5rem; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.align-items-center { align-items: center !important; }
.text-center { text-align: center !important; }
.text-end { text-align: right !important; }
.text-muted { color: var(--text-muted) !important; }
.text-white { color: white !important; }
.text-dark { color: #1e293b !important; }
.fw-bold { font-weight: 700 !important; }

/* Card Additions */
.card-header { padding: 1rem 1.5rem; margin: -1.5rem -1.5rem 1.5rem -1.5rem; border-bottom: 1px solid var(--border-color); border-radius: var(--radius-lg) var(--radius-lg) 0 0; font-weight: 600; }
.card-header.bg-primary { background: var(--primary); color: white; border-bottom: none; }
.card-header.bg-secondary { background: var(--text-muted); color: white; border-bottom: none; }
.card-header.bg-dark { background: var(--text-main); color: white; border-bottom: none; }
.card-body.p-0 { padding: 0; }

/* Button Additions */
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-outline-primary { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }
.btn-outline-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: white; }
.btn-outline-warning { background: transparent; border: 1px solid var(--warning); color: var(--warning); }
.btn-outline-warning:hover { background: var(--warning); color: white; }
.btn-outline-secondary { background: transparent; border: 1px solid var(--text-muted); color: var(--text-muted); }
.btn-outline-secondary:hover { background: var(--text-muted); color: white; }
.btn-light { background: #f8fafc; color: #334155; border: 1px solid var(--border-color); }
.btn-light:hover { background: #e2e8f0; }

/* Table Additions */
.table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.table th, .table td { padding: 1rem; border-bottom: 1px solid var(--border-color); text-align: left; }
.table th { background: #f8fafc; font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 0.8rem; }
.table-hover tbody tr:hover { background: #f1f5f9; }

/* Form Additions */
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 600; font-size: 0.875rem; color: var(--text-muted); }
.form-control, .form-select { width: 100%; padding: 0.625rem 0.875rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); font-size: 0.95rem; font-family: inherit; background: var(--bg-surface); color: var(--text-main); transition: all 0.2s; }
.form-control:focus, .form-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,106,79,0.2); }
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check-input { width: 1.1rem; height: 1.1rem; cursor: pointer; }
.form-check-label { font-size: 0.9rem; color: var(--text-main); cursor: pointer; font-weight: 400; }
.form-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Badges Additions */
.bg-primary { background-color: var(--primary); }
.bg-secondary { background-color: var(--text-muted); }
.bg-success { background-color: var(--success); }
.bg-danger { background-color: var(--danger); }
.bg-warning { background-color: var(--warning); }
.bg-info { background-color: #0ea5e9; }

/* =========================================
   TICKET DETALLE
   ========================================= */

    /* Premium Design Overrides */
    
    
    

    /* Glassmorphism Card */
    .glass-card {
        background: rgba(255, 255, 255, 0.7);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
        border-radius: 16px;
        padding: 24px;
        margin-bottom: 24px;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
    .glass-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.08), 0 10px 15px -6px rgba(0, 0, 0, 0.03);
    }

    /* Hero Section */
    .hero-section {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 20px;
        margin-bottom: 30px;
    }
    .ticket-title {
        font-size: 28px;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 16px;
    }
    .consecutivo {
        color: var(--text-muted);
        font-weight: 500;
        background: rgba(255,255,255,0.5);
        padding: 4px 12px;
        border-radius: 8px;
        border: 1px solid rgba(255,255,255,0.8);
    }

    /* Badges */
    .badge {
        display: inline-flex;
        align-items: center;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }
    .badge-estado-PENDIENTE { background: linear-gradient(135deg, var(--bg-surface), var(--warning)); color: var(--warning-hover); border: 1px solid var(--bg-surface); }
    .badge-estado-EN_PROGRESO { background: linear-gradient(135deg, #bfdbfe, #93c5fd); color: var(--primary-hover); border: 1px solid #bfdbfe; }
    .badge-estado-CERRADO { background: linear-gradient(135deg, var(--bg-surface), var(--success-hover)); color: var(--success-hover); border: 1px solid var(--bg-surface); }

    
    
    
    
    
    
    

    /* Live Counter */
    .live-counter-container {
        background: linear-gradient(135deg, var(--text-main), var(--text-main));
        color: white;
        padding: 12px 24px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        gap: 12px;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
    }
    .live-counter-val {
        font-family: monospace;
        font-size: 18px;
        font-weight: 600;
        letter-spacing: 0.5px;
        color: var(--primary-light);
    }
    
    /* Layout */
    .layout-grid {
        display: grid;
        grid-template-columns: 40% 60%;
        gap: 24px;
        align-items: start;
    }
    @media(max-width:900px) {
        .layout-grid { grid-template-columns: 1fr; }
    }

    /* Form Styles Premium */
    .form-group { margin-bottom: 20px; }
    .form-group label {
        display: block;
        font-weight: 600;
        margin-bottom: 8px;
        color: var(--text-main);
        font-size: 13px;
        letter-spacing: 0.02em;
    }
    .form-control {
        width: 100%;
        padding: 12px 16px;
        border-radius: 10px;
        border: 1px solid rgba(203, 213, 225, 0.8);
        background: rgba(255, 255, 255, 0.9);
        font-family: inherit;
        font-size: 14px;
        box-sizing: border-box;
        transition: all 0.3s ease;
        box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    }
    .form-control:focus {
        outline: none;
        border-color: var(--success);
        background: white;
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
    }

    /* Buttons */
    .btn-primary {
        background: linear-gradient(135deg, var(--success) 0%, var(--success-hover) 100%);
        color: white;
        border: none;
        padding: 12px 20px;
        border-radius: 10px;
        font-weight: 600;
        font-family: inherit;
        cursor: pointer;
        transition: all 0.3s ease;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    }
    .btn-primary:hover { 
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4); 
    }
    .btn-primary:disabled { opacity:0.7; cursor:not-allowed; transform:none; }

    .btn-secondary {
        background: rgba(255,255,255,0.8);
        color: var(--text-main);
        border: 1px solid rgba(203, 213, 225, 0.8);
        padding: 10px 16px;
        border-radius: 10px;
        font-weight: 600;
        font-family: inherit;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
        transition: all 0.3s ease;
        backdrop-filter: blur(4px);
    }
    .btn-secondary:hover { background: white; border-color: var(--text-muted); transform: translateY(-1px); box-shadow: 0 4px 6px rgba(0,0,0,0.02); }

    .btn-whatsapp { 
        background: linear-gradient(135deg, var(--success), var(--success-hover)); 
        color: white; 
        border: none; 
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    }
    .btn-whatsapp:hover { color: white; background: linear-gradient(135deg, var(--success-hover), #128c7e); }

    /* Timeline Styles */
    .timeline { padding-left: 10px; margin-top: 20px; }
    .timeline-item { position: relative; padding-left: 36px; margin-bottom: 24px; }
    .timeline-item::before {
        content: '';
        position: absolute;
        left: 15px;
        top: 32px;
        bottom: -24px;
        width: 2px;
        background: linear-gradient(to bottom, #cbd5e1, rgba(203,213,225,0));
    }
    .timeline-item:last-child::before { display: none; }

    .timeline-avatar {
        position: absolute;
        left: 0;
        top: 0;
        width: 32px;
        height: 32px;
        background: linear-gradient(135deg, var(--primary-light), var(--primary));
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 14px;
        border: 2px solid white;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        z-index: 1;
    }

    .timeline-content {
        background: rgba(255,255,255,0.8);
        border: 1px solid rgba(226, 232, 240, 0.8);
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }
    
    .timeline-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
    .timeline-text { font-size: 14px; color: var(--text-main); line-height: 1.6; white-space: pre-wrap; }

    .info-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 20px;
    }
    .info-label { color:var(--text-muted); font-size:12px; display:block; margin-bottom:4px; text-transform:uppercase; letter-spacing:0.05em; font-weight:600;}
    .info-value { font-weight: 600; color: var(--text-main); font-size:14px; }

/* =========================================
   INFORMES
   ========================================= */





.topbar{
    display:flex;
    justify-content:space-between;
    align-items:center;
    background:var(--primary-hover);
    color:white;
    padding:16px 25px;
    border-radius:8px;
    box-shadow:0 4px 10px rgba(0,0,0,.2);
    margin-bottom:24px;
}

.titulo{
    font-size:22px;
    font-weight:bold;
}

.btn-informes-home{
    background:#2e7d32;
    color:white;
    padding:10px 16px;
    border-radius:8px;
    text-decoration:none;
    font-weight:bold;
    transition:.3s;
}

.btn-informes-home:hover{
    background:#1b5e20;
}

.semana-card{
    background:white;
    border:1px solid #e1e7ec;
    border-radius:8px;
    box-shadow:0 2px 8px rgba(0,0,0,.07);
    margin-bottom:28px;
    overflow:hidden;
}

.semana-header{
    display:flex;
    justify-content:space-between;
    gap:18px;
    align-items:center;
    background:#37474f;
    color:white;
    padding:16px 20px;
}

.semana-header h2{
    margin:0;
    font-size:20px;
}

.semana-header span{
    color:#dce5ea;
    font-size:13px;
}

.kpis{
    display:grid;
    grid-template-columns:repeat(4,minmax(140px,1fr));
    gap:12px;
    padding:16px 20px 4px;
}

.kpi{
    border:1px solid #e5e7eb;
    border-radius:8px;
    padding:12px;
    background:#fafafa;
}

.kpi span{
    display:block;
    color:#607d8b;
    font-size:12px;
    font-weight:bold;
    text-transform:uppercase;
    margin-bottom:5px;
}

.kpi strong{
    font-size:24px;
    color:var(--primary-hover);
}

.bloque{
    padding:16px 20px 20px;
}

.bloque h3{
    margin:0 0 10px;
    color:var(--primary-hover);
    font-size:17px;
}

.operario-list{
    display:grid;
    grid-template-columns:1fr;
    gap:16px;
}

.operario-subbloque{
    border:1px solid #dce5ea;
    border-radius:8px;
    overflow:hidden;
    background:#fbfcfd;
}

.operario-subheader{
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:center;
    background:#edf3f6;
    border-bottom:1px solid #dce5ea;
    padding:12px 14px;
}

.operario-subheader h4{
    color:var(--primary-hover);
    font-size:16px;
    margin:0;
}

.operario-subheader span{
    color:#607d8b;
    font-size:13px;
    font-weight:bold;
}

.operario-resumen{
    display:grid;
    grid-template-columns:repeat(4,minmax(120px,1fr));
    gap:10px;
    padding:12px 14px;
}

.operario-metrica{
    background:white;
    border:1px solid #e5e7eb;
    border-radius:8px;
    padding:10px;
}

.operario-metrica span{
    color:#607d8b;
    display:block;
    font-size:12px;
    font-weight:bold;
    margin-bottom:4px;
    text-transform:uppercase;
}

.operario-metrica strong{
    color:var(--primary-hover);
    font-size:18px;
}

.operario-tabla{
    padding:0 14px 14px;
}









.sin-datos{
    background:white;
    border:1px solid #e1e7ec;
    border-radius:8px;
    padding:22px;
    color:#607d8b;
    text-align:center;
}

.btn-export{
    display:inline-block;
    background:var(--primary);
    color:white;
    padding:12px 22px;
    border-radius:8px;
    text-decoration:none;
    font-weight:bold;
    transition:.3s;
    margin-top:4px;
}

.btn-export:hover{
    background:var(--primary-hover);
}

.export-panel{
    background:white;
    border:1px solid #e1e7ec;
    border-radius:8px;
    box-shadow:0 2px 8px rgba(0,0,0,.07);
    margin-bottom:24px;
    padding:18px 20px;
}

.export-panel h2{
    color:var(--primary-hover);
    font-size:18px;
    margin:0 0 14px;
}

.export-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(220px,1fr));
    gap:14px;
}

.export-option{
    border:1px solid #e5e7eb;
    border-radius:8px;
    padding:14px;
    background:#fafafa;
}

.export-option h3{
    color:var(--primary-hover);
    font-size:16px;
    margin:0 0 12px;
}

.export-actions{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    align-items:center;
}

.export-form{
    display:grid;
    grid-template-columns:1fr auto;
    gap:8px;
    margin-top:10px;
}

.export-form input{
    border:1px solid #cfd8dc;
    border-radius:8px;
    font-size:14px;
    padding:9px 10px;
    min-width:0;
}

.btn-export-sec{
    background:#455a64;
    border:0;
    color:white;
    cursor:pointer;
    border-radius:8px;
    font-weight:bold;
    padding:10px 12px;
    text-decoration:none;
}

.btn-export-sec:hover{
    background:var(--primary-hover);
}

@media (max-width: 760px){
    

    .topbar,
    .semana-header{
        align-items:flex-start;
        flex-direction:column;
    }

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

    .operario-subheader{
        align-items:flex-start;
        flex-direction:column;
    }

    .operario-resumen{
        grid-template-columns:1fr 1fr;
    }

    .export-grid,
    .export-form{
        grid-template-columns:1fr;
    }

    
}

/* =========================================
   PLANIFICADOR
   ========================================= */

/* Reset & Typography */




.wrap { padding: 24px; max-width: 1500px; margin: 0 auto; }

/* Glassmorphism Classes */
.glass-panel {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    overflow: hidden;
}

/* Hero Section */
.hero {
    padding: 24px 32px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--text-main) 100%);
    color: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}
.hero h1 { font-size: 28px; margin: 0 0 8px; color: #f8fafc; }
.hero p { color: var(--text-muted); margin: 0; line-height: 1.5; max-width: 800px; font-size: 15px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Buttons */
.btn {
    border: 0; border-radius: 8px; padding: 12px 20px; cursor: pointer;
    font-weight: 700; font-family: inherit;
    transition: all 0.2s ease;
    font-size: 14px;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.btn.primary { background: linear-gradient(135deg, var(--success) 0%, var(--success-hover) 100%); color: white; }
.btn.blue { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%); color: white; }
.btn.light { background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.2); backdrop-filter: blur(4px); }
.btn.light:hover { background: rgba(255,255,255,0.2); }
.btn.danger { background: linear-gradient(135deg, var(--danger) 0%, var(--danger-hover) 100%); color: white; }
.btn.outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); }
.btn.outline:hover { background: #f1f5f9; }

/* Controls */
.controls {
    padding: 20px 24px;
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: 1.2fr repeat(4, minmax(150px, 1fr));
    gap: 16px;
    align-items: end;
}
.field label { display: block; font-size: 12px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin-bottom: 8px; letter-spacing: 0.05em; }
select, input[type=number] {
    width: 100%; height: 44px;
    border: 1px solid rgba(203, 213, 225, 0.6);
    border-radius: 8px; padding: 8px 12px; font-size: 15px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-main); font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
select:focus, input[type=number]:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Metrics */
.metrics {
    display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px;
}
.metric {
    padding: 20px; text-align: left;
    transition: transform 0.2s ease;
}
.metric:hover { transform: translateY(-4px); }
.metric span { display: block; font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; margin-bottom: 8px; letter-spacing: 0.05em; }
.metric strong { display: block; font-size: 28px; color: var(--text-main); line-height: 1.1; font-family: inherit; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric small { display: block; color: var(--text-muted); margin-top: 6px; font-size: 13px; line-height: 1.4; }

/* Workspace Layout */
.workspace { display: grid; grid-template-columns: minmax(560px, 1.2fr) minmax(430px, 0.8fr); gap: 20px; }

/* Panel generic */
.panel-head {
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.panel-head h2 { font-size: 18px; margin: 0; color: var(--text-main); font-weight: 600; }
.panel-head small { color: var(--text-muted); font-weight: 500; font-size: 13px; }

/* Table */
.table-wrap { max-height: 650px; overflow: auto; }
.table-wrap::-webkit-scrollbar { width: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    background: rgba(248, 250, 252, 0.9); backdrop-filter: blur(4px);
    color: var(--text-muted); text-align: left; padding: 14px 20px; position: sticky; top: 0; z-index: 2;
    font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: 0.05em;
    border-bottom: 2px solid rgba(226, 232, 240, 0.8);
}
td { padding: 14px 20px; border-bottom: 1px solid rgba(226, 232, 240, 0.6); vertical-align: middle; }
tr:hover { background: rgba(255, 255, 255, 0.6); }
.activity-name strong { display: block; margin-bottom: 4px; color: var(--text-main); font-weight: 600; }
.muted { color: var(--text-muted); font-size: 13px; }
.pre { font-size: 12px; color: var(--text-muted); max-width: 210px; line-height: 1.4; }

/* Stepper */
.num-cell { width: 130px; }
.stepper { display: grid; grid-template-columns: 36px 50px 36px; gap: 4px; align-items: center; }
.stepper button {
    height: 36px; border: 1px solid rgba(203, 213, 225, 0.6); background: rgba(248, 250, 252, 0.8);
    border-radius: 8px; font-weight: 700; cursor: pointer; color: var(--text-muted); transition: all 0.2s;
}
.stepper button:hover { background: var(--border-color); color: var(--text-main); }
.stepper input {
    height: 36px; text-align: center; padding: 4px; border: 1px solid rgba(203, 213, 225, 0.6);
    border-radius: 8px; font-weight: 600; color: var(--text-main); background: rgba(255,255,255,0.8);
}

/* Pills */
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.05em; }





/* Progress Mini Bar */
.bar-cell { min-width: 120px; }
.mini-track { height: 8px; background: rgba(226, 232, 240, 0.8); border-radius: 999px; overflow: hidden; }
.mini-bar { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, #60a5fa 100%); border-radius: 999px; width: 0; transition: width 0.3s ease; }

/* Sidebar */
.side { display: grid; gap: 20px; }

/* Gantt */
.gantt { padding: 20px; }
.gantt-scale { height: 30px; border-bottom: 2px solid rgba(226, 232, 240, 0.8); color: var(--text-muted); font-size: 12px; display: flex; justify-content: space-between; margin-bottom: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.gantt-row { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: center; margin-bottom: 14px; }
.gantt-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); }
.gantt-track { height: 32px; background: rgba(241, 245, 249, 0.6); border: 1px solid rgba(226, 232, 240, 0.8); border-radius: 8px; position: relative; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); }
.gantt-bar { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%); border-radius: 6px; position: absolute; min-width: 3px; box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3); transition: all 0.3s ease; }
.gantt-bar.bottleneck { background: linear-gradient(90deg, var(--danger) 0%, var(--danger-hover) 100%); box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3); }
.gantt-label { position: absolute; right: 8px; top: 8px; font-size: 11px; color: #fff; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* Recommendations */
.cards { display: grid; gap: 12px; padding: 20px; }
.rec { border: 1px solid rgba(226, 232, 240, 0.8); border-radius: 12px; padding: 14px 16px; background: rgba(255, 255, 255, 0.7); font-size: 14px; line-height: 1.5; box-shadow: 0 4px 12px rgba(0,0,0,0.02); backdrop-filter: blur(8px); }
.rec strong { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 700; }
.rec
.rec
.rec

/* Tabs */
.tabs { display: flex; gap: 8px; padding: 12px 24px 0; background: transparent; border-bottom: 2px solid rgba(203, 213, 225, 0.5); margin-bottom: 20px; }
.tab { border: none; background: transparent; color: var(--text-muted); padding: 10px 16px; font-weight: 700; cursor: pointer; border-bottom: 3px solid transparent; font-size: 14px; transition: all 0.2s; font-family: inherit; }
.tab:hover { color: var(--text-main); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.hidden { display: none !important; }
.empty { padding: 40px; text-align: center; color: var(--text-muted); font-size: 15px; }

/* Network Diagram */
#network-container {
    width: 100%;
    height: 600px;
    background: transparent;
}
.node-popup {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    flex-direction: column;
    gap: 10px;
    min-width: 200px;
}

/* Responsive */
@media(max-width: 1150px) {
  .controls, .metrics, .workspace { grid-template-columns: 1fr; }
  .table-wrap { max-height: none; }
}
@media(max-width: 768px) {
  .wrap { padding: 12px; }
  .hero { flex-direction: column; align-items: stretch; text-align: center; padding: 20px; }
  .hero-actions { justify-content: center; width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .controls { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 12px; }
  .table-wrap { overflow: visible; }
  table, thead, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { border-bottom: 1px solid rgba(226, 232, 240, 0.8); padding: 16px; background: rgba(255,255,255,0.4); border-radius: 8px; margin-bottom: 12px; }
  td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; align-items: center; }
  td::before { content: attr(data-label); font-size: 11px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin-right: 12px; }
  .num-cell, .bar-cell { width: auto; max-width: 150px; }
  .metrics .metric:last-child { grid-column: span 2; }
}
@media print {
  
  .global-nav-shell, .hero-actions, .controls, .tabs, .btn { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .glass-panel { border: 1px solid #ccc; box-shadow: none; background: white; page-break-inside: avoid; margin-bottom: 20px; }
}

/* =========================================
   ADMIN TOOLS PANEL
   ========================================= */

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}
.tool-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.tool-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.tool-icon {
    font-size: 24px;
    margin-bottom: 12px;
    display: inline-block;
}
.tool-title {
    margin: 0 0 8px 0;
    color: var(--text-main);
    font-size: 18px;
    font-weight: 600;
}
.tool-desc {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 20px 0;
    line-height: 1.5;
    flex-grow: 1;
}
.page-header {
    margin-bottom: 30px;
}
.page-header h1 {
    margin: 0 0 8px 0;
    color: var(--text-main);
    font-size: 28px;
}
.page-header p {
    margin: 0;
    color: var(--text-muted);
}

/* =========================================
   DASHBOARD HOME
   ========================================= */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 24px;
}
.page-head h1 {
    margin: 0;
    font-size: 28px;
    color: var(--text-main);
}
.page-head p {
    margin: 6px 0 0;
    color: var(--text-muted);
}
.filter-group select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: white;
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
}
.kpi-unit {
    font-size: 16px;
    color: var(--text-muted);
    margin-left: 8px;
    font-weight: 500;
}
.kpi-trend {
    display: flex;
    align-items: center;
    font-size: 13px;
    margin-top: 12px;
    font-weight: 500;
}
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.trend-neutral { color: var(--text-muted); }

.progress-container {
    width: 100%;
    background-color: var(--border-color);
    border-radius: 9999px;
    height: 8px;
    margin-top: 16px;
    overflow: hidden;
}
.progress-bar {
    background-color: var(--primary);
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease-in-out;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-top: 24px;
}
@media(max-width:900px){
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

.section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}
.section h2 {
    margin: 0 0 20px;
    font-size: 18px;
    color: var(--text-main);
}

.alert-item {
    background: #fef9c3;
    border-left: 4px solid var(--warning);
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 12px;
}
.alert-item.high {
    background: #fef2f2;
    border-left-color: var(--danger);
}
.alert-item h4 {
    margin: 0 0 4px;
    font-size: 14px;
    color: var(--warning-hover);
}
.alert-item.high h4 {
    color: var(--danger-hover);
}
.alert-item p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}
.info-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-body);
    border-radius: 8px;
    margin-bottom: 12px;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-color);
}
.info-item:hover {
    background: #eef2ff; /* adjust if necessary, maybe #f0fdf4 */
}
.info-icon {
    background: #dcfce7;
    color: var(--success-hover);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: bold;
}
.info-text strong {
    display: block;
    font-size: 14px;
}
.info-text span {
    font-size: 12px;
    color: var(--text-muted);
}

@media(max-width:700px){
    .page-head{align-items:flex-start;flex-direction:column}
}
