/* Colors. Light is a warm stone (#d2d0c6, like Claude's), dark a soft charcoal (#333333);
   the accent is the orange of Tomo's icon. */
:root {
  /* Fonts (fonts.css, built in): Inter for the app, IBM Plex Serif for the
     conversation, JetBrains Mono for code. */
  --font: "Inter", system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --bg: #d2d0c6;
  --surface: #dedcd3;     /* cards, the message box, your messages */
  --pressed: #c9c6ba;
  --raised: #f0eee8;      /* the picked option in a segmented control */
  --text: #191815;
  --muted: #5c5a52;
  --hairline: rgba(40, 30, 10, .1);
  --accent: #c2410c;
  --accent-text: #ffffff;
  --notice: #9b1c1c;      /* errors */
  --shadow: 0 1px 2px rgba(60, 45, 20, .07), 0 4px 16px rgba(60, 45, 20, .07);
  --header: rgba(210, 208, 198, .82);
  --glyph: #3a3833;       /* the app icon in the header */
  --scroll: rgba(40, 30, 10, .22); /* scrollbars, on a computer */
  --backdrop: #6b6860;    /* around the app on a wide screen */
  --card-hover: #ffffff;  /* a chat in the list under the mouse */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #333333;
    --surface: #3f3f3f;
    --pressed: #4a4a4a;
    --raised: #5a5a5a;
    --text: #ededed;
    --muted: #a8a8a8;
    --hairline: rgba(255, 255, 255, .08);
    --accent: #f97316;
    --accent-text: #1a1a1a;
    --notice: #fca5a5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 4px 16px rgba(0, 0, 0, .18);
    --header: rgba(51, 51, 51, .82);
    --glyph: #cccccc;
    --scroll: rgba(255, 255, 255, .2);
    --backdrop: #666666;
    --card-hover: var(--pressed);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #333333;
  --surface: #3f3f3f;
  --pressed: #4a4a4a;
  --raised: #5a5a5a;
  --text: #ededed;
  --muted: #a8a8a8;
  --hairline: rgba(255, 255, 255, .08);
  --accent: #f97316;
  --accent-text: #1a1a1a;
  --notice: #fca5a5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 4px 16px rgba(0, 0, 0, .18);
  --header: rgba(51, 51, 51, .82);
  --glyph: #cccccc;
  --scroll: rgba(255, 255, 255, .2);
  --backdrop: #666666;
  --card-hover: var(--pressed);
  color-scheme: dark;
}

/* Scrollbars (on a computer; phones show their own): thin, in the theme's colours, no arrows or track */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 2px; background: var(--scroll) padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; } } /* Firefox */

/* Mobile first: the base rules are for a phone held upright; wider screens
   get more room under the min-width queries. Padding uses the safe-area
   insets, since the installed app runs full screen around notches.
   Fonts are the device's own (system-ui), so Tomo looks native. */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; } /* even on elements whose class sets display */
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  /* Exactly the visible window, also while the keyboard is open. (Not 100dvh: in the
     installed app on Android it is the whole screen, so the bottom went off the edge.) */
  position: fixed;
  inset: 0;
  overflow: auto;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header: Tomo on the left (a new chat), the menu on the right. It stays put while the page scrolls. */
.top {
  position: sticky;
  top: 0;
  z-index: 2; /* its menu over the message box */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: calc(4px + env(safe-area-inset-top)) 4px 4px 14px;
  background: var(--header);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid var(--hairline);
}
.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
  text-decoration: none;
}
.top .brand svg { width: 30px; height: 30px; fill: none; stroke: var(--glyph); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; } /* just the glyph: no tile, no box */
.top .brand { position: relative; flex: none; width: 48px; height: 48px; border-radius: 7px; transition: background-color .15s; } /* a new chat; the dot is its badge */
.top .brand:active { background: var(--pressed); }
.top .brand .badge-dot { top: 6px; right: 4px; }
.nav { display: flex; align-items: center; }
.nav .icon-btn { position: relative; width: 48px; height: 48px; } /* Android's 48dp touch target */
.nav .icon-btn svg { width: 24px; height: 24px; }
.nav .icon-btn[aria-current="page"] { color: var(--accent); } /* on a page from the menu: orange, no circle */
/* The menu: Settings and Log out */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 210px;
  padding: 6px;
  border-radius: 8px;
  background: var(--raised);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .22);
}
.menu[hidden] { display: none; }
.menu a, .menu button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu svg { flex: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.menu a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.menu a:active, .menu button:active { background: var(--pressed); }
.menu form { margin: 0; }
@media (hover: hover) { .menu a:hover, .menu button:hover { background: var(--pressed); } }
.badge-dot {
  position: absolute;
  top: 10px;
  right: 11px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; /* big enough for a thumb */
  height: 44px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color .15s;
}
.icon-btn:active { background: var(--pressed); }
.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Conversation */
.log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 8px;
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 22dvh;
  color: var(--muted);
  text-align: center;
}
.empty img { width: 72px; height: 72px; border-radius: 9px; box-shadow: var(--shadow); }
.empty p { margin: 0; font-size: 20px; font-weight: 500; letter-spacing: -.01em; color: var(--text); }
/* A new chat: the message box on top (under the header), then the recent
   chats; app.js drops .starting once it starts */
