/* «Coding»: projects (left), the agent chat (middle, agent.css), files and changes (right). */

.cd {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 380px;
  height: 100vh;
  height: 100dvh;
}
.cd .ag { max-width: none; margin: 0; min-width: 0; }
.cd-empty { display: grid; place-content: center; gap: 12px; padding: 24px; max-width: 460px; margin: auto; text-align: center; }
.cd-empty[hidden], .cd-panel[hidden] { display: none; }
.cd-empty p { color: var(--muted); line-height: 1.5; }

/* projects */
.cd-side {
  display: flex; flex-direction: column; min-height: 0;
  padding: var(--top) 10px 10px;
  border-right: .5px solid var(--hairline);
  background: var(--fill);
}
.cd-side-head { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; }
.cd-side-head h2 { flex: 1; margin: 0; font-size: 15px; color: var(--muted); }
.cd-projects { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.cd-project { display: flex; align-items: center; border-radius: 10px; }
.cd-project.on { background: var(--fill-2); }
.cd-project-name {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px;
  border: 0; background: none; color: var(--text); text-align: left; cursor: pointer;
  padding: 8px 10px; font: 14px var(--font);
}
.cd-project-name small { color: var(--subtle); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-project-x { border: 0; background: none; color: var(--subtle); cursor: pointer; padding: 8px; font-size: 16px; }
.cd-project-x:hover { color: var(--danger); }

/* files, changes, history */
.cd-panel {
  display: flex; flex-direction: column; min-height: 0;
  padding: var(--top) 10px 10px;
  border-left: .5px solid var(--hairline);
}
.cd-tabs { display: flex; gap: 4px; padding-bottom: 8px; }
.cd-tabs button {
  flex: 1; border: 0; border-radius: 999px; padding: 7px 10px; cursor: pointer;
  background: var(--fill-2); color: var(--muted); font: 13px var(--font);
}
.cd-tabs button.on { background: var(--accent); color: var(--accent-ink); }
.cd-panel-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.cd-panel-foot { display: flex; gap: 6px; padding-top: 8px; flex-wrap: wrap; }
.cd-crumbs { font-size: 12px; color: var(--subtle); padding: 4px 6px 8px; word-break: break-all; }
.cd-file {
  border: 0; background: none; color: var(--text); text-align: left; cursor: pointer;
  padding: 6px 8px; border-radius: 8px; font: 13px var(--font);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cd-file:hover { background: var(--fill-2); }
.cd-file.dir { color: var(--muted); }
.cd-code, .cd-diff {
  margin: 0; padding: 10px; border-radius: 10px; background: #000; overflow: auto;
  font: 12px/1.45 var(--mono); white-space: pre; color: var(--text);
}
.cd-diff .add { color: #3fb950; }
.cd-diff .del { color: #f85149; }
.cd-diff .hunk { color: #79c0ff; }
.cd-change { display: flex; gap: 8px; font: 12px var(--mono); padding: 3px 6px; }
.cd-change b { color: var(--accent); min-width: 18px; }
.cd-commit { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 6px; font-size: 13px; border-bottom: .5px solid var(--hairline); }
.cd-commit code { color: var(--accent); font: 12px var(--mono); }
.cd-commit small { grid-column: 2; color: var(--subtle); }
.cd-note { color: var(--subtle); font-size: 13px; padding: 6px; }
.cd-only-phone { display: none; }

/* narrower screens: the panel opens on demand; on a phone the projects too */
@media (max-width: 1200px) {
  .cd { grid-template-columns: 240px minmax(0, 1fr); }
  .cd-panel { display: none; }
  .cd.panel-open .cd-panel {
    display: flex; position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 92vw);
    z-index: 20; background: var(--bg); box-shadow: -8px 0 30px rgba(0, 0, 0, .5);
  }
}
@media (min-width: 1201px) {
  .cd.panel-open { grid-template-columns: 260px minmax(0, 1fr); }
  .cd.panel-open .cd-panel { display: none; }
}
@media (max-width: 760px) {
  .cd { grid-template-columns: minmax(0, 1fr); }
  .cd-only-phone { display: inline-flex; }
  .cd-side { display: none; }
  .cd.side-open .cd-side {
    display: flex; position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 86vw);
    z-index: 20; box-shadow: 8px 0 30px rgba(0, 0, 0, .5);
  }
}
