/* ============================================
   TodoPMP Gantt - Design System Profesional
   Navy / Teal / Coral
   ============================================ */

/* ---- Design Tokens ---- */
:root {
  /* Sidebar */
  --sidebar-bg: #0f1923;
  --sidebar-hover: #1a2836;
  --sidebar-active: #1e3a5f;
  --sidebar-width: 230px;
  --sidebar-text: #8899aa;
  --sidebar-text-active: #ffffff;
  --sidebar-accent: #0ea5e9;
  --sidebar-border: rgba(255,255,255,0.06);

  /* Colors */
  --primary: #1e293b;
  --primary-light: #334155;
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --coral: #f97316;
  --coral-hover: #ea580c;
  --success: #22c55e;
  --success-light: #dcfce7;
  --warning: #eab308;
  --warning-light: #fef9c3;
  --danger: #ef4444;
  --danger-light: #fee2e2;

  /* Backgrounds */
  --bg: #f1f5f9;
  --bg-content: #f8fafc;
  --card-bg: #ffffff;

  /* Text */
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --text-muted: #cbd5e1;

  /* Borders & Shadows */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);

  /* Radius */
  --radius: 8px;
  --radius-lg: 12px;
  --radius-sm: 4px;

  /* Transitions */
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Custom Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ---- App Layout ---- */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 50;
  transition: width var(--transition);
}

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand a {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-brand .brand-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.sidebar-brand .brand-subtitle {
  font-size: 11px;
  color: var(--sidebar-text);
  letter-spacing: 0.3px;
}

/* Sidebar Navigation */
.sidebar-nav {
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 18px 6px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: all var(--transition);
  position: relative;
  border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.sidebar-nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  border-left-color: var(--sidebar-accent);
}

.sidebar-nav-item .nav-icon {
  font-size: 17px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav-item.active .nav-icon {
  opacity: 1;
}

/* Sidebar Footer - Banner */
.sidebar-footer {
  padding: 0;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--sidebar-text);
  transition: background var(--transition);
}

.sidebar-banner:hover {
  background: var(--sidebar-hover);
}

.sidebar-banner-icon { font-size: 20px; flex-shrink: 0; }

.sidebar-banner-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.sidebar-banner-text strong {
  color: #e2a84b;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.sidebar-banner-text span {
  font-size: 10px;
  color: var(--sidebar-text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-banner-arrow {
  font-size: 14px;
  color: #475569;
  flex-shrink: 0;
  margin-left: auto;
  transition: transform 0.2s, color 0.2s;
}

.sidebar-banner:hover .sidebar-banner-arrow {
  transform: translateX(3px);
  color: #e2a84b;
}

/* PMBOK Banner - Highlighted */
.sidebar-banner.sidebar-banner--pmbok {
  background: linear-gradient(135deg, #1a3a2e 0%, #1e4d3a 50%, #1a3a2e 100%);
  border-top: 1px solid rgba(34,197,94,0.15);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.sidebar-banner.sidebar-banner--pmbok::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #22c55e, #4ade80, #22c55e, transparent);
  animation: pmbok-shine 3s ease-in-out infinite;
}

@keyframes pmbok-shine {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.sidebar-banner.sidebar-banner--pmbok:hover {
  background: linear-gradient(135deg, #1e4d3a 0%, #236b4a 50%, #1e4d3a 100%);
}

.sidebar-banner.sidebar-banner--pmbok .sidebar-banner-icon {
  font-size: 26px;
  filter: drop-shadow(0 0 4px rgba(34,197,94,0.3));
}

.sidebar-banner.sidebar-banner--pmbok .sidebar-banner-text strong {
  color: #4ade80;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.sidebar-banner.sidebar-banner--pmbok .sidebar-banner-text span {
  color: #86efac;
  font-size: 10px;
}

.sidebar-banner.sidebar-banner--pmbok .sidebar-banner-arrow {
  color: #4ade80;
  font-size: 16px;
}

.sidebar-banner.sidebar-banner--pmbok:hover .sidebar-banner-arrow {
  color: #bbf7d0;
  transform: translateX(4px);
}

.sidebar-banner.sidebar-banner--pmbok .pmbok-badge {
  display: inline-block;
  background: rgba(34,197,94,0.2);
  color: #4ade80;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  margin-top: 3px;
  border: 1px solid rgba(34,197,94,0.25);
}

/* Sidebar Disclaimer */
.sidebar-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 10px 16px;
  font-size: 9px;
  color: #64748b;
  line-height: 1.4;
  border-top: 1px solid var(--sidebar-border);
  background: rgba(255,255,255,0.02);
}

.sidebar-disclaimer-icon {
  color: #eab308;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: -1px;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ---- Toolbar ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  z-index: 40;
}

.toolbar .project-name-input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  width: 220px;
  font-family: inherit;
  transition: border-color var(--transition);
}

.toolbar .project-name-input::placeholder { color: var(--text-muted); }
.toolbar .project-name-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 4px;
}

.toolbar .status-date-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.toolbar .status-date-group input[type="date"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all var(--transition);
  white-space: nowrap;
  background: var(--card-bg);
  color: var(--text-secondary);
}

.btn:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-toolbar {
  background: var(--card-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-toolbar:hover {
  background: var(--bg);
  color: var(--text);
}

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

.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #16a34a; border-color: #16a34a; }

.btn-warning { background: var(--coral); color: white; border-color: var(--coral); }
.btn-warning:hover { background: var(--coral-hover); border-color: var(--coral-hover); }

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 4px 6px; font-size: 14px; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ---- Ad Container ---- */
.ad-container {
  padding: 4px 16px;
  background: var(--bg-content);
  max-height: 100px;
  overflow: hidden;
}

/* ---- Content Area ---- */
.content {
  flex: 1;
  overflow: auto;
  padding: 20px;
  background: var(--bg-content);
}

/* ---- Card ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
}

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

.card-header h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* ============================================
   AI PROJECT GENERATOR
   ============================================ */
.btn-ai-generate {
  background: linear-gradient(135deg, #059669, #0ea5e9);
  color: white;
  border: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-ai-generate:hover {
  background: linear-gradient(135deg, #047857, #0284c7);
  color: white;
}
.btn-ai-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal--generate {
  max-width: 520px;
  width: 100%;
}

.generate-textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--transition);
}
.generate-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}
.generate-textarea:disabled {
  background: var(--bg);
  opacity: 0.7;
}

.generate-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

.generate-preview-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.generate-preview-card h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.generate-preview-stats {
  display: flex;
  gap: 16px;
}

.generate-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding: 8px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.generate-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}
.generate-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-top: 2px;
}

/* ============================================
   ONBOARDING TOUR (driver.js overrides)
   ============================================ */
.todopmp-tour.driver-popover {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 340px;
}

.todopmp-tour .driver-popover-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  font-family: 'Inter', sans-serif;
}

.todopmp-tour .driver-popover-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-family: 'Inter', sans-serif;
}

.todopmp-tour .driver-popover-progress-text {
  font-size: 11px;
  color: var(--text-light);
}

.todopmp-tour .driver-popover-prev-btn {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  padding: 6px 14px;
  font-family: 'Inter', sans-serif;
}

.todopmp-tour .driver-popover-prev-btn:hover {
  background: var(--border);
}

.todopmp-tour .driver-popover-next-btn,
.todopmp-tour .driver-popover-done-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  padding: 6px 14px;
  font-family: 'Inter', sans-serif;
  text-shadow: none;
}