body.starting .top { order: -2; }
body.starting .composer { order: -1; position: relative; z-index: 1; padding: 12px; } /* room under it, and its edge and shadow drawn over the chats scrolling up */
.msg {
  margin: 0 0 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.user {
  width: fit-content;
  max-width: 82%;
  margin-left: auto;
  padding: 9px 14px;
  border-radius: 10px 10px 3px 10px;
  background: var(--surface);
}
.msg.assistant { line-height: 1.6; white-space: normal; }
.msg.assistant, .msg.user { font-family: var(--serif); } /* the conversation */
.msg.assistant table { font-family: var(--font); }
/* Markdown in replies (markdown.js) */
.md { white-space: normal; }
.md p { margin: 0 0 6px; }
:is(.msg.assistant, .md) > :first-child { margin-top: 0; }
:is(.msg.assistant, .md) > :last-child { margin-bottom: 0; }
.msg.assistant p { margin: 0 0 10px; }
:is(.msg.assistant, .md) :is(h3, h4, h5, h6) { margin: 16px 0 6px; font-size: 17px; font-weight: 650; line-height: 1.35; }
:is(.msg.assistant, .md) :is(h5, h6) { font-size: 15px; }
:is(.msg.assistant, .md) :is(ul, ol) { margin: 0 0 10px; padding-left: 22px; }
:is(.msg.assistant, .md) li { margin: 2px 0; }
:is(.msg.assistant, .md) li > :is(ul, ol) { margin: 2px 0 0; }
:is(.msg.assistant, .md) li::marker { color: var(--muted); }
:is(.msg.assistant, .md) a { color: var(--accent); }
:is(.msg.assistant, .md) code { padding: 1px 5px; border-radius: 3px; background: color-mix(in srgb, var(--text) 9%, transparent); font-family: var(--mono); font-size: .9em; }
:is(.msg.assistant, .md) pre { margin: 0 0 10px; padding: 10px 12px; border-radius: 6px; background: var(--surface); overflow-x: auto; line-height: 1.45; }
:is(.msg.assistant, .md) pre code { padding: 0; background: none; white-space: pre; }
:is(.msg.assistant, .md) blockquote { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 3px solid var(--hairline); color: var(--muted); }
:is(.msg.assistant, .md) hr { margin: 14px 0; border: 0; border-top: 1px solid var(--hairline); }
.md-table { margin: 0 0 10px; overflow-x: auto; }
.md-table table { border-collapse: collapse; font-size: 14px; line-height: 1.4; }
.md-table :is(th, td) { padding: 6px 10px; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; }
.md-table th { font-weight: 600; white-space: nowrap; }
/* Thinking: an orange spinner where the reply will be */
.msg.waiting { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--muted); font-size: 14px; } /* the spinner, and what Tomo is doing beside it */
.msg.waiting::before {
  content: "";
  flex: none;
  width: 26px;
  height: 26px;
  border: 3px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .msg.waiting::before { animation-duration: 2.4s; } }
.msg.notice { color: var(--notice); font-size: 14px; }
/* Under a reply: the speaker (speak.js), only while the voice service answers */
.reply-actions { display: none; gap: 2px; margin: -12px 0 12px -8px; }
.can-speak .reply-actions { display: flex; }

