:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1a1d24;
  --ink-soft: #5b6472;
  --line: #e3e6eb;
  --accent: #2f6fed;
  --accent-soft: #e8f0ff;
  --shadow: 0 1px 2px rgba(20, 26, 38, 0.04), 0 4px 14px rgba(20, 26, 38, 0.06);
  --radius: 12px;

  --batch:        #6b7280;
  --batch-soft:   #eef0f4;
  --active:       #2f6fed;
  --active-soft:  #e8f0ff;
  --editing:      #7c3aed;
  --editing-soft: #ede9fe;
  --review:       #c98a1a;
  --review-soft:  #fcefd7;
  --live:         #1f9d6b;
  --live-soft:    #dff2e7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 18px;
}

.brand .dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.subtitle {
  color: var(--ink-soft);
  font-size: 13px;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar input[type="search"],
.toolbar select {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  min-width: 0;
}

.toolbar input[type="search"] { flex: 1 1 220px; }

.toolbar .hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-soft);
}

#grid {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

details.batch-section { }
details.batch-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
details.batch-section > summary::-webkit-details-marker { display: none; }

.batch-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.batch-head .batch-title { color: var(--ink); font-size: 13px; }
.batch-head .count {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.batch-head .chevron {
  margin-left: auto;
  font-size: 14px;
  color: var(--ink-soft);
  transition: transform 0.15s ease;
}
details[open].batch-section > summary .chevron { transform: rotate(180deg); }

.batch-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}
.batch-progress .progress { flex: 1; }
.batch-progress .batch-pct {
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}
details.batch-section.complete > summary .batch-pct { color: var(--live); font-weight: 600; }
details.batch-section.complete > summary { border-bottom-color: var(--live-soft); }

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
  min-width: 0;
}

a.card { color: inherit; }
a.card:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(20, 26, 38, 0.06), 0 10px 26px rgba(20, 26, 38, 0.08);
}

.name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.client-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--ink);
  min-width: 0;
  word-break: break-word;
}

.stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stage-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.stage-badge.batch    { background: var(--batch-soft);    color: var(--batch); }
.stage-badge.active   { background: var(--active-soft);   color: var(--active); }
.stage-badge.editing  { background: var(--editing-soft);  color: var(--editing); }
.stage-badge.review   { background: var(--review-soft);   color: var(--review); }
.stage-badge.live     { background: var(--live-soft);     color: var(--live); }
.stage-badge.paused   { background: #fde8e8;              color: #b3261e; }

.stage-badges { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.card.paused .progress { filter: blur(2px) grayscale(1); opacity: 0.7; }

.batch-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--batch-soft);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.progress {
  height: 6px;
  background: #eef0f4;
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--batch);
}
.progress.batch   > span { background: var(--batch); }
.progress.active  > span { background: var(--active); }
.progress.editing > span { background: var(--editing); }
.progress.review  > span { background: var(--review); }
.progress.live    > span { background: var(--live); }

.meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-soft);
}

/* --- detail page --- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  margin-bottom: 14px;
}
.back:hover { color: var(--ink); text-decoration: none; }

.detail-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.detail-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
}

.detail-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.batch-circle {
  margin-left: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.batch-circle .batch-circle-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
}
.batch-circle .batch-circle-num {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.section-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.section-icon.icon-build    { color: var(--active); }
.section-icon.icon-links    { color: var(--editing); }
.section-icon.icon-details  { color: var(--live); }
.section-icon.icon-internal { color: var(--review); }
.section-icon.icon-client   { color: var(--accent); }

.timeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  position: relative;
}

.timeline .step {
  text-align: center;
  position: relative;
  padding: 0 6px;
}
.timeline .step .marker {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #eef0f4;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--line);
  position: relative;
  z-index: 1;
}
.timeline .step.done .marker { background: var(--live); color: #fff; box-shadow: none; }
.timeline .step.current.batch   .marker { background: var(--batch);   color: #fff; box-shadow: 0 0 0 4px var(--batch-soft); }
.timeline .step.current.active  .marker { background: var(--active);  color: #fff; box-shadow: 0 0 0 4px var(--active-soft); }
.timeline .step.current.editing .marker { background: var(--editing); color: #fff; box-shadow: 0 0 0 4px var(--editing-soft); }
.timeline .step.current.review  .marker { background: var(--review);  color: #fff; box-shadow: 0 0 0 4px var(--review-soft); }
.timeline .step.current.live    .marker { background: var(--live);    color: #fff; box-shadow: 0 0 0 4px var(--live-soft); }
.timeline .step .label { font-size: 12px; color: var(--ink-soft); }
.timeline .step.done .label,
.timeline .step.current .label { color: var(--ink); font-weight: 500; }

.timeline-wrap { position: relative; }
.timeline-wrap.paused .timeline {
  filter: blur(4px) grayscale(1);
  opacity: 0.55;
  pointer-events: none;
}
.timeline-wrap .pause-overlay {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.timeline-wrap.paused .pause-overlay { display: flex; }
.timeline-wrap .pause-overlay svg {
  width: 56px;
  height: 56px;
  color: #b3261e;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  padding: 8px;
  box-shadow: 0 2px 12px rgba(20, 26, 38, 0.12);
}

.build-meta { margin-top: 36px; }

.build-panel.paused .build-meta {
  filter: blur(3px) grayscale(1);
  opacity: 0.55;
  pointer-events: none;
}

.paused-notice {
  margin: 20px 0 4px;
  padding: 14px 16px;
  border: 1px solid #f4c7c7;
  background: #fff7f7;
  border-radius: 10px;
  text-align: center;
}
.paused-notice .paused-heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #b3261e;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}
.paused-notice .pause-glyph {
  width: 18px;
  height: 18px;
}
.paused-notice .paused-status {
  color: var(--ink);
  font-size: 14px;
  white-space: pre-wrap;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--line);
  z-index: 0;
}

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px 24px;
}
.kv .label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.kv-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.kv-icon.icon-dev    { color: var(--accent); }
.kv-icon.icon-start  { color: var(--editing); }
.kv-icon.icon-launch { color: var(--review); }
.kv-icon.icon-status { color: var(--live); }
.kv .value { font-size: 15px; font-weight: 500; }

.notes { white-space: pre-wrap; }

.link-warning {
  margin: 10px 2px 0;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.notes-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.notes-row .panel { margin-bottom: 0; }
@media (max-width: 720px) {
  .notes-row { grid-template-columns: 1fr; }
}

.links-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.link-card {
  flex: 1 1 220px;
  border: 1px solid var(--line);
  background: #fafbfc;
  border-radius: 10px;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  display: block;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease;
}
.link-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.link-card.disabled {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}
.link-card .link-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.link-card .link-value {
  font-size: 14px;
  font-weight: 500;
  word-break: break-all;
}
.link-card .arrow {
  color: var(--ink-soft);
  margin-left: 4px;
}
.link-card:hover .arrow { color: var(--accent); }

.empty, .error {
  padding: 40px;
  text-align: center;
  color: var(--ink-soft);
}
.error { color: #b3261e; }
