body{margin:0;font-family:Arial;background:#fff;user-select:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;overflow:hidden;height:100vh;}
header{background:#bfdbfe;padding:18px 24px;display:flex;justify-content:space-between;align-items:center;box-shadow:0 2px 8px rgba(0,0,0,0.15);position:fixed;top:0;left:0;right:0;z-index:900;}
#currentProjectDisplay:hover{transform:translateY(-1px);box-shadow:0 4px 8px rgba(37,99,235,0.2);border-color:#2563eb;}
button{background:#2563eb;color:white;border:none;padding:12px 18px;border-radius:6px;cursor:pointer;font-weight:500;box-shadow:0 2px 6px rgba(37,99,235,0.2);transition:all 0.2s ease;}
button:hover{background:#1d4ed8;box-shadow:0 6px 12px rgba(37,99,235,0.35);transform:translateY(-2px);}
button:active{transform:translateY(0);box-shadow:0 2px 4px rgba(37,99,235,0.2);}
#toolbar button{font-size:13px;padding:10px 16px;}
#toolbar button:hover{box-shadow:0 6px 16px rgba(0,0,0,0.2);}
select.language-selector{padding:8px 12px;border:1px solid #93c5fd;border-radius:6px;background:white;color:#1e3a8a;font-weight:500;cursor:pointer;}
#toolbar{display:flex;gap:10px;align-items:center;position:relative;}
#dropdown{position:absolute;top:45px;left:0;background:white;border:1px solid #93c5fd;border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,0.15);width:260px;max-height:500px;overflow-y:auto;z-index:100;}
#dropdown button{background:none;color:#1e3a8a;text-align:left;padding:11px 16px;width:100%;border-radius:0;font-weight:500;font-size:13px;border-left:3px solid transparent;transition:all 0.15s ease;}
#dropdown button:hover{background:#eff6ff;border-left-color:#3b82f6;transform:translateX(2px);}
#dropdown hr{margin:8px 12px;border:none;border-top:1px solid #e2e8f0;}
.dropdown-heading{background:linear-gradient(135deg,#f1f5f9,#e2e8f0);color:#1e3a8a;font-weight:700;padding:12px 16px;cursor:pointer;display:flex;justify-content:space-between;align-items:center;border-radius:6px;margin:6px 8px;box-shadow:0 1px 3px rgba(0,0,0,0.08);}
.dropdown-heading:hover{background:linear-gradient(135deg,#e2e8f0,#cbd5e1);transform:translateY(-1px);box-shadow:0 3px 8px rgba(0,0,0,0.12);}
.qc-submenu{background:linear-gradient(180deg,#f0f9ff,#ffffff);border-left:3px solid #3b82f6;margin:0 8px 8px 8px;border-radius:0 0 6px 6px;}
.qc-submenu button{padding-left:24px;font-size:12.5px;}
#canvas{width:100vw;height:calc(100vh - 120px);background:#fff;position:fixed;top:80px;left:0;background-image:linear-gradient(to right, #e5e7eb 1px, transparent 1px),linear-gradient(to bottom, #e5e7eb 1px, transparent 1px);background-size:25px 25px;overflow:auto;transform-origin:top left;transition:transform 0.15s ease-out;}
.phase{position:absolute;top:20px;background:#f8fafc;padding:12px 20px;border:2px solid #94a3b8;border-radius:10px;font-weight:bold;color:#0f172a;box-shadow:0 2px 4px rgba(0,0,0,0.1);}
.node{position:absolute;background:white;border:2px solid #3b82f6;padding:10px;padding-bottom:20px;border-radius:10px;cursor:move;width:100px;height:90px;text-align:center;box-shadow:0 4px 12px rgba(0,0,0,0.1);color:#1e3a8a;font-weight:600;font-size:11px;display:flex;flex-direction:column;transition:transform 0.2s ease,box-shadow 0.2s ease;}
.node:hover{transform:translateY(-3px);box-shadow:0 8px 20px rgba(0,0,0,0.15);}
.node button{background:#22c55e;margin-top:4px;font-size:10px;padding:3px 6px;max-width:65px;align-self:center;border-radius:3px;}
.node button:hover{background:#16a34a;transform:none;}
#overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,0.5);z-index:998;}
#templateBox{display:none;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:white;padding:30px;border-radius:12px;box-shadow:0 12px 48px rgba(0,0,0,0.2);width:750px;max-height:85vh;overflow-y:auto;z-index:999;}
#templateBox input,#templateBox textarea,#templateBox select{width:100%;padding:8px;margin:8px 0;border:1px solid #cbd5e1;border-radius:6px;font-family:inherit;box-sizing:border-box;}
#templateBox textarea{min-height:80px;resize:vertical;}
.section-title{font-weight:600;color:#1e3a8a;margin:15px 0 8px 0;font-size:15px;border-bottom:2px solid #e2e8f0;padding-bottom:5px;}
.chart-container{margin-top:15px;padding:15px;background:#f8fafc;border-radius:8px;border:1px solid #e2e8f0;}
.data-input-row{display:flex;gap:10px;margin-bottom:8px;align-items:center;}
.data-input-row input{flex:1;margin:0;}
.data-input-row button{padding:5px 10px;margin:0;font-size:12px;}
table{width:100%;border-collapse:collapse;margin-top:10px;}
table th,table td{border:1px solid #cbd5e1;padding:8px;text-align:left;}
table th{background:#f1f5f9;font-weight:600;}
#closeBtn{position:absolute;top:15px;right:20px;background:none;color:#64748b;font-size:24px;font-weight:700;border:none;cursor:pointer;padding:0;margin:0;}
#closeBtn:hover{color:#dc2626;}
.btn-group{margin-top:20px;text-align:right;padding-top:15px;border-top:2px solid #e2e8f0;}
.btn-group button{margin-left:8px;}
.hide{display:none;}
.show{display:block;}
.info-box{background:#eff6ff;border-left:4px solid #2563eb;padding:12px;margin:10px 0;border-radius:4px;}
.calc-result{background:#f0fdf4;border:2px solid #22c55e;padding:15px;border-radius:8px;margin:15px 0;}
.calc-result h3{margin:0 0 10px 0;color:#166534;}
.description-text{background:#eff6ff;border-left:4px solid #2563eb;padding:10px 15px;margin:10px 0;border-radius:4px;font-size:13px;color:#1e3a8a;line-height:1.5;}
.team-member-row{display:flex;gap:10px;margin-bottom:8px;align-items:center;}
.team-member-row input{flex:1;margin:0;}
.team-member-row button{padding:5px 10px;margin:0;font-size:12px;background:#ef4444;}
/* AI Coach Panel */
.ai-coach-panel{position:fixed;right:0;top:65px;width:280px;height:calc(100vh - 65px);background:rgba(248,250,252,0.98);border-left:3px solid #cbd5e1;padding:20px;overflow-y:auto;z-index:800;transform:translateX(0);transition:transform 0.3s;box-shadow:-4px 0 12px rgba(0,0,0,0.1);}
.ai-coach-panel.hidden{transform:translateX(300px);}
.ai-coach-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px;font-weight:600;color:#1e3a8a;}
.coach-toggle{position:fixed;right:280px;top:120px;background:#2563eb;color:white;border:none;padding:10px 15px;border-radius:6px 0 0 6px;cursor:pointer;z-index:850;font-weight:600;transition:right 0.3s;}
.coach-toggle.panel-hidden{right:0;top:120px;}
.smart-tip{background:white;border-left:4px solid #2563eb;padding:12px;margin:10px 0;border-radius:6px;box-shadow:0 2px 4px rgba(0,0,0,0.1);font-size:13px;}
.smart-tip.warning{border-left-color:#f59e0b;}
.smart-tip.success{border-left-color:#22c55e;}
.smart-tip.info{border-left-color:#06b6d4;}
.smart-tip.critical{border-left-color:#dc2626;}
.tip-icon{font-size:16px;margin-right:6px;}
.progress-section{margin:20px 0;padding:15px;background:white;border-radius:8px;box-shadow:0 2px 4px rgba(0,0,0,0.05);}
.progress-bar{width:100%;height:20px;background:#e2e8f0;border-radius:10px;overflow:hidden;margin:10px 0;}
.progress-fill{height:100%;background:linear-gradient(90deg,#22c55e,#16a34a);transition:width 0.3s;display:flex;align-items:center;justify-content:center;color:white;font-size:11px;font-weight:600;}
.data-link-section{margin:15px 0;padding:10px;background:#eff6ff;border-radius:6px;}
.import-btn{background:#8b5cf6;color:white;padding:6px 12px;border-radius:4px;border:none;cursor:pointer;font-size:12px;margin:5px 0;display:block;width:100%;}
.import-btn:hover{background:#7c3aed;}
.tool-status{display:inline-block;padding:3px 8px;border-radius:10px;font-size:10px;font-weight:600;margin-left:5px;}
.status-complete{background:#dcfce7;color:#166534;}
.status-partial{background:#fef3c7;color:#92400e;}
.status-empty{background:#fee2e2;color:#991b1b;}
.node button.node-close{position:absolute;bottom:3px;right:3px;background:#ef4444;color:white;border:none;padding:2px 5px;border-radius:3px;cursor:pointer;font-size:9px;font-weight:600;line-height:1;z-index:10;margin-top:0;}
.node button.node-close:hover{background:#dc2626;}
.node.multi-selected{border:3px solid #f59e0b;box-shadow:0 0 0 3px rgba(245,158,11,0.3),0 4px 12px rgba(0,0,0,0.15);background:linear-gradient(135deg,#fffbeb 0%,#fef3c7 100%);}
.selection-box{position:absolute;border:2px dashed #3b82f6;background:rgba(59,130,246,0.1);pointer-events:none;z-index:50;}
/* Report Configuration Modal */
#reportConfigModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  overflow-y: auto;
}

#reportConfigContent {
  background: white;
  max-width: 1400px;
  width: 95%;
  margin: 30px auto;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: fixed;           /* Fixed to viewport - always visible */
  top: 45px;                 /* Below browser chrome */
  right: 45px;               /* Away from Settings button */
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 28px;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  z-index: 1001;             /* Above modal backdrop (1000) */
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.modal-close:hover {
  color: white;
  background: #dc2626;
  border-color: #dc2626;
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

.modal-title {
  font-size: 32px;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 25px;
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 3px solid #2563eb;
}

.section {
  background: #f8fafc;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  border: 2px solid #e2e8f0;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Grid layout for side-by-side sections */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  align-items: stretch;
}

.config-grid > div {
  display: flex;
  flex-direction: column;
}

.config-grid .section {
  margin-bottom: 0;
}

/* Make report items list taller */
#reportItemsList {
  max-height: 500px;
  min-height: 300px;
}

.button-group {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 30px;
  padding-top: 25px;
  border-top: 3px solid #e2e8f0;
}

.button-group button {
  transition: all 0.3s ease;
}

.button-group button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Report Items List Styles */
.report-item {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: move;
  transition: all 0.2s;
}

.report-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.report-item.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.report-item.tool-item {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #3b82f6;
}

.report-item.text-item {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
  margin-left: 30px;
}

.drag-handle {
  font-size: 18px;
  color: #94a3b8;
  cursor: grab;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.item-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.item-label {
  flex: 1;
  font-weight: 500;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;  /* Prevent text from wrapping to 2 lines */
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-number {
  display: inline-block;
  background: #3b82f6;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

.add-text-btn {
  background: #8b5cf6;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.add-text-btn:hover {
  background: #7c3aed;
}

.remove-text-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
}

.remove-text-btn:hover {
  background: #dc2626;
}

.text-section-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  margin-left: 30px;
}

.text-section-inputs input,
.text-section-inputs textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
}

.text-section-inputs textarea {
  min-height: 80px;
  resize: vertical;
}

.add-section-anywhere {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.add-section-anywhere:hover {
  border-color: #8b5cf6;
  background: #f5f3ff;
  color: #8b5cf6;
}
/* Custom Arrow Drawing System */
.custom-arrow{position:absolute;pointer-events:auto;cursor:pointer;z-index:0;}
.custom-arrow line{stroke:#2563eb;stroke-width:3;pointer-events:stroke;}
.custom-arrow polygon{fill:#2563eb;pointer-events:all;}
.custom-arrow.selected line{stroke:#f59e0b;stroke-width:4;}
.custom-arrow.selected polygon{fill:#f59e0b;}
.arrow-delete-btn{position:absolute;background:#ef4444;color:white;border:none;padding:5px 10px;border-radius:6px;cursor:pointer;font-size:12px;font-weight:600;z-index:1000;box-shadow:0 3px 10px rgba(239,68,68,0.4);}
.arrow-delete-btn:hover{background:#dc2626;transform:scale(1.05);}
/* Storage Widget Toggle Button */
#storageWidgetToggle{position:fixed;bottom:120px;right:25px;width:40px;height:40px;background:linear-gradient(135deg,#22c55e 0%,#16a34a 100%);border:2px solid #16a34a;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:18px;cursor:pointer;box-shadow:0 4px 12px rgba(0,0,0,0.15);z-index:900;transition:all 0.3s ease;}
#storageWidgetToggle:hover{transform:scale(1.1);box-shadow:0 6px 16px rgba(0,0,0,0.2);}
/* Storage Widget */
.storage-widget{position:fixed;bottom:20px;right:20px;background:linear-gradient(135deg,#dcfce7 0%,#d1fae5 100%);border:2px solid #22c55e;padding:20px;border-radius:12px;max-width:350px;box-shadow:0 8px 24px rgba(0,0,0,0.12);z-index:900;transition:all 0.3s ease;}
.storage-widget:hover{box-shadow:0 12px 32px rgba(0,0,0,0.18);}
.storage-widget-title{font-weight:bold;color:#166534;margin-bottom:12px;font-size:15px;display:flex;align-items:center;gap:8px;}
.storage-widget-list{margin:0;padding-left:24px;color:#166534;font-size:13px;line-height:1.8;}
.storage-widget-btn{margin-top:12px;padding:10px 18px;background:linear-gradient(135deg,#22c55e 0%,#16a34a 100%);color:white;border:none;border-radius:8px;cursor:pointer;font-size:13px;font-weight:600;width:100%;transition:all 0.2s ease;}
.storage-widget-btn:hover{background:linear-gradient(135deg,#16a34a 0%,#15803d 100%);transform:scale(1.02);}
