* { box-sizing: border-box; }

:root {
  --quiet: rgba(255, 255, 255, 0.48);
  --faint: rgba(255, 255, 255, 0.07);
  --card: rgba(255, 255, 255, 0.035);
  --card-hover: rgba(255, 255, 255, 0.06);
  --card-line: rgba(255, 255, 255, 0.05);
  --surface: var(--color-primary-dark);
  --over: #ff9e8f;
  --ok: #8ee6b0;

  --bar-h: 0px;
  --head-h: 112px;   /* shared top line for all three panes */
  --pad-x: 40px;
}

body {
  margin: 0;
  background: var(--color-primary);
  color: var(--color-text-primary);
  font-family: var(--font-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 900; font-style: italic; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; }

.eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--quiet);
  font-style: normal;
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  height: calc(100vh - var(--bar-h));
  max-width: 1180px;
  margin: 0 auto;
  background: var(--color-primary);
}

/* ---------- rail ---------- */

.rail { display: flex; padding: 16px 0 16px 16px; min-height: 0; }
.rail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 0 32px 28px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}
.brand {
  /* Minus the rail's top padding, so this divider lines up with the list's header rule */
  height: calc(var(--head-h) - 16px);
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--faint);
}
.mark {
  flex-shrink: 0;
  color: var(--color-accent);
  font-weight: 900;
  font-style: italic;
  font-size: 2.11rem;
  line-height: 1;
  letter-spacing: -0.03em;
}
.brand-text { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.brand .client { font-size: 1.05rem; font-weight: 600; line-height: 1.1; color: rgba(255, 255, 255, 0.95); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .product { font-size: 0.8125rem; line-height: 1; color: var(--quiet); }

.rail .group.first { padding-top: 30px; }
.group + .group { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--faint); }
.group .eyebrow { display: block; margin-bottom: 10px; }

.folder {
  display: block;
  width: calc(100% + 24px);
  margin: 0 -12px;
  padding: 10px 12px;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--quiet);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.folder:hover { color: var(--color-text-primary); }
.folder.active { color: var(--color-text-primary); background: rgba(255, 255, 255, 0.06); }
.folder .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.folder .name { display: inline-flex; align-items: center; gap: 6px; }
.folder .num { font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.folder .track { display: block; height: 2px; margin-top: 9px; border-radius: 1px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.folder .track i { display: block; height: 100%; background: var(--color-accent); opacity: 0.4; }
.folder.active .track i { opacity: 0.7; }
.folder.over .track i { background: var(--over); }
.folder.p-can { background: rgba(118, 170, 255, 0.12); color: var(--color-text-primary); }
.folder.p-cant { background: rgba(255, 158, 143, 0.08); }


/* ---------- list ---------- */

.list-pane { padding: 16px var(--pad-x) 96px 56px; overflow-y: auto; }
.list-head {
  /* Same box as .brand (top padding 16px + this height), so both headers share a center line and divider */
  height: calc(var(--head-h) - 16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.list-head h1 { font-size: 1.85rem; line-height: 1; font-weight: 600; font-style: normal; letter-spacing: -0.02em; color: rgba(255, 255, 255, 0.92); }
.head-rule { height: 1px; background: var(--faint); margin-bottom: 30px; }

/* Month pages: title sits where Backlog's does, capacity bar 16px below, then the same divider */
.list-head.month {
  --title-pad: calc((var(--head-h) - 16px - 1.85rem) / 2);
  height: auto;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 16px;
  padding: var(--title-pad) 0;
}
.title-row { display: flex; align-items: center; justify-content: space-between; }


.pb { --fill: var(--color-accent); font-variant-numeric: tabular-nums; }
.pb.is-over { --fill: var(--over); }
.pb-track { position: relative; height: 26px; border-radius: 8px; overflow: hidden; background: rgba(255, 255, 255, 0.08); }
.pb-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 8px;
  background: rgba(118, 170, 255, 0.28);
  transition: width var(--transition-base);
}
.pb.is-over .pb-fill { background: rgba(255, 140, 125, 0.28); }
.pb-label { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); font-size: 0.75rem; font-weight: 600; color: rgba(255, 255, 255, 0.9); }


.cards { position: relative; display: flex; flex-direction: column; gap: 12px; min-height: 160px; border-radius: var(--radius-lg); }

/* Item card */
.p-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  column-gap: 18px;
  row-gap: 0;
  padding: 18px 24px 18px 14px;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.p-card:hover { background: var(--card-hover); }
.p-card.selected { background: var(--card-hover); border-color: var(--color-border); }
.p-card { user-select: none; }
.p-card[data-movable="true"] { cursor: grab; }
.p-card.open { cursor: default; }
.p-expand { user-select: text; }
.p-title { font-size: 1rem; line-height: 1.4; }
.p-desc {
  margin-top: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--quiet);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.p-shipped { margin-top: 6px; font-size: 0.75rem; color: var(--ok); }
.p-card.shipped .p-title, .p-card.unsized .p-title { color: var(--quiet); }

/* The open section sits in its own row, so the type tile stays put when a card expands */
.p-card > .p-expand { grid-column: 2; }


.p-empty { color: var(--quiet); font-size: 0.85rem; }
.cards .p-empty { padding: 48px 0; text-align: center; }

/* ---------- expanded card ---------- */

.p-card.open { background: var(--card-hover); border-color: var(--color-border); cursor: default; }
.p-card.open .p-desc { -webkit-line-clamp: unset; color: rgba(255, 255, 255, 0.78); }

.p-expand {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 380ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 260ms ease;
}
.p-card.open .p-expand { grid-template-rows: 1fr; opacity: 1; transition-delay: 0s, 80ms; }
.p-expand-inner { min-height: 0; overflow: hidden; }
.p-expand section { padding-top: 22px; padding-bottom: 4px; }
.p-expand section:first-child { margin-top: 20px; border-top: 1px solid var(--faint); }

.comments { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 20px; }
.c-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.c-head .who { font-size: 0.85rem; font-weight: 600; color: rgba(255, 255, 255, 0.92); }
.c-head .when { font-size: 0.75rem; color: var(--quiet); white-space: nowrap; }
.c-body p { margin-top: 2px; font-size: 0.92rem; line-height: 1.6; color: rgba(255, 255, 255, 0.78); }

.c-form input {
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.c-form input:focus { border-color: var(--color-border); background: rgba(255, 255, 255, 0.06); }


input, textarea {
  font: inherit;
  color: var(--color-text-primary);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border);
  padding: 10px 0;
  width: 100%;
}
input::placeholder { color: var(--quiet); }
input:focus { outline: none; border-color: var(--color-accent); }

/* ---------- drag ---------- */

body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }

/* The card's place in the list while it's being moved */
.drag-slot {
  background: rgba(118, 170, 255, 0.04) !important;
  border: 1px dashed rgba(118, 170, 255, 0.35) !important;
}
.drag-slot > * { visibility: hidden; }

/* The floating copy that follows the pointer */
.drag-ghost {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  background: #0d1a36;
  border-color: var(--color-border);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: box-shadow 180ms ease;
}
.drag-ghost.landing { box-shadow: 0 0 0 rgba(0, 0, 0, 0); }
.drag-ghost.drop-away { opacity: 0; scale: 0.92; transition: opacity 160ms ease, scale 160ms ease; }

/* Collapse instantly when a drag starts */
.instant .p-expand { transition: none !important; }

/* ---------- mockup bar + toast ---------- */

.p-bar {
  display: flex;
  align-items: center;
  height: var(--bar-h);
  padding: 0 16px;
  background: #000;
  font-size: 0.72rem;
  color: #888;
}
.p-bar strong { color: #ffd479; font-weight: 700; }
.p-bar-spacer { flex: 1; }
.p-bar button { background: none; border: none; color: #888; cursor: pointer; padding: 0; }
.p-bar button:hover { color: #ddd; }

.p-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 1rem);
  opacity: 0;
  pointer-events: none;
  background: var(--color-text-primary);
  color: var(--color-primary);
  font-size: 0.85rem;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  z-index: 60;
  max-width: calc(100vw - 32px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.p-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */

@media (max-width: 700px) {
  :root { --pad-x: 16px; --head-h: 88px; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .rail { padding: 16px; }
}

/* ---------- editing (Kevin) ---------- */

[contenteditable] { outline: none; border-radius: 4px; transition: background var(--transition-fast), box-shadow var(--transition-fast); cursor: text; }
[contenteditable]:hover { background: rgba(255, 255, 255, 0.03); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.03); }
[contenteditable]:focus { background: rgba(255, 255, 255, 0.05); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05); }
.p-desc:empty { display: none; }
.p-card.open .p-desc[contenteditable]:empty { display: block; }
.p-desc[contenteditable]:empty::before { content: attr(data-placeholder); color: var(--quiet); opacity: 0.7; }

.admin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.p-expand .admin-row { margin-top: 20px; padding-top: 22px; border-top: 1px solid var(--faint); }
.p-expand .admin-row + section { margin-top: 0; border-top: none; }

.seg-toggle { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: rgba(255, 255, 255, 0.04); }
.seg-toggle button {
  font-size: 0.78rem;
  min-width: 34px;
  padding: 5px 11px;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--quiet);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.seg-toggle button:hover { color: var(--color-text-primary); }
.seg-toggle button.on { background: rgba(255, 255, 255, 0.1); color: var(--color-text-primary); }

.chip-btn {
  font-size: 0.78rem;
  padding: 7px 12px;
  border-radius: 9px;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--quiet);
  cursor: pointer;
}
.chip-btn:hover { color: var(--color-text-primary); }
.chip-btn.on { color: var(--ok); background: rgba(90, 210, 140, 0.12); }

.actions { display: flex; align-items: center; gap: 16px; }
.p-expand .actions { margin-top: 18px; }
.btn-primary {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-accent);
  background: transparent;
  color: var(--color-accent);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), opacity var(--transition-fast);
}
.btn-primary:hover { background: var(--color-accent); color: var(--color-primary); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; background: transparent; color: var(--color-accent); }
.btn-quiet { font-size: 0.85rem; padding: 0; border: none; background: none; color: var(--quiet); cursor: pointer; }
.btn-quiet:hover { color: var(--color-text-primary); }
.hint { font-size: 0.8rem; color: var(--quiet); }
.p-expand .hint { margin-top: 18px; }


/* ---------- requests ---------- */

.declined-note { color: #ffa597; }
/* Author and date only show on an open request */
.p-author { display: none; }
.p-card.open .p-author { display: inline; }
.p-card.open .p-author + .declined-note::before { content: ' · '; color: var(--quiet); }
.p-from:not(:has(.declined-note)) { display: none; }
.p-card.open .p-from { display: block; }
.p-from { margin-top: 8px; font-size: 0.75rem; color: var(--quiet); opacity: 0.8; }
.p-expand section.plain { margin-top: 0; padding-top: 18px; border-top: none; }
.p-card.req.declined { opacity: 0.6; cursor: default; }

/* New request: a card-styled button that expands into the editor */
.p-card.composer { display: block; padding: 0; cursor: default; }
.composer-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px 24px;
  border: none;
  background: none;
  font-size: 0.95rem;
  color: var(--color-accent);
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  max-height: 64px;
  transition: max-height 320ms cubic-bezier(0.2, 0.8, 0.2, 1), padding 320ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 180ms ease, color var(--transition-fast);
}
.composer-trigger .plus { font-size: 1.15rem; line-height: 1; }
.p-card.composer:not(.open):hover { background: var(--card-hover); border-color: var(--color-border); }
.p-card.composer:not(.open):hover .composer-trigger { color: var(--color-text-primary); }
.p-card.composer.open { background: var(--card-hover); border-color: var(--color-border); }
.composer.open .composer-trigger { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; pointer-events: none; }
.composer-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 18px;
  padding: 18px 24px 18px 14px;
}

