/* Workspace shell — recreates the real RalphX macOS app surface. */

.macwin {
  position: relative;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  font-size: 12.5px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---- Single-row chrome (v27 design) ---- */
/* traffic · breadcrumb · spacer · search · bell · theme · zoom */
.ws-chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: hsl(220 10% 7%);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  flex-shrink: 0;
}
.traffic { display: flex; gap: 6px; flex-shrink: 0; padding-right: 6px; }
.traffic span { width: 11px; height: 11px; border-radius: 50%; }
.traffic span:nth-child(1) { background: #ff5f57; }
.traffic span:nth-child(2) { background: #febc2e; }
.traffic span:nth-child(3) { background: #28c840; }

/* Breadcrumb — Workspace / Agents / New run */
.ws-breadcrumb {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.ws-bc-seg {
  color: var(--text-secondary);
  transition: color 300ms var(--ease-apple);
}
.ws-bc-seg.is-last {
  color: var(--text-primary);
  font-weight: 600;
}
.ws-bc-sep {
  color: var(--text-faint);
  font-size: 11px;
}

.ws-spacer { flex: 1; }

/* Search bar */
.ws-search {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 360px;
  max-width: 520px;
  padding: 5px 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  color: var(--text-muted);
}
.ws-search svg { color: var(--text-muted); }
.ws-search-placeholder {
  flex: 1;
  font-size: 12px;
  color: var(--text-muted);
}
.ws-search-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 6px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: hsl(220 10% 9%);
}

/* Notification bell with badge */
.ws-bell {
  position: relative;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
}
.ws-bell-badge {
  position: absolute;
  top: 1px; right: 1px;
  min-width: 14px; height: 14px;
  padding: 0 4px;
  background: var(--accent);
  color: hsl(0 0% 100%);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid hsl(220 10% 7%);
}

/* Pill-trigger buttons (theme + zoom) */
.ws-pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  font-size: 11.5px;
  color: var(--text-primary);
  cursor: pointer;
}
.ws-pill-btn svg { width: 12px; height: 12px; color: var(--text-secondary); }
.ws-pill-btn .chev { width: 9px; height: 9px; color: var(--text-muted); }
.ws-zoom-icon {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.02em;
}

/* ---- Body grid: rail · sidebar · main · [right] ---- */
.ws-body {
  display: grid;
  grid-template-columns: 48px 280px 1fr;
  flex: 1;
  min-height: 0;
}
.ws-body.has-rightpanel { grid-template-columns: 48px 280px 1fr 320px; }

/* ---- Icon rail (vertical nav) ---- */
.ws-rail {
  background: hsl(220 10% 5.5%);
  border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column;
  align-items: center;
  padding: 8px 0;
  overflow: hidden;
}
.ws-rail-brand {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: hsl(220 10% 9%);
  margin-bottom: 8px;
}
.ws-rail-brand img { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; }
.ws-rail-divider {
  width: 24px; height: 1px;
  background: var(--border-subtle);
  margin-bottom: 8px;
}
.ws-rail-items {
  display: flex; flex-direction: column;
  gap: 4px;
}
.ws-rail-item {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 300ms var(--ease-apple), color 300ms var(--ease-apple);
}
.ws-rail-item svg { width: 16px; height: 16px; }
.ws-rail-item:hover { color: var(--text-secondary); background: hsl(220 10% 9%); }
.ws-rail-item.is-active {
  background: hsl(220 10% 11%);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.ws-rail-spacer { flex: 1; }
.ws-rail-settings { color: var(--text-faint); }

/* ---- Sidebar (Projects panel) ---- */
.ws-side {
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-base);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.ws-side-header {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px 8px;
}
.ws-new-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px 5px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 7px;
  cursor: pointer;
}
.ws-new-btn svg { color: var(--text-secondary); }
.ws-side-spacer { flex: 1; }
.ws-side-icon-btn {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  border-radius: 5px;
  cursor: pointer;
}
.ws-side-icon-btn:hover { color: var(--text-secondary); background: hsl(220 10% 11%); }

/* Project tree */
.ws-side-tree {
  padding: 4px 8px 8px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.ws-prj { margin-bottom: 2px; }
.ws-prj-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  transition: background-color 300ms var(--ease-apple), color 300ms var(--ease-apple);
}
.ws-prj.is-accent .ws-prj-row {
  background: hsla(14 100% 60% / 0.10);
  color: var(--text-primary);
  font-weight: 500;
}
.ws-prj.is-accent .ws-prj-name,
.ws-prj.is-accent .folder { color: var(--accent); }
.ws-prj-row .chev {
  color: var(--text-faint);
  transition: transform 300ms var(--ease-apple);
}
.ws-prj-row .chev.is-open { transform: rotate(90deg); color: var(--text-secondary); }
.ws-prj-row .folder { color: var(--text-muted); flex-shrink: 0; }
.ws-prj-name {
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-prj-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
}
.ws-prj-count.is-accent {
  color: hsl(0 0% 100%);
  background: var(--accent);
  border-color: transparent;
  font-weight: 700;
}

.ws-prj-tasks {
  padding: 4px 0 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.ws-prj-task {
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 300ms var(--ease-apple);
}
.ws-prj-task.is-active {
  background: hsl(220 10% 11%);
}
.ws-prj-task-row {
  display: flex; align-items: center; gap: 8px;
}
.ws-prj-task-title {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-prj-task-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 1px solid var(--text-faint);
  flex-shrink: 0;
}
.ws-prj-task-meta {
  margin-top: 3px;
  display: flex; align-items: center; gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}
.ws-meta-sep { color: var(--text-faint); }
.ws-run-running { color: var(--accent); font-weight: 600; }
.ws-run-queued  { color: var(--text-muted); }

/* Recent section + Add project (pinned to bottom of sidebar) */
.ws-side-recent-wrap {
  border-top: 1px solid var(--border-subtle);
  padding: 12px 12px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.ws-side-recent-head {
  display: flex; align-items: center; justify-content: space-between;
}
.ws-side-recent-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ws-side-recent-link {
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}
.ws-side-recent {
  display: flex; flex-direction: column; gap: 8px;
}
.ws-recent-item {
  display: flex; gap: 10px;
  align-items: flex-start;
}
.ws-recent-dot {
  width: 8px; height: 8px;
  background: var(--status-success);
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.ws-recent-body { flex: 1; min-width: 0; }
.ws-recent-title {
  font-size: 11.5px;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.35;
}
.ws-recent-meta {
  margin-top: 2px;
  display: flex; align-items: center; gap: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
}
.ws-side-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 10px;
  background: transparent;
  border: 1px dashed var(--border-default);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
}
.ws-side-add svg { color: var(--text-muted); }

/* ---- Main pane ---- */
.ws-main {
  display: flex; flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
.ws-main-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.ws-main-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-main-actions { display: flex; gap: 6px; align-items: center; color: var(--text-muted); }
.ws-main-actions svg { width: 13px; height: 13px; }

.ws-subtabs {
  display: flex; gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.ws-subtab {
  padding: 9px 12px;
  font-size: 11.5px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color 300ms var(--ease-apple), border-color 300ms var(--ease-apple);
}
.ws-subtab svg { width: 11px; height: 11px; }
.ws-subtab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.ws-subtab .num {
  font-family: var(--font-mono);
  font-size: 9.5px;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  padding: 1px 5px;
  border-radius: 999px;
  color: var(--text-secondary);
}

.ws-thread {
  flex: 1;
  overflow: hidden;
  padding: 16px 24px;
  position: relative;
}

/* ---- Composer ---- */
.ws-composer {
  border-top: 1px solid var(--border-subtle);
  background: hsl(220 10% 7%);
  flex-shrink: 0;
}
.ws-composer-text {
  padding: 14px 18px 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.ws-composer-controls {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px 10px;
}
.ws-attach {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  border-radius: 6px;
}
.ws-control-mini {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-primary);
}
.ws-control-mini .key {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-right: 2px;
}
.ws-control-mini .icon { width: 11px; height: 11px; color: var(--text-muted); }
.ws-control-mini .chev { width: 9px; height: 9px; opacity: 0.6; }

.ws-controls-spacer { flex: 1; }

.ws-send {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: var(--accent);
  color: var(--bg-deep);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.ws-send svg { width: 11px; height: 11px; }

.ws-statusbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--bg-deep);
}
.ws-statusbar .key {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}
.ws-statusbar svg { color: var(--text-faint); }
.ws-statusbar-left, .ws-statusbar-right {
  display: inline-flex; align-items: center; gap: 6px;
}

/* ---- Right panel ---- */
.ws-rightpanel {
  border-left: 1px solid var(--border-subtle);
  background: hsl(220 10% 6%);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.ws-rightpanel-header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.ws-rightpanel-title {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.ws-rightpanel-title svg { color: var(--accent); }
.ws-rightpanel-sub-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
.ws-rightpanel-subtitle {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.ws-rightpanel-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 4px;
}
.ws-rightpanel-body {
  padding: 12px;
  flex: 1;
  overflow: hidden;
}

/* Right panel — grid of metadata cells (BRANCH/BASE/PR/MODE) */
.rp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.rp-cell {
  padding: 8px 10px;
  background: hsl(220 10% 8%);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  min-width: 0;
}
.rp-cell .rp-key {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.rp-cell .rp-val {
  font-size: 10.5px;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.4;
}
.rp-section-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 0 0;
}
.rp-action-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rp-action-row .rp-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border-default);
}

/* ---- Common bits ---- */
.ws-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.ws-badge svg { color: var(--accent); }

@media (max-width: 920px) {
  .ws-body { grid-template-columns: 48px 1fr; }
  .ws-body.has-rightpanel { grid-template-columns: 48px 1fr; }
  .ws-side, .ws-rightpanel { display: none; }
  .ws-search { min-width: 0; }
  .ws-search-placeholder, .ws-search-kbd { display: none; }
  .ws-pill-btn span { display: none; }
}
