/* Partner: the planning partner for ventures and builds (app/features/partner).
   Kid side: the Partner folder of the ledger desk. The chat is the main column; "What <name> sees" (the code-computed
   numbers the AI is allowed to use) and "On your list" sit beside it as two plates on the desk (above the chat,
   folded, on phones). Suggestions are dashed tickets (dashed = not yet); a taken one turns solid.
   Parent side: the office. Steel panels, ruled rows. Registered on every page (the dashboard panel), so every rule
   is scoped under .pt / .pt-*. Tokens only. */

.pt { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.pt-row-tight { display: inline-flex; align-items: center; gap: 8px; }
.pt-plain { white-space: pre-wrap; overflow-wrap: anywhere; }
.pt-hint { color: var(--ink-3); font-size: .85rem; line-height: 1.45; }

.pt-back {
  display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; min-height: 44px; max-width: 100%;
  padding-right: 8px; font-weight: 700; color: var(--ink-2); text-decoration: none;
}
.pt-back:hover { color: var(--ink); text-decoration: underline; }
.pt-back .icon { flex: none; }
.pt-back-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ the desk (chat page) */
.pt-top { display: flex; flex-direction: column; gap: 6px; }
.pt-top h1 { overflow-wrap: anywhere; }
.pt-who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: var(--ink-2); font-size: .95rem; }
.pt-who a { font-weight: 700; }

.pt-layout { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pt-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pt-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
@media (min-width: 1000px) {
  .pt-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "main side"; gap: 24px; align-items: start; }
  .pt-main { grid-area: main; }
  /* the desk stays beside a long chat; when it's taller than the window it scrolls on its own */
  .pt-side { grid-area: side; position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-bottom: 2px; }
}

.pt-transparency { display: flex; align-items: flex-start; gap: 8px; color: var(--ink-2); font-size: .95rem; }
.pt-transparency .icon { color: var(--blue); margin-top: 2px; }

/* the conversation */
.pt-chat { min-height: 120px; }
.pt-turn { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.pt .msg { overflow-wrap: anywhere; }
.pt .msg.me .msg-who { color: var(--blue-ink); }
.pt .msg.me a { color: var(--blue-ink); }
.pt-ai .msg-body ol, .pt-ai .msg-body ul { margin: .5em 0 0; padding-left: 1.3em; }
.pt-ai .msg-body li + li { margin-top: .3em; }
.pt-ai.is-offline { border-style: dashed; border-width: 1.5px; } /* the AI hasn't answered yet: dashed means not yet */
.pt-thinking { color: var(--ink-3); }
.pt-retry { margin-top: 10px; }

/* suggestions: tickets clipped under the reply */
.pt-props { display: flex; flex-direction: column; gap: 8px; width: min(100%, 64ch); }
.pt-props-wait { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: .9rem; }
.pt-props-wait .icon { color: var(--ink-3); }
.pt-skel { display: block; height: 52px; border-radius: var(--r); opacity: .7; }
.pt-prop {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r); background: var(--surface); border: 1.5px dashed var(--outline);
  transition: border-color .15s ease, background-color .15s ease;
}
.pt-prop.is-accepted { border-style: solid; border-color: var(--line); border-width: 1px; padding: 10.5px 12.5px; }
.pt-prop.is-gone { display: none; }
.pt-prop-icon { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.pt-prop.is-accepted .pt-prop-icon { background: var(--blue-soft); color: var(--blue); }
.pt-prop-text { display: grid; gap: 3px; min-width: 0; }
.pt-prop-kind { display: flex; flex-wrap: wrap; gap: 6px; }
.pt-prop-title { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.pt-prop-why { color: var(--ink-2); font-size: .9rem; line-height: 1.45; }
.pt-prop-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.pt-prop-done { font-weight: 700; color: var(--ink-2); font-size: .9rem; }
@media (max-width: 560px) {
  .pt-prop { grid-template-columns: auto minmax(0, 1fr); }
  .pt-prop-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* composer: sticky above the phone tab bar */
.pt-starters .chip { font-weight: 700; }
.pt-composer {
  position: sticky; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); z-index: 5;
  display: grid; gap: 8px; padding: 10px 0; background: var(--ground); border-top: 1px solid var(--line);
}
.pt-composer textarea { min-height: 52px; max-height: 40vh; resize: none; }
.pt-composer[data-busy="1"] textarea { background: var(--surface-2); }
.pt-composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pt-mode { min-height: 40px; padding: 6px 12px; font-size: .9rem; position: relative; }
.pt-mode .icon { width: 1.1em; height: 1.1em; }
.pt-mode:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.pt-mode:has(input:disabled) { opacity: .45; cursor: not-allowed; }
@media (min-width: 900px) { .pt-composer { bottom: 0; } }
@media (max-width: 380px) { .pt-send-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

/* the desk plates: what the partner sees + on your list */
.pt-fold { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.pt-fold > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 8px 14px;
  cursor: pointer; list-style: none; font-weight: 700; border-radius: var(--r-lg);
}
.pt-fold > summary::-webkit-details-marker { display: none; }
.pt-fold > summary:hover { background: var(--surface-2); }
.pt-fold-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.pt-fold-label .icon { color: var(--ink-2); }
.pt-fold-chev { color: var(--ink-3); transition: rotate .2s cubic-bezier(.16, 1, .3, 1); }
.pt-fold[open] > summary .pt-fold-chev { rotate: 180deg; }
.pt-fold-body { display: grid; gap: 10px; padding: 2px 14px 14px; }
.pt-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); font: 500 .75rem/1 var(--font-mono); }
.pt-sees-title { line-height: 1.3; overflow-wrap: anywhere; }
.pt-sees-summary { color: var(--ink-2); font-size: .92rem; line-height: 1.5; }
.pt-numbers { margin: 0; display: grid; }
.pt-num-row { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 6px 0; border-top: 1px solid var(--line); min-width: 0; }
.pt-num-row:last-child { border-bottom: 1px solid var(--line); }
.pt-num-row dt { flex: 1 1 auto; color: var(--ink-2); font-size: .9rem; min-width: 0; overflow-wrap: anywhere; }
.pt-num-row dd { flex: 0 1 auto; margin: 0; font-size: .9rem; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.pt-num-row.is-long { flex-direction: column; align-items: stretch; }
.pt-num-row.is-long dd { text-align: left; color: var(--ink); line-height: 1.4; }
.pt-more > summary { display: flex; align-items: center; gap: 6px; min-height: 40px; cursor: pointer; list-style: none; font-weight: 700; font-size: .9rem; color: var(--blue); }
.pt-more > summary::-webkit-details-marker { display: none; }
.pt-more[open] > summary .pt-fold-chev { rotate: 180deg; }
.pt-codes { display: flex; flex-wrap: wrap; gap: 6px; }

.pt-list { list-style: none; margin: 0; padding: 0; display: grid; }
.pt-item { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line); }
.pt-item:first-child { border-top: 0; padding-top: 0; }
.pt-item-icon { width: 28px; height: 28px; display: grid; place-items: center; color: var(--blue); }
.pt-item-text { display: grid; gap: 2px; min-width: 0; }
.pt-item-title { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.pt-item-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .85rem; color: var(--ink-3); }
a.pt-item-meta { color: var(--blue); font-weight: 700; }
.pt-item.is-done .pt-item-title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--paint); text-decoration-thickness: 3px; }
.pt-check {
  width: 28px; height: 28px; display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 1.5px solid var(--outline); border-radius: var(--r-sm); background: var(--surface); color: transparent;
  transition: background-color .15s ease, border-color .15s ease;
}
.pt-check:hover { border-color: var(--blue); }
.pt-check[aria-pressed="true"] { background: var(--paint); border-color: var(--paint); color: var(--paint-ink); }
.pt-check .icon { width: 18px; height: 18px; }
@media (pointer: coarse) { .pt-check { width: 44px; height: 44px; } .pt-item-icon { width: 44px; } }

