/* Style 5 — Timeline / Gantt | NQ57 */

:root {
  --s5-bg:        #E8ECF1;
  --s5-surface:   #F0F4F8;
  --s5-card:      #EDF2F7;
  --s5-primary:   #2563EB;
  --s5-accent:    #7C3AED;
  --s5-text:      #1E293B;
  --s5-muted:     #64748B;
  --s5-shadow-ou: 4px 4px 10px #c8cfd8, -4px -4px 10px #ffffff;
  --s5-shadow-in: inset 3px 3px 6px #c8cfd8, inset -3px -3px 6px #ffffff;
  --s5-radius:    10px;
  --s5-bar-fill:  #2563EB;
  --s5-bar-empty: rgba(37,99,235,0.18);
}

body {
  font-family: 'IBM Plex Sans', 'Inter', system-ui, sans-serif;
  background: var(--s5-bg);
  color: var(--s5-text);
  min-height: 100vh;
}

/* ── Layout ── */
.s5-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 20px 24px 32px;
  gap: 16px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ── Header ── */
.s5-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.s5-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--s5-text);
  letter-spacing: -0.3px;
}

.btn-back {
  color: var(--s5-muted);
  border-color: var(--s5-muted);
  flex-shrink: 0;
}

/* ── Neu card base ── */
.neu-card {
  background: var(--s5-card);
  border-radius: var(--s5-radius);
  box-shadow: var(--s5-shadow-ou);
  border: none;
}

.neu-btn {
  background: var(--s5-card);
  border-radius: 8px;
  box-shadow: 3px 3px 6px #c8cfd8, -3px -3px 6px #ffffff;
  border: none;
  cursor: pointer;
  transition: box-shadow 150ms ease;
  color: var(--s5-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
}

.neu-btn:active,
.neu-btn.active {
  box-shadow: var(--s5-shadow-in);
}

select.neu-select {
  background: var(--s5-card);
  box-shadow: inset 2px 2px 5px #c8cfd8, inset -2px -2px 5px #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 32px 8px 12px;
  color: var(--s5-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

select.neu-select:focus {
  box-shadow: inset 2px 2px 5px #c8cfd8, inset -2px -2px 5px #ffffff,
              0 0 0 2px rgba(37, 99, 235, 0.3);
}

/* ── Filters ── */
.s5-filters {
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.s5-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.s5-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--s5-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.s5-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.s5-search-wrap input {
  width: 100%;
  background: var(--s5-card);
  box-shadow: inset 2px 2px 5px #c8cfd8, inset -2px -2px 5px #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px 8px 36px;
  color: var(--s5-text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.s5-search-wrap input:focus {
  box-shadow: inset 2px 2px 5px #c8cfd8, inset -2px -2px 5px #ffffff,
              0 0 0 2px rgba(37, 99, 235, 0.3);
}

.s5-search-wrap input::placeholder {
  color: var(--s5-muted);
}

.s5-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--s5-muted);
  pointer-events: none;
  font-size: 14px;
}

.s5-divider {
  width: 1px;
  height: 28px;
  background: rgba(100, 116, 139, 0.2);
}

/* ── Stats strip ── */
.s5-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.s5-stat {
  background: var(--s5-card);
  border-radius: 8px;
  box-shadow: var(--s5-shadow-ou);
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 110px;
}

.s5-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--s5-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.s5-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--s5-primary);
  font-variant-numeric: tabular-nums;
}

/* ── Gantt wrapper ── */
.s5-gantt-wrap {
  position: relative;
  flex: 1;
}

.g-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
  border-radius: var(--s5-radius);
  box-shadow: var(--s5-shadow-ou);
  background: var(--s5-surface);
}

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

/* ── Sticky column: name ── */
.g-col-name {
  position: sticky;
  left: 0;
  background: var(--s5-surface);
  z-index: 10;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
}

/* ── Sticky header row ── */
.g-header-row th {
  position: sticky;
  top: 0;
  background: var(--s5-card);
  z-index: 20;
  padding: 10px 8px;
  font-weight: 600;
  font-size: 11px;
  color: var(--s5-accent);
  text-align: center;
  white-space: nowrap;
  border-bottom: 2px solid rgba(124, 58, 237, 0.2);
  min-width: 80px;
}

.g-header-row .g-col-name {
  z-index: 30;
  text-align: left;
  color: var(--s5-text);
  font-size: 12px;
  padding: 10px 14px;
  border-bottom: 2px solid rgba(37, 99, 235, 0.2);
}

.g-header-month-label {
  display: block;
  color: var(--s5-accent);
  font-weight: 700;
}

.g-header-month-sub {
  display: block;
  color: var(--s5-muted);
  font-weight: 400;
  font-size: 10px;
  margin-top: 2px;
}

/* ── Group header row ── */
.g-group-header {
  cursor: pointer;
  user-select: none;
}

.g-group-header td {
  background: var(--s5-primary);
  color: #ffffff;
  padding: 9px 14px;
  position: sticky;
  top: 44px;
  z-index: 8;
  font-weight: 600;
  font-size: 12px;
}

.g-group-header .g-col-name {
  z-index: 9;
  left: 0;
}

.g-group-header:hover td {
  background: #1d4ed8;
}

.g-group-name-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.g-chevron {
  font-size: 10px;
  transition: transform 150ms ease;
  flex-shrink: 0;
  display: inline-block;
}

.g-chevron.collapsed {
  transform: rotate(-90deg);
}

.g-group-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.g-group-count {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.75;
  flex-shrink: 0;
}

/* Summary bar in group header */
.g-group-fill-cell {
  padding: 9px 14px;
}

.g-summary-bar-wrap {
  height: 10px;
  background: rgba(255,255,255,0.2);
  border-radius: 5px;
  overflow: hidden;
  width: 100%;
}

.g-summary-bar-fill {
  height: 100%;
  background: rgba(255,255,255,0.85);
  border-radius: 5px;
  transition: width 300ms ease;
}

/* ── NV rows ── */
.g-nv-row {
  cursor: default;
}

.g-nv-row:hover .g-col-name,
.g-nv-row:hover .g-cell {
  background: rgba(37, 99, 235, 0.04);
}

.g-nv-row.collapsed-row {
  display: none;
}

.g-nv-name-cell {
  padding: 7px 14px;
  color: var(--s5-text);
  background: var(--s5-surface);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  overflow: hidden;
}

.g-nv-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 400;
}

