.config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.config-header h3 {
  margin: 0;
}

#closeConfigBtn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}

#majorBgColor {
  width: 48px;
  height: 32px;
  border: none;
  background: none;
}

.type-row {
  align-items: flex-start;
  flex-direction: column;
}

.type-label {
  margin-bottom: 4px;
}

#typeList {
  width: 100%;
  min-width: 200px;
}

#addTypeBtn {
  margin-top: 6px;
}

#typeConfigError {
  color: #dc2626;
  display: none;
  font-size: 13px;
  margin-top: 4px;
}

#saveConfigBtn {
  margin-top: 8px;
}
/* timeline_integrated.css - Extracted and merged CSS from timeline_integrated.html */

html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}
body {
  font-family: "Aptos", Arial, sans-serif;
  background: #f8fafc;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}
.container {
  height: 100vh;
  width: 100vw;
  min-height: 0;
  min-width: 0;
  margin: 0;
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  padding: 32px 24px;
  display: flex;
  gap: 32px;
  overflow: auto;
  box-sizing: border-box;
}
.form-section,
.timeline-section {
  flex: 1 1 0;
  min-width: 350px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  position: relative;
}
.timeline-section {
  background: #f8fafb;
  border-radius: 12px;
  padding: 24px;
}
h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 24px;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 12px;
}
#timelineForm {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  height: 100%;
}
#stages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 12px;
}
.actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  margin-bottom: 0;
  padding-bottom: 12px;
}
.btn {
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-add {
  background: #38bdf8;
  color: #fff;
}
.btn-add:hover {
  background: #0ea5e9;
}
.btn-remove {
  background: #f87171;
  color: #fff;
}
.btn-remove:hover {
  background: #ef4444;
}
.btn-cancel {
  background: #94a3b8;
  color: #fff;
}
.btn-cancel:hover {
  background: #64748b;
}
.btn-save {
  background: #34d399;
  color: #fff;
}
.btn-save:hover {
  background: #10b981;
}
.btn-export {
  background: #fbbf24;
  color: #fff;
}
.btn-export:hover {
  background: #f59e42;
}
.form-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.form-row label {
  min-width: 120px;
  color: #64748b;
  font-weight: 500;
}
.form-row input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
  font-size: 1rem;
  color: #334155;
  transition: border 0.2s;
}
.form-row input:focus {
  border-color: #38bdf8;
  outline: none;
}
.stage {
  border: 1px solid #e2e8f0;
  margin-bottom: 20px;
  border-radius: 8px;
  background: #f9fafb;
  box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.03);
}
.stage-header {
  background: #f1f5f9;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
}
.stage-title {
  font-weight: 700;
  color: #334155;
  font-size: 1.4rem;
}
.timeline-items {
  padding: 12px 24px;
}
.timeline-item {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
}

/* Timeline Item Row (horizontal and vertical) */
.timeline-item-row,
.timeline-item-row.vertical-fields {
  display: flex;
  /* align-items: center; */
  /* gap: 10px; */
  flex-wrap: wrap;
  background: #f3f4f6;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.timeline-item-row.vertical-fields {
  /* align-items: flex-end; */
  gap: 18px;
}
.timeline-item-row label,
.timeline-item-row.vertical-fields label {
  font-size: 0.97rem;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 0;
  min-width: 54px;
}
.timeline-item-row.vertical-fields label {
  font-size: 0.82rem;
  margin-bottom: 2px;
  min-width: 0;
  line-height: 1.1;
}
.timeline-item-row input[type="text"],
.timeline-item-row.vertical-fields input[type="text"] {
  border-radius: 5px;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 6px 10px;
  font-size: 0.77rem;
  color: #334155;
  min-width: 70px;
  transition: border 0.2s;
}
.timeline-item-row.vertical-fields input[type="text"] {
  padding: 5px 8px;
  min-width: 0;
}
.timeline-item-row input[type="text"]:focus,
.timeline-item-row.vertical-fields input[type="text"]:focus {
  border-color: #38bdf8;
  outline: none;
}
.timeline-item-row .btn-remove,
.timeline-item-row.vertical-fields .btn-remove {
  margin-left: auto;
  padding: 6px 14px;
  font-size: 0.97rem;
}
.timeline-item-row.vertical-fields .btn-remove {
  margin-left: 12px;
  /* align-self: flex-end; */
}
.timeline-item-row.vertical-fields .field-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* min-width: 90px; */
  flex: 1 1 90px;
  margin: 0 2px;
}

