/* ============================================================
   Wellet · Editorial UI Rollout · PR 5
   Ask Wellet surface (#view-ask)

   The intent: Ask is a quiet conversation with someone who has read
   the chart and remembers everything. Not a chatbot. Not a UI.
   So: editorial typography, hairline structure, no green chat
   bubbles, no shadows, no fills except where signal demands it.

   Every override scoped to #view-ask[data-editorial="ask"]
   so removing the data attribute reverts instantly.
   Foundation tokens come from editorial-foundation.css.
   ============================================================ */

/* ---- Container ---- */
#view-ask[data-editorial="ask"] {
  font-family: var(--sans);
  font-weight: 300;
  color: var(--ink-9);
  letter-spacing: 0.005em;
  background: transparent;
}
#view-ask[data-editorial="ask"] .ask-view {
  background: transparent;
  max-width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
@media (min-width: 1100px) {
  /* Soft cap on desktop so the conversation doesn't run super-wide. */
  #view-ask[data-editorial="ask"] .ask-view {
    max-width: 760px;
  }
}

/* ---- Person bar — same outline-only treatment as Records ---- */
#view-ask[data-editorial="ask"] .ask-person-bar {
  padding: 22px var(--gutter, 22px) 8px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--ink-1);
}
@media (max-width: 767px) {
  /* Tighter on mobile so the pills don't clip under the top chrome. */
  #view-ask[data-editorial="ask"] .ask-person-bar {
    padding: 10px var(--gutter, 22px) 8px;
  }
}
#view-ask[data-editorial="ask"] .ask-person-pill {
  background: transparent;
  border: 1px solid var(--ink-2);
  border-radius: 999px;
  color: var(--ink-5);
  font-family: var(--sans);
  font-weight: 400;
  font-size: var(--type-meta);
  letter-spacing: 0.005em;
  padding: 5px 14px;
  box-shadow: none;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#view-ask[data-editorial="ask"] .ask-person-pill:hover {
  border-color: var(--ink-4);
  color: var(--ink-7);
}
#view-ask[data-editorial="ask"] .ask-person-pill.active {
  border-color: var(--moss-deep);
  color: var(--moss-deep);
  background: transparent;
}
#view-ask[data-editorial="ask"] .ask-person-pill > span {
  background: var(--signal-fresh);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  opacity: 1;
}

/* ---- Chat area ---- */
#view-ask[data-editorial="ask"] .chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px var(--gutter, 22px) 8px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: transparent;
}

/* On mobile, before any real conversation, don't let chat-area stretch and
   push the suggestion chips + input bar down — keep the intro bubble snug to the
   top so chips sit just below the lede. */
@media (max-width: 767px) {
  #view-ask[data-editorial="ask"] .chat-area {
    padding-top: 14px;
  }
  #view-ask[data-editorial="ask"] .chat-area:has(> .chat-group:only-child) {
    flex: 0 0 auto;
  }
  /* Fallback for browsers without :has — tighten the empty-state class
     that wellet.js can set when only the lede bubble is present. */
  #view-ask[data-editorial="ask"] .chat-area.is-empty-state {
    flex: 0 0 auto;
  }
}

/* ---- Chat groups ---- */
#view-ask[data-editorial="ask"] .chat-group {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}
#view-ask[data-editorial="ask"] .chat-group.from-wellet { align-items: flex-start; }
#view-ask[data-editorial="ask"] .chat-group.from-user   { align-items: flex-end; }

/* The "Wellet" sender label — quiet upright serif byline. */
#view-ask[data-editorial="ask"] .chat-sender {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--type-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-5);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-variation-settings: "opsz" 14, "SOFT" 60;
}
/* Wellet glyph — quieter, smaller, moss-deep. */
#view-ask[data-editorial="ask"] .chat-sender svg {
  width: 11px;
  height: 11px;
  fill: var(--moss-deep);
  flex-shrink: 0;
}