/* Message box: one rounded field with the send button inside, on the tools row */
.composer {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 6px 12px calc(10px + env(safe-area-inset-bottom));
}
.composer-box {
  display: flex;
  flex-wrap: wrap; /* files waiting to go take a row of their own, above the text */
  align-items: flex-end;
  gap: 4px;
  padding: 4px 4px 4px 16px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.composer-box:focus-within { box-shadow: var(--shadow), 0 0 0 1.5px var(--accent); }
.composer-box.dropping { box-shadow: var(--shadow), 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 50vh; /* grows with what you type, up to half the screen, then scrolls */
  min-height: 40px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  font-size: 16px; /* 16px: phones don't zoom in on focus */
}
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--muted); }
.send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  transition: transform .1s, opacity .15s;
}
.send:active { transform: scale(.92); }
.send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }

/* Page titles */
.page-title { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 4px 4px 16px; }

.group-title {
  margin: 24px 16px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.group-title:first-child { margin-top: 8px; }
.card { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 8px; background: var(--surface); }
.card .muted { margin: 0; }
.muted { display: block; color: var(--muted); font-size: 15px; margin: 0 0 14px; }
.footnote { margin: 10px 16px 0; color: var(--muted); font-size: 13px; }
.row { display: flex; flex-direction: column; gap: 8px; }
.btn {
  width: 100%;
  min-height: 48px;
  padding: 10px 20px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.secondary { background: var(--pressed); color: var(--text); }

/* System / Light / Dark */
.segmented { display: flex; padding: 3px; border-radius: 6px; background: var(--pressed); }
.segmented button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 4.5px;
  background: transparent;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.segmented [aria-checked="true"] { background: var(--raised); box-shadow: var(--shadow); }

/* On/off switch */
.switch-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; cursor: pointer; }
.switch-row .label { display: block; font-weight: 500; margin-bottom: 2px; }
.switch-row .muted { margin: 0; }
.switches { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.switch {
  appearance: none;
  flex: none;
  position: relative;
  width: 52px;
  height: 32px;
  margin: 0;
  border-radius: 16px;
  background: var(--pressed);
  cursor: pointer;
  transition: background-color .2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .45; }

/* Login: icon, name, one box */
body.login { align-items: center; justify-content: safe center; padding: 16px; }
.login-form { width: 100%; max-width: 380px; margin-bottom: 10dvh; text-align: center; }
.login-icon { display: block; width: 192px; height: 192px; margin: 0 auto; border-radius: 21px; box-shadow: var(--shadow); }
.login-name { margin: 20px 0 32px; font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.password-box { position: relative; }
.login-form .password-box input {
  width: 100%;
  min-height: 52px;
  padding: 12px 52px 12px 20px; /* room on the right for the eye button */
  border: 0;
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.login-form input:focus { outline: none; box-shadow: var(--shadow), 0 0 0 1.5px var(--accent); }
.reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}
.reveal:active { background: var(--pressed); }
.reveal svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.reveal .eye-off, .reveal[aria-pressed="true"] .eye { display: none; }
.reveal[aria-pressed="true"] .eye-off { display: block; }
.login-form .password-box input:placeholder-shown { padding-left: 52px; text-align: center; } /* even sides: centered */
.login-form input::placeholder { color: var(--muted); }
.login-form .login-btn { width: 100%; min-height: 52px; margin-top: 12px; border-radius: 7px; }
.login-wrong { color: var(--notice); margin: 14px 0 0; font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Mouse and trackpad: hover feedback */
@media (hover: hover) {
  .icon-btn:hover, .top .brand:hover { background: var(--pressed); }
  .send:hover, .btn:hover { opacity: .9; }
}

/* Computers: the app is a box centred on grey, phone-sized to start (a Pixel 7 is 412px
   wide), so it looks and works the same everywhere. Its edges can be dragged to make it
   wider or narrower (common.js); the page fills it. */
@media (min-width: 480px) {
  html { --box: 412px; background: var(--backdrop); }
  body, .voice { width: min(var(--box), 100%); margin: 0 auto; }
  body { box-shadow: 0 0 32px rgb(0 0 0 / .35); }
  .log, .composer { max-width: none; }
}
@media (min-width: 480px) and (min-height: 640px) {
  body, .voice { top: 25px; bottom: 25px; height: auto; } /* grey above and below too, on a computer screen */
}

/* Password card: the passphrase with Show/Copy, then a box to change it */
.secret { display: flex; align-items: center; gap: 4px; min-height: 40px; }
.secret-value { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--muted); letter-spacing: .1em; }
.secret-value.shown { color: var(--text); letter-spacing: 0; font-weight: 500; user-select: all; }
.text-btn {
  flex: none;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}
.text-btn:active { background: var(--pressed); }
.field-row { display: flex; flex-direction: column; gap: 8px; }
.field {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 0;
  border-radius: 7px;
  background: var(--pressed);
  font-size: 16px; /* phones don't zoom in on focus */
}
.field::placeholder { color: var(--muted); }
.field:focus { outline: none; box-shadow: 0 0 0 1.5px var(--accent); }


/* The segmented control, as links */
.tabs { margin: 0 0 16px; }
.segmented a {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  border-radius: 4.5px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}
.segmented a[aria-current="page"] { background: var(--raised); box-shadow: var(--shadow); }

/* Memos */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 0 14px;
  border-radius: 7px;
  background: var(--surface);
}
.search:focus-within { box-shadow: 0 0 0 1.5px var(--accent); }
.search svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.search input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: transparent; font-size: 16px; }
.search input:focus { outline: none; }
.search input::placeholder { color: var(--muted); }

.card-list { list-style: none; margin: 0 0 8px; padding: 0; border-radius: 8px; background: var(--surface); overflow: hidden; }
.card-list:empty { display: none; }

.file-row { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb img { display: block; width: 88px; height: 88px; object-fit: cover; border-radius: 5px; background: var(--pressed); }
/* A file Tomo shows in a reply: bigger, its own shape */
.md-image { display: block; width: fit-content; max-width: min(100%, 260px); margin: 6px 0; }
.md-image img { width: auto; height: auto; max-width: 100%; max-height: 320px; }
.file-chip {
  display: inline-flex;
  flex-direction: column;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 5px;
  background: var(--pressed);
  color: var(--text);
  text-decoration: none;
}
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-size { color: var(--muted); font-size: 12px; }
.more { padding: 16px; color: var(--muted); text-align: center; font-size: 14px; }
#empty { margin-top: 12dvh; }

/* The message box: tool buttons, files waiting to be sent */
.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.tool-btn:active { background: var(--pressed); }
.tool-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.tool-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.composer-box:has(.composer-tools) { padding-left: 4px; }
/* The tools row, above the text: attach, camera and mic left, Send right */
.composer-tools { display: flex; flex: 1; align-items: center; gap: 2px; }
.composer-box:has(.composer-tools) textarea { order: 1; flex-basis: 100%; padding-left: 12px; } /* a row of its own, under the tools and Send */
/* Above a message sent with File or Analyze */
.msg-intent { width: fit-content; margin: 0 4px 4px auto; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.msg-intent + .msg.user, .msg-intent + .msg-files { margin-top: 0; }
.pending-files { display: flex; flex: 0 0 100%; flex-wrap: wrap; gap: 6px; max-height: 30vh; margin: 0; padding: 4px 4px 2px; list-style: none; overflow-y: auto; } /* as many rows as it takes, scrolling past a third of the screen */
.pending-file {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  max-width: min(220px, 100%);
  min-width: 0;
  padding: 4px 4px 4px 4px;
  border-radius: 6px;
  background: var(--pressed); /* inside the box: a shade darker than it */
}
.pending-file img { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; }
.pending-file .file-name { padding-left: 4px; }
.remove { flex: none; width: 32px; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
@media (hover: hover) {
  .tool-btn:hover { background: var(--pressed); }
}

/* Recent chats, under a new chat: a box per chat, its kind, title and the last thing said */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.starting .log { padding-top: 0; } /* the chats start just under the message box */
.recent[hidden] { display: none; }
.chat-cards { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chat-card { display: flex; align-items: flex-start; gap: 14px; min-height: 40px; padding: 7px 8px; border-radius: 8px; background: var(--surface); color: var(--text); text-decoration: none; transition: background-color .15s; }
.chat-card:active { background: var(--pressed); }
.chat-kind { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--pressed); color: var(--muted); }
.chat-kind.unseen, .chat-kind.awaiting { background: var(--accent); color: var(--accent-text); } /* a new reply; a "?": Tomo needs your answer */
.chat-kind svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-kind.awaiting svg { width: 22px; height: 22px; stroke-width: 2.8; } /* the "?" fills the square like the other icons */
.chat-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0; }
.chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; line-height: 26px; position: relative; top: -3px; } /* as tall as the icon, sharing its middle, then 3px up: looks level */
.chat-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; color: var(--muted); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
@media (hover: hover) { .chat-card:hover { background: var(--card-hover); } }

/* USER.md */
.lead { margin: -8px 4px 16px; font-size: 14px; }
.doc { padding: 4px 18px 14px; overflow-wrap: anywhere; }
.doc h2, .doc h3 { margin: 16px 0 6px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.doc h4 { margin: 14px 0 4px; font-size: 15px; }
.doc p, .doc ul, .doc ol { margin: 0 0 8px; }
.doc ul, .doc ol { padding-left: 20px; }
.doc li + li { margin-top: 4px; }
.doc li::marker { color: var(--accent); }
.doc code { padding: 1px 5px; border-radius: 2.5px; background: var(--pressed); font-size: .9em; }
.doc-edit { width: 100%; min-height: 60dvh; margin-bottom: 12px; font: 14px/1.5 var(--mono); resize: vertical; }
.link-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; color: var(--text); text-decoration: none; }
.link-row .label { display: block; font-weight: 500; margin-bottom: 2px; }
.link-row .muted { margin: 0; display: block; }
.link-row svg { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Files on your chat message: on your side, above its text */
.msg-files { width: fit-content; justify-content: flex-end; margin: 0 0 6px auto; max-width: 85%; }
.msg-files + .msg.user { margin-top: 0; }

/* Voice: full screen while listening, one big button to stop */
.voice {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  text-align: center;
}
.voice-state { margin: 0; color: var(--muted); font-size: 15px; letter-spacing: .02em; }
.voice-time { margin: 0; font-size: 40px; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.voice-stop {
  position: relative;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  margin: 40px 0; /* room for the ring at its largest */
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.voice-stop svg { position: relative; width: 44px; height: 44px; fill: currentColor; stroke: none; }
.voice-stop:active { transform: scale(.96); }
.voice-ring {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent);
  opacity: .3;
  transition: transform .12s ease-out; /* composer.js sizes it by how loud you are */
}
.voice-stop:disabled { opacity: .6; cursor: default; }
.voice-hint { margin: 0; color: var(--muted); font-size: 14px; }
.voice-lang { width: min(260px, 100%); } /* English / Русский, for the phone's speech recognition */
.voice-lang[hidden], .voice-heard[hidden] { display: none; }
.voice-heard { max-width: 100%; max-height: 30dvh; margin: -24px 0 0; overflow-y: auto; font-size: 17px; line-height: 1.45; overflow-wrap: anywhere; } /* the words so far */
.voice-cancel { margin-top: 8px; }
.voice-clip { display: block; width: 260px; max-width: 100%; height: 40px; }
/* Memo cards: what you sent on top, what Tomo did (or asks) below */
.cards { display: flex; flex-direction: column; gap: 12px; margin: 0 0 16px; padding: 0; list-style: none; }

/* Page title */
.title-row { display: flex; align-items: center; gap: 8px; margin: 4px 0 16px; }
.title-row .page-title { flex: 1; min-width: 0; margin: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* In a chat the title is the chat's name, smaller, and scrolls away with the messages */

/* Settings: daily brief time */
.time-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.time-row input { min-height: 44px; padding: 0 12px; border: 0; border-radius: 7px; background: var(--pressed); color: var(--text); font: inherit; font-size: 16px; color-scheme: light dark; }


/* On a computer, the box's edges can be dragged: both move, so it stays
   centred (common.js). A thin line shows on hover. */
.box-edge { display: none; }
@media (min-width: 480px) and (hover: hover) and (pointer: fine) {
  .box-edge {
    display: block;
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 20;
    width: 12px;
    cursor: ew-resize;
    touch-action: none;
  }
  .box-edge.left { left: max(0px, 50% - var(--box) / 2 - 6px); }
  .box-edge.right { left: min(100% - 12px, 50% + var(--box) / 2 - 6px); }
  .box-edge::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 5px;
    width: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity .15s;
  }
  .box-edge:hover::after, .box-edge.dragging::after { opacity: .5; }
  html.resizing, html.resizing * { cursor: ew-resize !important; user-select: none; }
}