.dropdown-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  transition: transform 0.2s;
  vertical-align: middle;
}
.collapsed .dropdown-icon {
  transform: rotate(-90deg);
}

/* Popup and Modal Styles */
#popup,
#importJsonPopup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(30, 41, 59, 0.3);
  align-items: center;
  justify-content: center;
  z-index: 100;
}
#popup-content,
#importJsonPopupContent {
  background: #fff;
  padding: 32px;
  border-radius: 12px;
  min-width: 400px;
  box-shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.1);
}
#popup-content textarea,
.json-input-section textarea,
#importJsonPopupContent textarea {
  width: 100%;
  font-size: 1rem;
  background: #f1f5f9;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  padding: 12px;
  color: #334155;
}
#popup-content textarea {
  height: 220px;
}
.json-input-section textarea,
#importJsonPopupContent textarea {
  height: 120px;
  font-family: monospace;
  font-size: 14px;
}
#popup-content button,
.json-input-section button,
#importJsonPopupContent button {
  margin-top: 16px;
}
.json-input-section button,
#importJsonPopupContent button {
  background: #3b82f6;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  margin-top: 8px;
}
.json-input-section button:hover,
#importJsonPopupContent button:hover {
  background: #2563eb;
}
.error-message {
  color: #dc2626;
  margin-top: 8px;
  font-size: 14px;
  display: none;
}

/* File Upload Button for Import JSON Popup */
#importJsonPopupContent .upload-label {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #38bdf8;
  color: #fff;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
  margin-right: 0;
  box-shadow: 0 2px 8px 0 rgba(56, 189, 248, 0.08);
  border: none;
  transition: background 0.2s, box-shadow 0.2s;
  width: fit-content;
  position: relative;
}
#importJsonPopupContent .upload-label:hover {
  background: #0ea5e9;
  box-shadow: 0 4px 12px 0 rgba(14, 165, 233, 0.12);
}
#importJsonPopupContent .upload-label input[type="file"] {
  display: none;
}
#importJsonPopupContent .upload-label .upload-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  vertical-align: middle;
}

/* Energetic Bright Colors for First Col */
.first-col.color-0 {
  background: #d9e1f2 !important;
  color: #1e293b;
}
.first-col.color-1 {
  background: #f8cbad !important;
  color: #1e293b;
}
.first-col.color-2 {
  background: #b4c7e7 !important;
  color: #1e293b;
}
.first-col.color-3 {
  background: #97ff2f !important;
  color: #1e293b;
}
.first-col.color-4 {
  background: #c5e0b4 !important;
  color: #1e293b;
}
.first-col.color-5 {
  background: #fcacd5 !important;
  color: #1e293b;
}

