/* Projectboard — Hatch house style
   accent #FF9900 as FILLS only (near-black label on fill), near-black top bar,
   white page, hairline borders, 8px radius. */

:root {
  --accent: #FF9900;
  --near-black: #1A1A1A;
  --page: #FFFFFF;
  --hairline: #E4E4E4;
  --muted: #6B6B6B;
  --track: #F2F2F2;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--near-black);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */

.topbar {
  background: var(--near-black);
  color: #FFFFFF;
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.wordmark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.refreshed {
  font-size: 12px;
  color: #A8A8A8;
  white-space: nowrap;
}

/* ---------- Accent button (fill + near-black label) ---------- */

.btn-accent {
  background: var(--accent);
  color: var(--near-black);
  border: 0;
  border-radius: var(--radius);
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-accent:hover { filter: brightness(1.06); }
.btn-accent:active { filter: brightness(0.94); }

.btn-accent:disabled {
  opacity: 0.55;
  cursor: default;
  filter: none;
}

:focus-visible {
  outline: 2px solid var(--near-black);
  outline-offset: 2px;
}

/* ---------- Shell: sidebar + detail ---------- */

.shell {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
}

.sidebar {
  flex: 0 0 272px;
  width: 272px;
  align-self: stretch;
  border-right: 1px solid var(--hairline);
  padding: 20px 12px 56px;
}

.panel {
  flex: 1 1 auto;
  min-width: 0;
  padding: 24px 20px 56px;
}

/* ---------- Sidebar tree ---------- */

.tree,
.children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.node-row {
  display: flex;
  align-items: flex-start;
  gap: 2px;
}

/* Collapse/expand triangle. Toggles only — it never changes the selection. */
.twisty {
  flex: 0 0 auto;
  width: 22px;
  height: 30px;
  margin-top: 3px;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  border-radius: 4px;
}

.twisty::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: translate(-50%, -50%);
}

.twisty.open::before {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  border-bottom: 0;
}

.twisty:hover::before { border-left-color: var(--near-black); }
.twisty.open:hover::before { border-top-color: var(--near-black); }

.twisty-spacer {
  flex: 0 0 auto;
  width: 22px;
}

.node-btn {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  text-align: left;
  background: transparent;
  border: 0;
  font: inherit;
  color: var(--near-black);
  padding: 7px 9px;
  margin-bottom: 2px;
  border-radius: var(--radius);
  cursor: pointer;
}

.node-btn:hover { background: var(--track); }

/* selection is an accent fill, near-black label — house style */
.node-btn.is-selected,
.node-btn.is-selected:hover {
  background: var(--accent);
  color: var(--near-black);
}

.node-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.node-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-btn.child .node-name { font-weight: 500; }

.node-count {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.node-btn.is-selected .node-count { color: var(--near-black); }

.node-btn .bar {
  margin-top: 6px;
  background: var(--page);
}

.node-btn:hover .bar { background: var(--page); }
.node-btn.is-selected .bar { background: rgba(26, 26, 26, 0.18); }

/* Children sit deeper than root rows, with a guide line, so a nested child is
   never mistaken for a top-level project. */
.children {
  margin-left: 22px;
  padding-left: 13px;
  border-left: 1px solid var(--hairline);
}

/* ---------- Project summary ---------- */

.summary {
  margin-bottom: 28px;
}

.summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.summary h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.summary .repo {
  font-size: 12px;
  color: var(--muted);
}

.summary-count {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.summary-count .of {
  color: var(--muted);
  font-weight: 500;
}

/* ---------- Progress bar (orange fill) ---------- */

.bar {
  height: 10px;
  background: var(--track);
  border-radius: var(--radius);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius);
  width: 0;
}

.bar.sm { height: 6px; }

/* ---------- Phase cards ---------- */

.phases {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.card-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.card .bar { margin-bottom: 14px; }

/* ---------- Tasks ---------- */

.tasks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
}

.task + .task { border-top: 1px solid var(--hairline); }

/* Read-only tickbox: v1 has no in-page ticking. */
.tick {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: var(--page);
}

.task.done .tick {
  background: var(--accent);
  border-color: var(--accent);
  position: relative;
}

/* near-black check on the accent fill */
.task.done .tick::after {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid var(--near-black);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task.done .task-label { color: var(--muted); }

/* ---------- States ---------- */

.state {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.state strong {
  display: block;
  color: var(--near-black);
  font-size: 15px;
  margin-bottom: 6px;
}

.is-loading { opacity: 0.5; }

@media (max-width: 720px) {
  .shell { display: block; }

  .sidebar {
    width: auto;
    flex: none;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
    padding: 12px 12px 16px;
  }

  .panel { padding: 20px 16px 56px; }
}

@media (max-width: 560px) {
  .topbar-inner { flex-wrap: wrap; }
  .phases { grid-template-columns: 1fr; }
}