.g-nv-name-sub {
  font-size: 10px;
  color: var(--s5-muted);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Gantt cells ── */
.g-cell {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  background: var(--s5-surface);
  min-width: 80px;
  vertical-align: middle;
}

.g-cell-active {
  cursor: pointer;
}

.g-bar-wrap {
  display: flex;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  width: 100%;
}

.g-bar-fill {
  background: var(--s5-bar-fill);
  height: 100%;
  border-radius: 0;
  transition: width 300ms ease;
  flex-shrink: 0;
}

.g-bar-empty {
  background: var(--s5-bar-empty);
  height: 100%;
  flex-shrink: 0;
}

/* zero-rate: entire bar empty color */
.g-bar-zero .g-bar-fill {
  display: none;
}

.g-bar-zero .g-bar-empty {
  width: 100% !important;
  opacity: 0.6;
}

.g-cell-active:hover .g-bar-wrap {
  opacity: 0.85;
  transform: scaleY(1.05);
  transition: transform 100ms ease, opacity 100ms ease;
}

/* ── Empty state ── */
.g-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--s5-muted);
  font-size: 14px;
}

/* ── Popup ── */
.g-popup {
  position: fixed;
  width: 300px;
  padding: 18px 20px;
  z-index: 500;
  background: var(--s5-card);
  pointer-events: auto;
}

.g-popup-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--s5-muted);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 150ms;
}

.g-popup-close:hover {
  background: rgba(0,0,0,0.06);
  color: var(--s5-text);
}

.g-popup-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--s5-primary);
  margin-bottom: 12px;
  padding-right: 24px;
  line-height: 1.4;
}

.g-popup-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.g-popup-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
}

.g-popup-row .g-pr-label {
  color: var(--s5-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.g-popup-row .g-pr-value {
  color: var(--s5-text);
  font-weight: 400;
  text-align: right;
  word-break: break-word;
}

.g-popup-row .g-pr-value.highlight {
  color: var(--s5-primary);
  font-weight: 600;
}

.g-popup-divider {
  height: 1px;
  background: rgba(100,116,139,0.15);
  margin: 6px 0;
}

/* Progress mini bar in popup */
.g-popup-bar {
  height: 6px;
  background: var(--s5-bar-empty);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.g-popup-bar-fill {
  height: 100%;
  background: var(--s5-primary);
  border-radius: 3px;
  transition: width 300ms ease;
}

/* ── Loading ── */
.s5-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 0;
  color: var(--s5-muted);
  font-size: 14px;
}

.s5-loading .spinner {
  color: var(--s5-primary);
}

/* ── Legend ── */
.s5-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  padding: 4px 0;
}

.s5-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--s5-muted);
}

.s5-legend-bar {
  display: flex;
  height: 10px;
  width: 48px;
  border-radius: 3px;
  overflow: hidden;
}

.s5-legend-fill {
  background: var(--s5-bar-fill);
  height: 100%;
}

.s5-legend-empty {
  background: var(--s5-bar-empty);
  height: 100%;
}

/* ── Scrollbar custom ── */
.g-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.g-wrap::-webkit-scrollbar-track {
  background: var(--s5-bg);
}
.g-wrap::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.25);
  border-radius: 4px;
}
.g-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 99, 235, 0.4);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .s5-layout { padding: 12px 12px 24px; }
  .s5-header h1 { font-size: 16px; }
  .g-col-name { width: 160px; min-width: 160px; max-width: 160px; }
  .g-popup { width: 260px; }
}