.todopmp-tour .driver-popover-next-btn:hover,
.todopmp-tour .driver-popover-done-btn:hover {
  background: var(--accent-hover);
}

.todopmp-tour .driver-popover-close-btn {
  color: var(--text-light);
}

.todopmp-tour .driver-popover-close-btn:hover {
  color: var(--text);
}

/* ============================================
   COLUMN VISIBILITY MENU
   ============================================ */
.column-menu-wrapper {
  position: relative;
}

.column-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  min-width: 220px;
  margin-top: 4px;
}

.column-menu-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.column-menu-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 2px;
}

.column-preset-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.column-preset-btn {
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.column-preset-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.column-preset-all {
  border-color: var(--accent);
  color: var(--accent);
}

.column-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.column-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.column-menu-item:hover {
  color: var(--accent);
}

.column-menu-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ============================================
   TASK TABLE (WBS)
   ============================================ */
.task-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.task-table thead th {
  background: var(--primary);
  color: #e2e8f0;
  padding: 10px 8px;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
  border-bottom: 2px solid var(--accent);
}

.task-table thead th:first-child {
  border-radius: var(--radius) 0 0 0;
}

.task-table thead th:last-child {
  border-radius: 0 var(--radius) 0 0;
}

.task-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.task-table tbody tr:nth-child(even) { background: #fafbfc; }
.task-table tbody tr:hover { background: #eef2f7; }

.task-table tbody tr.critical {
  background: var(--danger-light);
  border-left: 3px solid var(--coral);
}
.task-table tbody tr.critical:hover { background: #fdd; }

.task-table tbody tr.summary {
  background: #f0f4f8;
  font-weight: 600;
}
.task-table tbody tr.summary:hover { background: #e4eaf1; }

.task-table td {
  padding: 5px 8px;
  vertical-align: middle;
  white-space: nowrap;
}

.task-table td input,
.task-table td select {
  width: 100%;
  border: 1px solid transparent;
  padding: 4px 6px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: inherit;
  transition: all var(--transition);
}

.task-table td input:hover {
  border-color: var(--border);
}

.task-table td input:focus,
.task-table td select:focus {
  border-color: var(--accent);
  outline: none;
  background: white;
  box-shadow: 0 0 0 2px rgba(14,165,233,0.15);
}

.task-table td input[type="number"] {
  width: 60px;
  text-align: right;
  font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  font-size: 12px;
}

.task-table td input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

.shortcuts-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  font-size: 11px;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}

.shortcuts-bar kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  color: var(--text-light);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.08);
  line-height: 1.4;
}

.shortcuts-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.task-name-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

.indent-spacer { display: inline-block; width: 20px; }

.toggle-btn {
  width: 20px;
  height: 20px;
  border: none;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}

.toggle-btn:hover { background: var(--accent-hover); }

.wbs-code {
  color: var(--text-secondary);
  font-size: 12px;
  min-width: 50px;
  font-family: 'JetBrains Mono', monospace;
}

.float-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.float-value.critical { color: var(--danger); font-weight: bold; }

/* ============================================
   GANTT VIEW
   ============================================ */
.gantt-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.gantt-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-sm);
}

