/* Piko web UI. Tokens follow Documentation/DESIGN_SYSTEM.md (Canvas / Surface / Elevated / Ink /
   OnInk / Line; motion roles enter / exit / hover / layout / navigation). Three forms mirror the
   native clients: data-form="desk" (Mac), "pad" (iPad), "phone" (iPhone). */
.pk-root {
  --canvas: #f5f5f3; --surface: #fcfcfb; --elevated: #efefed; --ink: #111111; --on-ink: #ffffff;
  --line: #e5e5ea; --secondary: rgba(60, 60, 67, .62); --tertiary: rgba(60, 60, 67, .34);
  --page: #ffffff; --side: #f5f5f3; --float: #ffffff; --danger: #d70015; --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 6px 24px rgba(0, 0, 0, .07);
  --shadow-float: 0 2px 6px rgba(0, 0, 0, .06), 0 14px 40px rgba(0, 0, 0, .14);
  --enter: .32s cubic-bezier(.16, 1, .3, 1); --exit: .18s cubic-bezier(.4, 0, 1, 1);
  --hover: .15s ease-out; --layout: .24s cubic-bezier(.3, .7, .3, 1); --nav: .34s cubic-bezier(.3, .7, .3, 1);
  --drawer: .4s cubic-bezier(.22, .95, .32, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "PingFang TC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --base: 13px; --chat: 14px; --tap: 30px; --side-w: 224px; --col: 680px; --head: 52px; --pad: 24px;
  position: absolute; inset: 0; display: flex; overflow: hidden; color: var(--ink); background: var(--page);
  font: var(--base)/1.45 var(--font); -webkit-font-smoothing: antialiased; color-scheme: light;
  -webkit-tap-highlight-color: transparent;
}
@media (prefers-color-scheme: dark) { .pk-root:not([data-theme="light"]) {
  --canvas: #0b0b0a; --surface: #151515; --elevated: #1a1a19; --ink: #f4f4f4; --on-ink: #111111;
  --line: #3a3a3c; --secondary: rgba(235, 235, 245, .62); --tertiary: rgba(235, 235, 245, .3);
  --page: #0b0b0a; --side: #151515; --float: #20201e; --danger: #ff453a; --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23111111' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .35);
  --shadow-float: 0 2px 6px rgba(0, 0, 0, .4), 0 14px 40px rgba(0, 0, 0, .55); color-scheme: dark; } }
.pk-root[data-theme="dark"] {
  --canvas: #0b0b0a; --surface: #151515; --elevated: #1a1a19; --ink: #f4f4f4; --on-ink: #111111;
  --line: #3a3a3c; --secondary: rgba(235, 235, 245, .62); --tertiary: rgba(235, 235, 245, .3);
  --page: #0b0b0a; --side: #151515; --float: #20201e; --danger: #ff453a; --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23111111' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .35);
  --shadow-float: 0 2px 6px rgba(0, 0, 0, .4), 0 14px 40px rgba(0, 0, 0, .55); color-scheme: dark;
}
.pk-root[data-form="pad"] { --base: 17px; --chat: 17px; --tap: 44px; --side-w: 320px; --col: 720px; --head: 64px; --pad: 28px; }
.pk-root[data-form="phone"] { --base: 17px; --chat: 17px; --tap: 44px; --side-w: min(84vw, 340px); --col: 100%; --head: 68px; --pad: 16px; }

.pk-root *, .pk-root *::before, .pk-root *::after { box-sizing: border-box; }
.pk-root button, .pk-root input, .pk-root textarea { font: inherit; color: inherit; }
.pk-root button { background: none; border: 0; padding: 0; cursor: pointer; }
.pk-root [hidden] { display: none !important; }
.pk-root :focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
.pk-icon { width: 1.25em; height: 1.25em; flex: none; display: block; }
.pk-root[data-form="desk"] .pk-icon { width: 16px; height: 16px; }
.pk-avatar { flex: none; display: block; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .12)); }
.pk-avatar-face { fill: #ffffff; } .pk-avatar-depth { fill: #e4e4e2; }

/* Buttons: every tap target is at least --tap, plus 6px of slack through padding on touch. */
.pk-iconbtn { width: var(--tap); height: var(--tap); display: inline-grid; place-items: center; border-radius: 50%; flex: none;
  color: var(--ink); transition: background var(--hover), transform .1s ease-out, opacity var(--hover); }
.pk-iconbtn:disabled { opacity: .45; cursor: default; }
@media (hover: hover) { .pk-iconbtn:not(:disabled):hover { background: var(--elevated); } }
.pk-iconbtn:not(:disabled):active { transform: scale(.92); }
.pk-round { background: var(--float); box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.pk-root[data-form="desk"] .pk-round { width: 36px; height: 36px; box-shadow: 0 0 0 1px var(--line); }
.pk-icon-in { animation: pk-icon-in .32s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes pk-icon-in { from { transform: scale(.5); opacity: 0; } }

/* ---- Sidebar ---------------------------------------------------------------------------- */
.pk-sidebar { width: var(--side-w); flex: none; display: flex; flex-direction: column; gap: 2px; background: var(--side);
  padding: 10px 10px 10px; border-right: 1px solid var(--line); transition: margin-left var(--nav), transform var(--drawer); z-index: 3; }
.pk-root[data-sidebar="closed"]:not([data-form="phone"]) .pk-sidebar { margin-left: calc(-1 * var(--side-w)); }
.pk-side-head { display: flex; align-items: center; justify-content: space-between; min-height: var(--tap); margin-bottom: 4px; }
.pk-side-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.08em; padding: 6px 8px; border-radius: 10px; min-height: var(--tap); }
.pk-side-brand .pk-icon { width: 12px; height: 12px; color: var(--secondary); margin-left: 2px; }
.pk-side-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--tap); padding: 0 10px; border-radius: 8px;
  text-align: left; cursor: pointer; transition: background var(--hover); position: relative; }
.pk-root:not([data-form="desk"]) .pk-side-row { border-radius: 12px; padding: 0 12px; }
@media (hover: hover) { .pk-side-row:hover, .pk-side-brand:hover { background: var(--elevated); } }
.pk-side-row:active { background: var(--elevated); }
.pk-selected { background: var(--elevated); font-weight: 600; }
.pk-search { display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 10px; margin: 4px 0 6px; border-radius: 8px;
  background: var(--elevated); color: var(--secondary); }
.pk-root:not([data-form="desk"]) .pk-search { border-radius: 12px; }
.pk-search-input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); padding: 0; }
.pk-search-input::placeholder, .pk-input::placeholder, .pk-field::placeholder { color: var(--tertiary); }
.pk-search-input::-webkit-search-cancel-button { display: none; }
.pk-side-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; overscroll-behavior: contain; }
.pk-side-label { font-size: .85em; color: var(--secondary); padding: 12px 10px 4px; }
.pk-side-note { font-size: .85em; color: var(--secondary); padding: 8px 10px; }
.pk-row-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-row-more { width: 24px; height: 24px; opacity: 0; margin-right: -4px; }
.pk-chat-row:hover .pk-row-more, .pk-row-more:focus-visible { opacity: 1; }
.pk-root:not([data-form="desk"]) .pk-row-more { display: none; }
.pk-side-foot { padding-top: 6px; }
.pk-side-collapse { color: var(--secondary); }
.pk-root[data-form="phone"] .pk-side-collapse { display: none; }

/* Phone: the sidebar is a drawer over the chat. */
.pk-root[data-form="phone"] .pk-sidebar { position: absolute; inset: 0 auto 0 0; transform: translateX(-102%); border-right: 0;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); box-shadow: none; }
.pk-root[data-form="phone"][data-drawer="open"] .pk-sidebar { transform: none; box-shadow: var(--shadow-float); }
.pk-drawer-scrim { display: none; }
.pk-root[data-form="phone"] .pk-drawer-scrim { display: block; position: absolute; inset: 0; background: rgba(0, 0, 0, .28); opacity: 0;
  pointer-events: none; transition: opacity var(--drawer); z-index: 2; }
.pk-root[data-form="phone"][data-drawer="open"] .pk-drawer-scrim { opacity: 1; pointer-events: auto; }

/* ---- Main, header ------------------------------------------------------------------------ */
.pk-main { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; background: var(--page); }
.pk-head { position: absolute; inset: 0 0 auto 0; height: var(--head); display: flex; align-items: center; gap: 10px; padding: 0 var(--pad);
  z-index: 1; background: color-mix(in srgb, var(--page) 76%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px); }