/* ------------------------------------------------------------------ picking the partner */
.pt-pick { max-width: 760px; }
.pt-pick-head { display: grid; gap: 8px; }
.pt-lede { color: var(--ink-2); max-width: 60ch; }
.pt-pick-form { display: grid; gap: 22px; }
.pt-plate { display: grid; place-items: center; min-height: 128px; padding: 22px 16px; }
.pt-plate-tape {
  display: inline-block; max-width: 100%; padding: 8px 18px 9px; border-radius: var(--r-sm);
  background: var(--label-tape); color: var(--label-ink); box-shadow: var(--shadow-hung);
  font: 500 clamp(1.3rem, 1rem + 2vw, 1.9rem)/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase;
  overflow-wrap: anywhere; text-align: center;
}
.pt-name-field { max-width: 420px; }
.pt-styles-set { display: grid; gap: 10px; }
.pt-styles { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .pt-styles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pt-style {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px;
  align-content: start; padding: 14px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
@media (min-width: 720px) { .pt-style { grid-template-columns: 1fr; } }
.pt-style input { position: absolute; opacity: 0; pointer-events: none; }
.pt-style:hover { border-color: var(--ink-3); }
.pt-style:active { transform: translateY(1px); }
.pt-style:has(input:checked) { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); background: var(--blue-soft); }
.pt-style:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.pt-style-icon { width: 44px; height: 44px; border-radius: var(--r); display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.pt-style:has(input:checked) .pt-style-icon { background: var(--blue); color: var(--blue-ink); }
.pt-style-icon .icon { width: 24px; height: 24px; }
.pt-style-text { display: grid; gap: 4px; min-width: 0; }
.pt-style-blurb { color: var(--ink-2); font-size: .92rem; }
.pt-style-sample { color: var(--ink-2); font-size: .9rem; line-height: 1.45; padding-top: 6px; border-top: 1px dashed var(--line); }
.pt-pick-go { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ------------------------------------------------------------------ parent office */
.pt-office { gap: 24px; }
.pt-office-head { display: grid; gap: 8px; }
.pt-panel-title { margin-bottom: 8px; }
.pt-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pt-ledger { list-style: none; margin: 0; padding: 0; display: grid; }
.pt-ledger-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 12px 10px; border-top: 1px solid var(--line); }
.pt-ledger-row:first-child { border-top: 0; }
.pt-ledger-row.is-current { background: var(--blue-soft); border-radius: var(--r); }
.pt-ledger-main { display: grid; gap: 2px; min-width: 0; }
.pt-ledger-main a { overflow-wrap: anywhere; }
.pt-ledger-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.pt-panel-link { justify-self: start; }
.pt-transcript .msg { max-width: min(92%, 58ch); }
.pt-time { font: 500 .72rem var(--font-mono); }
.pt-flag { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; font-size: .85rem; color: var(--warn); }
.pt .msg.me .pt-flag { color: var(--blue-ink); }
.pt-guarded { margin-top: 8px; font-size: .9rem; }
.pt-guarded summary { cursor: pointer; font-weight: 700; color: var(--ink-2); min-height: 32px; }
.pt-tprops { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--line); display: grid; gap: 6px; font-size: .9rem; }
.pt-tprops li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