.gantt-toolbar span:first-child {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.gantt-scroll {
  flex: 1;
  overflow: auto;
  background: white;
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.scale-select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
}

/* ============================================
   RESOURCES VIEW
   ============================================ */
.resource-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.resource-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.resource-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--text-muted);
}

.resource-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

.resource-form { display: flex; flex-direction: column; gap: 6px; }
.resource-form label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.resource-form span {
  font-size: 14px;
  font-weight: 500;
}
.resource-form input, .resource-form select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
}
.resource-form input:focus, .resource-form select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(14,165,233,0.12);
}

/* Histogram */
.histogram-container {
  margin-top: 16px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.histogram-bar-group {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.histogram-bar {
  min-width: 12px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  position: relative;
  transition: opacity var(--transition);
}

.histogram-bar:hover { opacity: 0.85; }
.histogram-bar.overallocated { background: var(--danger); }

.histogram-max-line {
  position: absolute;
  top: 0;
  left: -2px;
  right: -2px;
  height: 2px;
  background: var(--danger);
}

/* ============================================
   EVM DASHBOARD
   ============================================ */
.evm-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.evm-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

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

.evm-card .metric-label {
  font-size: 12px;
  color: var(--text-light);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.evm-card .metric-value {
  font-size: 28px;
  font-weight: 700;
  margin: 6px 0;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.5px;
}

.evm-card .metric-desc {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
}

/* Status colors with top-border accent */
.evm-card.status-green {
  border-top: 3px solid var(--success);
}
.evm-card.status-green .metric-value { color: var(--success); }

.evm-card.status-yellow {
  border-top: 3px solid var(--warning);
}
.evm-card.status-yellow .metric-value { color: var(--warning); }

.evm-card.status-red {
  border-top: 3px solid var(--danger);
}
.evm-card.status-red .metric-value { color: var(--danger); }

.evm-card.status-gray {
  border-top: 3px solid var(--text-muted);
}
.evm-card.status-gray .metric-value { color: var(--text-secondary); }

/* Interpretations */
.evm-interpretations {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  border: 1px solid var(--border-light);
}

.evm-interpretations h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.evm-interpretations li {
  margin: 6px 0;
  font-size: 14px;
  list-style: none;
  padding-left: 20px;
  position: relative;
  color: var(--text-secondary);
}

.evm-interpretations li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* S-Curve */
.scurve-container {
  position: relative;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 20px;
}

.scurve-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
  font-size: 13px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-swatch {
  width: 20px;
  height: 3px;
  border-radius: 2px;
}

/* ============================================
   BASELINE VIEW
   ============================================ */
.baseline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.baseline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow var(--transition);
}

.baseline-item:hover { box-shadow: var(--shadow-md); }

.baseline-item .bl-info h4 {
  font-size: 14px;
  font-weight: 600;
}
.baseline-item .bl-info span {
  font-size: 11px;
  color: var(--text-light);
}

/* ============================================
   STATUS BAR
   ============================================ */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 16px;
  background: var(--primary);
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  font-weight: 500;
}

.status-bar .status-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.green { background: var(--success); }
.status-indicator.yellow { background: var(--warning); }
.status-indicator.red { background: var(--danger); }

.status-branding a {
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 0.5px;
  transition: color var(--transition);
}
.status-branding a:hover { color: rgba(255,255,255,0.85); }

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  min-width: 420px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.modal .form-group {
  margin-bottom: 14px;
}

.modal .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.modal .form-group input:focus,
.modal .form-group select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ============================================
   TOASTS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 40px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 18px;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

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

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

/* ============================================
   CONFIG MODAL
   ============================================ */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.config-grid label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.config-grid input,
.config-grid select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  width: 100%;
  font-family: inherit;
}