.pk-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.04em; }
.pk-head-id { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.pk-head-tools { display: flex; align-items: center; gap: 6px; }
.pk-head-menu { display: none; }
.pk-root[data-sidebar="closed"] .pk-head-menu { display: inline-grid; box-shadow: none; background: none; }
.pk-root[data-form="phone"] .pk-head-menu { display: inline-grid; }
.pk-head-new { display: none; }
.pk-root[data-sidebar="closed"]:not([data-form="phone"]) .pk-head-new { display: inline-grid; }
/* iPhone header: round menu button, Piko centered, round more button. */
.pk-root[data-form="phone"] .pk-head { padding-top: env(safe-area-inset-top); height: calc(var(--head) + env(safe-area-inset-top)); }
.pk-root[data-form="phone"] .pk-title, .pk-root[data-form="phone"] .pk-head-edit { display: none; }
.pk-root[data-form="phone"] .pk-head-id { position: absolute; left: 50%; transform: translateX(-50%); font-size: 1.02em; }
.pk-root[data-form="phone"] .pk-head-tools { margin-left: auto; }
.pk-root[data-form="phone"][data-chat="none"] .pk-head-new { display: inline-grid; }

/* ---- Chat column ------------------------------------------------------------------------- */
.pk-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
/* ReplyStoppedNoticePresentation: a capsule above the composer (44pt hit area), rising in from 0.96 / 4pt. */
.pk-stopped-slot { display: flex; justify-content: center; padding: 0 12px; }
.pk-stopped-slot:empty { display: none; }
.pk-root .pk-stopped { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; background: none; color: var(--ink); font-size: .85em; }
.pk-stopped > .pk-icon { width: 13px; height: 13px; color: var(--secondary); }
.pk-stopped > span, .pk-stopped > .pk-icon { position: relative; }
.pk-stopped { position: relative; isolation: isolate; animation: pk-stopped-in var(--layout) both; }
.pk-stopped::after { content: ''; position: absolute; inset: 7px 0; z-index: -1; border-radius: 999px; background: color-mix(in srgb, var(--float) 86%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 0 0 .5px var(--line), 0 2px 6px rgba(0, 0, 0, .08); }
.pk-stopped.pk-stopped-leaving { animation: pk-stopped-out .18s ease-in both; }
@keyframes pk-stopped-in { from { opacity: 0; transform: translateY(4px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pk-stopped-out { to { opacity: 0; transform: translateY(4px) scale(.96); } }
@media (prefers-reduced-motion: reduce) { .pk-stopped { animation: pk-fade-in .15s both; } .pk-stopped.pk-stopped-leaving { animation: none; opacity: 0; } }
@media (prefers-reduced-transparency: reduce) { .pk-stopped::after { background: var(--elevated); backdrop-filter: none; box-shadow: 0 0 0 .5px var(--line); } }
/* ChatAttachmentDropZone: dashed hint over the whole chat while files are dragged over it. */
.pk-drop { position: absolute; inset: 12px; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px;
  border-radius: 18px; border: 2px dashed var(--line); background: color-mix(in srgb, var(--elevated) 95%, transparent); color: var(--ink); pointer-events: none;
  text-align: center; animation: pk-fade-in var(--hover) both; }
.pk-drop[hidden] { display: none; }
.pk-drop .pk-icon { width: 32px; height: 32px; margin-bottom: 4px; }
.pk-drop-title { font-size: 1.15em; font-weight: 500; }
.pk-drop-text { color: var(--secondary); }
@keyframes pk-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pk-drop { animation: none; } }
.pk-scroll { flex: 1; overflow-y: auto; padding: calc(var(--head) + env(safe-area-inset-top, 0px) + 8px) var(--pad) 12px; overscroll-behavior: contain; scrollbar-gutter: stable both-edges; }
.pk-root[data-form="phone"] .pk-scroll { scrollbar-gutter: auto; }
.pk-column { max-width: var(--col); margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.pk-messages { display: flex; flex-direction: column; gap: 18px; font-size: var(--chat); line-height: 1.6; }
.pk-msg { display: flex; flex-direction: column; gap: 4px; min-width: 0; animation: pk-rise var(--enter) both; }
@keyframes pk-rise { from { opacity: 0; transform: translateY(8px); } }
.pk-msg-user { align-items: flex-end; }
.pk-bubble { max-width: min(78%, 560px); background: var(--ink); color: var(--on-ink); padding: .5em 1em; border-radius: 1.35em;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.pk-msg-files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pk-actions { display: flex; align-items: center; gap: 2px; height: 26px; margin-bottom: -20px; opacity: 0; transition: opacity var(--hover); color: var(--secondary); }
.pk-actions .pk-iconbtn { width: 26px; height: 26px; color: var(--secondary); }
.pk-actions .pk-icon { width: 15px; height: 15px; }
.pk-msg:hover .pk-actions, .pk-actions:focus-within, .pk-actions-shown { opacity: 1; }
.pk-msg-piko .pk-actions { margin-left: -5px; }
.pk-msg:last-child .pk-actions, .pk-actions-shown { margin-bottom: 0; }
/* Touch clients use press-and-hold instead of a hover row. */
.pk-root:not([data-form="desk"]) .pk-actions:not(.pk-actions-shown) { display: none; }
.pk-pager { display: inline-flex; align-items: center; gap: 2px; font-size: .82em; font-variant-numeric: tabular-nums; }
.pk-queued .pk-bubble { opacity: .5; }
.pk-queued-label { font-size: .8em; }

/* Markdown */
.pk-prose { overflow-wrap: anywhere; min-width: 0; }
.pk-prose > :first-child { margin-top: 0; } .pk-prose > :last-child { margin-bottom: 0; }
.pk-prose p, .pk-prose ul, .pk-prose ol, .pk-prose blockquote, .pk-prose .pk-code, .pk-prose .pk-table { margin: 0 0 .75em; }
.pk-prose h1, .pk-prose h2, .pk-prose h3, .pk-prose h4 { margin: 1.1em 0 .45em; line-height: 1.3; font-weight: 650; }
.pk-prose h1 { font-size: 1.35em; } .pk-prose h2 { font-size: 1.2em; } .pk-prose h3 { font-size: 1.08em; } .pk-prose h4 { font-size: 1em; }
.pk-prose ul, .pk-prose ol { padding-left: 1.4em; } .pk-prose li { margin: .2em 0; } .pk-prose li > p { margin: 0; }
.pk-prose a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.pk-prose blockquote { padding-left: .9em; border-left: 3px solid var(--line); color: var(--secondary); }
.pk-prose hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.pk-prose code { font: .9em var(--mono); background: var(--elevated); padding: .12em .36em; border-radius: 5px; }
.pk-code { background: var(--elevated); border-radius: 12px; overflow: hidden; }
.pk-code-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 0 12px; font: .78em var(--mono); color: var(--secondary); min-height: 30px; }
.pk-code-copy { width: 28px; height: 28px; color: var(--secondary); } .pk-code-copy .pk-icon { width: 15px; height: 15px; }
.pk-code pre { margin: 0; padding: 4px 14px 12px; overflow-x: auto; }
.pk-code pre code { background: none; padding: 0; font-size: .88em; line-height: 1.55; }
.pk-table { overflow-x: auto; }
.pk-prose table { border-collapse: collapse; font-size: .94em; }
.pk-prose th, .pk-prose td { padding: .45em .8em; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.pk-prose th { font-weight: 600; white-space: nowrap; }
.pk-prose input[type="checkbox"] { margin-right: .4em; }

/* Live reply: status line (never a bare spinner), rough thinking, steps. Fixed heights so the
   thinking animation does not shift the layout. */
.pk-status { display: flex; align-items: center; gap: 8px; height: 1.6em; color: var(--secondary); }
.pk-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); animation: pk-breathe 1.2s ease-in-out infinite; }
@keyframes pk-breathe { 0%, 100% { transform: scale(.55); opacity: .35; } 50% { transform: scale(1); opacity: 1; } }
.pk-status-text { background: linear-gradient(90deg, var(--secondary) 0%, var(--ink) 50%, var(--secondary) 100%) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: pk-shimmer 1.8s linear infinite; }
@keyframes pk-shimmer { to { background-position: -200% 0; } }
.pk-thoughts { max-height: 4.8em; overflow: hidden; color: var(--secondary); font-size: .88em; line-height: 1.6; white-space: pre-wrap;
  padding-left: 12px; border-left: 2px solid var(--line); -webkit-mask-image: linear-gradient(transparent, #000 .8em); mask-image: linear-gradient(transparent, #000 .8em); }
.pk-steps { display: flex; flex-direction: column; gap: 4px; }
.pk-step { display: flex; align-items: center; gap: 8px; color: var(--secondary); font-size: .9em; animation: pk-rise var(--enter) both; }
.pk-step .pk-icon { width: 15px; height: 15px; }
.pk-step-running { color: var(--ink); }
.pk-step-failed { color: var(--danger); }
.pk-step span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-error-text { display: flex; align-items: center; gap: 8px; color: var(--danger); }
.pk-error-row { display: flex; align-items: center; gap: 6px; }
.pk-errcode { font: .78em var(--mono); color: var(--secondary); background: var(--elevated); padding: 4px 8px; border-radius: 6px; user-select: all; }

.pk-jump { position: absolute; left: 50%; bottom: calc(var(--composer-h, 76px) + 12px); margin-left: calc(var(--tap) / -2); background: var(--float);
  box-shadow: 0 0 0 1px var(--line), var(--shadow); z-index: 1; animation: pk-pop .4s cubic-bezier(.3, 1.25, .5, 1) both; }
@keyframes pk-pop { from { opacity: 0; transform: translateY(14px) scale(.94); } }
.pk-root[data-form="desk"] .pk-jump { width: 34px; height: 34px; margin-left: -17px; }

/* ---- Composer ---------------------------------------------------------------------------- */
.pk-composer-wrap { padding: 0 var(--pad) max(14px, env(safe-area-inset-bottom)); }
.pk-composer { max-width: var(--col); margin: 0 auto; background: var(--float); border-radius: 24px; box-shadow: 0 0 0 1px var(--line), var(--shadow);
  padding: 6px; display: flex; flex-direction: column; gap: 4px; transition: box-shadow var(--hover); }
.pk-root[data-form="desk"] .pk-composer { border-radius: 20px; padding: 5px; }
.pk-composer-row { display: flex; align-items: flex-end; gap: 4px; }
.pk-input { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: none; padding: calc((var(--tap) - 1.45em) / 2) 4px; max-height: 200px;
  line-height: 1.45; font-size: var(--chat); }
.pk-root .pk-input:focus-visible, .pk-root .pk-search-input:focus-visible { outline: 0; }
.pk-send { width: var(--tap); height: var(--tap); flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--ink); color: var(--on-ink);
  transition: opacity var(--hover), transform .1s ease-out, background var(--hover); }
.pk-root:not([data-form="desk"]) .pk-send { border-radius: 14px; }
.pk-root .pk-send { background: var(--ink); color: var(--on-ink); }
.pk-send:disabled { opacity: .32; cursor: default; }
.pk-send:not(:disabled):active { transform: scale(.92); }
.pk-send .pk-icon { stroke-width: 2.2; }
.pk-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 4px 0; }
.pk-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; height: 30px; padding: 0 4px 0 10px; border-radius: 10px; background: var(--elevated);
  font-size: .82em; color: var(--ink); animation: pk-rise var(--enter) both; }
.pk-msg-files .pk-chip { padding-right: 10px; }
.pk-chip .pk-icon { width: 14px; height: 14px; color: var(--secondary); }
.pk-chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-chip-x { width: 22px; height: 22px; } .pk-chip-x .pk-icon { width: 12px; height: 12px; }
.pk-chip-busy { opacity: .55; }
.pk-accessory { padding: 4px 4px 0; }

/* ---- Floating: menu, sheet, toast --------------------------------------------------------- */
.pk-layer { position: absolute; inset: 0; z-index: 20; }
.pk-scrim { background: rgba(0, 0, 0, .28); display: grid; place-items: center; animation: pk-fade .18s ease-out both; }
.pk-scrim.pk-leaving { animation: pk-fade-out .18s ease-in both; }
@keyframes pk-fade { from { opacity: 0; } } @keyframes pk-fade-out { to { opacity: 0; } }
.pk-menu { position: absolute; min-width: 180px; padding: 5px; border-radius: 12px; background: var(--float); box-shadow: 0 0 0 1px var(--line), var(--shadow-float);
  animation: pk-menu-in var(--enter) both; }
.pk-menu.pk-leaving { animation: pk-menu-out var(--exit) both; }
@keyframes pk-menu-in { from { opacity: 0; transform: scale(.94); } } @keyframes pk-menu-out { to { opacity: 0; transform: scale(.97); } }
.pk-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 8px; text-align: left; }
@media (hover: hover) { .pk-menu-item:hover { background: var(--elevated); } }
.pk-menu-item:focus-visible { background: var(--elevated); outline: 0; }
.pk-danger { color: var(--danger); }
.pk-sheet { width: min(440px, calc(100% - 32px)); max-height: calc(100% - 48px); overflow-y: auto; background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-float); animation: pk-sheet-in var(--enter) both; }
.pk-sheet.pk-leaving { animation: pk-menu-out var(--exit) both; }
@keyframes pk-sheet-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
/* PikoZoomTransition: a sheet opened from a card animates from that card (overlay.js), not with the usual entrance. */
.pk-root .pk-sheet.pk-zoom, .pk-root[data-form="phone"] .pk-sheet.pk-zoom { animation: none; }
.pk-sheet.pk-zooming { overflow: hidden; will-change: transform, opacity; }
.pk-root[data-form="phone"] .pk-scrim { place-items: end center; }
.pk-root[data-form="phone"] .pk-sheet { width: 100%; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); animation-name: pk-sheet-up; }
.pk-root[data-form="phone"] .pk-sheet.pk-leaving { animation-name: pk-sheet-down; }
@keyframes pk-sheet-up { from { transform: translateY(100%); } } @keyframes pk-sheet-down { to { transform: translateY(100%); } }
.pk-sheet-body { padding: 10px 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.pk-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pk-sheet-head h2 { margin: 0; font-size: 1.05em; font-weight: 600; }
.pk-head-spacer { width: var(--tap); }
.pk-confirm { background: var(--ink); color: var(--on-ink); }
.pk-root .pk-confirm:hover { background: var(--ink); opacity: .86; }
.pk-sheet-text { margin: 0 4px; color: var(--secondary); }
.pk-group { background: var(--elevated); border-radius: 14px; overflow: hidden; }
.pk-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: max(40px, var(--tap)); padding: 6px 14px; width: 100%; }
.pk-row + .pk-row { border-top: 1px solid var(--line); }
.pk-row-value { color: var(--secondary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-root .pk-row-button, .pk-row-button { text-align: left; padding: 6px 14px; box-sizing: border-box; }
.pk-segment { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--canvas); gap: 2px; }
.pk-segment button { padding: 4px 10px; border-radius: 7px; font-size: .88em; min-height: 28px; transition: background var(--layout), color var(--layout); color: var(--secondary); }
.pk-segment .pk-on { background: var(--float); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.pk-toast { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--on-ink); padding: 8px 14px;
  border-radius: 999px; font-size: .9em; box-shadow: var(--shadow-float); animation: pk-toast-in .4s cubic-bezier(.3, 1.25, .5, 1) both; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
.pk-toast.pk-leaving { animation: pk-toast-out .18s ease-in both; }
@keyframes pk-toast-in { from { opacity: 0; transform: translate(-50%, 14px) scale(.94); } } @keyframes pk-toast-out { to { opacity: 0; transform: translate(-50%, 6px); } }

/* ---- Sign-in ----------------------------------------------------------------------------- */
.pk-login { flex: 1; display: grid; place-items: center; padding: 24px; background: var(--canvas); overflow-y: auto; }
.pk-login-card { width: min(360px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; animation: pk-rise var(--enter) both; }
.pk-login-title { margin: 0 0 6px; font-size: 26px; font-weight: 650; letter-spacing: -.01em; }
.pk-login-form { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.pk-field { width: 100%; height: 46px; padding: 0 14px; border: 0; outline: 0; border-radius: 14px; background: var(--elevated); font-size: 16px; }
.pk-root[data-form="desk"] .pk-sheet .pk-field { height: 38px; font-size: 14px; border-radius: 10px; }
.pk-field:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; border-radius: 14px; }
.pk-primary { height: 46px; border-radius: 14px; background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: 16px; transition: opacity var(--hover), transform .1s ease-out; }
.pk-root .pk-primary { background: var(--ink); color: var(--on-ink); }
/* 你的 BOT footer (ProfileSettingsView.pikoPageFooter): status line over a full-width primary save. */
.pk-profile-foot { display: grid; gap: 8px; padding: 12px 14px 14px; }
.pk-profile-foot .pk-save-note { margin: 0; min-height: 1.4em; font-size: .9em; color: var(--secondary); text-align: center; }
.pk-profile-foot .pk-save-note:empty { min-height: 0; }
.pk-root .pk-profile-save { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.pk-profile-save .pk-icon { width: 20px; height: 20px; }
.pk-primary:disabled { opacity: .45; } .pk-primary:not(:disabled):active { transform: scale(.98); }
.pk-root .pk-destructive { background: var(--danger); color: #fff; }
.pk-login-error { color: var(--danger); font-size: 14px; padding: 0 4px; }
.pk-link { color: var(--secondary); font-size: 14px; text-decoration: underline; text-underline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .pk-root *, .pk-root *::before, .pk-root *::after { animation-duration: .12s !important; transition-duration: .12s !important; animation-iteration-count: 1 !important; }
  .pk-msg, .pk-step, .pk-chip, .pk-jump, .pk-menu, .pk-sheet, .pk-toast, .pk-login-card { animation-name: pk-fade !important; }
}

/* ---- sign-in, matching the native account card ---------------------------------------------- */
.pk-login-card { width: min(400px, 100%); gap: 12px; }
.pk-login-title { margin: 4px 0 0; font-size: 22px; font-weight: 600; letter-spacing: 0; text-align: center; }
.pk-login-sub { margin: 0 0 12px; color: var(--secondary); font-size: 15px; text-align: center; }
.pk-login-form { gap: 14px; }
.pk-form-field { display: flex; flex-direction: column; gap: 6px; }
.pk-form-label { font-size: 13px; color: var(--secondary); padding: 0 4px; }
.pk-secondary { color: var(--secondary); }
.pk-forgot { align-self: flex-end; min-height: var(--tap); margin: -10px 0 -8px; padding: 0 4px; color: var(--ink); }
.pk-consent { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 14px; min-height: var(--tap); border-radius: 10px; transition: background var(--hover); }
.pk-consent .pk-link { color: var(--ink); }
.pk-consent-check { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); cursor: pointer; }
.pk-check { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 0; flex: none; border-radius: 6px; border: 1.5px solid var(--tertiary); background: transparent; cursor: pointer;
  transition: background var(--hover), border-color var(--hover); }
.pk-check:checked { border-color: var(--ink); background: var(--ink) center / 14px no-repeat; background-image: var(--check-mark); }
.pk-check:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pk-consent.pk-attention .pk-check { border-color: var(--danger); }
.pk-primary[data-dim="true"]:not(:disabled) { opacity: .45; }
.pk-login-switch { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: 15px; }
.pk-login-switch .pk-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.pk-login-foot { margin-top: 6px; font-size: 13px; color: var(--secondary); }
.pk-login-foot strong { color: var(--ink); font-weight: 600; letter-spacing: .02em; }
.pk-login-error, .pk-login-note { font-size: 14px; padding: 10px 12px; border-radius: 12px; background: var(--elevated); }
.pk-login-note[data-bad="true"] { color: var(--danger); }
.pk-sheet-text { margin: 0; font-size: 14px; }

/* ---- sidebar: Mac keeps tools on top; iPhone and iPad follow the native drawer ---------------- */
.pk-side-tools { display: flex; flex-direction: column; gap: 2px; }
.pk-side-gear, .pk-side-compose { display: none; }
.pk-root:not([data-form="desk"]) .pk-side-tools { order: 9; flex-direction: row; align-items: center; gap: 10px; padding-top: 10px; }
.pk-root:not([data-form="desk"]) .pk-side-new, .pk-root:not([data-form="desk"]) .pk-side-foot, .pk-root:not([data-form="desk"]) .pk-side-collapse { display: none; }
.pk-root:not([data-form="desk"]) .pk-search { flex: 1; margin: 0; min-height: 48px; padding: 0 16px; border-radius: 999px; }
.pk-root:not([data-form="desk"]) .pk-side-compose { display: grid; width: 48px; height: 48px; flex: none; }
.pk-root:not([data-form="desk"]) .pk-side-gear { display: grid; width: var(--tap); height: var(--tap); border-radius: 12px; background: var(--elevated); }
.pk-root:not([data-form="desk"]) .pk-side-brand { font-size: 26px; font-weight: 700; padding: 6px 4px; pointer-events: none; }
.pk-root:not([data-form="desk"]) .pk-side-brand .pk-avatar, .pk-root:not([data-form="desk"]) .pk-side-brand .pk-icon { display: none; }
.pk-root:not([data-form="desk"]) .pk-side-head { margin: 6px 0 14px; }
.pk-side-tools, .pk-search { min-width: 0; box-sizing: border-box; }
.pk-root:not([data-form="desk"]) .pk-search-input { width: 0; }
.pk-root:not([data-form="desk"]) .pk-sidebar { padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); }

.pk-or { display: flex; align-items: center; gap: 12px; color: var(--secondary); font-size: 13px; }
.pk-or span { flex: 1; height: 1px; background: var(--line); }
.pk-root .pk-secondary-button, .pk-secondary-button { height: 46px; border-radius: 14px; background: var(--elevated); color: var(--ink); font-weight: 600; font-size: 16px;
  transition: opacity var(--hover), transform .1s ease-out; }
.pk-secondary-button:active { transform: scale(.98); }

/* ==== Native alignment (Piko/DesignSystem + Features/Chat, 2026-11-17) ==========================
   Icons: PikoIconShape exported 1:1 (dom.js). Composer: ChatComposer + PikoInputSurface (22 corner,
   Elevated, 6 inset, 8 gap, 44 hit, send key 36 square / 9 corner). Header: WorkspaceToolbar.
   Messages: MessageRow / MessageActions / ReplyVersionPager. Status: ChatReplyStatus. */

/* Header ------------------------------------------------------------------------------------ */
.pk-root .pk-head-menu { display: inline-grid; }
.pk-root:not([data-form="desk"]) .pk-head { padding-left: 18px; padding-right: 18px; }
.pk-root:not([data-form="desk"]) .pk-title, .pk-root:not([data-form="desk"]) .pk-head-new { display: none; }
.pk-root:not([data-form="desk"]) .pk-head-menu, .pk-root:not([data-form="desk"]) .pk-head-more {
  width: 44px; height: 44px; background: var(--surface); box-shadow: inset 0 0 0 .5px var(--line); }
.pk-root:not([data-form="desk"]) .pk-head-menu .pk-icon, .pk-root:not([data-form="desk"]) .pk-head-more .pk-icon { width: 20px; height: 20px; }
@media (hover: hover) { .pk-root:not([data-form="desk"]) .pk-head .pk-iconbtn:not(:disabled):hover { background: var(--surface); opacity: .86; } }
.pk-root:not([data-form="desk"]) .pk-head-id { position: absolute; left: 50%; transform: translateX(-50%); gap: 4px; font-weight: 400; font-size: 17px; }
.pk-root:not([data-form="desk"]) .pk-head-id .pk-avatar { width: 46px !important; height: 34px !important; }
.pk-root:not([data-form="desk"]) .pk-head-tools { margin-left: auto; }
/* Mac toolbar: plain 17pt glyphs in 32pt squares; hit area padded to 44 without moving the glyphs. */
.pk-root[data-form="desk"] .pk-side-collapse { display: none; }
.pk-root[data-form="desk"] .pk-head-menu, .pk-root[data-form="desk"] .pk-head-new, .pk-root[data-form="desk"] .pk-head-more {
  display: inline-grid; width: 32px; height: 32px; border-radius: 8px; background: none; box-shadow: none; position: relative; }
.pk-root[data-form="desk"] .pk-head .pk-iconbtn .pk-icon { width: 17px; height: 17px; }
.pk-root[data-form="desk"] .pk-head .pk-iconbtn::after { content: ""; position: absolute; inset: -6px; }
.pk-root[data-form="desk"] .pk-head-tools { gap: 12px; }
.pk-root[data-form="desk"] .pk-head-id { gap: 4px; margin-right: 0; }
@media (hover: hover) { .pk-root[data-form="desk"] .pk-head .pk-iconbtn:not(:disabled):hover { background: none; opacity: .86; } }

/* Composer ---------------------------------------------------------------------------------- */
.pk-composer-wrap { padding: 0 var(--pad) max(14px, env(safe-area-inset-bottom)); }
.pk-root .pk-composer { border-radius: 22px; padding: 6px; gap: 4px; background: var(--elevated);
  box-shadow: inset 0 1px 1px rgba(17, 17, 17, .025), inset 0 0 .8px rgba(17, 17, 17, .01), 0 4px 12px rgba(0, 0, 0, .07);
  transition: box-shadow var(--hover); }
.pk-root .pk-composer:focus-within { box-shadow: inset 0 1px 3px rgba(17, 17, 17, .16), inset 0 0 .8px rgba(17, 17, 17, .09), 0 4px 12px rgba(0, 0, 0, .07); }
.pk-root[data-theme="dark"] .pk-composer:focus-within { box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6), 0 4px 12px rgba(0, 0, 0, .3); }
@media (prefers-color-scheme: dark) { .pk-root:not([data-theme="light"]) .pk-composer:focus-within { box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6), 0 4px 12px rgba(0, 0, 0, .3); } }
.pk-composer-row, .pk-recbar { display: flex; align-items: flex-end; gap: 8px; }
.pk-recbar { align-items: center; }
.pk-composer .pk-iconbtn { width: 44px; height: 44px; border-radius: 12px; color: var(--ink); }
.pk-composer .pk-icon, .pk-root[data-form="desk"] .pk-composer .pk-icon { width: 20px; height: 20px; }
@media (hover: hover) { .pk-composer .pk-iconbtn:not(:disabled):hover { background: none; opacity: .86; } }
.pk-plus .pk-icon { transition: transform var(--enter); }
.pk-plus-open .pk-icon { transform: rotate(45deg); }
.pk-root .pk-input { min-height: 44px; padding: calc((44px - 1.45em) / 2) 0; }
.pk-root .pk-send, .pk-root:not([data-form="desk"]) .pk-send { width: 44px; height: 44px; border-radius: 0; background: none; color: var(--on-ink); display: grid; place-items: center; }
.pk-send-key { width: 36px; height: 36px; border-radius: 9px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; transition: opacity var(--hover); }
.pk-root .pk-send:disabled { opacity: 1; }
.pk-send:disabled .pk-send-key { opacity: .35; }
.pk-send .pk-icon { stroke-width: 1.7; }
.pk-levels { flex: 1; min-width: 0; height: 36px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; }
.pk-level { flex: none; width: 3px; height: 28px; border-radius: 1.5px; background: var(--ink); opacity: .2; transform: scaleY(.107); transition: transform .15s ease-out; will-change: transform; }
.pk-level-on { opacity: .8; }
.pk-root .pk-totext { min-width: 44px; min-height: 44px; padding: 0 4px; white-space: nowrap; font-size: 15px; color: var(--ink); transition: opacity var(--hover); }
.pk-root[data-form="desk"] .pk-totext { font-size: 12px; }
@media (hover: hover) { .pk-totext:hover { opacity: .86; } }
.pk-recording { animation: none; }

/* "+" panel: popover on iPad / Mac, bottom sheet on iPhone. */
.pk-popover { width: 360px; max-width: calc(100vw - 16px); padding: 0; border-radius: 16px; background: var(--canvas); transform-origin: left bottom; }
.pk-panel { display: flex; flex-direction: column; gap: 12px; padding: 20px 12px 12px; color: var(--ink); }
.pk-panel-sheet { padding-bottom: 8px; }
.pk-root[data-form="phone"] .pk-sheet:has(.pk-panel-sheet) { background: var(--canvas); border-radius: 28px 28px 0 0; }
.pk-panel-pick { display: flex; gap: 8px; overflow-x: auto; }
.pk-root .pk-panel-square { width: 76px; height: 76px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 6px;
  border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 12px; line-height: 1.2; text-align: center; transition: opacity var(--hover), transform .1s ease-out; }
.pk-root .pk-panel-square .pk-icon { width: 22px; height: 22px; }
.pk-panel-square:active { transform: scale(.96); }
.pk-panel-rows { display: flex; flex-direction: column; }
.pk-root .pk-panel-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 4px; border-radius: 12px; text-align: left; cursor: pointer;
  font-size: 17px; transition: background var(--hover); }