/* ---- Wellet replies — no bubble, editorial body type on linen ---- */
#view-ask[data-editorial="ask"] .chat-bubble.wellet {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  max-width: 100%;
  color: var(--ink-9);
  font-family: var(--sans);
  font-weight: 300;
  font-size: var(--type-body);
  line-height: 1.55;
  letter-spacing: 0.005em;
  align-self: stretch;
}
/* The first/lede greeting bubble — upright Fraunces, intimate. */
#view-ask[data-editorial="ask"] .chat-group.from-wellet:first-child .chat-bubble.wellet {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--type-h2);
  line-height: 1.45;
  color: var(--ink-7);
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 24, "SOFT" 60;
  padding: 4px 0 0;
}
@media (min-width: 768px) {
  #view-ask[data-editorial="ask"] .chat-group.from-wellet:first-child .chat-bubble.wellet {
    font-size: var(--type-h1);
  }
}

/* Markdown bits inside Wellet replies */
#view-ask[data-editorial="ask"] .chat-bubble.wellet .md-p {
  margin: 0 0 10px;
}
#view-ask[data-editorial="ask"] .chat-bubble.wellet .md-p:last-child {
  margin-bottom: 0;
}
#view-ask[data-editorial="ask"] .chat-bubble.wellet .md-h {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--type-h2);
  line-height: 1.25;
  color: var(--ink-9);
  margin: 14px 0 6px;
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 24, "SOFT" 60;
}
#view-ask[data-editorial="ask"] .chat-bubble.wellet .md-h:first-child {
  margin-top: 0;
}
#view-ask[data-editorial="ask"] .chat-bubble.wellet .md-ul,
#view-ask[data-editorial="ask"] .chat-bubble.wellet .md-ol {
  margin: 6px 0 12px;
  padding-left: 20px;
}
#view-ask[data-editorial="ask"] .chat-bubble.wellet .md-ul li,
#view-ask[data-editorial="ask"] .chat-bubble.wellet .md-ol li {
  margin: 4px 0;
  line-height: 1.55;
  color: var(--ink-9);
}
#view-ask[data-editorial="ask"] .chat-bubble.wellet .md-ul { list-style: disc; }
#view-ask[data-editorial="ask"] .chat-bubble.wellet .md-ol { list-style: decimal; }
#view-ask[data-editorial="ask"] .chat-bubble.wellet .md-code {
  background: var(--ink-1);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: var(--type-meta);
  color: var(--ink-9);
}
#view-ask[data-editorial="ask"] .chat-bubble.wellet a {
  color: var(--moss-deep);
  text-decoration: underline;
  text-decoration-color: var(--moss);
  text-underline-offset: 2px;
  word-break: break-word;
}

/* ---- User messages — quiet ink-1 chip, right-aligned ---- */
#view-ask[data-editorial="ask"] .chat-bubble.user {
  background: var(--ink-1);
  color: var(--ink-9);
  font-family: var(--sans);
  font-weight: 400;
  font-size: var(--type-body);
  line-height: 1.5;
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  max-width: 80%;
  align-self: flex-end;
  box-shadow: none;
}

/* ---- Suggestion chips — converted to vertical "starting points" list ---- */
#view-ask[data-editorial="ask"] .suggestion-chips {
  padding: 4px var(--gutter, 22px) 16px;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  border-top: 0;
  margin-top: 4px;
}
#view-ask[data-editorial="ask"] .suggestion-chips::before {
  content: "Some places to start";
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--type-meta);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-5);
  padding: 12px 0 4px;
  font-variation-settings: "opsz" 14, "SOFT" 60;
}
#view-ask[data-editorial="ask"] .chip {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 9px 0;
  margin: 0;
  font-family: var(--sans);
  font-weight: 300;
  font-size: var(--type-body);
  letter-spacing: 0.005em;
  color: var(--ink-9);
  text-align: left;
  white-space: normal;
  cursor: pointer;
  transition: color 0.15s ease;
  box-shadow: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
#view-ask[data-editorial="ask"] .chip::before {
  content: "";
  flex: 0 0 6px;
  width: 6px;
  height: 1px;
  background: var(--moss);
}
#view-ask[data-editorial="ask"] .chip:hover {
  background: transparent;
  color: var(--moss-deep);
}