/* ============================================
   FILE INPUT (HIDDEN)
   ============================================ */
.file-input { display: none; }

/* ============================================
   LEGACY CLASSES (backward compat)
   ============================================ */
.tabs-container { display: none; }
.todopmp-banner { display: none; }

.app-title { display: none; }
.app-subtitle { display: none; }

/* ============================================
   MOBILE WARNING BANNER
   ============================================ */
.mobile-warning {
  display: none;
}

@media (max-width: 768px) {
  .mobile-warning {
    display: block;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2744 100%);
    border-bottom: 2px solid var(--accent);
    position: relative;
    z-index: 200;
  }

  .mobile-warning-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
  }

  .mobile-warning-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
  }

  .mobile-warning-text {
    flex: 1;
    min-width: 0;
  }

  .mobile-warning-text strong {
    display: block;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 3px;
  }

  .mobile-warning-text p {
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.4;
    margin: 0;
  }

  .mobile-warning-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: all 150ms;
  }

  .mobile-warning-close:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.1);
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .evm-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  #app { flex-direction: column; }

  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
  }

  .sidebar-brand { display: none; }
  .sidebar-footer { display: none; }
  .sidebar-nav-label { display: none; }

  .sidebar-nav {
    display: flex;
    padding: 0;
    flex: 1;
    overflow-x: auto;
  }

  .sidebar-nav-item {
    padding: 10px 14px;
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    font-size: 12px;
  }

  .sidebar-nav-item.active {
    border-bottom-color: var(--sidebar-accent);
    border-left: none;
    background: var(--sidebar-active);
  }

  .sidebar-nav-item .nav-icon { display: none; }

  .main-content { flex: 1; overflow: auto; }

  .toolbar {
    padding: 6px 8px;
    gap: 4px;
  }

  .toolbar .project-name-input { width: 150px; font-size: 13px; }

  .content { padding: 10px; }

  .evm-grid { grid-template-columns: repeat(2, 1fr); }
  .config-grid { grid-template-columns: 1fr; }
}

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

/* ============================================
   PRINT
   ============================================ */
@media print {
  .sidebar, .toolbar, .status-bar { display: none !important; }
  #app { display: block; }
  .main-content { margin: 0; }
  .content { padding: 0; overflow: visible; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}

/* ── Botón Analizar con IA ── */
.btn-ai {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  border-color: #7c3aed;
  font-weight: 600;
}
.btn-ai:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9, #9333ea);
}
.btn-ai:disabled { opacity: 0.7; cursor: not-allowed; }
.ai-spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal IA ── */
.modal-overlay--fullscreen { align-items: flex-start; padding: 24px; }
.modal--ai {
  max-width: 900px; width: 100%;
  max-height: 90vh;
  display: flex; flex-direction: column;
  padding: 0; overflow: hidden;
}
.modal-ai-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f3f0ff, #faf5ff);
  flex-shrink: 0;
}
.modal-ai-header h3 { font-size: 16px; font-weight: 700; color: #6d28d9; margin: 0; }
.ai-loading-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; gap: 16px;
  color: var(--text-secondary);
}
.ai-loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid #e9d5ff; border-top-color: #7c3aed;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
.ai-content { flex: 1; overflow-y: auto; padding: 24px 28px; line-height: 1.7; }
.ai-content h2 {
  font-size: 17px; font-weight: 700; color: #1e293b;
  margin: 24px 0 10px; padding-bottom: 6px;
  border-bottom: 2px solid #e9d5ff;
}
.ai-content h2:first-child { margin-top: 0; }
.ai-content h3 { font-size: 14px; font-weight: 600; color: #374151; margin: 14px 0 6px; }
.ai-content p  { margin-bottom: 8px; }
.ai-content ul, .ai-content ol { padding-left: 20px; margin-bottom: 10px; }
.ai-content li { margin-bottom: 4px; }
.ai-content table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.ai-content th {
  background: #f3f0ff; border: 1px solid #ddd6fe;
  padding: 8px 12px; text-align: left; font-weight: 600;
}
.ai-content td { border: 1px solid #e5e7eb; padding: 7px 12px; }
.ai-content tr:nth-child(even) td { background: #fafafa; }
