:root {
  --bg: #0B0B0E;
  --surface: #131318;
  --surface-2: #1B1B22;
  --ink: #ECECF1;
  --muted: #73738A;
  --pink: #FF4D8F;
  --line: #23232E;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: "Instrument Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.hidden { display: none !important; }

/* ============ AUTH ============ */
.auth {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
  z-index: 100;
}
.auth-card {
  width: min(380px, 92vw);
  text-align: center;
  padding: 36px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.auth-cat { width: 84px; height: 84px; color: var(--pink); }
.auth-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 26px; font-weight: 500; letter-spacing: -0.02em;
  margin-top: 6px;
}
.auth-title em { font-style: normal; color: var(--pink); }
.auth-sub { color: var(--muted); font-size: 14px; margin: 10px 0 20px; line-height: 1.5; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.auth-tabs button {
  flex: 1;
  font: 600 13px "Instrument Sans", sans-serif;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px;
  cursor: pointer;
}
.auth-tabs button.on { color: var(--pink); border-color: var(--pink); }

.auth-fields { display: flex; flex-direction: column; gap: 9px; text-align: left; }
.auth-fields input {
  font: 16px "Instrument Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
  width: 100%;
  color-scheme: dark;
}
.auth-fields input:focus { border-color: var(--pink); }
.dob-label { font: 500 11.5px "Instrument Sans", sans-serif; color: var(--muted); margin: 2px 0 -3px 2px; }
.auth-primary {
  font: 600 14px "Instrument Sans", sans-serif;
  color: #0B0B0E;
  background: var(--pink);
  border: none; border-radius: 10px;
  padding: 11px; cursor: pointer; margin-top: 4px;
}
.auth-primary:disabled { background: var(--surface-2); color: var(--muted); }
.guest-btn {
  margin-top: 14px;
  font: 500 13px "Instrument Sans", sans-serif;
  color: var(--muted);
  background: none; border: none; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.guest-btn:hover { color: var(--pink); }
.app.guest .sidebar { display: none; }
.app.guest .menu-btn { display: none !important; }
.auth-msg { margin-top: 14px; font-size: 13.5px; color: var(--pink); min-height: 18px; }

/* ============ APP SHELL ============ */
.app { display: flex; height: 100vh; height: 100dvh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
  gap: 10px;
}
.new-chat {
  font: 600 13.5px "Instrument Sans", sans-serif;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, color .15s;
}
.new-chat:hover { border-color: var(--pink); color: var(--pink); }

.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.chat-item {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13.5px;
  transition: background .12s, color .12s;
}
.chat-item:hover { background: var(--surface-2); color: var(--ink); }
.chat-item.active { background: var(--surface-2); color: var(--ink); }
.chat-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .del {
  border: none; background: none; color: var(--muted);
  font-size: 15px; cursor: pointer; padding: 0 3px; line-height: 1;
  opacity: 0; transition: opacity .12s;
}
.chat-item:hover .del { opacity: 1; }
.chat-item .del:hover { color: var(--pink); }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.user-email {
  font: 400 11px "JetBrains Mono", monospace;
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.logout {
  font: 500 11px "JetBrains Mono", monospace;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
  background: none; border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 9px; cursor: pointer; flex-shrink: 0;
}
.logout:hover { color: var(--pink); border-color: var(--pink); }

/* ============ MAIN ============ */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar { display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 18px 12px; }
.menu-btn {
  display: none;
  border: 1px solid var(--line); background: none; color: var(--ink);
  border-radius: 8px; width: 36px; height: 36px;
  align-items: center; justify-content: center; cursor: pointer;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--pink); }
.logo { width: 28px; height: 28px; }
.wordmark {
  font-family: "JetBrains Mono", monospace;
  font-size: 16px; font-weight: 500; letter-spacing: -0.02em;
  color: var(--ink);
}
.wordmark em { font-style: normal; color: var(--pink); }
.topbar-spacer { flex: 1; }

.line-cat .draw { stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw 1.4s ease forwards; }
.line-cat .d2 { animation-delay: 1s; animation-duration: .6s; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.chat {
  flex: 1; overflow-y: auto;
  padding: 20px 16px 12px;
  display: flex; flex-direction: column; gap: 12px;
  width: 100%; max-width: 760px; margin: 0 auto;
}

.empty { margin: auto; text-align: center; color: var(--muted); }
.empty-title { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.empty-sub { margin-top: 6px; font: 400 12px "JetBrains Mono", monospace; letter-spacing: .04em; }

.msg {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: var(--radius);
  line-height: 1.6; font-size: 15px;
  white-space: pre-wrap; word-wrap: break-word;
  animation: rise .22s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

.msg.user {
  align-self: flex-end;
  background: rgba(255, 77, 143, .09);
  border: 1px solid rgba(255, 77, 143, .45);
  border-bottom-right-radius: 4px;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.msg.error {
  align-self: flex-start;
  background: #2A1218; border: 1px solid #5C2333; color: #F2A9BE;
}
.msg.thinking {
  align-self: flex-start;
  color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  font-family: "JetBrains Mono", monospace; font-size: 13px;
}
.msg.thinking::after { content: ""; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0%{content:""} 25%{content:"."} 50%{content:".."} 75%{content:"..."} }

/* ============ COMPOSER ============ */
.composer {
  display: flex; align-items: flex-end; gap: 4px;
  width: 100%; max-width: 760px;
  margin: 0 auto calc(16px + env(safe-area-inset-bottom));
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color .15s;
}
.composer:focus-within { border-color: var(--pink); }

#attach {
  flex-shrink: 0; width: 38px; height: 38px;
  border: none; border-radius: 10px;
  background: transparent; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#attach:hover { color: var(--pink); background: var(--surface-2); }

.input-wrap { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.file-chip {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  margin: 4px 0 0 2px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 6px 4px 10px;
  font: 500 12px "JetBrains Mono", monospace;
  color: var(--pink);
}
.file-chip[hidden] { display: none !important; }
.file-chip button { border: none; background: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 2px 5px; }

#input {
  width: 100%; resize: none;
  font: 16px/1.55 "Instrument Sans", sans-serif;
  color: var(--ink); background: transparent;
  border: none; padding: 9px 8px;
  min-height: 52px; max-height: 40vh;
  outline: none; overflow-y: hidden;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
#input::placeholder { color: var(--muted); }
#input::-webkit-scrollbar { width: 8px; }
#input::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
#input::-webkit-scrollbar-track { background: transparent; }

#send {
  flex-shrink: 0; width: 38px; height: 38px;
  border: none; border-radius: 10px;
  background: var(--pink); color: #0B0B0E;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#send:disabled { background: var(--surface-2); color: var(--muted); }

.dl-btn {
  display: inline-block; margin-top: 10px;
  font: 500 12px "JetBrains Mono", monospace; letter-spacing: .03em;
  color: var(--pink);
  background: rgba(255,77,143,.1);
  border: 1px solid rgba(255,77,143,.45);
  border-radius: 8px; padding: 7px 13px; text-decoration: none;
}
.msg .attach-note { display: block; font: 500 12px "JetBrains Mono", monospace; opacity: .8; margin-bottom: 4px; }

/* ============ MOBILE ============ */
@media (max-width: 760px) {
  .sidebar {
    position: fixed; inset: 0 25% 0 0; z-index: 60;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 12px 0 40px rgba(0,0,0,.4);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: flex; }
  .msg { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  .msg { animation: none; }
  .line-cat .draw { animation: none; stroke-dashoffset: 0; }
  .msg.thinking::after { animation: none; content: "…"; }
  .sidebar { transition: none; }
}

/* ============ PETS FORK ADDITIONS ============ */
.pet-bar { display: flex; gap: 6px; }
#pet-select {
  flex: 1;
  font: 600 14px "Instrument Sans", sans-serif;
  color: var(--pink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  outline: none;
  appearance: none;
}
#add-pet {
  width: 40px;
  font: 600 18px "Instrument Sans", sans-serif;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
#add-pet:hover { color: var(--pink); border-color: var(--pink); }
.edit-pet {
  font: 500 11px "JetBrains Mono", monospace;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
  background: none; border: none;
  text-align: left; padding: 0 2px;
  cursor: pointer;
}
.edit-pet:hover { color: var(--pink); }

.modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.6);
  display: grid; place-items: center;
  padding: 16px;
}
.modal-card {
  width: min(400px, 100%);
  max-height: 90vh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
}
.modal-card h2 {
  font: 600 18px "Instrument Sans", sans-serif;
  margin-bottom: 14px;
}
.modal-card select {
  font: 16px "Instrument Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  width: 100%;
  outline: none;
  color-scheme: dark;
}
.modal-row { display: flex; gap: 8px; margin-top: 6px; }
.modal-row .auth-primary { flex: 1; margin-top: 0; }
.ghost-btn {
  flex: 1;
  font: 600 14px "Instrument Sans", sans-serif;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px; cursor: pointer;
}
.ghost-btn:hover { color: var(--ink); }

/* timeline panel */
.tl-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--line);
  z-index: 50;
  display: none; flex-direction: column;
  box-shadow: -12px 0 40px rgba(0,0,0,.35);
}
.tl-panel.open { display: flex; }
.tl-head {
  display: flex; align-items: center; gap: 6px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tl-head .ptitle {
  margin-right: auto;
  font: 600 12px "JetBrains Mono", monospace;
  letter-spacing: .08em; text-transform: uppercase; opacity: .8;
}
.code-btn2 {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 6px; padding: 5px 10px;
  font: 500 11px "JetBrains Mono", monospace; cursor: pointer;
}
.code-btn2:hover { border-color: var(--pink); color: var(--pink); }
.tl-form {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}
.tl-form input, .tl-form textarea {
  font: 16px "Instrument Sans", sans-serif;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none; width: 100%;
  color-scheme: dark; resize: none;
}
.tl-form input:focus, .tl-form textarea:focus { border-color: var(--pink); }
.tl-entries { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.tl-entry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.tl-entry .tl-date {
  font: 500 11px "JetBrains Mono", monospace;
  color: var(--pink);
  letter-spacing: .05em;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.tl-entry .tl-date .tl-del {
  border: none; background: none; color: var(--muted);
  cursor: pointer; font-size: 14px; opacity: 0;
}
.tl-entry:hover .tl-del { opacity: 1; }
.tl-entry .tl-del:hover { color: var(--pink); }
.tl-entry .tl-body { font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; }
.tl-entry img {
  width: 100%; border-radius: 10px; display: block; margin-top: 4px;
}
.tl-empty { color: var(--muted); text-align: center; margin-top: 30px; font-size: 14px; }

.disclaim {
  text-align: center;
  font: 400 11px "JetBrains Mono", monospace;
  color: var(--muted);
  padding: 0 16px calc(10px + env(safe-area-inset-bottom));
  margin-top: -8px;
}


/* pet profile */
.prof-photo-wrap { margin-bottom: 12px; }
.prof-photo { width: 100%; max-height: 300px; object-fit: cover; border-radius: 12px; display: block; }
.prof-photo-empty {
  height: 120px; border: 1px dashed var(--line); border-radius: 12px;
  display: grid; place-items: center;
  font: 500 12px "JetBrains Mono", monospace; color: var(--muted);
}
.prof-details { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 14px; }
.prof-row { display: flex; gap: 10px; font-size: 14px; line-height: 1.4; }
.prof-row .k {
  flex-shrink: 0; width: 92px;
  font: 500 11px "JetBrains Mono", monospace;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding-top: 2px;
}
.prof-row .v { color: var(--ink); }

/* drawing-cat thinking indicator */
.msg.thinking::after { content: none !important; animation: none !important; }
.msg.thinking { color: var(--pink); padding: 8px 14px 4px; }
.think-cat { width: 36px; height: 36px; display: block; }
.think-cat .tc1 { stroke-dasharray: 320; stroke-dashoffset: 320; animation: catloop1 1.7s ease-in-out infinite; }
.think-cat .tc2 { stroke-dasharray: 60; stroke-dashoffset: 60; animation: catloop2 1.7s ease-in-out infinite; }
@keyframes catloop1 {
  0% { stroke-dashoffset: 320; opacity: 1; }
  55% { stroke-dashoffset: 0; opacity: 1; }
  80% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes catloop2 {
  0%, 35% { stroke-dashoffset: 60; opacity: 1; }
  70% { stroke-dashoffset: 0; opacity: 1; }
  80% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .think-cat .tc1, .think-cat .tc2 { animation: none; stroke-dashoffset: 0; }
}


/* pet list (3 or fewer pets) */
.pet-list { display: flex; flex-direction: column; gap: 2px; }
.pet-item {
  display: flex; align-items: center; gap: 8px;
  font: 600 14px "Instrument Sans", sans-serif;
  color: var(--muted);
  background: none; border: 1px solid transparent;
  border-radius: 10px; padding: 9px 10px;
  cursor: pointer; text-align: left; width: 100%;
}
.pet-item:hover { background: var(--surface-2); color: var(--ink); }
.pet-item.active { background: var(--surface-2); color: var(--pink); border-color: var(--line); }

.chats-label {
  font: 500 10.5px "JetBrains Mono", monospace;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
  padding: 4px 4px 0;
}

.danger-btn {
  width: 100%; margin-top: 10px;
  font: 600 13px "Instrument Sans", sans-serif;
  color: #F2A9BE;
  background: none;
  border: 1px solid #5C2333;
  border-radius: 10px;
  padding: 10px; cursor: pointer;
}
.danger-btn:hover { background: #2A1218; }

/* sidebar backdrop (mobile) */
#scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(0, 0, 0, 0.5);
  display: none;
}
#scrim.show { display: block; }
@media (min-width: 761px) { #scrim { display: none !important; } }


/* ---------- v4: scroll behavior fixes ---------- */
html, body { overscroll-behavior: none; }
.chat, .tl-entries, .chat-list { -webkit-overflow-scrolling: touch; }

/* ---------- v4: icon button ---------- */
.icon-btn {
  border: 1px solid var(--line); background: none; color: var(--muted);
  border-radius: 8px; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover { color: var(--pink); border-color: var(--pink); }

/* ---------- v4: settings ---------- */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.set-label { font: 500 13.5px "Instrument Sans", sans-serif; color: var(--ink); }
.set-toggle { display: flex; gap: 6px; }
.set-opt {
  font: 600 12.5px "Instrument Sans", sans-serif;
  color: var(--muted); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; cursor: pointer;
}
.set-opt.on { color: var(--pink); border-color: var(--pink); }

/* ---------- v4: timeline edit ---------- */
.tl-date .tl-edit {
  border: none; background: none; color: var(--muted);
  cursor: pointer; font-size: 13px; opacity: 0; padding: 0 2px;
}
.tl-entry:hover .tl-edit { opacity: 1; }
.tl-entry .tl-edit:hover { color: var(--pink); }
.tl-inline-form { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.tl-inline-form input, .tl-inline-form textarea {
  font: 15px "Instrument Sans", sans-serif;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; outline: none; width: 100%; resize: none; color-scheme: dark;
}
.tl-inline-form input:focus, .tl-inline-form textarea:focus { border-color: var(--pink); }

/* ---------- v4: unread markers ---------- */
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--pink); flex-shrink: 0; display: inline-block;
}

/* ---------- v4: light theme ---------- */
html.light {
  --bg: #F7F5F2;
  --surface: #FFFFFF;
  --surface-2: #EEEBE5;
  --ink: #191821;
  --muted: #8B879A;
  --pink: #D62F77;
  --line: #E4E0D8;
}
html.light body { background: var(--bg); }
html.light .code-card { background: rgba(0, 0, 0, 0.045); }
html.light .msg.error { background: #FBEAEC; border-color: #E8B9C2; color: #8E2B44; }
html.light .msg.thinking { background: var(--surface); }
html.light #scrim { background: rgba(0, 0, 0, 0.3); }
html.light .tl-inline-form input, html.light .tl-inline-form textarea,
html.light .modal-card select, html.light .auth-fields input, html.light .tl-form input, html.light .tl-form textarea { color-scheme: light; }
html.light .prof-photo-empty { border-color: var(--line); }
html.light .danger-btn { color: #B2314C; border-color: #E3B4BE; }
html.light .danger-btn:hover { background: #FBEAEC; }


/* photos shown inline in chat bubbles */
.msg .chat-photo {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  margin-top: 6px;
  object-fit: cover;
}
.msg.user .chat-photo:first-child { margin-top: 0; }


/* pet overview */
.prof-stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.stat-chip {
  font: 500 11.5px "JetBrains Mono", monospace;
  color: var(--pink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
}
.prof-spark-wrap { margin: 4px 0 12px; }
.spark-title {
  font: 500 10.5px "JetBrains Mono", monospace;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 5px;
}
#prof-spark { width: 100%; height: 54px; display: block; }
#prof-spark polyline { fill: none; stroke: var(--pink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
#prof-spark circle { fill: var(--pink); }
.spark-lbl { font: 400 11px "JetBrains Mono", monospace; color: var(--muted); margin-top: 3px; }
.prof-summary-wrap { margin: 4px 0 12px; }
.prof-summary { font-size: 14.5px; line-height: 1.6; color: var(--ink); }
.prof-summary.loading { color: var(--muted); font-style: italic; }

/* on this day card */
.msg.otd { border-left: 3px solid var(--pink); }
.otd-head {
  font: 600 10.5px "JetBrains Mono", monospace;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--pink); margin-bottom: 6px;
}
.msg.otd img {
  display: block; max-width: 100%; max-height: 300px;
  border-radius: 10px; margin-top: 8px; object-fit: cover;
}


/* ============ v9: usability overhaul — bigger, friendlier, app-like ============ */
button { touch-action: manipulation; }
.clear, .icon-btn { min-height: 44px; min-width: 44px; }
.clear { font-size: 14px; padding: 10px 18px; border-radius: 12px; text-transform: none; letter-spacing: .01em; }
.new-chat { padding: 14px; font-size: 15px; border-radius: 12px; }
.pet-item { padding: 13px 12px; font-size: 15.5px; border-radius: 12px; }
#pet-select { padding: 14px 12px; font-size: 15px; }
#add-pet { width: 48px; font-size: 22px; }
.chat-item { padding: 13px 12px; font-size: 14.5px; border-radius: 10px; }
.chat-item .del { font-size: 18px; padding: 4px 6px; }
.chats-label { font-size: 11.5px; padding-top: 8px; }
.edit-pet { font-size: 12px; padding: 6px 4px; min-height: 32px; }
.code-btn2 { font: 600 13px "Instrument Sans", sans-serif; padding: 10px 14px; border-radius: 10px; min-height: 40px; text-transform: none; letter-spacing: 0; }
.tl-head { gap: 8px; padding-bottom: 12px; }
.tl-head .ptitle { font-size: 13px; }
.tl-entry { padding: 14px 16px; border-radius: 14px; }
.tl-entry .tl-date { font-size: 12px; }
.tl-entry .tl-body { font-size: 15px; }
.tl-entry .tl-edit, .tl-entry .tl-del { min-width: 34px; min-height: 34px; font-size: 16px; opacity: .55; }
.modal-card { padding: 24px; border-radius: 20px; }
.modal-card h2 { font-size: 20px; }
.ghost-btn, .auth-primary { min-height: 48px; font-size: 15px; border-radius: 12px; }
.danger-btn { min-height: 46px; font-size: 14px; }
.prof-row { font-size: 15px; }
.prof-row .k { font-size: 11.5px; width: 100px; }
.stat-chip { font-size: 12.5px; padding: 8px 14px; }
.auth-fields input, .modal-card select { min-height: 48px; }
.sidebar { width: 270px; }
@media (max-width: 760px) { .sidebar { inset: 0 18% 0 0; } }

/* onboarding */
.onboard-card { text-align: center; }
.onboard-card .auth-cat { width: 76px; height: 76px; }
.onboard-sub { color: var(--muted); font-size: 14.5px; line-height: 1.6; margin: 10px 0 18px; }
.big-btn { width: 100%; font-size: 16px; min-height: 52px; }

/* health panel */
.hp-insights {
  margin: 12px 14px 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--pink);
  border-radius: 14px;
  font-size: 14.5px; line-height: 1.6;
}
.hp-insights.loading { color: var(--muted); font-style: italic; }
.hp-kind {
  font: 600 10.5px "JetBrains Mono", monospace;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 6px 14px 0; padding-top: 8px;
}
.hp-item { display: flex; align-items: baseline; gap: 10px; }
.hp-item .hp-name { font-weight: 600; }
.hp-item .hp-due { margin-left: auto; font: 500 12px "JetBrains Mono", monospace; color: var(--muted); white-space: nowrap; }
.hp-item .hp-due.overdue { color: #E23B4E; font-weight: 700; }
.hp-item .hp-due.soon { color: var(--pink); }
.hp-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }


/* ============ v10: topbar fit + mono restore + profile card ============ */
.topbar { flex-wrap: nowrap; overflow: hidden; gap: 8px; }
@media (max-width: 520px) { .wordmark { display: none; } }

.top-act {
  display: flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 0 13px;
  font: 500 11px "JetBrains Mono", monospace;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink);
  background: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer; flex-shrink: 0;
}
.top-act:hover { color: var(--pink); border-color: var(--pink); }
@media (max-width: 640px) {
  .top-act { padding: 0 11px; }
  .top-act .lbl { display: none; }
}

/* restore the mono voice on action buttons (sizes stay big) */
.clear, .code-btn2 {
  font: 500 11px "JetBrains Mono", monospace;
  letter-spacing: .1em; text-transform: uppercase;
}
.chats-label { font-size: 10.5px; }

/* profile card button */
.profile-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 54px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font: 600 14px "Instrument Sans", sans-serif;
  color: var(--ink);
  text-align: left;
}
.profile-btn:hover { border-color: var(--pink); color: var(--pink); }
.pp-thumb {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--line);
}
.pp-arrow { margin-left: auto; font-size: 20px; color: var(--muted); }

/* file input in pet form */
.auth-fields input[type="file"] {
  min-height: auto; padding: 10px;
  font: 13px "Instrument Sans", sans-serif;
  color: var(--muted);
}


/* insights footer */
.hp-foot {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
  font: 500 11px "JetBrains Mono", monospace;
  letter-spacing: .05em; color: var(--muted);
}
.hp-refresh {
  margin-left: auto;
  border: 1px solid var(--line); background: none; color: var(--muted);
  border-radius: 8px; padding: 6px 10px;
  font: 500 11px "JetBrains Mono", monospace;
  letter-spacing: .05em; text-transform: uppercase; cursor: pointer;
  min-height: 32px;
}
.hp-refresh:hover { color: var(--pink); border-color: var(--pink); }

/* health form select — match the other fields */
.tl-form select {
  font: 16px "Instrument Sans", sans-serif;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  min-height: 48px;
  width: 100%;
  outline: none;
  color-scheme: dark;
}
.tl-form select:focus { border-color: var(--pink); }
html.light .tl-form select { color-scheme: light; }


/* vet summary */
.vetsum-card { width: min(560px, 100%); }
.vetsum-body {
  white-space: pre-wrap;
  font: 12.5px/1.6 "JetBrains Mono", monospace;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  max-height: 52vh;
  overflow-y: auto;
  margin: 6px 0 12px;
  -webkit-overflow-scrolling: touch;
}
.vetsum-body.loading { color: var(--muted); font-style: italic; }


.vetsum-concern {
  width: 100%;
  font: 16px "Instrument Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none; resize: none;
  margin: 4px 0 8px;
  color-scheme: dark;
}
.vetsum-concern:focus { border-color: var(--pink); }
html.light .vetsum-concern { color-scheme: light; }


/* ============ share card builder ============ */
.card-builder { width: min(480px, 100%); }
.card-preview {
  position: relative; overflow: hidden;
  border-radius: 14px; background: #111;
  margin: 6px 0 10px; width: 100%;
}
.card-preview.story { aspect-ratio: 9 / 16; max-height: 46vh; margin-left: auto; margin-right: auto; width: auto; }
.card-preview.square { aspect-ratio: 1 / 1; max-height: 46vh; margin-left: auto; margin-right: auto; width: auto; }
.card-slide {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 1s ease;
}
.card-slide.show { opacity: 1; }
.card-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 18px;
  background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.35) 30%, transparent 55%);
  opacity: 0; transition: opacity .8s ease;
  pointer-events: none;
}
.card-overlay.show { opacity: 1; }
.card-ov-title { font: 700 22px "Instrument Sans", sans-serif; color: #fff; }
.card-ov-zinger { font: 500 13.5px "Instrument Sans", sans-serif; color: rgba(255,255,255,.92); margin-top: 4px; line-height: 1.4; }
.card-ov-brand { font: 500 10px "JetBrains Mono", monospace; letter-spacing: .12em; color: rgba(255,255,255,.75); margin-top: 10px; }
.card-preview.square .card-overlay {
  background: none;
  justify-content: flex-end; padding: 0;
}
.card-preview.square .card-overlay > div {
  background: #F7F3EC; width: 100%; padding: 10px 14px;
}
.card-preview.square .card-ov-title { color: #191821; font-size: 19px; padding-top: 12px; }
.card-preview.square .card-ov-zinger { color: #6E6B7A; }
.card-preview.square .card-ov-brand { color: #B9B4C2; padding-bottom: 12px; }
.card-fmt { justify-content: center; margin-bottom: 4px; }
.card-hint { font: 400 11.5px "JetBrains Mono", monospace; color: var(--muted); margin: 4px 0 8px; text-align: center; }
.card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.card-thumb {
  position: relative; aspect-ratio: 1/1; border-radius: 10px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; padding: 0; background: none;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb.sel { border-color: var(--pink); }
.card-thumb .n {
  position: absolute; top: 4px; left: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--pink); color: #fff;
  font: 700 11px "Instrument Sans", sans-serif;
  display: grid; place-items: center;
}
.card-thumb:not(.sel) img { opacity: .38; }

.prof-close-full { margin-top: 8px; }