/* ---- Input bar — no top hairline; spacing carries the separation ---- */
#view-ask[data-editorial="ask"] .ask-input-bar {
  padding: 14px var(--gutter, 22px) 14px;
  border-top: 0;
  background: var(--bg, #F7F5F0);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
#view-ask[data-editorial="ask"] .ask-input {
  flex: 1;
  border: 1px solid var(--ink-2);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: var(--sans);
  font-weight: 300;
  font-size: var(--type-body);
  line-height: 1.4;
  color: var(--ink-9);
  background: var(--bg-2, #FBF9F4);
  resize: none;
  max-height: 100px;
  box-shadow: none;
  letter-spacing: 0.005em;
}
#view-ask[data-editorial="ask"] .ask-input::placeholder {
  color: var(--ink-5);
  font-family: var(--sans);
  font-weight: 300;
  letter-spacing: 0.005em;
}
#view-ask[data-editorial="ask"] .ask-input:focus {
  outline: none;
  border-color: var(--moss-deep);
  background: #fff;
}
#view-ask[data-editorial="ask"] .ask-mic {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--ink-2);
  color: var(--ink-5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}
#view-ask[data-editorial="ask"] .ask-mic:hover {
  border-color: var(--moss-deep);
  color: var(--moss-deep);
}
#view-ask[data-editorial="ask"] .ask-mic.listening {
  background: var(--moss-deep);
  border-color: var(--moss-deep);
  color: #fff;
}
#view-ask[data-editorial="ask"] .ask-send {
  min-width: 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--moss-deep);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: none;
  transition: background 0.15s ease;
}
#view-ask[data-editorial="ask"] .ask-send:hover {
  background: var(--moss);
}
#view-ask[data-editorial="ask"] .ask-send:disabled {
  background: var(--ink-2);
  cursor: default;
}

/* ---- Context chip (when a record/event is being asked about) ---- */
#view-ask[data-editorial="ask"] #ask-context-chip {
  margin: 0 var(--gutter, 22px) 6px;
  font-family: var(--serif);
  font-size: var(--type-meta);
  color: var(--ink-5);
  font-variation-settings: "opsz" 14, "SOFT" 60;
}

/* ============================================================================
 * CARE SIGNALS v1 — pills on wearable cards + watch_proposal card in chat
 * ========================================================================== */

/* Per-card pill row sits at the bottom of each wearable card */
.wearable-pill-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--ink-1, #ECEAE4);
  flex-wrap: wrap;
}

.wearable-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink-7, #2B2A28);
  background: #F5F3EE;
  border: 1px solid #E2DDD2;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.wearable-pill:hover {
  background: #ECE7DA;
  border-color: #D6CFBE;
}
.wearable-pill:active {
  transform: translateY(0.5px);
}

/* Notify pill picks up a warm bell tint to read as a different action */
.wearable-pill-notify {
  background: #FFF6E2;
  border-color: #F0DCA9;
  color: #6B4F12;
}
.wearable-pill-notify:hover {
  background: #FBEFCC;
  border-color: #E6CD8A;
}