.pk-root[data-form="desk"] .pk-panel-row { font-size: 13px; }
@media (hover: hover) { .pk-panel-row:hover { background: var(--elevated); } }
.pk-panel-row > span:not(.pk-panel-icon) { flex: 1; min-width: 0; }
.pk-panel-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--ink);
  transition: background var(--layout), color var(--layout); }
.pk-panel-icon .pk-icon, .pk-root[data-form="desk"] .pk-panel-icon .pk-icon { width: 20px; height: 20px; }
.pk-panel-icon.pk-on { background: var(--ink); color: var(--on-ink); }
.pk-switch { appearance: none; -webkit-appearance: none; flex: none; margin: 0 0 0 auto; width: 51px; height: 31px; border-radius: 999px; position: relative; cursor: pointer;
  background: rgba(120, 120, 128, .16); transition: background var(--layout); }
.pk-switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: transform var(--layout); }
.pk-switch:checked { background: var(--ink); }
.pk-switch:checked::before { transform: translateX(20px); }
.pk-root[data-form="desk"] .pk-switch { width: 38px; height: 22px; }
.pk-root[data-form="desk"] .pk-switch::before { width: 20px; height: 20px; top: 1px; left: 1px; }
.pk-root[data-form="desk"] .pk-switch:checked::before { transform: translateX(16px); }
.pk-root[data-theme="dark"] .pk-switch { background: rgba(120, 120, 128, .32); }
.pk-root[data-theme="dark"] .pk-switch:checked::before, .pk-root[data-theme="dark"] .pk-switch:checked { }
@media (prefers-color-scheme: dark) { .pk-root:not([data-theme="light"]) .pk-switch { background: rgba(120, 120, 128, .32); }
  .pk-root:not([data-theme="light"]) .pk-switch:checked { background: var(--ink); } .pk-root:not([data-theme="light"]) .pk-switch:checked::before { background: #111111; } }
.pk-root[data-theme="dark"] .pk-switch:checked { background: var(--ink); }
.pk-root[data-theme="dark"] .pk-switch:checked::before { background: #111111; }

/* Latest: 18pt down arrow in a 38pt material round, 44pt hit, centred over the composer. */
.pk-root .pk-jump, .pk-root[data-form="desk"] .pk-jump { width: 38px; height: 38px; margin-left: -19px; border-radius: 50%; position: absolute;
  background: color-mix(in srgb, var(--float) 78%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  box-shadow: 0 0 0 .5px var(--line), 0 2px 8px rgba(0, 0, 0, .08); }
.pk-root .pk-jump::after { content: ""; position: absolute; inset: -3px; }
.pk-root .pk-jump .pk-icon { width: 18px; height: 18px; }

/* Messages ---------------------------------------------------------------------------------- */
.pk-root .pk-msg { gap: 9px; }
.pk-root .pk-bubble { max-width: calc(100% - 57px); padding: 16px; border-radius: 22px; line-height: calc(1em + 5px + .2em); }
.pk-msg-files { justify-content: flex-end; }
.pk-msg-piko .pk-msg-files { justify-content: flex-start; }
/* Mac hover row: 14pt glyphs in 28×26 cells, glyph on the message's reading edge; 44pt tall hit. */
.pk-root .pk-actions { height: 26px; gap: 0; margin-bottom: -26px; color: var(--secondary); transition: opacity var(--hover); }
.pk-root .pk-msg-piko .pk-actions { margin-left: -7px; }
.pk-root .pk-msg-user .pk-actions { margin-right: -7px; }
.pk-root .pk-actions .pk-iconbtn { width: 28px; height: 26px; border-radius: 6px; position: relative; color: var(--secondary); }
.pk-root .pk-actions .pk-iconbtn::after { content: ""; position: absolute; inset: -9px 0; }
.pk-root .pk-actions .pk-icon { width: 14px; height: 14px; }
@media (hover: hover) { .pk-root .pk-actions .pk-iconbtn:not(:disabled):hover { background: none; opacity: .86; } }
.pk-root .pk-msg:last-child .pk-actions, .pk-root .pk-actions-shown { margin-bottom: 0; }
.pk-root:not([data-form="desk"]) .pk-actions:not(.pk-actions-shown) { display: none !important; }
.pk-pager { align-self: flex-start; display: inline-flex; align-items: center; gap: 0; font-size: 12px; color: var(--secondary); font-variant-numeric: tabular-nums; }
.pk-root .pk-pager .pk-iconbtn { width: 44px; height: 44px; color: var(--secondary); }
.pk-root .pk-pager .pk-icon { width: 13px; height: 13px; }
.pk-root .pk-pager { margin-left: -15.5px; }
.pk-root[data-form="desk"] .pk-pager { font-size: 11px; margin-left: -8.5px; }
.pk-root[data-form="desk"] .pk-pager .pk-iconbtn { width: 28px; height: 26px; position: relative; }
.pk-root[data-form="desk"] .pk-pager .pk-iconbtn::after { content: ""; position: absolute; inset: -9px 0; }
.pk-root[data-form="desk"] .pk-pager .pk-icon { width: 11px; height: 11px; }
.pk-pager .pk-iconbtn:disabled { opacity: .35; }
@media (hover: hover) { .pk-root .pk-pager .pk-iconbtn:not(:disabled):hover { background: none; opacity: .86; } }

/* Live status (ChatReplyStatus): Piko's face in a 36pt frame with a soft orbit, caption beside it. */
.pk-root .pk-status { height: 36px; gap: 10px; }
.pk-status-face { width: 36px; height: 36px; flex: none; display: grid; place-items: center; position: relative; }
.pk-root .pk-status-text { font-size: 12px; }
.pk-root:not([data-form="desk"]) .pk-status-text { font-size: 13px; }

/* Quote reply (MessageQuotePreview / MessageQuoteDraftView / MessageQuoteLink) ----------------- */
.pk-quote { display: flex; gap: 10px; align-items: stretch; padding: 12px; border-radius: 14px; background: var(--elevated); color: var(--ink);
  text-align: left; min-width: 0; }
.pk-quote-bar { width: 3px; flex: none; border-radius: 1px; background: var(--secondary); }
.pk-quote-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.pk-quote-title { font-size: 12px; font-weight: 600; }
.pk-quote-text { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.pk-quote-note { font-size: 11px; color: var(--secondary); }
.pk-root .pk-quote-link { display: block; max-width: min(78%, 560px); padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; border-radius: 14px; }
.pk-root .pk-quote-gone { cursor: default; }
.pk-root .pk-msg-piko .pk-quote-link { max-width: 100%; }
@media (hover: hover) { .pk-root .pk-quote-link:not(.pk-quote-gone):hover .pk-quote { opacity: .86; } }
.pk-root .pk-quote-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pk-quotebar, .pk-editbar { display: flex; align-items: flex-start; gap: 0; padding: 6px 6px 0; min-width: 0; }
.pk-quotebar[hidden], .pk-editbar[hidden] { display: none; }
.pk-quotebar .pk-quote { flex: 1; background: var(--surface); }
.pk-editbar { align-items: center; gap: 8px; padding: 2px 0 0 14px; color: var(--secondary); }
.pk-editbar > .pk-icon { width: 16px; height: 16px; flex: none; }
.pk-editbar-text { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* PikoCloseButton: a 30pt round on Elevated inside a 44pt hit area. */
.pk-root .pk-composer .pk-close-round, .pk-root .pk-close-round { width: 44px; height: 44px; border-radius: 50%; color: var(--ink); position: relative; background: none; }
.pk-root .pk-close-round::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--elevated); }
.pk-root .pk-composer .pk-close-round::before { background: var(--surface); }
.pk-root .pk-close-round .pk-icon { position: relative; width: 14px !important; height: 14px !important; }
.pk-msg-found > .pk-bubble, .pk-msg-found > .pk-prose { animation: pk-found 1.4s ease-out; }
@keyframes pk-found { 0%, 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 18%, transparent); } 100% { box-shadow: 0 0 0 4px transparent; } }
.pk-msg-piko.pk-msg-found > .pk-prose { border-radius: 10px; }

/* Hover row time (MessageActions): caption, secondary, beside the buttons. */
.pk-msg-time { font-size: 11px; color: var(--secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pk-msg-user .pk-msg-time { padding-right: 7px; }
.pk-msg-piko .pk-msg-time { padding-left: 7px; }

/* 选择文本 sheet */
.pk-select { display: flex; flex-direction: column; gap: 12px; padding: 12px 12px 16px 20px; }
.pk-select-head { display: flex; align-items: center; gap: 8px; }
.pk-select-title { flex: 1; margin: 0; font-size: 17px; font-weight: 600; }
.pk-select-text { max-height: 55vh; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text;
  font-size: 15px; line-height: 1.5; padding-right: 8px; outline: none; }
.pk-select-actions { display: flex; justify-content: flex-end; gap: 4px; }
.pk-root .pk-select-actions .pk-iconbtn { width: 44px; height: 44px; color: var(--ink); }
.pk-root .pk-select-actions .pk-icon { width: 20px; height: 20px; }

/* "+" panel camera tile: filled ink, as the native panel. */
.pk-root .pk-panel-square.pk-panel-camera { background: var(--ink); color: var(--on-ink); }

.pk-face { overflow: visible; }
@media (prefers-reduced-motion: reduce) {
  .pk-status-text { animation: none !important; background: none !important; -webkit-text-fill-color: currentColor !important; color: var(--secondary); }
  .pk-msg-found > .pk-bubble, .pk-msg-found > .pk-prose { animation: none; }
}

/* Voice call (VoiceCallView) ------------------------------------------------------------------ */
.pk-call { position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; background: var(--canvas); color: var(--ink);
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); animation: pk-fade var(--enter) both; }
.pk-call.pk-leaving { animation: pk-fade var(--exit) reverse both; }
.pk-call-top { width: 100%; display: flex; justify-content: center; min-height: 44px; align-items: center; }
.pk-call-time { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--secondary); padding: 6px 14px; border-radius: 999px; background: var(--elevated); }
.pk-call-stage { flex: 1; width: 100%; max-width: 520px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: 0; }
.pk-root .pk-call-face { width: 200px; height: 200px; border-radius: 50%; border: 0; padding: 0; background: none; display: grid; place-items: center; cursor: default; }
.pk-call[data-phase="speaking"] .pk-call-face { cursor: pointer; }
.pk-call-level { width: 120px; height: 4px; border-radius: 2px; background: var(--ink); opacity: .5; transform: scaleX(.15); transition: transform 80ms linear; }
.pk-call:not([data-phase="listening"]) .pk-call-level { opacity: .12; }
.pk-call-status { font-size: 17px; font-weight: 600; min-height: 1.4em; }
.pk-call-lines { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; width: 100%; min-height: 5.5em; }
.pk-call-line { margin: 0; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pk-call-line:empty { display: none; }
.pk-call-user { color: var(--secondary); }
.pk-call-hint { margin: 0; font-size: 14px; color: var(--secondary); }
.pk-call-bottom { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.pk-call-privacy { margin: 0; font-size: 12px; color: var(--tertiary); text-align: center; max-width: 360px; }
.pk-call-controls { display: flex; gap: 28px; }
.pk-root .pk-call-control { width: 64px; height: 64px; border-radius: 50%; background: var(--elevated); color: var(--ink); }
.pk-root .pk-call-control .pk-icon { width: 26px; height: 26px; }
.pk-root .pk-call-control.pk-on { background: var(--ink); color: var(--on-ink); }
.pk-root .pk-call-hangup { background: var(--danger); color: #ffffff; }
@media (hover: hover) { .pk-root .pk-call-control:hover { opacity: .86; } }
@media (prefers-reduced-motion: reduce) { .pk-call-level { transition: none; } }

/* Sign in / create account (CloudAuthForm) ------------------------------------------------------ */
.pk-secret { position: relative; display: flex; align-items: center; border-radius: 14px; background: var(--elevated); }
.pk-secret .pk-field-secret { flex: 1; min-width: 0; background: transparent; padding-right: 0; }
.pk-secret:focus-within { outline: 2px solid var(--ink); outline-offset: 0; }
.pk-secret .pk-field-secret:focus-visible { outline: 0; }
.pk-root .pk-reveal { flex: none; min-width: 52px; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer; }
.pk-field-status { font-size: 13px; color: var(--danger); padding: 0 4px; display: flex; gap: 6px; align-items: flex-start; }
.pk-field-status[hidden] { display: none; }
.pk-strength { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); padding: 0 4px; min-height: 18px; }
.pk-strength[hidden] { display: none; }
.pk-strength-hint { color: var(--secondary); }
.pk-strength-bars { display: flex; gap: 4px; width: 72px; }
.pk-strength-bars span { flex: 1; height: 3px; border-radius: 2px; background: var(--line); transition: background var(--hover); }
.pk-strength-bars span.pk-on { background: var(--ink); }
.pk-register-only[hidden], .pk-forgot[hidden] { display: none; }
.pk-consent-wrap { display: flex; flex-direction: column; gap: 4px; }
.pk-consent-note { padding-left: 4px; }
.pk-root .pk-switch-mode { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--ink); font-weight: 600; font-size: 15px; cursor: pointer; }
.pk-login-switch { align-items: center; }
.pk-secondary-button[data-dim="true"]:not(:disabled) { opacity: .45; }
.pk-secondary-button:disabled { opacity: .45; }
/* CloudAuthFeedback: its own region, icon and text on Elevated. */
.pk-auth-feedback { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--elevated); font-size: 14px; line-height: 1.4; }
.pk-auth-feedback[hidden] { display: none; }
.pk-auth-feedback-icon { flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; color: var(--ink); }
.pk-auth-feedback-icon .pk-icon { width: 18px; height: 18px; }
.pk-auth-feedback[data-bad="true"] .pk-auth-feedback-icon { color: var(--danger); }
.pk-swap { animation: pk-swap var(--layout) both; }
@keyframes pk-swap { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .pk-swap { animation-name: pk-fade; } }

/* Mac hover row: the glyphs keep the client's 14pt size; each target is 44pt wide and tall
   (the client's 28×26 frames sit closer together, which would make the targets overlap here). */
.pk-root .pk-actions .pk-iconbtn { width: 44px; }
.pk-root .pk-actions .pk-iconbtn::after { inset: -9px 0; }
.pk-root .pk-msg-piko .pk-actions { margin-left: -15px; }
.pk-root .pk-msg-user .pk-actions { margin-right: -15px; }

/* Reactions (MessageReactionPicker / MessageReactionsView / MessageReactionBadge) --------------- */
.pk-menu.pk-menu-wide { min-width: min(360px, calc(100vw - 16px)); max-width: min(380px, calc(100vw - 16px)); }
.pk-reaction-strip { display: flex; gap: 2px; overflow-x: auto; padding: 4px; margin: 0 0 6px; border-radius: 999px; background: var(--elevated); scrollbar-width: none; }
.pk-reaction-strip::-webkit-scrollbar { display: none; }
.pk-root .pk-reaction-choice { position: relative; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; display: grid; place-items: center; cursor: pointer; padding: 0; }
.pk-reaction-emoji { font-size: 22px; line-height: 1; }
.pk-root .pk-reaction-choice.pk-on { background: var(--line); }
@media (hover: hover) { .pk-root .pk-reaction-choice:not(.pk-on):hover { background: color-mix(in srgb, var(--line) 60%, transparent); } }
.pk-reaction-check { position: absolute; right: 1px; bottom: 1px; width: 16px; height: 16px; border-radius: 50%; background: var(--elevated); display: grid; place-items: center; color: var(--ink); }
.pk-reaction-check .pk-icon { width: 10px; height: 10px; }
.pk-reactions { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.pk-msg-user .pk-reactions { justify-content: flex-end; }
.pk-root .pk-reaction-badge { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; }
.pk-root button.pk-reaction-badge { cursor: pointer; }
.pk-reaction-pill { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 4px 9px; border-radius: 999px; font-size: 16px; line-height: 1;
  background: color-mix(in srgb, var(--elevated) 85%, transparent); box-shadow: 0 0 0 .5px var(--line); animation: pk-badge-in var(--enter) both; }
.pk-reaction-pill .pk-avatar { filter: none; }
@media (hover: hover) { .pk-root button.pk-reaction-badge:hover .pk-reaction-pill { opacity: .86; } }
@keyframes pk-badge-in { from { transform: scale(.92); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pk-reaction-pill { animation-name: pk-fade; } }

/* 分享为图片 sheet: the canvas itself is the preview. */
.pk-share { display: flex; flex-direction: column; gap: 12px; padding: 12px 12px 16px 20px; }
.pk-share-preview { max-height: 62vh; overflow: auto; display: flex; justify-content: center; padding-right: 8px; }
.pk-root .pk-share-card { display: block; max-width: 100%; height: auto; border-radius: 12px; box-shadow: 0 0 0 .5px var(--line); }

/* A long menu (reactions + nine actions) never runs off a short screen: it scrolls. */
.pk-menu[role="menu"] { max-height: calc(100% - 16px); overflow-y: auto; overscroll-behavior: contain; }

/* 我的内容: Mac rows (19pt glyph, 36pt rows), iPad (22pt, 46pt), iPhone drawer (22pt, body 600). */
.pk-side-pages { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.pk-side-pages .pk-side-label { padding-top: 8px; }
.pk-root .pk-page-row { min-height: 36px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.pk-root .pk-page-row .pk-icon { width: 19px; height: 19px; flex: none; }
.pk-root .pk-page-row.pk-selected { background: var(--elevated); }
.pk-root:not([data-form="desk"]) .pk-page-row { min-height: 46px; gap: 12px; }
.pk-root:not([data-form="desk"]) .pk-page-row .pk-icon { width: 22px; height: 22px; }
.pk-root:not([data-form="desk"]) .pk-page-row:not(.pk-selected) { color: var(--secondary); }
.pk-root[data-form="phone"] .pk-page-row { gap: 16px; font-weight: 600; border-radius: 999px; }
.pk-root[data-form="phone"] .pk-page-row.pk-selected { color: var(--ink); }
.pk-page-in { animation: pk-fade var(--nav) both; }


/* 资源库 page */
.pk-library { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pk-library[hidden] { display: none; }
.pk-lib-bar { display: flex; align-items: center; gap: 8px; padding: 8px var(--pad) 10px; max-width: 1040px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.pk-root .pk-lib-search { flex: 1; margin: 0; min-height: 44px; background: var(--elevated); border-radius: 12px; }
.pk-root[data-form="desk"] .pk-lib-search { min-height: 36px; border-radius: 10px; }
.pk-root .pk-lib-tool { width: 44px; height: 44px; border-radius: 50%; color: var(--ink); flex: none; }
.pk-root .pk-lib-tool .pk-icon { width: 20px; height: 20px; }
.pk-lib-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px var(--pad) 28px; }
.pk-lib-body { max-width: 1040px; margin: 0 auto; }
.pk-lib-count { max-width: 1040px; margin: 12px auto 0; color: var(--secondary); font-size: 12px; }
.pk-lib-count[hidden] { display: none; }
/* iPhone / iPad: cards, 300pt minimum column, at most 3 columns, 12pt apart. */
.pk-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
@media (min-width: 1000px) { .pk-lib-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pk-root .pk-lib-card { display: flex; align-items: center; gap: 14px; padding: 14px; border: 0; border-radius: 14px; background: var(--surface); color: var(--ink);
  text-align: left; font: inherit; cursor: pointer; min-width: 0; box-shadow: 0 0 0 .5px var(--line); transition: transform .1s ease-out; }
.pk-root .pk-lib-card:active { transform: scale(.985); }
.pk-root .pk-lib-card > .pk-icon { width: 14px; height: 14px; color: var(--tertiary); flex: none; }
.pk-lib-tile { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--elevated); }
.pk-lib-tile .pk-icon { width: 20px; height: 20px; }
.pk-lib-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.pk-lib-card-title { font-size: 16px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pk-lib-card-date { font-size: 12px; color: var(--secondary); }
.pk-lib-card-kind { font-size: 12px; color: var(--tertiary); }
/* Mac: a table — 名称 · 添加日期 (≥ 760) · 类型 (≥ 560) · 文件状态; rows 56pt, 12pt corners. */
.pk-lib-table { display: flex; flex-direction: column; gap: 4px; container-type: inline-size; }
.pk-lib-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 76px 132px; align-items: center; gap: 12px; min-height: 56px; padding: 0 12px; border-radius: 12px; outline: 0; cursor: default; }
.pk-lib-row.pk-lib-head { min-height: 32px; color: var(--secondary); font-size: 12px; }
.pk-lib-row[data-id]:hover { background: color-mix(in srgb, var(--elevated) 60%, transparent); }
.pk-lib-row.pk-selected { background: var(--elevated); }
.pk-lib-row[data-id]:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); }
.pk-lib-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pk-lib-icon .pk-icon { width: 20px; height: 20px; display: block; }
.pk-lib-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.pk-lib-date, .pk-lib-kind, .pk-lib-state { color: var(--secondary); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@container (max-width: 759px) { .pk-lib-row { grid-template-columns: minmax(0, 1fr) 76px 132px; } .pk-lib-date { display: none; } }
@container (max-width: 559px) { .pk-lib-row { grid-template-columns: minmax(0, 1fr) 132px; } .pk-lib-kind { display: none; } }
.pk-lib-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 45px 16px; color: var(--secondary); }
.pk-lib-empty h2 { margin: 4px 0 0; font-size: 17px; font-weight: 600; color: var(--ink); }
.pk-lib-empty p { margin: 0; font-size: 14px; max-width: 320px; overflow-wrap: anywhere; }
.pk-lib-empty-icon .pk-icon { width: 34px; height: 34px; }

/* DocumentDetailView (文件预览) and DocumentEditor (新建笔记). */
.pk-root .pk-sheet.pk-sheet-wide { width: min(680px, calc(100% - 32px)); }
.pk-root[data-form="phone"] .pk-sheet.pk-sheet-wide { width: 100%; max-height: calc(100% - 24px); }
.pk-doc { display: flex; flex-direction: column; min-height: 0; padding: 12px 12px 8px 20px; }
.pk-doc-label { flex: 1; font-size: 13px; color: var(--secondary); }
.pk-root .pk-doc-action { width: 44px; height: 44px; color: var(--ink); }
.pk-doc-scroll { padding: 8px 8px 24px 0; }
.pk-doc-title { margin: 0 0 10px; font-size: 26px; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; }
.pk-doc-kind { display: flex; align-items: center; gap: 6px; color: var(--secondary); font-size: 12px; }
.pk-doc-kind .pk-icon { width: 14px; height: 14px; }
.pk-doc-rule { border: 0; height: 1px; background: var(--line); margin: 18px 0; }
.pk-note-form { display: flex; flex-direction: column; gap: 14px; }
.pk-root .pk-note-content { height: auto; min-height: 180px; padding: 12px 14px; resize: vertical; line-height: 1.5; font: inherit; font-size: 16px; }
.pk-root .pk-note-save { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pk-root .pk-note-save .pk-icon { width: 18px; height: 18px; }

/* 更多表情 sheet */
.pk-emoji-sheet { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 16px 20px; min-height: 0; }
.pk-root .pk-emoji-input { font-size: 18px; }
.pk-emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); max-height: 46vh; overflow-y: auto; padding-right: 6px; overscroll-behavior: contain; }
.pk-root .pk-emoji-cell { width: 100%; min-width: 44px; height: 44px; border: 0; background: none; border-radius: 10px; font-size: 24px; line-height: 1; padding: 0; cursor: pointer; }
@media (hover: hover) { .pk-root .pk-emoji-cell:hover { background: var(--elevated); } }
.pk-root .pk-reaction-more { background: color-mix(in srgb, var(--elevated) 70%, transparent); color: var(--ink); }
.pk-root .pk-reaction-more .pk-icon { width: 20px; height: 20px; }

/* The header floats over the page (as over the chat): the library starts below it. */
.pk-library { padding-top: calc(var(--head) + env(safe-area-inset-top, 0px)); }
.pk-root[data-page]:not([data-page="chat"])[data-form] .pk-head-new { display: none; }

/* 动态 / 点子 / 目标 pages: the header floats over them as over the chat; 1080pt page width. */
.pk-page { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-top: calc(var(--head) + env(safe-area-inset-top, 0px)); }
.pk-page[hidden] { display: none; }
.pk-page-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 8px var(--pad) 32px; overscroll-behavior: contain; }
.pk-page-inner { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.pk-feed-inner { max-width: 1080px; }
.pk-page-head { display: flex; align-items: center; gap: 12px; }
.pk-page-heading { flex: 1; min-width: 0; }
.pk-page-title { margin: 0; font-size: 22px; font-weight: 600; }
.pk-root[data-form="desk"] .pk-page-title { font-size: 17px; }
.pk-page-sub { margin: 2px 0 0; color: var(--secondary); font-size: 13px; }
.pk-page-section { margin: 4px 0 0; font-size: 15px; font-weight: 600; color: var(--secondary); }
.pk-page-section[hidden] { display: none; }
.pk-root .pk-page-tool { width: 44px; height: 44px; border-radius: 50%; color: var(--ink); flex: none; }
.pk-root .pk-page-tool .pk-icon { width: 20px; height: 20px; }
.pk-card { background: var(--surface); border-radius: 16px; box-shadow: 0 0 0 .5px var(--line); }
.pk-page-badge { margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--secondary); }
.pk-page-badge[hidden] { display: none; }
.pk-page-name { flex: 1; min-width: 0; }
.pk-capsule { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 999px; background: var(--elevated); font-size: 12px; color: var(--secondary); }

/* 目标 */
.pk-goal-filter { align-self: flex-start; max-width: 100%; }
.pk-goal-card { padding: 4px 0; }
.pk-goal-divider { border: 0; height: 1px; background: var(--line); margin: 0 0 0 48px; }
.pk-goal-row { padding: 6px 8px 8px 0; }
.pk-goal-main { display: flex; align-items: center; gap: 4px; }
.pk-root .pk-goal-check, .pk-root .pk-goal-more { width: 44px; height: 44px; color: var(--ink); flex: none; }
.pk-root .pk-goal-check .pk-icon { width: 22px; height: 22px; }
.pk-root .pk-goal-open { flex: 1; min-width: 0; min-height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 2px; border: 0; background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; padding: 4px 0; }
.pk-goal-title { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.pk-root[data-form="desk"] .pk-goal-title { font-size: 13px; }
.pk-goal-status { font-size: 12px; color: var(--secondary); }
.pk-goal-row.pk-done .pk-goal-title { text-decoration: line-through; color: var(--secondary); }
.pk-goal-next { display: flex; align-items: center; gap: 8px; margin-left: 48px; min-height: 44px; color: var(--secondary); font-size: 13px; }
.pk-root .pk-goal-step-box { width: 44px; height: 44px; margin: 0 -13px; color: var(--ink); flex: none; }
.pk-root .pk-goal-step-box .pk-icon { width: 18px; height: 18px; }
.pk-goal-next-label { font-size: 12px; color: var(--secondary); flex: none; }
.pk-goal-next-title { color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-goal-detail .pk-doc-scroll { display: flex; flex-direction: column; gap: 16px; }
.pk-goal-hero, .pk-goal-note, .pk-goal-steps { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.pk-goal-hero .pk-doc-title { margin: 0; font-size: 22px; }
.pk-goal-hero-top { display: flex; align-items: center; justify-content: space-between; }
.pk-goal-detail-text { margin: 0; color: var(--secondary); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pk-goal-bar { height: 6px; border-radius: 3px; background: var(--elevated); overflow: hidden; }
.pk-goal-bar > span { display: block; height: 100%; background: var(--ink); border-radius: 3px; transform-origin: left center; transition: transform var(--layout); }
.pk-goal-progress { display: flex; justify-content: space-between; font-size: 12px; color: var(--secondary); font-variant-numeric: tabular-nums; }
.pk-goal-next-line { margin: 0; font-size: 14px; }
.pk-goal-section { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.pk-goal-section .pk-icon { width: 16px; height: 16px; }
.pk-goal-section > span { flex: 1; }
.pk-goal-note p { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pk-goal-when { margin: 0; font-size: 12px; color: var(--secondary); }
.pk-root .pk-goal-edit { width: 44px; height: 44px; color: var(--ink); }
.pk-root .pk-goal-step { display: flex; align-items: center; gap: 10px; min-height: 44px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 15px; text-align: left; cursor: pointer; padding: 0; }
.pk-root .pk-goal-step .pk-icon { width: 20px; height: 20px; flex: none; }
.pk-goal-step.pk-done span { text-decoration: line-through; color: var(--secondary); }
.pk-goal-cadence { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.pk-goal-cadence .pk-icon { width: 16px; height: 16px; }
.pk-root .pk-goal-complete { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pk-root .pk-goal-complete .pk-icon { width: 18px; height: 18px; }
.pk-goal-form-title { margin: 0; font-size: 17px; font-weight: 600; }
.pk-goal-form-section { font-size: 13px; color: var(--secondary); margin-top: 4px; }
.pk-root .pk-goal-detail-field { height: auto; min-height: 72px; padding: 10px 14px; resize: vertical; font: inherit; font-size: 16px; }
.pk-goal-edit-steps { display: flex; flex-direction: column; gap: 8px; }
.pk-goal-edit-step { display: flex; align-items: center; gap: 6px; }
.pk-root .pk-goal-remove, .pk-root .pk-goal-add { width: 44px; height: 44px; flex: none; color: var(--ink); }
.pk-root select.pk-field { appearance: auto; }

/* 点子: 300pt tiles on touch (2 columns), 280pt on Mac (3 columns), 12pt apart. */
.pk-idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.pk-root[data-form="desk"] .pk-idea-grid { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
@media (min-width: 1100px) { .pk-root:not([data-form="desk"]) .pk-idea-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pk-root .pk-idea-tile { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border: 0; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 .5px var(--line);
  color: var(--ink); text-align: left; font: inherit; cursor: pointer; min-width: 0; transition: transform .1s ease-out; }
.pk-root .pk-idea-tile:active { transform: scale(.985); }
.pk-idea-text { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.pk-idea-title { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.pk-root[data-form="desk"] .pk-idea-title { font-size: 13px; }
.pk-idea-body { font-size: 14px; color: var(--secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pk-idea-reason { font-size: 12px; color: var(--secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* ContentArtwork: a white tile tilted over a grey one, the glyph on top. */
.pk-art { position: relative; flex: none; display: block; }
.pk-art-back, .pk-art-front { position: absolute; inset: 12%; border-radius: 22%; }
.pk-art-back { background: #e4e4e2; transform: translate(-4%, 6%); }
.pk-art-front { background: linear-gradient(#ffffff, #f2f2f2); transform: rotate(-9deg); display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .08); color: #111111; }
.pk-art-front .pk-icon { width: 44%; height: 44%; transform: rotate(9deg); }
.pk-idea-detail-body { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.pk-idea-detail-title { margin: 0; font-size: 19px; font-weight: 600; }
.pk-idea-detail-text { margin: 0; color: var(--secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
.pk-idea-why { align-items: flex-start; }
.pk-root .pk-idea-go { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.pk-root .pk-idea-go .pk-icon { width: 18px; height: 18px; }

/* 动态: one column, two once the content is 778pt wide; cards 16pt in, 18pt apart. */
.pk-feed-overview { display: flex; align-items: center; gap: 10px; }
.pk-root .pk-feed-title { font-size: 17px; font-weight: 500; }
.pk-feed-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; container-type: inline-size; }
@media (min-width: 900px) { .pk-root:not([data-form="phone"]) .pk-feed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pk-feed-card { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.pk-root .pk-feed-open { display: flex; flex-direction: column; gap: 8px; border: 0; background: none; padding: 0; text-align: left; color: var(--ink); font: inherit; cursor: pointer; }
.pk-feed-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--secondary); }
.pk-feed-meta .pk-icon { width: 14px; height: 14px; }
.pk-feed-card-title { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.pk-root[data-form="desk"] .pk-feed-card-title { font-size: 14px; }
.pk-feed-preview { font-size: 14px; color: var(--secondary); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.pk-feed-source { font-size: 12px; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-feed-bottom { display: flex; align-items: center; justify-content: space-between; margin: 0 -8px -8px; }
.pk-feed-reactions { display: flex; gap: 2px; }
.pk-root .pk-feed-react, .pk-root .pk-feed-discuss { width: 44px; height: 44px; border-radius: 10px; color: var(--ink); }
.pk-root .pk-feed-react .pk-icon { width: 22px; height: 22px; }
.pk-root .pk-feed-react.pk-on { background: var(--elevated); }
.pk-feed-empty { padding: 22px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.pk-feed-empty h2 { margin: 0; font-size: 17px; }
.pk-feed-empty p { margin: 0; color: var(--secondary); font-size: 14px; }
.pk-feed-publishers { margin: 0; font-size: 14px; color: var(--secondary); }
.pk-feed-context { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.pk-feed-context p { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.pk-root .pk-feed-cite { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 0; color: var(--ink); text-decoration: none; }
.pk-root .pk-feed-cite > .pk-icon { width: 16px; height: 16px; flex: none; color: var(--secondary); }
.pk-feed-cite-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pk-feed-cite-title { font-size: 14px; overflow-wrap: anywhere; }
@media (hover: hover) { .pk-root a.pk-feed-cite:hover .pk-feed-cite-title { text-decoration: underline; } }
.pk-feed-detail-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.pk-root .pk-feed-talk { display: flex; align-items: center; gap: 8px; padding: 0 18px; }
.pk-root .pk-feed-talk .pk-icon { width: 18px; height: 18px; }
.pk-root .pk-goal-filter { background: var(--elevated); border-radius: 12px; padding: 3px; }
.pk-root .pk-goal-filter button { min-height: 44px; padding: 0 14px; border-radius: 10px; }

/* The main chat's mark in the chat list (MacWorkspaceSidebar: 13pt home, secondary). */
.pk-row-home { flex: none; display: grid; place-items: center; color: var(--secondary); }
.pk-row-home .pk-icon { width: 13px; height: 13px; }

/* 灵息 (PikoThinkingAura, Documentation/PIKO_THINKING_AURA.md): behind Piko's face while it works — a
   breathing haze and three soft motes rising and dissolving. Measured on the 36pt frame, drawn in its
   background: it may spill a few points but never changes the row's layout. Ink is near black in
   light mode and near white in dark mode, so both follow the theme. */
.pk-status-face { isolation: isolate; }
.pk-status-face > .pk-face { position: relative; z-index: 1; }
.pk-aura { position: absolute; inset: 0; z-index: 0; pointer-events: none; animation: pk-aura-in .18s ease-in-out both; }
@keyframes pk-aura-in { from { opacity: 0; } }
/* 1. The haze: 1.5 × the frame, ink 16% → 7% at 45% → 0 at the circle's edge (70.7% of the corner). */
.pk-aura-haze { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--ink) 16%, transparent) 0%, color-mix(in srgb, var(--ink) 7%, transparent) 31.8%, transparent 70.7%);
  animation: pk-aura-breath 2.4s ease-in-out infinite alternate; }
@keyframes pk-aura-breath { from { transform: scale(.86); opacity: .5; } to { transform: scale(1.06); opacity: 1; } }
/* 2. Three motes, each in a still 8×16pt column whose vertical mask lets it appear and fade. */
.pk-aura-col { position: absolute; width: 8px; height: 16px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 40%, #000 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 40%, #000 60%, transparent 100%); }
/* Column centres from the face centre (18, 18): A (+17, −9), B (−16, −6), C (+6, −17). */
.pk-aura-col.pk-a { left: 31px; top: 1px; }
.pk-aura-col.pk-b { left: -2px; top: 4px; }
.pk-aura-col.pk-c { left: 20px; top: -7px; }
.pk-aura-mote { position: absolute; left: 50%; top: 50%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--ink) 50%, transparent), transparent 70.7%);
  animation: pk-mote-rise 3s linear infinite; }
.pk-a .pk-aura-mote { width: 4.4px; height: 4.4px; margin: -2.2px 0 0 -2.2px; }
.pk-b .pk-aura-mote { width: 3.4px; height: 3.4px; margin: -1.7px 0 0 -1.7px; animation-delay: 1s; }
.pk-c .pk-aura-mote { width: 2.6px; height: 2.6px; margin: -1.3px 0 0 -1.3px; animation-delay: 2s; }
/* Up 14pt with a 1.8pt drift to the right: from (−0.6, +7) to (+1.2, −7) in the column. */
@keyframes pk-mote-rise { from { transform: translate(-0.6px, 7px); } to { transform: translate(1.2px, -7px); } }
@media (prefers-reduced-motion: reduce) {
  /* No motes; the haze keeps its size and only breathes 0.6 ↔ 1. */
  .pk-aura { animation-duration: .12s; }
  .pk-aura-col { display: none; }
  .pk-aura-haze { animation-name: pk-aura-fade; }
}
@keyframes pk-aura-fade { from { opacity: .6; } to { opacity: 1; } }

/* ============================================================================================
   Parity with the native clients (Documentation/DESIGN_SYSTEM.md, Piko/DesignSystem/*,
   Shared/PikoMotion.swift). Values below are the app's own; later rules here win over the
   earlier approximations above.
   ============================================================================================ */
.pk-root {
  /* Type scale: iOS points on touch forms, macOS points on the Mac form (PikoTypographyMetrics). */
  --t-title2: 21px; --t-title3: 19px; --t-headline: 16px; --t-body: 16px; --t-callout: 15px; --t-sub: 15px; --t-foot: 13px; --t-cap: 12px; --t-cap2: 11px;
  --lead: 5px;                     /* MarkdownText line spacing: body 16 → 5 */
  --page: var(--canvas);           /* the page is Canvas, as the app's window */
  --hair: .5px;                    /* hairlines: 0.5pt in Line */
  /* Motion tokens (PikoMotion / PikoLivelyMotion). Springs are expressed as their nearest curve. */
  --m-enter: cubic-bezier(.16, 1, .3, 1); --m-exit: cubic-bezier(.4, 0, 1, 1);
  --m-menu: cubic-bezier(.16, 1, .3, 1); --m-menu-out: cubic-bezier(.3, 0, .5, 1);
  --m-arrival: cubic-bezier(.34, 1.22, .64, 1);   /* spring 0.40, bounce 0.14 */
  --m-panel: cubic-bezier(.32, 1.16, .56, 1);     /* spring 0.34, bounce 0.12 */
  --m-swap: cubic-bezier(.34, 1.36, .64, 1);      /* spring 0.32, bounce 0.20 */
  --m-release: cubic-bezier(.3, 1.3, .5, 1);      /* button release spring 0.28, bounce 0.16 */
  --m-smooth: cubic-bezier(.3, .7, .3, 1);        /* .smooth */
  --press: .97;
}
.pk-root[data-form="desk"] {
  --t-title2: 17px; --t-title3: 15px; --t-headline: 13px; --t-body: 13px; --t-callout: 12px; --t-sub: 12px; --t-foot: 10px; --t-cap: 10px; --t-cap2: 10px;
  --lead: 4px; --press: .985;
}
.pk-root[data-form="pad"], .pk-root[data-form="phone"] { --base: 16px; --chat: 16px; }
.pk-root[data-form="desk"] { --base: 13px; --chat: 13px; }
/* Dark mode is drawn 40 lighter in weight (PikoNativeFont), so text does not glow. */
@media (prefers-color-scheme: dark) { .pk-root:not([data-theme="light"]) { font-weight: 360; } .pk-root:not([data-theme="light"]) :is(strong, b, h1, h2, h3, h4, h5, h6, th) { font-weight: 560; } }
.pk-root[data-theme="dark"] { font-weight: 360; }
.pk-root[data-theme="dark"] :is(strong, b, h1, h2, h3, h4, h5, h6, th) { font-weight: 560; }

/* Scroll bars: thin and quiet, as the system's overlay indicators. */
.pk-root * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent; }
.pk-root ::-webkit-scrollbar { width: 9px; height: 9px; }
.pk-root ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 20%, transparent); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
.pk-root ::-webkit-scrollbar-track { background: transparent; }

/* Press feedback (PikoButtonPressFeedback): 0.97 on touch, 0.985 on Mac; pressed .smooth(0.10),
   released on a light spring. Icon buttons fade to 0.66 while pressed. */
.pk-root :is(.pk-iconbtn, .pk-primary, .pk-secondary-button, .pk-send, .pk-menu-item, .pk-side-row, .pk-tab, .pk-lib-card, .pk-idea-tile, .pk-feed-open, .pk-goal-open, .pk-panel-row, .pk-panel-square, .pk-reaction-choice) {
  transition: transform .28s var(--m-release), opacity var(--hover), background-color var(--hover), color var(--hover); }
.pk-root :is(.pk-iconbtn, .pk-primary, .pk-secondary-button, .pk-send, .pk-menu-item, .pk-side-row, .pk-tab, .pk-lib-card, .pk-idea-tile, .pk-feed-open, .pk-goal-open, .pk-panel-row, .pk-panel-square, .pk-reaction-choice):not(:disabled):active {
  transform: scale(var(--press)); transition: transform .1s var(--m-smooth), opacity .1s; }
.pk-root .pk-iconbtn:not(:disabled):active { opacity: .66; }
.pk-root :focus-visible { outline: 2px solid color-mix(in srgb, var(--ink) 60%, transparent); outline-offset: 2px; }

/* ---- Header (WorkspaceToolbar + FloatingHeaderBackdrop) ---------------------------------- */
/* A canvas veil that is thin at the top and fuller below, over a soft blur, fading out with a
   smooth edge: content passes under it the way it does in the app. */
.pk-root .pk-head { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; isolation: isolate; }
.pk-root .pk-head::before { content: ""; position: absolute; inset: 0 0 -16px 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--canvas) 72%, transparent), color-mix(in srgb, var(--canvas) 66%, transparent));
  -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 62%, rgba(0, 0, 0, .55) 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 62%, rgba(0, 0, 0, .55) 80%, transparent 100%); }
.pk-head-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pk-head-status { font-size: var(--t-cap); color: var(--secondary); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-head-status:empty { display: none; }
.pk-root[data-form="desk"] .pk-head-status { display: none; }
/* iPhone and iPad: 44pt round buttons on Surface with a hairline, name in subheadline 500. */
.pk-root:not([data-form="desk"]) .pk-head-menu, .pk-root:not([data-form="desk"]) .pk-head-more {
  width: 44px; height: 44px; background: var(--surface); box-shadow: 0 0 0 var(--hair) var(--line); color: var(--ink); }
.pk-root:not([data-form="desk"]) .pk-head-id { gap: 10px; font-size: var(--t-sub); font-weight: 500; }
.pk-root:not([data-form="desk"]) .pk-head-id .pk-avatar { width: 40px !important; height: 30px !important; }
/* Mac: 32pt square toolbar items with 17pt glyphs; the mark at 24pt. */
.pk-root[data-form="desk"] .pk-head .pk-iconbtn { width: 32px; height: 32px; border-radius: 8px; }
.pk-root[data-form="desk"] .pk-head .pk-icon { width: 17px; height: 17px; }
@media (hover: hover) { .pk-root[data-form="desk"] .pk-head .pk-iconbtn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); } }

/* ---- Chat column (ChatConversationView, MessageRow) --------------------------------------- */
.pk-root { --col: 688px; }   /* 760 including 36pt side padding */
.pk-root[data-form="phone"] { --col: 100%; }
.pk-root .pk-messages { gap: 25px; font-size: var(--chat); line-height: calc(1.2em + var(--lead)); }
.pk-root .pk-msg { gap: 9px; animation: none; }
.pk-root .pk-msg.pk-arrive, .pk-root .pk-live { animation: pk-arrive .4s var(--m-arrival) both; transform-origin: 50% 100%; }
@keyframes pk-arrive { from { opacity: 0; transform: translateY(18px) scale(.96); } }
.pk-root .pk-bubble { max-width: calc(100% - 45px); padding: 16px; border-radius: 22px; line-height: calc(1.2em + 5px); font-size: var(--t-body); }
.pk-root[data-form="desk"] .pk-bubble { padding: 12px 16px; }
.pk-stamp { align-self: center; font-size: var(--t-cap); color: var(--secondary); padding: 4px 0; margin-bottom: -9px; font-variant-numeric: tabular-nums; }
.pk-column.pk-chat-switch { animation: pk-chat-switch .25s linear; }
@keyframes pk-chat-switch { 0% { opacity: 1; } 28% { opacity: .72; } 100% { opacity: 1; } }
/* Streaming: the newest glyphs come in over 90ms, 30ms apart (PikoStreamingText). */
.pk-glyph { animation: pk-glyph 90ms cubic-bezier(.215, .61, .355, 1) both; }
@keyframes pk-glyph { from { opacity: 0; } }   /* inline, so words still wrap as text */

/* Markdown rhythm (MarkdownBlockSpacing / MarkdownBlockView / MarkdownInline). */
.pk-root .pk-prose { line-height: calc(1.2em + var(--lead)); }
.pk-root .pk-prose > * { margin: 0; }
.pk-root .pk-prose > * + * { margin-top: 14px; }
.pk-root .pk-prose > * + :is(h1) { margin-top: 32px; } .pk-root .pk-prose > * + :is(h2) { margin-top: 28px; }
.pk-root .pk-prose > * + :is(h3) { margin-top: 22px; } .pk-root .pk-prose > * + :is(h4, h5, h6) { margin-top: 18px; }
.pk-root .pk-prose > :is(h1, h2) + * { margin-top: 10px; } .pk-root .pk-prose > :is(h3, h4, h5, h6) + * { margin-top: 6px; }
.pk-root .pk-prose > * + :is(ul, ol) { margin-top: 12px; } .pk-root .pk-prose > :is(ul, ol) + * { margin-top: 16px; }
.pk-root .pk-prose > * + :is(.pk-code, .pk-table, blockquote, hr) { margin-top: 18px; }
.pk-root .pk-prose :is(h1, h2, h3, h4, h5, h6) { font-weight: 600; line-height: calc(1.2em + 3px); margin-bottom: 0; }
.pk-root .pk-prose h1 { font-size: var(--t-title2); } .pk-root .pk-prose h2 { font-size: var(--t-title3); }
.pk-root .pk-prose :is(h3, h4) { font-size: var(--t-headline); } .pk-root .pk-prose :is(h5, h6) { font-size: var(--t-sub); color: var(--secondary); }
.pk-root .pk-prose :is(ul, ol) { padding-left: 26px; margin-bottom: 0; }
.pk-root .pk-prose li { margin: 0; } .pk-root .pk-prose li + li { margin-top: 8px; }
.pk-root .pk-prose li :is(ul, ol) { margin-top: 4px; padding-left: 22px; } .pk-root .pk-prose li li + li { margin-top: 4px; }
.pk-root .pk-prose ul { list-style: disc; } .pk-root .pk-prose ul ul { list-style: circle; } .pk-root .pk-prose ul ul ul { list-style: square; }
.pk-root .pk-prose li::marker { color: var(--secondary); }
.pk-root .pk-prose strong { font-weight: 600; }
.pk-root .pk-prose a { text-decoration-color: color-mix(in srgb, var(--ink) 38%, transparent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.pk-root .pk-prose :not(pre) > code { font: 400 .9em var(--mono); background: var(--elevated); padding: .1em .35em; border-radius: 5px; }
.pk-root .pk-prose blockquote { margin-left: 0; padding: 4px 0 4px 17px; border: 0; position: relative; color: var(--secondary); }
.pk-root .pk-prose blockquote::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 28%, transparent); }
.pk-root .pk-prose hr { border: 0; height: var(--hair); background: var(--line); margin-block: 6px; }
/* Code: a 14pt card on Surface with a hairline; Elevated header with the language and copy. */
.pk-root .pk-code { border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 var(--hair) var(--line); overflow: hidden; }
.pk-root .pk-code-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 4px 0 14px; background: var(--elevated);
  font-size: var(--t-cap); font-weight: 500; color: var(--secondary); }
.pk-root .pk-code-copy { width: 44px; height: 44px; color: var(--secondary); }
.pk-root .pk-code pre { margin: 0; padding: 16px; overflow-x: auto; background: none; font: 400 var(--t-callout)/calc(1.2em + 4px) var(--mono); }
.pk-root .pk-code pre code { font: inherit; background: none; padding: 0; }
/* Tables: corner 12 with a hairline, Elevated header in 600, cells 12×10, 0.5pt rules. */
.pk-root .pk-table { border-radius: 12px; box-shadow: 0 0 0 var(--hair) var(--line); overflow-x: auto; }
.pk-root .pk-prose table { border-collapse: collapse; width: 100%; font-size: 1em; }
.pk-root .pk-prose th, .pk-root .pk-prose td { padding: 10px 12px; min-width: 148px; border-bottom: var(--hair) solid var(--line); text-align: left; }
.pk-root .pk-prose tr:last-child td { border-bottom: 0; }
.pk-root .pk-prose thead th { background: var(--elevated); font-weight: 600; }

/* Thinking (ChatThinkingView): a quiet header, the latest line, the full text behind a 1pt rule. */
.pk-thinking { display: flex; flex-direction: column; gap: 4px; color: var(--secondary); font-size: var(--t-cap); }
.pk-root .pk-thinking-head { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0; border: 0; background: none; color: var(--secondary); font: inherit; cursor: pointer; align-self: flex-start; }
.pk-root .pk-thinking-head .pk-icon { width: 14px; height: 14px; }
.pk-root .pk-thinking-head .pk-icon:last-child { width: 10px; height: 10px; transition: transform .24s var(--m-smooth); }
.pk-thinking.pk-open .pk-thinking-head .pk-icon:last-child { transform: rotate(90deg); }
.pk-thinking-line { color: var(--tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; }
.pk-thinking-full { max-height: 160px; overflow-y: auto; padding-left: 10px; border-left: 1px solid var(--line); white-space: pre-wrap; line-height: calc(1.2em + 4px);
  animation: pk-fade .24s var(--m-smooth) both; }
.pk-root .pk-status { height: 36px; gap: 10px; }
.pk-root .pk-status-text { font-size: var(--t-cap); }

/* ---- Composer (ChatComposer + PikoInputSurface) ------------------------------------------- */
.pk-root .pk-composer-wrap { padding: 8px 16px max(12px, env(safe-area-inset-bottom)); }
.pk-root:not([data-form="phone"]) .pk-composer-wrap { padding: 8px 30px 22px; }
.pk-root .pk-composer { max-width: 760px; border-radius: 22px; padding: 6px; gap: 8px; background: var(--elevated);
  box-shadow: inset 0 1px 1px color-mix(in srgb, var(--ink) 2.5%, transparent), inset 0 0 .8px color-mix(in srgb, var(--ink) 1%, transparent), 0 4px 12px rgba(0, 0, 0, .07);
  transition: box-shadow .24s var(--m-smooth); }
.pk-root .pk-composer:focus-within { box-shadow: inset 0 1px 3px color-mix(in srgb, var(--ink) 16%, transparent), inset 0 0 .8px color-mix(in srgb, var(--ink) 9%, transparent), 0 4px 12px rgba(0, 0, 0, .07); }
.pk-root .pk-composer-row { gap: 8px; align-items: flex-end; }
.pk-root .pk-input { min-height: 44px; padding: 11px 4px; line-height: calc(1.2em + 4px); font-size: var(--t-body); }
.pk-root .pk-composer .pk-iconbtn { width: 44px; height: 44px; border-radius: 12px; }
.pk-root .pk-send { width: 44px; height: 44px; background: none; border-radius: 9px; }
.pk-root .pk-send-key { width: 36px; height: 36px; border-radius: 9px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; }
.pk-root .pk-send-key .pk-icon { width: 20px; height: 20px; }
.pk-plus .pk-icon { transition: transform .32s var(--m-swap); }
.pk-icon-in { animation: pk-icon-in .32s var(--m-swap) both; }
@keyframes pk-icon-in { from { opacity: 0; transform: scale(.5); } }
/* Jump to latest (ChatLatestButton): a 38pt material circle, no shadow, 8pt above the composer. */
.pk-root .pk-jump, .pk-root[data-form="desk"] .pk-jump { width: 38px; height: 38px; margin-left: -19px; box-shadow: none;
  background: color-mix(in srgb, var(--float) 72%, transparent); -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px);
  bottom: calc(var(--composer-h, 76px) + 8px); animation: pk-pop-up .4s var(--m-arrival) both; }
@keyframes pk-pop-up { from { opacity: 0; transform: translateY(14px) scale(.94); } }

/* ---- Menus, sheets, toasts (MessageActionPanel / pop transition / AttachmentToast) --------- */
.pk-root .pk-menu { border-radius: 20px; padding: 6px; background: color-mix(in srgb, var(--float) 80%, transparent);
  -webkit-backdrop-filter: saturate(1.8) blur(30px); backdrop-filter: saturate(1.8) blur(30px);
  box-shadow: 0 0 0 var(--hair) var(--line), 0 12px 32px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .05);
  animation: pk-pop-in .3s var(--m-menu) both; }
.pk-root[data-form="desk"] .pk-menu { border-radius: 12px; padding: 5px; }
.pk-root .pk-menu.pk-leaving { animation: pk-pop-out .18s var(--m-menu-out) both; }
@keyframes pk-pop-in { from { opacity: 0; transform: translateY(-6px) scale(.94); } }
@keyframes pk-pop-out { to { opacity: 0; transform: translateY(-4px) scale(.98); } }
.pk-root .pk-menu-item { gap: 12px; padding: 0 16px; border-radius: 12px; font-size: var(--t-body); }
.pk-root[data-form="desk"] .pk-menu-item { border-radius: 8px; padding: 0 10px; gap: 10px; }
.pk-root .pk-menu-item .pk-icon { width: 20px; height: 20px; }
.pk-root[data-form="desk"] .pk-menu-item .pk-icon { width: 16px; height: 16px; }
.pk-root .pk-menu-item + .pk-menu-item { box-shadow: 0 calc(-1 * var(--hair)) 0 0 color-mix(in srgb, var(--line) 70%, transparent); }
.pk-root[data-form="desk"] .pk-menu-item + .pk-menu-item { box-shadow: none; }
@media (hover: hover) { .pk-root .pk-menu-item:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); box-shadow: none; } }
.pk-root .pk-sheet { border-radius: 24px; background: var(--surface); box-shadow: 0 12px 24px rgba(0, 0, 0, .16), 0 0 0 var(--hair) var(--line);
  animation: pk-sheet-pop .34s var(--m-panel) both; }
@keyframes pk-sheet-pop { from { opacity: 0; transform: translateY(14px) scale(.94); } }
.pk-root[data-form="phone"] .pk-sheet { border-radius: 28px 28px 0 0; animation: pk-sheet-up .34s var(--m-panel) both; }
.pk-root .pk-sheet.pk-leaving { animation: pk-pop-out .18s var(--m-menu-out) both; }
.pk-root[data-form="phone"] .pk-sheet.pk-leaving { animation: pk-sheet-down .18s var(--m-exit) both; }
.pk-root .pk-scrim { background: rgba(0, 0, 0, .18); }
@media (prefers-color-scheme: dark) { .pk-root:not([data-theme="light"]) .pk-scrim { background: rgba(0, 0, 0, .36); } }
.pk-root .pk-toast { border-radius: 12px; color: var(--ink); background: color-mix(in srgb, var(--float) 80%, transparent); -webkit-backdrop-filter: saturate(1.8) blur(24px);
  backdrop-filter: saturate(1.8) blur(24px); box-shadow: 0 0 0 var(--hair) var(--line), 0 2px 8px rgba(0, 0, 0, .10); }

/* ---- Sidebar and drawer (MacWorkspaceSidebar / WorkspaceSidebar / ChatDrawerView) ---------- */
.pk-root[data-form="desk"] .pk-sidebar { background: var(--canvas); }
.pk-root[data-form="desk"] .pk-side-row { min-height: 36px; padding: 0 10px; border-radius: 12px; gap: 10px; }
.pk-root[data-form="desk"] .pk-side-row .pk-icon { width: 19px; height: 19px; }
@media (hover: hover) { .pk-root[data-form="desk"] .pk-side-row:hover { background: color-mix(in srgb, var(--elevated) 55%, transparent); } }
.pk-root[data-form="desk"] .pk-side-row.pk-selected { background: var(--elevated); }
.pk-root .pk-side-label { font-size: var(--t-cap); color: var(--secondary); padding: 16px 8px 4px; }
.pk-root[data-form="desk"] .pk-search { background: var(--elevated); border-radius: 12px; min-height: 36px; }
.pk-root[data-form="pad"] { --side-w: 260px; }
.pk-root:not([data-form="desk"]) .pk-sidebar { background: var(--surface); }
.pk-root:not([data-form="desk"]) .pk-page-row { min-height: 46px; padding: 0 14px; gap: 12px; font-size: var(--t-sub); }
.pk-root[data-form="phone"] .pk-page-row { min-height: 44px; padding: 11px 14px; gap: 16px; font-size: var(--t-body); font-weight: 600; border-radius: 999px; }
.pk-root:not([data-form="desk"]) .pk-page-row.pk-selected { background: var(--elevated); color: var(--ink); }
.pk-root:not([data-form="desk"]) .pk-chat-row { min-height: 44px; font-size: var(--t-body); }
.pk-root:not([data-form="desk"]) .pk-search { min-height: 46px; border-radius: 999px; background: var(--canvas); box-shadow: 0 0 0 var(--hair) var(--line); }
.pk-root[data-form="phone"] .pk-drawer-scrim { background: color-mix(in srgb, var(--canvas) 55%, transparent); }

/* ---- iPhone tab bar (PikoLiquidTabBar) ------------------------------------------------------ */
.pk-tabbar { display: none; }
.pk-root[data-form="phone"] .pk-tabbar { display: flex; flex: none; gap: 2px; margin: 4px 16px max(10px, env(safe-area-inset-bottom)); padding: 5px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent); -webkit-backdrop-filter: saturate(1.8) blur(24px); backdrop-filter: saturate(1.8) blur(24px);
  box-shadow: 0 0 0 var(--hair) var(--line), 0 3px 8px rgba(0, 0, 0, .10), 0 6px 16px rgba(0, 0, 0, .08); position: relative; z-index: 2; }
@media (prefers-color-scheme: dark) { .pk-root[data-form="phone"]:not([data-theme="light"]) .pk-tabbar { box-shadow: 0 0 0 var(--hair) var(--line), 0 3px 8px rgba(0, 0, 0, .35), 0 6px 16px rgba(0, 0, 0, .30); } }
.pk-root .pk-tab { flex: 1; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; border-radius: 999px; background: none; color: var(--ink); font: 500 var(--t-cap2)/1 var(--font); cursor: pointer; }
.pk-root .pk-tab .pk-icon { width: 24px; height: 24px; }
.pk-root .pk-tab.pk-selected { background: var(--elevated); }
.pk-root[data-form="phone"] .pk-composer-wrap { padding-bottom: 6px; }
.pk-root[data-form="phone"] .pk-jump { bottom: calc(var(--composer-h, 76px) + 8px); }

/* ---- Pages, cards, sign-in --------------------------------------------------------------------- */
.pk-page-in { animation: pk-page-in .3s var(--m-smooth) both; }
@keyframes pk-page-in { from { opacity: .92; transform: translateY(8px); } }
.pk-root .pk-page-title { font-size: var(--t-title2); font-weight: 600; }
.pk-root .pk-page-sub { font-size: var(--t-foot); }
.pk-root .pk-card, .pk-root .pk-lib-card, .pk-root .pk-idea-tile { border-radius: 16px; background: var(--surface); box-shadow: none; }
@media (hover: hover) { .pk-root :is(.pk-lib-card, .pk-idea-tile):hover { background: color-mix(in srgb, var(--elevated) 55%, var(--surface)); } }
.pk-root .pk-segment button, .pk-root .pk-goal-filter button { transition: background-color .24s var(--m-smooth), color .24s var(--m-smooth), box-shadow .24s var(--m-smooth); }
/* Sign-in card (CloudSignInCard / CloudAuthForm / PikoButtonStyle / PikoInputSurface). */
.pk-root .pk-login-card { width: min(440px, 100%); }
.pk-root .pk-login-title { font-size: var(--t-title2); font-weight: 600; }
.pk-root .pk-login-sub { font-size: var(--t-sub); }
.pk-root .pk-form-label { font-size: var(--t-sub); font-weight: 500; color: var(--ink); }
.pk-root .pk-field, .pk-root .pk-secret { border-radius: 12px; background: var(--elevated);
  box-shadow: inset 0 1px 1px color-mix(in srgb, var(--ink) 2.5%, transparent), inset 0 0 .8px color-mix(in srgb, var(--ink) 1%, transparent); }
.pk-root .pk-field { min-height: 48px; padding: 0 14px; }
.pk-root .pk-secret .pk-field-secret { box-shadow: none; background: none; }
.pk-root .pk-field:focus, .pk-root .pk-secret:focus-within { outline: 0;
  box-shadow: inset 0 1px 3px color-mix(in srgb, var(--ink) 16%, transparent), inset 0 0 .8px color-mix(in srgb, var(--ink) 9%, transparent); }
.pk-root .pk-primary, .pk-root .pk-secondary-button { min-height: 44px; height: auto; padding: 13px 20px; border-radius: 999px; font-size: var(--t-sub); font-weight: 600; }
.pk-root .pk-primary:disabled, .pk-root .pk-primary[data-dim="true"]:not(:disabled) { opacity: .45; }

/* ---- Reduce Motion: every move becomes a short fade (0.12 s) ---------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .pk-root .pk-msg.pk-arrive, .pk-root .pk-live, .pk-root .pk-menu, .pk-root .pk-sheet, .pk-root[data-form="phone"] .pk-sheet, .pk-root .pk-jump, .pk-page-in, .pk-icon-in, .pk-column.pk-chat-switch {
    animation: pk-fade .12s ease-in-out both !important; }
  .pk-root .pk-menu.pk-leaving, .pk-root .pk-sheet.pk-leaving { animation: pk-fade-out .12s ease-in-out both !important; }
  .pk-glyph { animation: none; }
  .pk-root :is(.pk-iconbtn, .pk-primary, .pk-secondary-button, .pk-send, .pk-menu-item, .pk-side-row, .pk-tab, .pk-lib-card, .pk-idea-tile, .pk-feed-open, .pk-goal-open, .pk-panel-row, .pk-panel-square, .pk-reaction-choice):not(:disabled):active { transform: none; }
  .pk-plus .pk-icon, .pk-thinking-head .pk-icon { transition: none; }
}

/* iPhone and iPad put the phase in the header caption; beside the face there is only Piko. */
.pk-root:not([data-form="desk"]) .pk-live .pk-status-text { display: none; }
/* ChatReplyStatus below the text (a tool step after the answer began): the step's label shows on every form. */
.pk-root .pk-live .pk-status.pk-status-below .pk-status-text { display: inline; }

/* iPhone drawer (ChatDrawerView): section titles a size up, every tab row in ink. */
.pk-root[data-form="phone"] .pk-sidebar .pk-side-label { font-size: var(--t-body); padding: 20px 20px 6px; }
.pk-root[data-form="phone"] .pk-page-row, .pk-root[data-form="phone"] .pk-page-row:not(.pk-selected) { color: var(--ink); }

/* Task progress (DESIGN_SYSTEM 1177): an Elevated card, corner 16; 36pt rows; done steps in
   secondary, the running one in ink 600, a failed one struck through. */
.pk-root .pk-steps { background: var(--elevated); border-radius: 16px; padding: 4px 16px; gap: 0; max-height: calc(36px * 6 + 8px); overflow-y: auto; }
.pk-root .pk-step { min-height: 36px; gap: 12px; font-size: var(--t-sub); color: var(--secondary); animation: pk-row-in .3s var(--m-arrival) both; }
.pk-root .pk-step .pk-icon { width: 18px; height: 18px; flex: none; }
.pk-root .pk-step-running { color: var(--ink); font-weight: 600; }
.pk-root .pk-step-failed { color: var(--secondary); }
.pk-root .pk-step-failed span { text-decoration: line-through; }
@keyframes pk-row-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@media (prefers-reduced-motion: reduce) { .pk-root .pk-step { animation: pk-fade .12s ease-in-out both; } }

/* ---- Settings: 你的 BOT, chat size (ProfileSettingsView / GeneralSettingsView) ------------------ */
.pk-group-form { padding: 4px 0 0; }
.pk-group-title { font-size: .8em; font-weight: 600; color: var(--secondary); padding: 10px 16px 2px; }
.pk-form-row { display: flex; flex-direction: column; gap: 4px; padding: 8px 16px; border-bottom: .5px solid var(--line); }
.pk-form-row > span { font-size: .8em; color: var(--secondary); }
.pk-form-input { font: inherit; color: var(--ink); background: transparent; border: 0; outline: 0; padding: 4px 0; min-height: 28px; width: 100%; }
.pk-form-area { resize: vertical; line-height: 1.45; min-height: 64px; }
.pk-form-input::placeholder { color: var(--tertiary); }
.pk-form-row:focus-within > span { color: var(--ink); }
.pk-save-note { margin-left: auto; font-size: .85em; color: var(--secondary); }
/* ChatTextSize: Mac 12 / 13 / 15 / 17 pt, iPhone and iPad 15 / 16 / 18 / 20 pt, relative to the default. */
.pk-root[data-chat-size="small"] .pk-messages { font-size: calc(var(--chat) * .9375); }
.pk-root[data-chat-size="large"] .pk-messages { font-size: calc(var(--chat) * 1.125); }
.pk-root[data-chat-size="xl"] .pk-messages { font-size: calc(var(--chat) * 1.25); }
.pk-root[data-form="desk"][data-chat-size="small"] .pk-messages { font-size: calc(var(--chat) * .923); }
.pk-root[data-form="desk"][data-chat-size="large"] .pk-messages { font-size: calc(var(--chat) * 1.154); }
.pk-root[data-form="desk"][data-chat-size="xl"] .pk-messages { font-size: calc(var(--chat) * 1.308); }
/* 顶部形象: the face in the chat header, small → extra large, or hidden. */
.pk-root[data-head-avatar="small"] .pk-head-id .pk-avatar { width: 20px !important; height: 15px !important; }
.pk-root[data-head-avatar="large"] .pk-head-id .pk-avatar { width: 30px !important; height: 22px !important; }
.pk-root[data-head-avatar="xl"] .pk-head-id .pk-avatar { width: 36px !important; height: 26px !important; }
.pk-root[data-head-avatar="hidden"] .pk-head-id .pk-avatar { display: none; }
.pk-row-volume { gap: 12px; }
.pk-volume { flex: 1; min-width: 80px; max-width: 220px; height: 44px; accent-color: var(--ink); }
.pk-row-action { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 12px; background: var(--elevated); font-weight: 500; }
.pk-form-tone .pk-segment { align-self: flex-start; margin-top: 2px; }

/* ---- Performance: long chats render only what is near the screen; streaming stays on its own layer. */
.pk-messages > .pk-msg:not(:nth-last-child(-n+12)) { content-visibility: auto; contain-intrinsic-size: auto 120px; }
.pk-msg { contain: layout style; }
@media (prefers-reduced-motion: reduce) { .pk-level, .pk-goal-bar > span { transition: none; } }
/* Segmented controls stay 28pt to the eye, but take a 44pt tall touch. */
.pk-root[data-form="phone"] .pk-segment button, .pk-root[data-form="pad"] .pk-segment button { position: relative; }
.pk-root[data-form="phone"] .pk-segment button::after, .pk-root[data-form="pad"] .pk-segment button::after { content: ""; position: absolute; left: 0; right: 0; top: -8px; bottom: -8px; }

/* Account deletion: the notice and the final action are red in both themes. */
.pk-delete-notice { color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.pk-delete-notice ul { margin: 6px 0 0; padding-left: 18px; }
.pk-delete-notice li + li { margin-top: 4px; }
.pk-root .pk-primary.pk-primary-danger, .pk-primary.pk-primary-danger { background: var(--danger); color: #fff; }
.pk-check.pk-check-danger { border-color: var(--danger); }
.pk-check.pk-check-danger:checked { border-color: var(--danger); background-color: var(--danger); }
.pk-root .pk-danger, .pk-root .pk-row-button.pk-danger, .pk-root .pk-row-button.pk-danger span { color: var(--danger); }

/* ---- Message menu lift (MessageActionOverlay / MessageMenuLift) ---------------------------------- */
.pk-layer-dim { background: rgba(0, 0, 0, .08); animation: pk-dim-in .18s ease-out both; }
.pk-root[data-theme="dark"] .pk-layer-dim { background: rgba(0, 0, 0, .18); }
@media (prefers-color-scheme: dark) { .pk-root:not([data-theme="light"]) .pk-layer-dim { background: rgba(0, 0, 0, .18); } }
.pk-layer-dim.pk-layer-leaving { animation: pk-dim-out .14s ease-out both; }
@keyframes pk-dim-in { from { opacity: 0; } }
@keyframes pk-dim-out { to { opacity: 0; } }
.pk-layer-dim.pk-layer-leaving .pk-lift { transition: transform .18s cubic-bezier(.30, 0, .50, 1), box-shadow .18s ease-out; box-shadow: none; }
.pk-lift { position: absolute; z-index: 1; box-sizing: border-box; padding: 12px; border-radius: 22px; background: var(--canvas); overflow-y: auto; overscroll-behavior: contain;
  transform-origin: 0 0; will-change: transform; font-size: var(--chat); line-height: 1.6; pointer-events: auto; }
.pk-lift.pk-lift-in { transition: transform .30s cubic-bezier(.16, 1, .30, 1), box-shadow .30s ease-out; box-shadow: 0 5px 12px rgba(0, 0, 0, .10); }
.pk-lift.pk-lift-user { padding: 0; background: none; overflow: visible; display: flex; justify-content: flex-end; }
.pk-lift.pk-lift-user.pk-lift-in { box-shadow: none; }
.pk-lift.pk-lift-user > .pk-bubble { max-width: 100%; box-shadow: 0 5px 12px rgba(0, 0, 0, .10); }
.pk-lift > .pk-prose, .pk-lift > .pk-bubble { margin: 0; }
.pk-lift-source { opacity: 0; }
.pk-menu.pk-menu-lifted { position: absolute; z-index: 2; animation: pk-menu-reveal .18s ease-out both; }
@keyframes pk-menu-reveal { from { opacity: 0; transform: translateY(-6px); } }
.pk-lifted { transform: translateY(-2px); transition: transform .30s cubic-bezier(.16, 1, .30, 1); }
.pk-msg .pk-bubble, .pk-msg .pk-prose { transition: transform .18s cubic-bezier(.30, 0, .50, 1); }
@media (prefers-reduced-motion: reduce) { .pk-lifted { transform: none; } .pk-layer-dim, .pk-menu.pk-menu-lifted { animation-duration: .12s; } }

/* ---- pikoRowTransition: list rows added / removed ------------------------------------------------ */
.pk-row-host { position: relative; }
.pk-row-in { animation: pk-row-in .24s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes pk-row-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.pk-row-ghost { position: absolute !important; margin: 0 !important; pointer-events: none; z-index: 1; animation: pk-row-out .18s cubic-bezier(.30, 0, .50, 1) both; }
@keyframes pk-row-out { to { opacity: 0; transform: scale(.98); } }
@media (prefers-reduced-motion: reduce) { .pk-row-in, .pk-row-ghost { animation: none; } .pk-row-ghost { display: none; } }

/* ---- The 灵息 fades out when the reply ends (0.18 s) ----------------------------------------------- */
.pk-aura-fading { position: absolute !important; margin: 0 !important; pointer-events: none; z-index: 1; animation: pk-aura-out .18s ease-in-out both; }
@keyframes pk-aura-out { to { opacity: 0; } }

/* ---- PESA 交办任务 (BackgroundWorkViews.swift) ------------------------------------------------- */
/* The line above the composer: appears by itself (enter 0.32 s, rise 8pt), leaves by itself (0.18 s). */
.pk-things-entry { max-width: 760px; margin: 0 auto 6px; display: flex; flex-direction: column; gap: 4px; }
.pk-things-entry.pk-things-in { animation: pk-rise var(--enter) both; }
.pk-things-entry.pk-things-leaving { animation: pk-things-out var(--exit) both; }
@keyframes pk-things-out { to { opacity: 0; transform: translateY(6px); } }
.pk-things-line { display: flex; align-items: center; gap: 4px; }
.pk-root .pk-things-open { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border-radius: 12px; text-align: left;
  transition: background var(--hover); }
.pk-root .pk-things-open:hover { background: var(--elevated); }
.pk-things-open .pk-icon { width: 18px; height: 18px; flex: none; }
.pk-things-open .pk-icon:last-child { width: 14px; height: 14px; color: var(--secondary); }
.pk-things-title { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-sub, 14px); }
.pk-things-status { flex: none; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--secondary); font-size: .9em; }
.pk-root .pk-things-dismiss { width: 44px; height: 44px; flex: none; }
.pk-things-choices { display: flex; gap: 8px; padding-bottom: 4px; }
.pk-root .pk-things-btn { flex: 1; min-height: 44px; padding: 0 14px; border-radius: 12px; background: var(--elevated); color: var(--ink); font-weight: 600;
  transition: opacity var(--hover), transform .1s ease-out; }
.pk-root .pk-things-btn.pk-things-main { background: var(--ink); color: var(--on-ink); }
.pk-root .pk-things-btn:active { transform: scale(.97); }
.pk-root .pk-things-btn:hover { opacity: .86; }

/* The sheet: list and detail side by side when wide; on a phone the detail pushes in (nav 0.34 s). */
.pk-sheet.pk-things-sheet { width: min(920px, calc(100% - 32px)); height: min(680px, calc(100% - 48px)); overflow: hidden; display: flex; }
.pk-root[data-form="phone"] .pk-sheet.pk-things-sheet { width: 100%; height: calc(100% - 24px); }
.pk-things { flex: 1; min-width: 0; display: grid; grid-template-columns: 300px 1fr; overflow: hidden; position: relative; }
.pk-things-pane { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.pk-things-listpane { border-right: 1px solid var(--line); }
.pk-things-head { padding: 10px 10px 4px; }
.pk-root .pk-things-head .pk-iconbtn { width: 44px; height: 44px; }
.pk-things-head .pk-head-spacer { width: 44px; }
.pk-things-list { flex: 1; overflow-y: auto; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 16px; position: relative; }
.pk-things-group { display: flex; flex-direction: column; gap: 2px; }
.pk-things-grouptitle { margin: 0; padding: 0 8px 2px; font-size: .88em; font-weight: 600; color: var(--secondary); }
.pk-root .pk-things-row { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; text-align: left;
  transition: background var(--hover), transform .1s ease-out; }
.pk-root .pk-things-row:hover { background: var(--elevated); }
.pk-root .pk-things-row.pk-on { background: var(--elevated); }
.pk-root .pk-things-row:active { transform: scale(.98); }
.pk-things-rowtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pk-things-rowtitle { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-things-rowsub { font-size: .88em; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-things-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); flex: none; }
.pk-root .pk-things-toggle { min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 8px; color: var(--secondary); font-size: .88em; font-weight: 600; text-align: left; }
.pk-things-toggle .pk-icon { width: 12px; height: 12px; transition: transform var(--layout); }
.pk-things-toggle[aria-expanded="true"] .pk-icon { transform: rotate(90deg); }
.pk-things-empty { margin: 8px; color: var(--secondary); }
.pk-things-detail { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pk-things-detail.pk-things-enter { animation: pk-fade var(--layout) both; }
.pk-things-scroll { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }
.pk-root .pk-things-back { display: none; align-self: flex-start; min-height: 44px; align-items: center; gap: 4px; margin: -12px 0 -12px -8px; padding: 0 8px; color: var(--secondary); }
.pk-things-back .pk-icon { width: 16px; height: 16px; }
.pk-things-header { display: flex; align-items: flex-start; gap: 12px; }
.pk-things-heading { flex: 1; min-width: 0; }
.pk-things-name { margin: 0; font-size: 1.45em; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.pk-things-number { margin: 4px 0 0; color: var(--secondary); font-variant-numeric: tabular-nums; }
.pk-things-header .pk-things-btn { flex: none; }
.pk-root .pk-things-more { width: 44px; height: 44px; flex: none; }
.pk-things-links { display: flex; flex-direction: column; gap: 4px; }
.pk-root .pk-things-related { min-height: 44px; display: flex; align-items: center; gap: 6px; color: var(--secondary); font-size: .9em; font-weight: 600; text-align: left; }
.pk-things-related span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-things-related .pk-icon { width: 12px; height: 12px; flex: none; }
.pk-things-card { padding: 16px; border-radius: 20px; background: var(--elevated); display: flex; flex-direction: column; gap: 12px; }
/* 已执行的步骤 · N (BackgroundWorkViews.stepsSection): a 44pt toggle, then the list on a card; grid rows animate open. */
.pk-things-steps { display: flex; flex-direction: column; }
.pk-root .pk-things-steps-toggle { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 2px; align-self: stretch;
  font-size: .85em; font-weight: 600; color: var(--secondary); text-align: left; background: none; border-radius: 10px; }
.pk-things-steps-toggle .pk-icon { width: 12px; height: 12px; transition: transform var(--layout); }
.pk-things-steps.pk-open .pk-things-steps-toggle .pk-icon { transform: rotate(90deg); }
.pk-things-steps-body { display: grid; grid-template-rows: 0fr; opacity: 0; visibility: hidden;
  transition: grid-template-rows var(--layout), opacity var(--layout), visibility 0s linear .24s; }
.pk-things-steps.pk-open .pk-things-steps-body { grid-template-rows: 1fr; opacity: 1; visibility: visible; transition: grid-template-rows var(--layout), opacity var(--layout), visibility 0s; }
.pk-things-steps-clip { min-height: 0; overflow: hidden; }
.pk-things-steps-list { margin: 0; padding: 16px; list-style: none; border-radius: 20px; background: var(--elevated); display: flex; flex-direction: column; gap: 12px; }
.pk-things-step { display: flex; align-items: flex-start; gap: 10px; content-visibility: auto; contain-intrinsic-size: auto 40px; }
.pk-things-step > .pk-icon { width: 16px; height: 16px; margin: 2px; flex: none; color: var(--secondary); }
.pk-things-step-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pk-things-step-title { font-size: .95em; overflow-wrap: anywhere; }
.pk-things-step-detail { font-size: .85em; color: var(--secondary); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .pk-things-steps-body, .pk-things-steps-toggle .pk-icon { transition: none; } }
.pk-things-card p { margin: 0; }
.pk-things-cardtitle { font-size: .88em; font-weight: 600; color: var(--secondary); }
.pk-things-cardnote { color: var(--secondary); }
.pk-things-line-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pk-things-gone { margin: auto; color: var(--secondary); padding: 40px 0; text-align: center; }
.pk-things-note { display: flex; align-items: flex-end; gap: 8px; margin: 12px 24px; padding: 2px 2px 2px 16px; min-height: 48px; border-radius: 24px; background: var(--elevated); }
.pk-things-input { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: none; color: var(--ink); font: inherit; font-size: 15px; line-height: 1.45; padding: 12px 0; min-height: 44px; max-height: 96px; box-sizing: border-box; }
.pk-root .pk-things-send { width: 44px; height: 44px; flex: none; display: grid; place-items: center; background: none; }
.pk-root .pk-things-send .pk-send-key { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--on-ink); }
.pk-root .pk-things-send:disabled { opacity: .35; }
.pk-things.pk-things-narrow { grid-template-columns: 100% 100%; }
.pk-things.pk-things-narrow .pk-things-pane { transition: transform var(--nav); }
.pk-things.pk-things-narrow.pk-things-pushed .pk-things-pane { transform: translateX(-100%); }
.pk-things.pk-things-narrow .pk-things-listpane { border-right: 0; }
.pk-root .pk-things.pk-things-narrow .pk-things-back { display: inline-flex; }
.pk-things.pk-things-narrow .pk-things-scroll { padding: 16px; }
.pk-things.pk-things-narrow .pk-things-note { margin: 8px 12px 12px; }
@media (prefers-reduced-motion: reduce) { .pk-things-pane, .pk-things-toggle .pk-icon { transition: none; } .pk-things-entry.pk-things-in, .pk-things-detail.pk-things-enter { animation: none; } }
.pk-things-input:focus-visible { outline: none; }
.pk-things-note { transition: box-shadow var(--hover); }
.pk-things-note:focus-within { box-shadow: 0 0 0 1.5px var(--tertiary); }
/* A toast while the sheet is open sits above its note field. */
.pk-root:has(.pk-things-sheet) .pk-toast { bottom: 132px; }
.pk-things-approvaltitle { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pk-things-approvaltitle .pk-icon { width: 18px; height: 18px; flex: none; }
.pk-things-approvaltext { color: var(--secondary); font-size: .92em; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 12; -webkit-box-orient: vertical; overflow: hidden; }
.pk-root .pk-things-btn.pk-things-wide { flex: none; width: 100%; }
.pk-root .pk-things-btn:disabled { opacity: .45; }
.pk-things-error { margin: -8px 0 0; color: var(--danger); font-size: .92em; }
/* 按名称或编号查找 (BackgroundWorkViews): a 44pt field above the list; 全部停止 under 正在做. */
.pk-root .pk-things-search { display: block; box-sizing: border-box; width: calc(100% - 16px); min-height: 44px; margin: 0 8px 8px; padding: 0 12px; border: 0; border-radius: 12px;
  background: var(--elevated); color: var(--ink); font: inherit; outline: none; }
.pk-root .pk-things-search:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 25%, transparent); }
.pk-root .pk-things-stopall { flex: none; align-self: flex-start; margin: 2px 8px 10px; }
.pk-things-row { -webkit-touch-callout: none; }
.pk-things-syncfail { display: grid; gap: 8px; margin: 0; padding: 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--danger) 9%, transparent); }
.pk-things-syncfail p { margin: 0; }
.pk-things-code { color: var(--secondary); }
.pk-things-code code { font-family: var(--mono); color: var(--ink); user-select: all; }
.pk-things-syncfail .pk-things-btn { justify-self: start; }
.pk-things-confirm h2 { margin: 4px 4px 0; font-size: 1.1em; font-weight: 600; }
.pk-things-confirm .pk-primary, .pk-things-confirm .pk-secondary-button { min-height: 46px; }

/* ---- ChatWelcomeView: a new chat ----------------------------------------------------------------- */
.pk-welcome { max-width: var(--col); margin: 0 auto; padding: 68px 32px 32px; display: flex; flex-direction: column; gap: 10px; text-align: left; animation: pk-rise var(--enter) both; }
.pk-welcome-compact { padding: 24px; max-width: 480px; justify-content: center; min-height: 100%; box-sizing: border-box; }
.pk-welcome-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.pk-welcome-sub { margin: 0; font-size: 15px; color: var(--secondary); }
.pk-welcome-guide { margin: 0 0 14px; font-size: 13px; color: var(--secondary); }
.pk-welcome-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.pk-welcome-card { padding: 20px; border-radius: 20px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 8px; }
.pk-welcome-label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 15px; }
.pk-welcome-label .pk-icon { width: 18px; height: 18px; }
.pk-welcome-goal { margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pk-welcome-bar { height: 4px; border-radius: 2px; background: var(--elevated); overflow: hidden; }
.pk-welcome-bar span { display: block; height: 100%; width: var(--value, 0%); background: var(--ink); border-radius: 2px; }
.pk-root .pk-welcome-link { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; color: var(--ink); }
.pk-welcome-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-welcome-link .pk-icon { width: 16px; height: 16px; flex: none; color: var(--secondary); }

/* ---- ChatTimestampReveal (touch): the time keeps its slot, develops in on a tap, dissolves after 3.2 s -- */
.pk-stamp-touch { opacity: 0; filter: blur(5px); transition: opacity .5s cubic-bezier(.4, 0, .6, 1), filter .5s cubic-bezier(.4, 0, .6, 1); pointer-events: none; }
.pk-stamp-touch.pk-stamp-on { opacity: 1; filter: none; transition: opacity .55s cubic-bezier(.2, .9, .3, 1), filter .55s cubic-bezier(.2, .9, .3, 1); }
@media (prefers-reduced-motion: reduce) { .pk-stamp-touch, .pk-stamp-touch.pk-stamp-on { filter: none; transition-duration: .12s; } }

/* ---- ChatQueuedTurnsView: waiting messages above the composer ------------------------------------------ */
.pk-queue { max-width: 760px; margin: 0 auto 8px; background: var(--elevated); border-radius: 16px; overflow: hidden; animation: pk-rise var(--enter) both; --qh: 48px; --qw: 52px; --ql: 44px; }
.pk-root[data-form="desk"] .pk-queue { --qh: 44px; --qw: 44px; --ql: 36px; } /* the client uses 36pt rows on Mac; 44 px is this project’s minimum target */
.pk-root .pk-queue-head { width: 100%; height: var(--qh); min-height: 44px; display: flex; align-items: center; gap: 8px; text-align: left; color: var(--ink); }
.pk-queue-lead { width: var(--ql); height: var(--qh); flex: none; display: grid; place-items: center; }
.pk-queue-lead .pk-icon { width: 16px; height: 16px; }
.pk-queue-grip .pk-icon { width: 14px; height: 14px; color: var(--secondary); }
.pk-queue-count { font-size: 12px; font-weight: 600; flex: none; }
.pk-queue-first { min-width: 0; flex: 1; font-size: 12px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-queue-chevron { margin-left: auto; width: var(--qw); height: var(--qh); display: grid; place-items: center; flex: none; }
.pk-queue-chevron .pk-icon { width: 14px; height: 14px; transform: rotate(90deg); transition: transform var(--layout); }
.pk-queue-head[aria-expanded="false"] .pk-queue-chevron .pk-icon { transform: none; }
.pk-queue-list { overflow-y: auto; max-height: calc(var(--qh) * var(--rows, 3)); }
.pk-queue-list[data-rows="1"] { --rows: 1; } .pk-queue-list[data-rows="2"] { --rows: 2; } .pk-queue-list[data-rows="3"] { --rows: 3; }
.pk-queue-list[data-rows="4"] { --rows: 4; } .pk-queue-list[data-rows="5"] { --rows: 5; }
.pk-queue-list[data-peek="true"] { max-height: calc(var(--qh) * (var(--rows) + .5)); }
.pk-queue-row { display: flex; align-items: center; min-height: var(--qh); }
.pk-queue-row.pk-dragging { opacity: .5; }
.pk-root .pk-queue-main { flex: 1; min-width: 0; height: var(--qh); min-height: 44px; display: flex; align-items: center; gap: 8px; text-align: left; color: var(--ink); }
.pk-queue-files { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--secondary); font-variant-numeric: tabular-nums; flex: none; }
.pk-queue-files .pk-icon { width: 14px; height: 14px; }
.pk-queue-text { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pk-root .pk-queue-action { width: var(--qw); min-width: 44px; height: var(--qh); min-height: 44px; flex: none; display: grid; place-items: center; color: var(--ink); transition: opacity var(--hover); }
.pk-queue-action .pk-icon { width: 17px; height: 17px; }
.pk-root[data-form="desk"] .pk-queue-row .pk-queue-action { opacity: .35; }
.pk-root[data-form="desk"] .pk-queue-row:hover .pk-queue-action, .pk-root[data-form="desk"] .pk-queue-action:focus-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .pk-queue { animation: none; } .pk-queue-chevron .pk-icon { transition: none; } }

/* ---- MemoryManagementView ---------------------------------------------------------------------------- */
.pk-sheet .pk-mem { gap: 10px; }
.pk-mem-section { margin: 8px 4px 0; font-size: .95em; font-weight: 500; }
.pk-mem-note { margin: 0 4px; font-size: 13px; }
.pk-root .pk-row-nav { justify-content: space-between; min-height: 44px; }
.pk-row-nav .pk-icon { width: 14px; height: 14px; color: var(--secondary); }
.pk-mem .pk-row { min-height: 44px; }
.pk-mem-search { margin-top: 2px; }
.pk-mem-list { display: flex; flex-direction: column; gap: 10px; }
.pk-mem-card { padding: 14px 16px; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 .5px var(--line); display: flex; flex-direction: column; gap: 6px; }
.pk-mem-card p { margin: 0; }
.pk-mem-category, .pk-mem-date { font-size: 12px; color: var(--secondary); }
.pk-mem-content { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.pk-mem-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 8px; text-align: center; }
.pk-mem-empty .pk-icon { width: 30px; height: 30px; }
.pk-mem-empty p { margin: 0; }
.pk-mem-empty-title { font-weight: 500; }
.pk-mem .pk-switch:disabled { opacity: .45; cursor: default; }
.pk-root .pk-mem .pk-sheet-head .pk-iconbtn { width: 44px; height: 44px; }
.pk-mem .pk-sheet-head .pk-head-spacer { width: 44px; }
.pk-mem-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pk-root .pk-mem-add { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 12px; background: var(--elevated); color: var(--ink); font-weight: 500; }
.pk-mem-add .pk-icon { width: 16px; height: 16px; }
.pk-mem-card { flex-direction: row; align-items: flex-start; gap: 8px; }
.pk-root .pk-mem-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--ink); min-height: 44px; }
.pk-root .pk-mem-trash { width: 44px; height: 44px; flex: none; color: var(--danger); }
.pk-mem-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--secondary); }
.pk-mem-state .pk-icon { width: 14px; height: 14px; }
.pk-mem-state-bad { color: var(--danger); }
.pk-root .pk-mem-retry { min-height: 44px; padding: 0 10px; border-radius: 10px; color: var(--ink); font-weight: 500; }
.pk-mem-pending { box-shadow: 0 0 0 1px var(--line); background: var(--canvas); }
.pk-mem-deleting { text-decoration: line-through; color: var(--secondary); }
.pk-mem-editor .pk-mem-text { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; font: inherit; line-height: 1.5; }
.pk-mem-editor .pk-mem-select { min-height: 44px; }

/* 资源库 构件 / 影音内容 (LibraryView segments; MacLibraryFilter on Mac): two 44pt options on a surface tray. */
.pk-lib-bar { flex-wrap: wrap; }
.pk-lib-segrow { flex: 0 0 100%; min-width: 0; }
.pk-root[data-form="desk"] .pk-lib-segrow { flex: none; }
.pk-lib-segments { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 .5px var(--line); width: 100%; max-width: 300px; box-sizing: border-box; }
.pk-root[data-form="desk"] .pk-lib-segments { width: 220px; }
.pk-root .pk-lib-segment { flex: 1; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background var(--hover), box-shadow var(--hover); }
.pk-root[data-form="desk"] .pk-lib-segment { min-height: 30px; font-size: 12px; }
.pk-root .pk-lib-segment[aria-pressed="true"] { background: var(--elevated); box-shadow: 0 0 0 .5px var(--line); }
.pk-root .pk-lib-segment:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

/* ArtifactFileCard: one surface — a small view of the content above the file entry (filename, “format · size”). */
.pk-root .pk-art-card { display: flex; flex-direction: column; align-items: stretch; width: 100%; min-width: 0; padding: 0; border: 0; border-radius: 18px; background: var(--surface);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; overflow: hidden; box-shadow: 0 0 0 .5px var(--line); transition: transform .1s ease-out, background var(--hover);
  -webkit-touch-callout: none; }
.pk-root .pk-art-card:hover { background: color-mix(in srgb, var(--elevated) 45%, var(--surface)); }
.pk-root .pk-art-card:active { transform: scale(.985); }
.pk-root .pk-art-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pk-art-view { display: block; height: 176px; margin: 4px 4px 0; border-radius: 14px; background: var(--page); overflow: hidden; position: relative; }
.pk-art-view::after { content: ""; position: absolute; inset: auto 0 0; height: 44px; background: linear-gradient(transparent, var(--page)); }
.pk-art-view-text { display: block; padding: 12px 14px; font-size: 12px; line-height: 1.5; color: var(--secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
.pk-art-view-text.pk-art-code { font-family: var(--mono); font-size: 11px; }
.pk-art-foot { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px; box-sizing: border-box; }
.pk-art-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; }
.pk-art-icon .pk-icon { width: 20px; height: 20px; }
.pk-art-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pk-art-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-art-meta { font-size: 12px; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-msg-artifacts { display: flex; flex-direction: column; gap: 10px; max-width: 520px; margin-top: 10px; }
/* ArtifactPreviewView: the synced preview, text as written; a picture from the original when the account has it. */
.pk-art-pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 15px; line-height: 1.55; }
.pk-art-pre.pk-art-code { font-family: var(--mono); font-size: 13px; }
.pk-art-image { display: block; max-width: 100%; height: auto; margin: 0 0 16px; border-radius: 14px; }
.pk-art-note { margin: 18px 0 0; font-size: 13px; line-height: 1.5; color: var(--secondary); }
@media (prefers-reduced-motion: reduce) { .pk-root .pk-art-card { transition: none; } .pk-root .pk-art-card:active { transform: none; } }

/* 临时对话 notice (ChatComposer): chat icon 16pt, footnote, secondary, two lines at most, 14pt in, 8pt above. */
.pk-tempnotice { display: flex; align-items: center; gap: 8px; padding: 8px 14px 2px; color: var(--secondary); }
.pk-tempnotice[hidden] { display: none; }
.pk-tempnotice > .pk-icon { width: 16px; height: 16px; flex: none; }
.pk-tempnotice > span { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pk-root .pk-menu-item:disabled { opacity: .4; cursor: default; }

/* ComposerCommandPanel: the top part of the composer — rows of 44pt, icon in the “+” column, title on the input's
   leading edge, the typed name at the trailing edge; up to five rows show, more scroll (220pt); a hairline below. */
.pk-cmd { padding: 6px 6px 0; max-height: 226px; overflow-y: auto; border-bottom: .5px solid var(--line); margin: 0 8px; }
.pk-cmd[hidden] { display: none; }
.pk-cmd.pk-cmd-in { animation: pk-fade .18s ease-out both; }
.pk-root .pk-cmd-row { display: flex; align-items: center; gap: 8px; width: 100%; height: 44px; padding: 0 12px 0 0; border: 0; border-radius: 12px; background: transparent;
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.pk-root .pk-cmd-row > .pk-icon { width: 44px; flex: none; height: 18px; color: var(--secondary); }
.pk-root .pk-cmd-row.pk-on, .pk-root .pk-cmd-row:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.pk-cmd-title { flex: none; max-width: 50%; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-cmd-detail { flex: 1; min-width: 0; font-size: 12px; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-cmd-alias { margin-left: auto; flex: none; padding-left: 8px; font-family: var(--mono); font-size: 12px; color: var(--secondary); }
.pk-root[data-form="desk"] .pk-cmd-title { font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .pk-cmd.pk-cmd-in { animation: none; } }

/* 使用指引 (GuidedTourOverlay): a small card over the real interface — no dimming, nothing else blocked. Card 350
   (narrower screens keep 12 from the edges), 22 corners, 1pt ink hairline, soft shadow; the target gets a 2pt ring
   4pt outside it with 14 corners. Steps move with a gentle spring (0.38 s); text changes cross-fade (0.18 s). */
.pk-tour { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; }
.pk-tour[hidden] { display: none; }
.pk-tour-ring { position: fixed; left: 0; top: 0; width: var(--ring-w, 0); height: var(--ring-h, 0); transform: translate(var(--ring-x, 0), var(--ring-y, 0));
  border: 2px solid color-mix(in srgb, var(--ink) 65%, transparent); border-radius: 14px; box-sizing: border-box;
  transition: transform .38s cubic-bezier(.3, 1.08, .5, 1), width .38s cubic-bezier(.3, 1.08, .5, 1), height .38s cubic-bezier(.3, 1.08, .5, 1); }
.pk-tour-ring[hidden] { display: none; }
.pk-root .pk-tour-card { position: fixed; left: 0; top: 0; width: var(--tour-w, 350px); max-height: calc(100% - 24px); overflow-y: auto; box-sizing: border-box;
  transform: translate(var(--tour-x, 12px), var(--tour-y, 12px)); pointer-events: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px;
  border-radius: 22px; background: color-mix(in srgb, var(--float) 96%, transparent); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 16%, transparent), 0 5px 16px rgba(0, 0, 0, .12); color: var(--ink);
  transition: transform .38s cubic-bezier(.3, 1.08, .5, 1); }
.pk-root .pk-tour-card[hidden] { display: none; }
.pk-tour-head { display: flex; align-items: flex-start; justify-content: space-between; }
.pk-tour-face { width: 46px; height: 46px; display: grid; place-items: center; }
.pk-tour-face .pk-avatar { display: block; transform-origin: 50% 70%; }
.pk-root .pk-tour-close { width: 44px; height: 44px; margin: -8px -8px 0 0; color: var(--secondary); }
.pk-tour-title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.pk-tour-body { margin: 4px 0 0; font-size: 15px; line-height: 1.45; color: var(--secondary); }
.pk-tour-actions { display: flex; justify-content: flex-end; }
.pk-tour-actions[hidden] { display: none; }
.pk-root .pk-tour-go { min-height: 44px; width: auto; padding: 0 20px; border-radius: 22px; font-size: 15px; font-weight: 600; }
.pk-tour-card.pk-tour-swap .pk-tour-text { animation: pk-fade .18s ease-in-out both; }
/* The face moves a little with each step (GuidedTourCoach gestures), only when motion is welcome. */
.pk-tour-card.pk-tour-swap .pk-tour-face .pk-avatar { animation: pk-tour-nod .6s cubic-bezier(.3, 1.08, .5, 1) both; }
.pk-tour-face[data-gesture="finish"] .pk-avatar { transform: scale(1.02); }
@keyframes pk-tour-nod { 0% { transform: rotate(0) } 35% { transform: rotate(-6deg) translateY(-2px) } 70% { transform: rotate(3deg) } 100% { transform: rotate(0) } }
.pk-root[data-form="desk"] .pk-tour-title { font-size: 15px; }
.pk-root[data-form="desk"] .pk-tour-body { font-size: 13px; }
.pk-row-stack { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; text-align: left; }
.pk-row-note { font-size: .85em; color: var(--secondary); line-height: 1.35; }
@media (prefers-reduced-motion: reduce) {
  .pk-root .pk-tour .pk-tour-card, .pk-root .pk-tour .pk-tour-ring { transition-property: none !important; } /* no gliding at all (PikoMotion.tour is nil) */
  .pk-tour-card.pk-tour-swap .pk-tour-text { animation-duration: .12s; }
  .pk-tour-card.pk-tour-swap .pk-tour-face .pk-avatar { animation: none; }
}
@media (prefers-reduced-transparency: reduce) { .pk-root .pk-tour-card { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 16%, transparent); } }

/* ---- Piko CRM connections (1.5): 设置 → 连接 → Piko CRM, and the card before a CRM change ---------- */
.pk-crm-entry-name { display: inline-flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.pk-crm-entry-name .pk-icon { width: 18px; height: 18px; color: var(--ink); }
.pk-crm-count { margin-left: auto; }
.pk-sheet .pk-crm-sheet { gap: 12px; }
.pk-crm-lede { margin: 0 4px; font-size: 13px; }
.pk-crm-list { display: flex; flex-direction: column; gap: 12px; }
.pk-crm-space .pk-row { min-height: 44px; }
.pk-crm-head { cursor: pointer; }
.pk-crm-mark { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: 15px; }
.pk-crm-mark .pk-icon { width: 18px; height: 18px; }
.pk-crm-name > span:first-child { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.pk-crm-access .pk-segment { flex: none; }
.pk-crm-access .pk-segment button:disabled { opacity: .4; cursor: not-allowed; }
.pk-crm-why { margin: 0; padding: 0 14px 10px; font-size: 12px; color: var(--secondary); line-height: 1.4; }
.pk-crm-open { color: var(--ink); text-decoration: none; justify-content: space-between; border-top: 1px solid var(--line); }
.pk-crm-open .pk-icon { width: 15px; height: 15px; color: var(--secondary); }
.pk-crm-none { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 8px; text-align: center; }
.pk-crm-none .pk-icon { width: 30px; height: 30px; color: var(--secondary); }
.pk-crm-none-title { margin: 0; font-weight: 500; }
.pk-crm-open-empty { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; padding: 0 20px; }
.pk-crm-empty { margin: 0 4px; }

.pk-crm-slot { margin: 6px 0 8px; }
.pk-crm-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 var(--hair, .5px) var(--line); max-width: 520px; }
.pk-crm-card-head { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--t-foot, 13px); color: var(--secondary); }
.pk-crm-card-head .pk-icon { width: 16px; height: 16px; flex: none; color: var(--ink); }
.pk-crm-card-title { font-weight: 600; color: var(--ink); white-space: nowrap; }
.pk-crm-card-space { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-crm-card-space::before { content: "·"; margin-right: 8px; }
.pk-crm-review { margin: 0; color: var(--ink); font-size: var(--t-callout, 15px); line-height: 1.45; overflow-wrap: anywhere; }
.pk-crm-changes { display: flex; flex-direction: column; border-radius: 10px; background: var(--elevated); padding: 2px 12px; }
.pk-crm-change { display: grid; grid-template-columns: minmax(56px, auto) 1fr; gap: 12px; align-items: baseline; padding: 7px 0; font-size: var(--t-sub, 14px); }
.pk-crm-change + .pk-crm-change { border-top: var(--hair, .5px) solid var(--line); }
.pk-crm-field { color: var(--secondary); white-space: nowrap; }
.pk-crm-values { min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.pk-crm-from { color: var(--secondary); text-decoration: line-through; }
.pk-crm-arrow { color: var(--secondary); margin: 0 6px; }
.pk-crm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pk-root .pk-crm-actions .pk-primary, .pk-root .pk-crm-actions .pk-secondary-button { min-height: 36px; height: auto; padding: 8px 18px; font-size: var(--t-sub, 14px); width: auto; }
.pk-crm-actions .pk-primary { display: inline-flex; align-items: center; gap: 6px; }
.pk-crm-actions .pk-primary .pk-icon { width: 16px; height: 16px; }
.pk-root[data-form="phone"] .pk-crm-actions > * { flex: 1; justify-content: center; }
@media (prefers-reduced-motion: no-preference) { .pk-crm-card { animation: pk-crm-in .32s var(--m-enter, cubic-bezier(.16, 1, .3, 1)); } }
@keyframes pk-crm-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
