/* ============================================================
   Project Builder — shell + shared primitives
   ------------------------------------------------------------
   Loaded on EVERY /projects/ page, right after pb-tokens.css.

   Holds the two things every page needs — the indigo hero band
   and the button/notice primitives — plus the workspace's
   two-column layout and its contextual left rail.

   `.pb-btn` lives here rather than in pb-workspace.css because
   the hub, the chooser and the wizard all use it and none of
   them load the workspace stylesheet.

   The workspace's left rail is a column inside the page's
   content block — it is NOT an override of base_app's sidebar
   block. That block is the platform's global nav, and .pb-scope
   (where the --pb-* tokens are declared) is a sibling of it, so
   the tokens could not reach an overridden sidebar anyway.
   ============================================================ */

/* Alpine's x-cloak is inert without this rule, and there is no global one in
   the platform CSS — without it every workspace panel renders at once on load
   and only collapses when Alpine boots. */
[x-cloak] { display: none !important; }

/* ── Buttons ──────────────────────────────────────────────── */
.pb-btn {
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--pb-primary);
  color: #fff;
  background: var(--pb-primary);
  border-radius: var(--pb-r-sm);
  padding: .45rem .9rem;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.pb-btn:hover { background: var(--pb-primary-hover); border-color: var(--pb-primary-hover); color: #fff; }
.pb-btn:focus-visible { outline: 2px solid var(--pb-primary); outline-offset: 2px; }
.pb-btn--ghost { background: transparent; color: var(--pb-primary); }
.pb-btn--ghost:hover { background: var(--pb-primary-soft); color: var(--pb-primary-hover); }
.pb-btn--xs { font-size: .72rem; padding: .15rem .5rem; }
.pb-btn[disabled] { opacity: .55; cursor: not-allowed; }
.pb-btn[disabled]:hover { background: var(--pb-primary); border-color: var(--pb-primary); }

/* ── Indigo hero band ─────────────────────────────────────── */
.pb-shell-hero {
  background: linear-gradient(135deg, var(--pb-shell-2), var(--pb-shell) 55%, var(--pb-indigo-700));
  border-radius: var(--pb-r-2xl);
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  color: var(--pb-shell-text);
}
.pb-shell-hero__eyebrow {
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--pb-indigo-200);
  margin: 0 0 .5rem;
}
.pb-shell-hero__title {
  font-family: var(--pb-font-display);
  font-size: clamp(1.9rem, 3.2vw, 2.9rem);
  line-height: 1.08;
  font-weight: 600;
  color: var(--pb-shell-text-strong);
  margin: 0 0 .6rem;
}
.pb-shell-hero__sub {
  font-size: 1.02rem;
  color: var(--pb-indigo-100);
  max-width: 46rem;
  margin: 0;
}
.pb-shell-hero__actions { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: .6rem; }
/* On indigo, the normal indigo button disappears — invert it. */
.pb-shell-hero .pb-btn {
  background: #fff;
  color: var(--pb-indigo-700);
  border-color: #fff;
}
.pb-shell-hero .pb-btn:hover { background: var(--pb-indigo-50); color: var(--pb-indigo-800); }
.pb-shell-hero .pb-btn--ghost {
  background: transparent;
  color: #fff;
  border-color: var(--pb-indigo-300);
}
.pb-shell-hero .pb-btn--ghost:hover { background: rgba(255, 255, 255, .12); color: #fff; }

/* ── Notices ──────────────────────────────────────────────── */
.pb-notice {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .9rem 1.1rem;
  border-radius: var(--pb-r-md);
  border: 1px solid var(--pb-border);
  background: var(--pb-bg-elev);
  font-size: .88rem;
  margin-bottom: 1.25rem;
}
.pb-notice--warn { border-color: var(--pb-gold-100); background: var(--pb-gold-100); color: var(--pb-ink-800); }
.pb-notice--warn i { color: var(--pb-gold-500); }
.pb-notice--info { border-color: var(--pb-indigo-100); background: var(--pb-indigo-50); }
.pb-notice--info i { color: var(--pb-primary); }

/* ── Workspace layout: rail + main ────────────────────────── */
.pb-ws {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.pb-wsnav {
  position: sticky;
  top: 1rem;
  background: var(--pb-bg-elev);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-r-lg);
  box-shadow: var(--pb-shadow-sm);
  padding: .75rem;
  display: flex;
  flex-direction: column;
  min-height: 28rem;
}
.pb-wsnav__brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .6rem .75rem;
  border-bottom: 1px solid var(--pb-border);
  margin-bottom: .5rem;
}
.pb-wsnav__brand i { color: var(--pb-primary); font-size: 1.2rem; }
.pb-wsnav__brand span {
  font-family: var(--pb-font-display);
  font-weight: 600;
  font-size: .95rem;
  color: var(--pb-ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pb-wsnav__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.pb-wsnav__item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .6rem;
  border-radius: var(--pb-r-sm);
  font-size: .88rem;
  font-weight: 500;
  color: var(--pb-ink-700);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  transition: background .12s ease, color .12s ease;
}
.pb-wsnav__item i { font-size: .95rem; color: var(--pb-ink-400); }
.pb-wsnav__item:hover { background: var(--pb-neutral-100); color: var(--pb-ink-900); }
.pb-wsnav__item.is-active {
  background: var(--pb-primary);
  color: #fff;
  font-weight: 600;
}
.pb-wsnav__item.is-active i { color: #fff; }
.pb-wsnav__item:focus-visible { outline: 2px solid var(--pb-primary); outline-offset: -2px; }
.pb-wsnav__count {
  margin-left: auto;
  font-size: .7rem;
  font-weight: 700;
  padding: .05rem .4rem;
  border-radius: var(--pb-r-pill);
  background: var(--pb-neutral-150);
  color: var(--pb-ink-600);
}
.pb-wsnav__item.is-active .pb-wsnav__count { background: rgba(255, 255, 255, .25); color: #fff; }
/* Pinned to the bottom — the mockup's Preference / Log out slot. */
.pb-wsnav__foot {
  margin-top: auto;
  padding-top: .5rem;
  border-top: 1px solid var(--pb-border);
}

/* The main column. min-width:0 stops a wide table or code block inside a
   panel from blowing the grid track out past the viewport. */
.pb-wsmain { min-width: 0; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .pb-ws { grid-template-columns: 1fr; }
  /* The rail becomes a thumb-reachable chip strip. Deliberately not a bottom
     tab bar: base_app already ships a mobile nav toggle, and two competing
     navigation systems on one screen is worse than one good one. */
  .pb-wsnav {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 0;
    flex-direction: row;
    align-items: center;
    gap: .4rem;
    overflow-x: auto;
    padding: .5rem;
    border-radius: var(--pb-r-md);
  }
  .pb-wsnav__brand { display: none; }
  .pb-wsnav__list { display: flex; gap: .4rem; }
  .pb-wsnav__item { white-space: nowrap; border: 1px solid var(--pb-border); }
  .pb-wsnav__foot { margin: 0 0 0 auto; padding: 0 0 0 .4rem; border-top: 0; border-left: 1px solid var(--pb-border); }
}

@media (max-width: 575.98px) {
  .pb-shell-hero { padding: 1.6rem 1.25rem; }
}

/* ── Shared: status chips, progress bars, fine print ─────── */
/* Used by the workspace panels AND the hub's recent-projects table, so
   they live here rather than in either page's own stylesheet. */
.pb-status {
  font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; font-weight: 700;
  padding: .12rem .5rem; border-radius: var(--pb-r-pill); border: 1px solid var(--pb-border);
  color: var(--pb-ink-600); background: var(--pb-neutral-150);
}
.pb-status--drafting { color: var(--pb-gold-500); background: var(--pb-gold-100); border-color: var(--pb-gold-100); }
.pb-status--drafted,
.pb-status--approved { color: var(--pb-green-500); background: var(--pb-green-100); border-color: var(--pb-green-100); }
.pb-status--needs_review { color: var(--pb-rose-500); background: var(--pb-rose-100); border-color: var(--pb-rose-100); }

.pb-saved { font-size: .78rem; color: var(--pb-green-500); }
.pb-req { font-size: .7rem; color: var(--pb-text-subtle); }

.pb-progress { margin: .9rem 0 0; }
.pb-progress__track {
  height: .5rem;
  border-radius: var(--pb-r-pill);
  background: var(--pb-neutral-200);
  overflow: hidden;
}
.pb-progress__fill {
  height: 100%;
  border-radius: var(--pb-r-pill);
  background: var(--pb-stat);
  transition: width .3s ease;
}
.pb-progress__label {
  font-size: .78rem;
  color: var(--pb-text-subtle);
  margin: .35rem 0 0;
}


/* Delete lives in the rail's foot but must not read as just another nav item. */
.pb-wsnav__item--danger { color: #b91c1c; }
.pb-wsnav__item--danger:hover { background: #fef2f2; color: #991b1b; }
