:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #111c34;
  --panel-soft: #16233f;
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #e5eefc;
  --muted: #93a4c2;
  --accent: #7dd3fc;
  --green: #4ade80;
  --orange: #fbbf24;
  --red: #f87171;
  --grey: #64748b;
  --blue: #60a5fa;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.10), transparent 24%),
    linear-gradient(180deg, #08101f 0%, var(--bg) 100%);
  color: var(--text);
}

/* ── Shell ── */
.app-shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 80px;
}

/* ── Header ── */
.page-header {
  padding: 24px 28px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.page-header h1 {
  font-size: 1.8rem;
  letter-spacing: -0.02em;
}
.page-summary {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ── Project Grid ── */
.project-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* ── Project Card ── */
.project-card {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(22, 35, 63, 0.96), rgba(13, 22, 39, 0.96));
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.project-card:hover {
  transform: translateY(-2px);
  border-color: rgba(125, 211, 252, 0.35);
  box-shadow: 0 12px 32px rgba(14, 165, 233, 0.08);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Status light */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot[data-tone="green"]  { background: var(--green); box-shadow: 0 0 8px rgba(74, 222, 128, 0.5); }
.status-dot[data-tone="orange"] { background: var(--orange); box-shadow: 0 0 8px rgba(251, 191, 36, 0.5); }
.status-dot[data-tone="red"]    { background: var(--red); box-shadow: 0 0 8px rgba(248, 113, 113, 0.5); }
.status-dot[data-tone="grey"]   { background: var(--grey); }
.status-dot[data-tone="blue"]   { background: var(--blue); box-shadow: 0 0 8px rgba(96, 165, 250, 0.4); }

.card-name {
  font-size: 1.05rem;
  font-weight: 600;
  flex: 1;
}

.card-status {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.card-desc {
  margin-top: 10px;
  color: #c4d2ea;
  font-size: 0.88rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Readiness bar (for projects that have it) */
.card-readiness {
  margin-top: 14px;
}
.readiness-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
}
.readiness-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 0.4s ease;
}
.readiness-label {
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay[hidden] { display: none; }

.modal-panel {
  position: relative;
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 28px;
  border-radius: 20px;
  border: 1px solid rgba(125, 211, 252, 0.25);
  background: linear-gradient(180deg, rgba(17, 28, 52, 0.98), rgba(10, 18, 34, 0.98));
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}
.modal-close:hover {
  background: rgba(30, 41, 59, 0.95);
}

/* ── Modal content ── */
.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.detail-header h2 {
  font-size: 1.4rem;
}

.detail-desc {
  margin-top: 12px;
  color: #c4d2ea;
  line-height: 1.6;
}

.detail-section {
  margin-top: 20px;
}
.detail-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.detail-list {
  list-style: none;
  padding: 0;
}
.detail-list li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  font-size: 0.9rem;
  line-height: 1.5;
  color: #d6e2f5;
}
.detail-list li:last-child { border-bottom: none; }

/* Pillar bars */
.pillar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}
.pillar-row:last-child { border-bottom: none; }
.pillar-name {
  flex: 1;
  font-size: 0.88rem;
  color: #d6e2f5;
}
.pillar-bar-wrap {
  width: 100px;
  height: 6px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
}
.pillar-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--green));
}
.pillar-pct {
  width: 36px;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.detail-forecast {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(125, 211, 252, 0.06);
  border: 1px solid rgba(125, 211, 252, 0.15);
  color: #c4d2ea;
  font-size: 0.9rem;
  line-height: 1.55;
}

.state-message {
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

/* ── Pixlik preview gallery ── */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.preview-item {
  text-align: center;
}
.preview-img {
  width: 100%;
  max-width: 184px;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: #000;
  image-rendering: pixelated;
}
.preview-label {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 640px);
    padding-top: 18px;
  }
  .project-grid {
    grid-template-columns: 1fr;
  }
  .modal-panel {
    padding: 20px;
  }
}

/* Process status */
.process-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 8px 0 4px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
}
.process-status[data-process-tone="green"] { background: rgba(74, 222, 128, 0.12); color: var(--green); }
.process-status[data-process-tone="orange"] { background: rgba(251, 191, 36, 0.12); color: var(--orange); }
.process-status[data-process-tone="yellow"] { background: rgba(251, 191, 36, 0.08); color: #fde68a; }
.process-status[data-process-tone="red"] { background: rgba(248, 113, 113, 0.12); color: var(--red); }
.process-status[data-process-tone="grey"] { background: rgba(100, 116, 139, 0.12); color: var(--grey); }

.process-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.process-status[data-process-tone="green"] .process-indicator {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-green 2s infinite;
}
.process-status[data-process-tone="orange"] .process-indicator { background: var(--orange); }
.process-status[data-process-tone="yellow"] .process-indicator { background: #fde68a; }
.process-status[data-process-tone="red"] .process-indicator { background: var(--red); }
.process-status[data-process-tone="grey"] .process-indicator { background: var(--grey); }

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Process detail in modal */
.process-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 8px;
}
.process-detail[data-process-tone="green"] { background: rgba(74, 222, 128, 0.1); color: var(--green); }
.process-detail[data-process-tone="orange"] { background: rgba(251, 191, 36, 0.1); color: var(--orange); }
.process-detail[data-process-tone="yellow"] { background: rgba(251, 191, 36, 0.06); color: #fde68a; }
.process-detail[data-process-tone="red"] { background: rgba(248, 113, 113, 0.1); color: var(--red); }
.process-detail .process-indicator { width: 10px; height: 10px; }

.process-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.process-meta strong { color: var(--text); }
.process-warn { color: var(--orange); }
.process-updated { color: var(--grey); font-size: 0.75rem; }
