@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* ── Variables ── */
:root {
  --bg: #f0efed;
  --surface: #FFFFFF;
  --border: #D8D3C8;
  --accent: #9DB755;
  --accent-dark: #7a9240;
  --text: #1a1a1a;
  --text-muted: #7b7b7b;
  --grey: #999;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
body {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

main {
  padding: 24px 0 48px;
}

/* ── Buttons ── */
.btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-dark); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn-ghost:hover { background: var(--bg); border-color: #bbb; }

/* ── Inputs ── */
input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Labels ── */
label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

/* ── Code ── */
code {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  background: var(--border);
  padding: 1px 5px;
  border-radius: 3px;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  font-size: 12px;
  line-height: 1.7;
}

/* ── Hint ── */
.hint {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 6px;
  padding: 10px 12px;
  border-left: 3px solid var(--border);
}

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
  gap: 16px;
}
.header-left h1 {
  font-size: 21px;
  font-weight: 600;
}
.header-left .page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 1px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}
footer .container {
  display: flex;
  justify-content: space-between;
}
.footer-text {
  font-size: 12px;
  color: var(--grey);
}
.footer-text a {
  color: var(--grey);
  text-decoration: none;
}
.footer-text a:hover {
  text-decoration: underline;
}

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

/* ── States ── */
.loading-state, .error-state, .empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.error-state { color: #991B1B; }

/* ── Status badge colours ── */
:root {
  --status-not-started-bg: #f0f0f0;
  --status-not-started-text: #555;
  --status-in-progress-bg: #FEF3C7;
  --status-in-progress-text: #92400E;
  --status-complete-bg: #D1FAE5;
  --status-complete-text: #065F46;
  --status-blocked-bg: #EBEBEB;
  --status-blocked-text: #555;
  --status-overdue-bg: #FEE2E2;
  --status-overdue-text: #991B1B;
}

/* ── Password gate ── */
#gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.gate-card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.gate-card p {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 13px;
}

.gate-card input[type="password"] {
  margin-bottom: 12px;
  text-align: center;
  letter-spacing: 2px;
}

.gate-card button {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.gate-card button:hover { background: var(--accent-dark); }

.gate-error {
  color: #991B1B;
  font-size: 13px;
  margin-top: 10px;
  display: none;
}

/* ── App ── */
#app { display: none; }

.header-left .client-name {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Refresh button ── */
.btn-refresh {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 13px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-refresh:hover { background: var(--bg); border-color: #bbb; }
.btn-refresh svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-refresh.spinning svg { animation: spin 0.7s linear infinite; }

/* ── Progress bar ── */
.progress-section { padding: 20px 0 0; width: 100%; }

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.progress-pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-dark);
}

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ── Phase group ── */
.phase-group {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.phase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.phase-header:hover { background: #faf8f4; }

.phase-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.phase-name { font-size: 16px; font-weight: 600; }

.phase-count {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 6px;
}

.phase-chevron {
  width: 16px;
  height: 16px;
  color: var(--grey);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.phase-group.collapsed .phase-chevron { transform: rotate(-90deg); }
.phase-group.collapsed .phase-body { display: none; }

/* Shared grid context — all task rows inherit these column tracks */
.phase-body {
  display: grid;
  grid-template-columns: 1fr 115px auto auto;
  column-gap: 12px;
}

/* ── Task rows ── */
.task-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.task-row:last-child { border-bottom: none; }

.task-main { min-width: 0; }

.task-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.task-description {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.task-notes {
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 6px;
}
.task-notes a {
  color: var(--accent-dark);
  text-decoration: underline;
}

/* Transparent wrapper — children slot into the shared grid columns */
.task-right { display: contents; }

/* ── Badges and pills ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 99px;
  white-space: nowrap;
  justify-self: start;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-not-started { background: var(--status-not-started-bg); color: var(--status-not-started-text); }
.status-not-started .status-dot { background: #aaa; }
.status-in-progress { background: var(--status-in-progress-bg); color: var(--status-in-progress-text); }
.status-in-progress .status-dot { background: #D97706; }
.status-complete { background: var(--status-complete-bg); color: var(--status-complete-text); }
.status-complete .status-dot { background: #059669; }
.status-blocked { background: var(--status-blocked-bg); color: var(--status-blocked-text); }
.status-blocked .status-dot { background: #999; }
.status-overdue { background: var(--status-overdue-bg); color: var(--status-overdue-text); }
.status-overdue .status-dot { background: #DC2626; }

.owner-pill {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
  justify-self: start;
}

.due-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.due-date.overdue { color: #DC2626; font-weight: 500; }

/* ── Roadmap responsive ── */
@media (max-width: 640px) {
  /* Tighten container padding */
  .container { padding: 0 16px; }

  /* Gate */
  .gate-card { padding: 28px 20px; }

  /* Header: allow project name and button to wrap */
  header .container {
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .header-left h1 { font-size: 15px; }
  .header-left .client-name { font-size: 12px; }

  /* Progress */
  .progress-section { padding: 14px 0 0; }

  /* Phase header */
  .phase-header { padding: 12px 14px; }
  .phase-name { font-size: 13px; }

  /* Task rows: stack columns */
  .phase-body { display: block; }

  .task-row {
    display: grid;
    grid-template-columns: 1fr;
    padding: 12px 14px;
    gap: 8px;
  }

  /* Restore task-right as a real box so its children flex wrap */
  .task-right {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .task-name { font-size: 13px; }
  .task-description { font-size: 12px; }
}