.ghost-input {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.55;
  resize: none;
}
.ghost-input:focus { outline: none; }
.ghost-input.title { font-size: 1rem; color: var(--color-text-primary); margin-bottom: 8px; }
.composer .actions { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--faint); }

/* Mockup role switch */
.p-switch { display: inline-flex; align-items: center; gap: 4px; margin-left: 18px; color: #888; }
.p-switch button { padding: 2px 8px; border-radius: 4px; color: #888 !important; }
.p-switch button.on { background: #ffd479; color: #000 !important; }

.pts-input { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 12px; border-radius: 9px; background: rgba(255, 255, 255, 0.04); cursor: text; }
.pts-input:focus-within { background: rgba(255, 255, 255, 0.07); }
.pts-input input {
  width: 3ch;
  padding: 0;
  border: none;
  background: none;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
  color: var(--color-text-primary);
  -moz-appearance: textfield;
}
.pts-input input::-webkit-outer-spin-button, .pts-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pts-input input:focus { outline: none; }
.pts-input span { font-size: 0.72rem; color: var(--quiet); }

.actions-spacer { flex: 1; }
.p-expand section.actions.plain { margin-top: 18px; }
.btn-quiet:disabled { opacity: 0.35; cursor: default; color: var(--quiet); }

.btn-sm {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
}
.btn-sm.save { color: var(--color-accent); border-color: var(--color-accent); background: transparent; }
.btn-sm.save:hover:not(:disabled) { background: var(--color-accent); color: var(--color-primary); }
.btn-sm.save[hidden] { display: none; }
.btn-sm.save { animation: save-in 160ms ease; }
@keyframes save-in { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
.btn-sm.delete { color: #ffa597; border-color: rgba(255, 140, 125, 0.6); background: transparent; }
.btn-sm.delete:hover { background: rgba(255, 110, 95, 0.12); border-color: #ff9e8f; }
.btn-sm.delete.confirm { color: var(--color-primary); background: #ff9e8f; border-color: #ff9e8f; }

/* ---------- scrollbars ---------- */

* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.12) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 3px solid transparent;
  background: rgba(255, 255, 255, 0.1) padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22) padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }

/* ---------- type + points tile ---------- */

.p-card { --bug-fg: #ffa597; --bug-bg: rgba(255, 110, 95, 0.14); --feature-fg: #8ee6b0; --feature-bg: rgba(90, 210, 140, 0.14); --request-fg: var(--color-accent-light); --request-bg: rgba(118, 170, 255, 0.12); }
.type-tile.bug { --fg: var(--bug-fg); --bg: var(--bug-bg); }
.type-tile.feature { --fg: var(--feature-fg); --bg: var(--feature-bg); }
.type-tile.request, .type-tile.new { --fg: var(--request-fg); --bg: var(--request-bg); }

.type-tile {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 56px;
  height: 56px;
  border-radius: 13px;
  background: var(--bg);
  line-height: 1;
}
.type-tile strong { font-size: 1.3rem; font-weight: 600; color: var(--color-text-primary); font-variant-numeric: tabular-nums; }
.type-tile span { font-size: 0.68rem; font-weight: 600; color: var(--fg); }
.composer-body .type-tile { align-self: start; }

/* ---------- sign in ---------- */

.layout.signed-out { display: block; }
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-form { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 12px; }
.signin-form .mark { font-size: 2.11rem; margin-bottom: 4px; }
.signin-form h1 { font-size: 1.5rem; font-weight: 600; font-style: normal; margin-bottom: 18px; }
.signin-form input {
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
}
.signin-form input:focus { border-color: var(--color-border); background: rgba(255, 255, 255, 0.07); }
.signin-form .btn-primary { margin-top: 10px; padding: 12px; }
.signin-error { font-size: 0.85rem; color: #ffa597; }

/* ---------- sidebar footer + client switch ---------- */

.rail-foot { margin-top: auto; padding-top: 24px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 0.8rem; color: var(--quiet); }
.rail-foot .btn-quiet { font-size: 0.8rem; }
.client-switch { padding: 0; border: none; background: none; cursor: pointer; font: inherit; color: inherit; max-width: 100%; }
.client-switch:focus { outline: none; }
