/* JD conversation history — editorial monochrome, open layout.
   Inherits theme tokens (--surface, --text, --border, --serif...) so light/dark/mono all work. */
.jd-chat-heading{align-items:flex-start;gap:16px}
.jd-chat-heading-actions{display:flex;gap:8px;flex-wrap:wrap}
.jd-chat-meta{font-size:.85rem;color:var(--text-2);overflow-wrap:anywhere}
.jd-turn-time{display:block;font-size:.72rem;color:var(--muted);margin-top:3px;text-align:end}
.jd-turn-time-jd{text-align:start;margin-top:-20px;margin-inline-start:58px}
.jd-conversation-home .jd-home-chats{margin-inline-start:auto;white-space:nowrap}
.jd-conversation-home .badge{margin-inline-start:0}

.jd-chats-panel{display:flex;flex-direction:column;width:100%;max-width:960px;color:var(--text);font-family:inherit;background:transparent;border:0;box-shadow:none;border-radius:0}
body.in-app #view-app .jd-chats-panel{max-width:960px;background:transparent;border:0;box-shadow:none;border-radius:0}

/* Heading */
.jd-chats-header{display:flex;flex-direction:column;gap:0}
.jd-chats-intro{padding-bottom:28px;border-bottom:1px solid var(--text)}
.jd-chats-kicker{margin:0 0 14px;font-size:.6875rem;font-weight:600;letter-spacing:.22em;text-transform:uppercase;color:var(--muted)}
.jd-chats-title{margin:0;font-weight:600;font-size:clamp(2.1rem,1.4rem + 3vw,3.6rem);line-height:1;letter-spacing:-.04em;text-wrap:balance}
.jd-chats-title em{font-family:var(--serif,Georgia,serif);font-style:italic;font-weight:400;letter-spacing:-.015em}
.jd-chats-lead{margin:16px 0 0;max-width:58ch;font-size:1rem;line-height:1.6;color:var(--text-2)}

.jd-chats-header-main{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 0}
.jd-chats-header-row{display:flex;align-items:center;min-width:0}
.jd-chats-new-btn{flex:none;min-height:46px;padding:0 22px;border-radius:999px;border:1px solid var(--text);background:var(--text);color:var(--surface);font:inherit;font-size:.9rem;font-weight:600;cursor:pointer;transition:transform .16s ease,opacity .16s ease}
.jd-chats-new-btn:hover{opacity:.86}
.jd-chats-new-btn:active{transform:translateY(1px)}

/* Sync */
.jd-sync-container{display:flex;align-items:center;gap:2px;min-width:0}
.jd-sync-status{display:flex;align-items:center;gap:6px;font-size:.78rem;line-height:1.3;color:var(--muted);min-width:0}
.jd-sync-text{overflow:hidden;text-overflow:ellipsis}
.jd-sync-status.is-error{color:var(--text);font-weight:600}
.jd-sync-status.is-error svg{width:14px;height:14px;flex:none}
.jd-sync-refresh-btn{display:flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--muted);cursor:pointer;transition:color .15s ease,background .15s ease}
.jd-sync-refresh-btn:hover{color:var(--text);background:var(--surface-2)}
.jd-sync-refresh-btn:disabled{cursor:default}
.jd-sync-refresh-btn svg{width:15px;height:15px}
.jd-sync-refresh-btn.is-spinning svg{animation:jd-spin 1s linear infinite;opacity:.6}
@keyframes jd-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}

/* Toolbar */
.jd-chats-toolbar{display:flex;align-items:center;justify-content:space-between;gap:20px;border-bottom:1px solid var(--border)}
.jd-chats-search-wrapper{position:relative;display:flex;align-items:center;flex:1;max-width:420px}
.jd-chats-search-wrapper>svg:first-child{position:absolute;left:0;width:16px;height:16px;color:var(--muted);pointer-events:none}
.jd-chats-search-input{width:100%;min-height:48px;padding:0 44px 0 28px;border:0;border-radius:0;background:transparent;color:var(--text);font:inherit;font-size:.95rem}
.jd-chats-search-input:focus{outline:none}
.jd-chats-search-wrapper:focus-within{box-shadow:inset 0 -2px 0 var(--text)}
.jd-chats-search-input::placeholder{color:var(--muted)}
.jd-chats-search-clear{position:absolute;right:0;display:flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--muted);cursor:pointer}
.jd-chats-search-clear:hover{color:var(--text);background:var(--surface-2)}
.jd-chats-search-clear svg{width:16px;height:16px}
.jd-chats-filters{display:flex;gap:22px;flex:none}
.jd-chats-filter{position:relative;display:flex;align-items:center;gap:8px;min-height:48px;padding:0;border:0;background:none;color:var(--muted);font:inherit;font-size:.9rem;font-weight:600;cursor:pointer}
.jd-chats-filter:hover,.jd-chats-filter[aria-pressed="true"]{color:var(--text)}
.jd-chats-filter[aria-pressed="true"]::after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;background:var(--text)}
.jd-chats-badge{min-width:20px;padding:3px 6px;border-radius:999px;background:var(--text);color:var(--surface);font-size:.7rem;font-weight:700;line-height:1;text-align:center}