/* Timeline Table and Timeline Preview */
#timeline-wrapper {
  min-height: 300px;
  position: relative;
  overflow: auto;
}
#timeline,
#timeline-fullscreen {
  border: 1px #e5e7eb solid;
  border-collapse: collapse;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  width: fit-content;
}
.header {
  border: 1px #e5e7eb solid;
  transition: background-color 0.15s ease-in-out;
  text-align: center;
  font-weight: 600;
  color: #ffffff;
  font-size: 1rem;
  padding: 4px 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.header.days,
.header.years {
  color: #374151;
  background-color: #f8fafc;
}
.guideline td:not(.first-col) {
  display: none;
}
.guideline td {
  border: 0px !important;
}
.ten-day-start {
  border-left: 1px solid #e5e7eb !important;
}
.ten-day-end {
  border-right: 1px solid #e5e7eb !important;
}
.month-end {
  border-right: 1.5px solid #b9b9b9 !important;
}
.item-row td {
  position: relative;
  padding: 0px;
  min-width: 4.9px;
  width: 20px;
  height: 24px;
  border-top: 1px solid #e5e7eb !important;
  border-bottom: 1px solid #e5e7eb !important;
  transition: background-color 0.15s ease-in-out;
}
.item-row td.first-col {
  min-width: 200px;
  width: 200px !important;
  max-width: 320px;
  background-color: #f8fafc;
  padding: 12px;
  font-weight: 500;
  color: #1f2937;
  box-sizing: border-box;
  word-break: break-word;
  text-align: center;
}
.item-row td div div.timeline-line {
  position: relative;
  z-index: 1;
  box-shadow: 5px 5px 7px 0px rgba(0, 0, 0, 0.05);
}
.item-row td div div.timeline-line.working {
  background-color: #22c55e;
  border: 1px solid #22c55e;
}
.item-row td div div.timeline-line.finished {
  background-color: #bfbfbf;
  border: 1px solid #bfbfbf;
}
.item-name {
  position: absolute;
  display: flex;
  align-items: center;
  top: 0;
  left: 10px;
  font-size: 0.95rem;
  color: #1f2937;
  white-space: nowrap;
  width: fit-content;
  z-index: 1;
  height: 100%;
}
.item-name span {
  margin: 2px;
  background-color: rgba(255, 255, 255, 0.65);
  padding: 4px 8px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-weight: 500;
}
.item-name.item-finished {
  color: #bbb;
}

/* Modern Quarter color tones */
.q1 {
  background-color: #1e40af;
}
.q1-month {
  background-color: #3b82f6;
}
.q1-ten {
  background-color: #bfdbfe;
}
.q1-guideline {
  background-color: #eff6ff;
}
.q2 {
  background-color: #9a3412;
}
.q2-month {
  background-color: #ea580c;
}
.q2-ten {
  background-color: #fed7aa;
}
.q2-guideline {
  background-color: #fff7ed;
}
.q3 {
  background-color: #374151;
}
.q3-month {
  background-color: #6b7280;
}
.q3-ten {
  background-color: #e5e7eb;
}
.q3-guideline {
  background-color: #f9fafb;
}
.q4 {
  background-color: #854d0e;
}
.q4-month {
  background-color: #d97706;
}
.q4-ten {
  background-color: #fde68a;
}
.q4-guideline {
  background-color: #fef9c3;
}

/* Export Button & Loading Spinner */
.export-button,
.fullscreen-button {
  background: #3b82f6;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.15s ease-in-out;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  margin: 32px auto 0 auto;
  position: static;
  justify-content: center;
  max-width: 300px;
}
.export-button:hover,
.fullscreen-button:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(0, 0, 0, 0.1);
}
.export-button:active,
.fullscreen-button:active {
  transform: translateY(0);
}
.export-button svg,
.fullscreen-button svg {
  width: 16px;
  height: 16px;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.spinner {
  border: 4px solid #3b82f6;
  border-top: 4px solid #e5e7eb;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}
.loading-indicator {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  z-index: 10;
  justify-content: center;
  align-items: center;
}
.loading-indicator.active {
  display: flex !important;
}
#fullscreenTimelinePopup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(30, 41, 59, 0.92);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#fullscreenTimelineContent {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.18);
  padding: 24px;
  max-width: 98vw;
  max-height: 94vh;
  overflow: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 20px;
}
#fullscreenTimelineInner {
  overflow: auto;
}
#closeFullscreenTimelineBtn {
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 2;
}
.btn.btn-move[disabled],
.btn.btn-move:disabled {
  cursor: not-allowed !important;
  opacity: 0.5;
}
#openConfigBtn {
  /* see inline style above */
}
.config-slide-panel {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 340px;
  max-width: 90vw;
  background: #f1f5f9;
  box-shadow: 2px 0 16px 0 rgba(30, 41, 59, 0.1);
  z-index: 201;
  padding: 32px 24px 24px 24px;
  border-radius: 0 16px 16px 0;
  transform: translateX(-110%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.config-slide-panel.active {
  transform: translateX(0);
}
@media (max-width: 600px) {
  .config-slide-panel {
    width: 98vw;
    padding: 18px 8px 8px 8px;
  }
}
.date-field {
  width: 75px;
}
.checkbox-field {
  align-items: flex-start;
}

.timeline-line.critical-path-item {
  border-top: red 3px solid !important;
  border-bottom: red 3px solid !important;
}
.item-row td div div.timeline-line.critical-path-item.start {
  border-left: 3px solid red !important;
}
.item-row td div div.timeline-line.critical-path-item.end {
  border-right: 3px solid red !important;
}
.item-date-range {
  width: 140px;
}

#configOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 200;
  background: rgba(0, 0, 0, 0.01);
}