/* Share pill stays neutral / moss to match existing share affordance */
.wearable-pill-share {
  background: #EDF3EE;
  border-color: #CDE0D2;
  color: var(--moss-deep, #2F4A3A);
}
.wearable-pill-share:hover {
  background: #DCE9E0;
  border-color: #B7D2BF;
}

/* ---- Watch proposal card (rendered via addWelletMessage) ---- */
.watch-proposal-card {
  margin: 4px 0;
  padding: 14px 16px;
  background: #FFFBF0;
  border: 1px solid #F0DCA9;
  border-radius: 14px;
  font-family: var(--sans, system-ui, sans-serif);
}

.watch-proposal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.watch-proposal-title {
  font-family: var(--serif, 'Fraunces', Georgia, serif);
  font-size: 15px;
  font-weight: 500;
  color: #4A360E;
  letter-spacing: -0.01em;
}

.watch-conf {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.watch-conf-low  { background: #F5EFE2; color: #7A5A1F; border: 1px solid #E5D7B0; }
.watch-conf-med  { background: #EAF1E5; color: #3F6132; border: 1px solid #C9DDC0; }
.watch-conf-high { background: #DBE9D1; color: #2C4D24; border: 1px solid #B0CDA1; }

.watch-proposal-body {
  font-size: 14px;
  line-height: 1.45;
  color: #2B2A28;
  margin-bottom: 8px;
}

.watch-proposal-meta {
  font-size: 12px;
  line-height: 1.4;
  color: #76685B;
  margin-bottom: 12px;
}

.watch-proposal-actions {
  display: flex;
  gap: 8px;
}

.watch-btn {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.watch-btn-primary {
  background: var(--moss-deep, #2F4A3A);
  color: #fff;
  border-color: var(--moss-deep, #2F4A3A);
}
.watch-btn-primary:hover { background: var(--moss, #3D5C49); border-color: var(--moss, #3D5C49); }
.watch-btn-primary:disabled {
  background: var(--ink-2, #BFB9AE);
  border-color: var(--ink-2, #BFB9AE);
  cursor: default;
}

.watch-btn-secondary {
  background: transparent;
  color: var(--moss-deep, #2F4A3A);
  border-color: #C9D5CD;
}
.watch-btn-secondary:hover {
  background: #EDF3EE;
  border-color: #B7D2BF;
}

/* ---- Care Signals v1: Lucide icon sizing inside pills + cards ---- */
.wearable-pill .wearable-pill-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.wearable-pill svg {
  width: 12px;
  height: 12px;
  display: block;
}

.watch-proposal-card .watch-proposal-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #B68A2A;
}
.watch-proposal-card .watch-proposal-icon.watch-proposal-icon-saved {
  color: #3F6132;
}
.watch-proposal-card svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Saved-state card variant */
.watch-proposal-card.watch-proposal-card-saved {
  background: #F4F8F0;
  border-color: #C8DDB7;
}
.watch-proposal-card.watch-proposal-card-saved .watch-proposal-title {
  color: #2C4D24;
}

/* ---- Care Signals v1: "What I'm watching" settings sheet rows ---- */
.watch-row {
  background: #FAF7F0;
  border: 1px solid #E5DFD2;
  border-radius: 14px;
  padding: 14px 14px 12px;
  margin-bottom: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.watch-row:hover {
  border-color: #D4CCB8;
}

.watch-row-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.watch-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #EDF3EE;
  color: #2F4A3A;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.watch-row-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.watch-row-meta {
  flex: 1;
  min-width: 0;
}

.watch-row-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 15px;
  font-weight: 500;
  color: #1F2A22;
  line-height: 1.3;
  margin-bottom: 2px;
  word-wrap: break-word;
}

.watch-row-sub {
  font-size: 13px;
  color: #6B6356;
  line-height: 1.4;
  word-wrap: break-word;
}

.watch-row-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 10px;
  flex-shrink: 0;
  margin-top: 2px;
}
.watch-row-status.watch-row-status-active {
  background: #EDF3EE;
  color: #2F4A3A;
}
.watch-row-status.watch-row-status-paused {
  background: #F0EDE5;
  color: #8A8170;
}

.watch-row-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #EFE9DB;
  padding-top: 10px;
  margin-top: 2px;
}

.watch-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid #E5DFD2;
  background: #fff;
  color: #4A453B;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.watch-row-btn:hover {
  background: #FAF7F0;
  border-color: #D4CCB8;
}
.watch-row-btn svg {
  width: 13px;
  height: 13px;
  display: block;
}

.watch-row-btn-danger {
  color: #A8473A;
  border-color: #E8D4D0;
}
.watch-row-btn-danger:hover {
  background: #FBF0EE;
  border-color: #DDB8B0;
  color: #8E3A2F;
}

/* Empty state inside watches-list */
.watches-empty {
  text-align: center;
  padding: 32px 16px 16px;
  color: #6B6356;
}
.watches-empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #F0EDE5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8A8170;
}
.watches-empty-icon svg { width: 20px; height: 20px; }
.watches-empty-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 16px;
  color: #1F2A22;
  margin-bottom: 6px;
}
.watches-empty-sub {
  font-size: 13px;
  line-height: 1.5;
  max-width: 280px;
  margin: 0 auto;
}