/* List */
.jd-chats-body{flex:1}
.jd-chats-list{list-style:none;margin:0;padding:0;counter-reset:jdc}
.jd-chats-item{position:relative;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px 20px;border-bottom:1px solid var(--border);transition:background .16s ease}
.jd-chats-item:hover{background:color-mix(in srgb,var(--surface-2) 55%,transparent)}
.jd-chats-item.is-active::before{content:"";position:absolute;left:0;top:18px;bottom:18px;width:2px;background:var(--text)}
.jd-chats-item-main{display:flex;flex-direction:column;gap:6px;width:100%;min-height:64px;padding:22px 0 22px 18px;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}
.jd-chats-item-header{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}
.jd-chats-item-title{font-family:var(--serif,Georgia,serif);font-size:1.45rem;font-weight:400;line-height:1.15;letter-spacing:-.01em;color:var(--text);overflow-wrap:anywhere}
.jd-chats-item-main:hover .jd-chats-item-title{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:4px}
.jd-chats-status{padding:3px 9px;border:1px solid var(--border-strong,var(--border));border-radius:999px;font-size:.68rem;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--text-2);white-space:nowrap}
.jd-chats-status.is-due{background:var(--text);border-color:var(--text);color:var(--surface)}
.jd-chats-item-place{display:flex;align-items:center;gap:6px;font-size:.86rem;color:var(--text-2)}
.jd-chats-item-place svg{width:13px;height:13px;flex:none;opacity:.7}
.jd-chats-item-date{font-size:.8rem;color:var(--muted);font-variant-numeric:tabular-nums}
.jd-chats-item.is-due-item .jd-chats-item-date+.jd-chats-item-date{color:var(--text);font-weight:600}
.jd-chats-item-actions{display:flex;align-items:center;gap:2px;padding-right:4px}
.jd-chats-action{display:flex;align-items:center;gap:6px;min-height:44px;padding:0 12px;border:0;border-radius:999px;background:transparent;color:var(--text-2);font:inherit;font-size:.8rem;font-weight:600;cursor:pointer;transition:background .15s ease,color .15s ease}
.jd-chats-action:hover{background:var(--surface-2);color:var(--text)}
.jd-chats-action svg{width:14px;height:14px}

.jd-chats-new-btn:focus-visible,.jd-chats-action:focus-visible,.jd-chats-filter:focus-visible,.jd-chats-item-main:focus-visible,.jd-chats-export-btn:focus-visible,.jd-sync-refresh-btn:focus-visible,.jd-chats-search-clear:focus-visible{outline:2px solid var(--ring,var(--text));outline-offset:2px}

/* Empty / no results / error / loading */
.jd-chats-empty{display:flex;flex-direction:column;align-items:flex-start;gap:12px;padding:56px 0 64px;max-width:46ch}
.jd-chats-empty-mark{display:grid;place-items:center;width:52px;height:52px;border:1px solid var(--border-strong,var(--border));border-radius:50%;color:var(--text-2);margin-bottom:6px}
.jd-chats-empty-mark svg{width:22px;height:22px}
.jd-chats-empty h3{margin:0;font-family:var(--serif,Georgia,serif);font-size:clamp(1.6rem,1.3rem + 1vw,2.1rem);font-weight:400;line-height:1.1;letter-spacing:-.01em;color:var(--text);overflow-wrap:anywhere}
.jd-chats-empty p{margin:0;font-size:.95rem;line-height:1.6;color:var(--text-2)}
.jd-chats-empty.is-error .jd-chats-empty-mark{border-color:var(--text);color:var(--text)}
.jd-chats-skeleton{display:flex;flex-direction:column}
.jd-chats-skeleton span{height:96px;border-bottom:1px solid var(--border);background:linear-gradient(90deg,transparent 0,var(--surface-2) 40%,transparent 80%) 0 0/200% 100%;animation:jd-chats-shimmer 1.4s ease-in-out infinite;opacity:.7}
@keyframes jd-chats-shimmer{to{background-position:-200% 0}}

/* Footer */
.jd-chats-footer{display:flex;align-items:center;justify-content:space-between;gap:16px 28px;padding:24px 0 8px}
.jd-chats-note{display:flex;align-items:flex-start;gap:10px;margin:0;max-width:60ch;font-size:.82rem;line-height:1.55;color:var(--muted)}
.jd-chats-note svg{width:15px;height:15px;flex:none;margin-top:2px}
.jd-chats-export-btn{display:flex;align-items:center;gap:8px;flex:none;min-height:44px;padding:0 18px;border:1px solid var(--border-strong,var(--border));border-radius:999px;background:transparent;color:var(--text);font:inherit;font-size:.82rem;font-weight:600;cursor:pointer;transition:border-color .15s ease,background .15s ease}
.jd-chats-export-btn:hover{border-color:var(--text);background:var(--surface-2)}
.jd-chats-export-btn svg{width:14px;height:14px}

@media (max-width:767px){
  .jd-chat-heading-actions{width:100%}
  .jd-turn-time-jd{margin-inline-start:44px}
  .jd-chats-intro{padding-bottom:22px}
  .jd-chats-toolbar{flex-direction:column;align-items:stretch;gap:0}
  .jd-chats-search-wrapper{max-width:none;border-bottom:1px solid var(--border)}
  .jd-chats-item{grid-template-columns:1fr;gap:0}
  .jd-chats-item-main{padding:20px 0 6px 14px}
  .jd-chats-item-actions{padding:0 0 12px 4px}
  .jd-chats-footer{flex-direction:column;align-items:flex-start}
}
@media (max-width:480px){
  .jd-chats-header-main{flex-wrap:wrap}
  .jd-chats-new-btn{width:100%}
  .jd-chats-header-row{order:2}
  .jd-chats-item-title{font-size:1.3rem}
  .jd-chats-action{padding:0 10px}
}
@media (prefers-reduced-motion:reduce){.jd-chats-skeleton span,.jd-sync-refresh-btn.is-spinning svg{animation:none}}
