/* Components shared by the chat and account pages. */

/* Buttons: capsules that press in on a spring and carry a highlight under the pointer (interactions.js). */
.button, .nav-row, .row-link, .segment {
  --px: 50%; --py: 50%;
  position: relative; isolation: isolate;
}
.button::after, .nav-row::after, .row-link::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(90px circle at var(--px) var(--py), var(--color-glow), transparent 70%); /* taste-skill-ignore */
  opacity: 0; transition: opacity var(--motion-base) ease;
}

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-block-size: var(--control-height); padding: var(--space-2) var(--space-5);
  border: 0; border-radius: var(--radius-full); overflow: hidden;
  background: var(--color-fill); color: var(--color-ink);
  font-size: var(--text-subhead); font-weight: var(--weight-strong); line-height: 1.3; text-decoration: none; text-wrap: balance;
  transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.button:active:not(:disabled) { transform: scale(.96); transition-duration: 80ms; }
/* Disabled reads as neutral and legible, never as a washed-out accent. */
.button:disabled { color: var(--color-muted); }
.button.primary { background: var(--color-accent-fill); color: var(--color-on-accent); --color-glow: rgb(255 255 255 / 30%); }
.button.primary:disabled { background: var(--color-fill-strong); color: var(--color-muted); }
.button.primary.is-busy:disabled { background: var(--color-accent-fill); color: transparent; }
.button.secondary { background: var(--color-fill); }
.button.tinted { background: var(--color-accent-soft); color: var(--color-accent); }
.button.danger { background: var(--color-danger-soft); color: var(--color-danger); }
.button.full-width { inline-size: 100%; }
.button.icon-button { inline-size: 40px; min-block-size: 40px; padding: 0; background: transparent; color: var(--color-muted); }
.button.glass { color: var(--color-ink); }
/* Hover only where a pointer really hovers: on touch it would stick after the tap. */
@media (hover: hover) and (pointer: fine) {
  .button:hover:not(:disabled)::after, .nav-row:hover::after, .row-link:hover::after { opacity: 1; }
  .button:hover:not(:disabled) { background: var(--color-fill-strong); }
  .button.primary:hover:not(:disabled) { background: var(--color-accent-press); }
  .button.tinted:hover:not(:disabled) { background: var(--color-accent-soft); }
  .button.danger:hover:not(:disabled) { background: var(--color-danger-soft); }
  .button.icon-button:hover:not(:disabled) { background: var(--color-fill); color: var(--color-ink); }
  .button.glass:hover:not(:disabled) { background: var(--material); }
  .button:hover [data-name="plus"], .nav-row:hover [data-name="plus"] { transform: rotate(90deg); }
  .button:hover [data-name="gear"] { transform: rotate(60deg); }
  .button:hover [data-name="refresh"] { transform: rotate(120deg); }
  .button:hover [data-name="close"] { transform: rotate(90deg); }
  .button:hover [data-name="sidebar"], .button:hover [data-name="more"] { transform: scale(1.1); }
  .nav-row:hover [data-name="card"], .nav-row:hover [data-name="chart"], .nav-row:hover [data-name="receipt"], .nav-row:hover [data-name="grid"], .nav-row:hover [data-name="spark"] { transform: scale(1.14) rotate(-4deg); }
  .profile-row:hover .avatar { transform: scale(1.06); }
  .row-link:hover > .icon:last-child { transform: translateX(2px); }
  [dir="rtl"] .row-link:hover > .icon:last-child { transform: scaleX(-1) translateX(2px); }
}

.text-button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-block-size: var(--control-height); padding: var(--space-2) var(--space-4); border: 0; border-radius: var(--radius-full);
  background: var(--color-accent-soft); color: var(--color-accent);
  font-size: var(--text-subhead); font-weight: var(--weight-medium); line-height: 1.5; text-align: center; text-decoration: none; cursor: pointer;
  transition: background-color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
@media (hover: hover) and (pointer: fine) { .text-button:hover:not(:disabled) { background: var(--color-fill-strong); } }
.text-button:active:not(:disabled) { transform: scale(.96); }
.text-button:disabled { color: var(--color-muted); cursor: not-allowed; }

/* Fields */
label { display: block; font-size: var(--text-footnote); font-weight: var(--weight-medium); }
input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea {
  display: block; inline-size: 100%; min-block-size: var(--control-height); padding: var(--space-2) var(--space-4);
  border: 0; border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--color-separator);
  background: var(--color-surface); color: var(--color-ink); font-size: var(--text-body); line-height: 1.5;
  transition: box-shadow var(--motion-fast) ease;
}
input:not([type="checkbox"], [type="radio"], [type="file"]):hover, select:hover, textarea:hover { box-shadow: inset 0 0 0 1px var(--color-muted); }
input:not([type="checkbox"], [type="radio"], [type="file"]):focus-visible, select:focus-visible, textarea:focus-visible {
  outline-color: transparent; box-shadow: inset 0 0 0 1.5px var(--color-accent), 0 0 0 4px var(--color-accent-soft);
}
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input[readonly] { background: var(--color-fill); }
/* Our own chevron, the same in both themes and both directions. */
select { appearance: none; padding-inline-end: var(--space-8); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; }
[dir="rtl"] select { background-position: left 12px center; }
input[type="file"] { inline-size: 100%; font-size: var(--text-footnote); }
textarea { resize: vertical; }

/* Consent checks stay checkboxes; settings use switches. */
input[type="checkbox"] {
  appearance: none; display: inline-grid; place-items: center; inline-size: 22px; block-size: 22px; margin: 0; flex: none; cursor: pointer;
  border-radius: 7px; box-shadow: inset 0 0 0 1.5px var(--color-muted); background: transparent;
  transition: background-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
input[type="checkbox"]:checked { background: var(--color-accent-fill); box-shadow: none; }
input[type="checkbox"]::before {
  content: ""; inline-size: 12px; block-size: 7px; margin-block-start: -3px; border-block-end: 2px solid #fff; border-inline-start: 2px solid #fff;
  opacity: 0; transform: rotate(-45deg) scale(.6); transition: opacity var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
[dir="rtl"] input[type="checkbox"]::before { transform: rotate(45deg) scale(.6); }
input[type="checkbox"]:checked::before { opacity: 1; transform: rotate(-45deg) scale(1); }
[dir="rtl"] input[type="checkbox"]:checked::before { transform: rotate(45deg) scale(1); }
input[type="checkbox"]:active:not(:disabled) { transform: scale(.88); }
input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }

/* A switch that stretches its thumb while pressed, as on iOS. */
input[type="checkbox"].switch {
  --travel: 20px;
  position: relative; display: block; inline-size: 51px; block-size: 31px; border-radius: var(--radius-full);
  background: var(--color-fill-strong); box-shadow: none; transition: background-color var(--motion-base) ease;
}
[dir="rtl"] input[type="checkbox"].switch { --travel: -20px; }
input[type="checkbox"].switch::before {
  position: absolute; inset-block-start: 2px; inset-inline-start: 2px; inline-size: 27px; block-size: 27px; margin: 0; border: 0; border-radius: var(--radius-full);
  background: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / 22%), 0 0 0 .5px rgb(0 0 0 / 4%);
  opacity: 1; transform: none; transition: transform var(--motion-base) var(--spring), inline-size var(--motion-fast) ease;
}
input[type="checkbox"].switch:checked { background: var(--color-switch-on); }
input[type="checkbox"].switch:checked::before { transform: translateX(var(--travel)); }
input[type="checkbox"].switch:active:not(:disabled) { transform: none; }
input[type="checkbox"].switch:active:not(:disabled)::before { inline-size: 32px; }
[dir="ltr"] input[type="checkbox"].switch:checked:active:not(:disabled)::before { transform: translateX(15px); }
[dir="rtl"] input[type="checkbox"].switch:checked:active:not(:disabled)::before { transform: translateX(-15px); }

/* Segmented control: settings.js mirrors a real <select>; the thumb slides to the chosen index. */
.segmented {
  --n: 2; --i: 0; --dir: 1;
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  padding: 2px; border-radius: var(--radius-sm); background: var(--color-fill);
}
[dir="rtl"] .segmented { --dir: -1; }
.segmented::before {
  content: ""; position: absolute; inset-block: 2px; inset-inline-start: 2px; inline-size: calc((100% - 4px) / var(--n));
  border-radius: 8px; background: var(--color-surface); box-shadow: 0 2px 8px rgb(0 0 0 / 12%), 0 0 0 .5px rgb(0 0 0 / 4%);
  transform: translateX(calc(var(--i) * 100% * var(--dir))); transition: transform var(--motion-base) var(--spring);
}
:root[data-theme="dark"] .segmented::before { background: #636366; }
.segment {
  z-index: 1; min-block-size: 34px; padding: var(--space-1) var(--space-3); border: 0; border-radius: 8px; background: transparent;
  color: var(--color-ink); font-size: var(--text-footnote); font-weight: var(--weight-medium); transition: transform var(--motion-base) var(--spring-bouncy);
}
.segment[aria-pressed="true"] { font-weight: var(--weight-strong); }
.segment:active { transform: scale(.96); }

/* Verification code: one real input laid over six boxes (login.js). */
.code-boxes { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-2); direction: ltr; }
.code-box {
  display: grid; place-items: center; block-size: 60px; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-separator);
  font-size: var(--text-title1); font-weight: var(--weight-strong); line-height: 1; font-variant-numeric: var(--numeric);
  transition: box-shadow var(--motion-fast) ease, background-color var(--motion-fast) ease;
}
.code-box.is-filled { box-shadow: inset 0 0 0 1px var(--color-border-filled, var(--color-muted)); animation: digit-in var(--motion-base) var(--spring-bouncy); }
@keyframes digit-in { from { transform: scale(.8); } }
.code-boxes:focus-within .code-box.is-active { box-shadow: inset 0 0 0 2px var(--color-accent), 0 0 0 4px var(--color-accent-soft); }
.code-box.is-active:not(.is-filled)::after { content: ""; inline-size: 2px; block-size: 28px; border-radius: 2px; background: var(--color-accent); opacity: 0; }
.code-boxes:focus-within .code-box.is-active:not(.is-filled)::after { opacity: 1; animation: caret 1.06s step-end infinite; }
@keyframes caret { 50% { opacity: 0; } }
.code-boxes > input { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; opacity: 0; font-size: 16px; caret-color: transparent; }
.code-boxes.is-long { display: block; }
.code-boxes.is-long .code-box { display: none; }
.code-boxes.is-long > input { position: static; block-size: auto; opacity: 1; }
/* While the code is checked a wave runs across the boxes; a wrong code shakes them, as a wrong passcode does. */
.code-boxes.is-verifying .code-box { background: var(--color-accent-soft); box-shadow: none; animation: code-wave .9s ease-in-out calc(var(--i) * 70ms) infinite; }
@keyframes code-wave { 30% { transform: translateY(-5px); } 60% { transform: none; } }
.is-shaking { animation: shake .44s var(--ease-out); }
.code-boxes.is-shaking .code-box { background: var(--color-danger-soft); box-shadow: inset 0 0 0 1.5px var(--color-danger); }
@keyframes shake { 0%, 100% { transform: none; } 16% { transform: translateX(-10px); } 34% { transform: translateX(8px); } 52% { transform: translateX(-6px); } 70% { transform: translateX(4px); } 86% { transform: translateX(-2px); } }

/* A button at work shows a spinner in place of its label. */
.button.is-busy { color: transparent; pointer-events: none; }
.button.is-busy:disabled { opacity: 1; }
.button.is-busy > * { visibility: hidden; }
.button.is-busy::before {
  content: ""; position: absolute; inset-block-start: 50%; inset-inline-start: 50%; inline-size: 20px; block-size: 20px; margin: -10px; border: 2px solid var(--busy-color, var(--color-ink)); border-block-start-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite;
}
.button.primary.is-busy { --busy-color: var(--color-on-accent); }
.resend-slot .button.is-busy { --busy-color: var(--color-accent); }

.field-hint { color: var(--color-muted); font-size: var(--text-caption); font-weight: var(--weight-regular); line-height: 1.6; }
.field-hint:empty { display: none; }

/* A status line says its meaning in text and in a leading mark, never in colour alone. */
.status { font-size: var(--text-subhead); line-height: 1.6; animation: fade var(--motion-base) ease; }
.status:empty { display: none !important; }
.status.error, .status.success, .status.warning {
  display: flex; align-items: flex-start; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); animation: pop var(--motion-base) var(--spring);
}
.status.error { background: var(--color-danger-soft); color: var(--color-danger); }
.status.success { background: var(--color-success-soft); color: var(--color-success); }
.status.warning { background: var(--color-warning-soft); color: var(--color-warning); }
.status.error::before { content: "!"; font-weight: var(--weight-bold); }
.status.success::before { content: ""; inline-size: 16px; block-size: 16px; flex: none; margin-block-start: .3em; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.status.warning::before { content: "?"; font-weight: var(--weight-bold); }

/* Floating sidebar: a sheet of material with the product's key actions. */
.sidebar {
  --off: calc(100% + 2 * var(--float-gap));
  position: fixed; inset-block: var(--float-gap); inset-inline-start: var(--float-gap); z-index: var(--z-drawer);
  display: flex; flex-direction: column; gap: var(--space-1); inline-size: min(84vw, var(--sidebar-width)); padding: var(--space-3) var(--space-2) max(var(--space-2), env(safe-area-inset-bottom));
  border-radius: var(--radius-xl);
  transition: transform var(--motion-slow) var(--spring), visibility var(--motion-slow);
}
[dir="ltr"] .sidebar { --off: calc(-100% - 2 * var(--float-gap)); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; min-block-size: 40px; padding-inline: var(--space-2); margin-block-end: var(--space-2); flex: none; }
.nav-row {
  display: flex; align-items: center; gap: var(--space-3); inline-size: 100%; min-block-size: 40px; padding: var(--space-2); border: 0; border-radius: var(--radius-md); overflow: hidden;
  background: transparent; color: var(--color-ink); font-size: var(--text-subhead); font-weight: var(--weight-regular); line-height: 1.3; text-align: start; text-decoration: none; flex: none;
  transition: background-color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.nav-row:hover { background: var(--color-fill); }
.nav-row:active { transform: scale(.97); transition-duration: 80ms; }
/* The current row wears a light accent tint, as a selection does in a macOS sidebar, instead of a grey block. */
.nav-row[aria-current="page"] { background: color-mix(in srgb, var(--color-accent) 13%, transparent); font-weight: var(--weight-strong); }
.nav-row:disabled { opacity: .5; }
/* Key rows wear the same coloured tiles as Settings, so each destination is recognisable at a glance. */
.nav-row > .icon {
  --tile: #8e8e93;
  inline-size: 28px; block-size: 28px; padding: 6px; border-radius: 8px; color: #fff; stroke-width: 2;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tile) 84%, #fff), var(--tile)); box-shadow: inset 0 .5px 0 rgb(255 255 255 / 35%); /* taste-skill-ignore */
}
.nav-row > [data-name="card"] { --tile: #0a7be0; }
.nav-row > [data-name="chart"] { --tile: #1f9d63; }
.nav-row > [data-name="receipt"] { --tile: #e07b00; }
.nav-row > [data-name="grid"] { --tile: #4c7fb8; }
.nav-row > [data-name="spark"] { --tile: #d6336c; }
.nav-row > [data-name="memory"] { --tile: #a855d6; }
.nav-row > [data-name="folder"] { --tile: #0e8f7e; }
.key-icon {
  display: grid; place-items: center; inline-size: 28px; block-size: 28px; flex: none; border-radius: 8px;
  background: var(--fill-accent); color: var(--color-on-accent); box-shadow: inset 0 .5px 0 rgb(255 255 255 / 45%); transition: transform var(--motion-base) var(--spring-bouncy);
}
.key-icon .icon { inline-size: 16px; block-size: 16px; stroke-width: 2.2; }
.nav-row.key-new { font-weight: var(--weight-strong); }
.nav-row.key-new:active .key-icon { transform: scale(.88); }
.sidebar-foot {
  display: flex; align-items: center; gap: var(--space-1); margin-block-start: auto; padding-block-start: var(--space-2); flex: none;
}
.profile-row {
  display: flex; align-items: center; gap: var(--space-2); flex: 1; min-inline-size: 0; min-block-size: 48px; padding: var(--space-1) var(--space-2); border-radius: var(--radius-md);
  color: var(--color-ink); text-decoration: none; transition: background-color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.profile-row:hover { background: var(--color-fill); }
.profile-row:active { transform: scale(.97); }
.profile-row[aria-current="page"] { background: color-mix(in srgb, var(--color-accent) 13%, transparent); }
.profile-row .avatar { transition: transform var(--motion-base) var(--spring-bouncy); }
.profile-text { display: grid; min-inline-size: 0; line-height: 1.35; }
.profile-text strong { overflow: hidden; font-size: var(--text-footnote); font-weight: var(--weight-strong); white-space: nowrap; text-overflow: ellipsis; }
.profile-text small { overflow: hidden; color: var(--color-muted); font-size: var(--text-caption); white-space: nowrap; text-overflow: ellipsis; }

/* Menus */
.conversation-menu { position: relative; }
.conversation-menu > summary { user-select: none; }
.account-menu-items {
  position: absolute; inset-block-start: calc(100% + var(--space-2)); inset-inline-end: 0; z-index: var(--z-menu);
  display: grid; gap: 2px; inline-size: max-content; min-inline-size: 200px; max-inline-size: min(320px, calc(100vw - 2 * var(--space-4)));
  padding: var(--space-2); border-radius: var(--radius-md); transform-origin: top right; animation: pop var(--motion-base) var(--spring);
}
/* The menu grows out of its trigger's corner, which is the inline end. */
[dir="rtl"] .account-menu-items { transform-origin: top left; }
.account-menu-items > button {
  display: flex; align-items: center; min-block-size: 40px; inline-size: 100%; padding: var(--space-2) var(--space-3);
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-ink);
  font-size: var(--text-subhead); text-align: start; transition: background-color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.account-menu-items > button:hover:not(:disabled) { background: var(--color-fill); }
.account-menu-items > button:active:not(:disabled) { transform: scale(.97); }
.account-menu-items > button:disabled { color: var(--color-muted); }
.account-menu-items .danger { color: var(--color-danger); }
.account-menu-items > button { gap: var(--space-3); }
.account-menu-items > button[id]::before { content: ""; inline-size: 18px; block-size: 18px; flex: none; background: currentColor; -webkit-mask: var(--menu-glyph) center / contain no-repeat; mask: var(--menu-glyph) center / contain no-repeat; }
#rename-conversation-btn::before { --menu-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16v4zM13.5 6.5l4 4'/%3E%3C/svg%3E"); }
#copy-conversation-btn::before { --menu-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 9h9a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1zM5 15H4.8A.8.8 0 0 1 4 14.2V4.8A.8.8 0 0 1 4.8 4h9.4a.8.8 0 0 1 .8.8V5'/%3E%3C/svg%3E"); }
#print-conversation-btn::before { --menu-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9V4h10v5M7 17H5a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2'/%3E%3Cpath d='M7 14h10v6H7z'/%3E%3C/svg%3E"); }
#export-conversation-btn::before { --menu-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 10l5 5 5-5M5 20h14'/%3E%3C/svg%3E"); }
#delete-conversation-btn::before { --menu-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3'/%3E%3C/svg%3E"); }
#pin-conversation-btn::before { --menu-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3.5h6l-1 6 3.5 3V15h-11v-2.5l3.5-3zM12 15v5.5'/%3E%3C/svg%3E"); }
#archive-conversation-btn::before { --menu-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9h16v11H4zM3 4h18v5H3zM9.5 13h5'/%3E%3C/svg%3E"); }
#move-project-btn::before { --menu-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a1 1 0 0 1 1-1h5l2 2h9a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E"); }
#share-conversation-btn::before { --menu-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14a4.5 4.5 0 0 0 6.4 0l3-3a4.5 4.5 0 0 0-6.4-6.4L11.5 6M14 10a4.5 4.5 0 0 0-6.4 0l-3 3a4.5 4.5 0 0 0 6.4 6.4L12.5 18'/%3E%3C/svg%3E"); }

/* Dialogs rise as a sheet on phones and scale in on wider screens; closing plays where the browser allows. */
dialog {
  inline-size: 100%; max-inline-size: 100%; max-block-size: min(92dvh, 760px); margin: auto auto 0; padding: var(--space-6);
  overflow-y: auto; overscroll-behavior: contain; border: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--color-surface); color: var(--color-ink); box-shadow: var(--shadow-overlay);
  opacity: 0; transform: translateY(32px);
  transition: opacity var(--motion-fast) ease, transform var(--motion-fast) ease, overlay var(--motion-fast) allow-discrete, display var(--motion-fast) allow-discrete;
}
dialog[open] {
  display: grid; gap: var(--space-4); opacity: 1; transform: none;
  transition: opacity var(--motion-base) ease, transform var(--motion-slow) var(--spring), overlay var(--motion-slow) allow-discrete, display var(--motion-slow) allow-discrete;
}
@starting-style { dialog[open] { opacity: 0; transform: translateY(32px); } }
dialog::backdrop {
  background: var(--color-scrim); opacity: 0; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: opacity var(--motion-base) ease, overlay var(--motion-base) allow-discrete, display var(--motion-base) allow-discrete;
}
dialog[open]::backdrop { opacity: 1; }
@starting-style { dialog[open]::backdrop { opacity: 0; } }
@media (min-width: 600px) {
  dialog { inline-size: min(100% - 48px, 520px); margin: auto; border-radius: var(--radius-xl); transform: scale(.96); }
  @starting-style { dialog[open] { opacity: 0; transform: scale(.96); } }
}
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.setting-field { display: grid; gap: var(--space-2); }

/* Inset grouped lists, the shape of iOS Settings */
.group-title { padding-inline: var(--space-4); margin-block-end: calc(-1 * var(--space-2)); color: var(--color-muted); font-size: var(--text-footnote); font-weight: var(--weight-regular); }
.group { display: grid; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-card); overflow: hidden; }
dialog .group { background: var(--color-fill); box-shadow: none; }
.row {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  min-block-size: 50px; padding: var(--space-3) var(--space-4);
}
.row + .row::before, .row + .row-link::before, .row-link + .row::before, .row-link + .row-link::before {
  content: ""; position: absolute; inset-block-start: 0; inset-inline: var(--space-4) 0; block-size: 1px; background: var(--color-separator);
}
.row-text { display: grid; gap: 2px; min-inline-size: 0; }
.row-title { font-size: var(--text-subhead); font-weight: var(--weight-regular); }
.row-link {
  display: flex; align-items: center; gap: var(--space-3); inline-size: 100%; min-block-size: 50px; padding: var(--space-3) var(--space-4); border: 0; overflow: hidden;
  background: transparent; color: var(--color-ink); font-size: var(--text-subhead); text-align: start; text-decoration: none;
  transition: background-color var(--motion-fast) ease;
}
.row-link:hover { background: var(--color-fill); }
.row-link:active { background: var(--color-fill-strong); }
.row-link:focus-visible { outline-offset: -2px; }
.row-link > [data-i18n] { flex: 1; min-inline-size: 0; }
.row-link > .icon:last-child { color: var(--color-muted); inline-size: 16px; block-size: 16px; transition: transform var(--motion-base) var(--spring-bouncy); }
[dir="rtl"] .row-link > .icon:last-child { transform: scaleX(-1); }
.row-link.danger { color: var(--color-danger); }

/* Coloured symbol tiles, as in System Settings */
.symbol-tile {
  display: grid; place-items: center; inline-size: 28px; block-size: 28px; flex: none; border-radius: 8px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tile, #8e8e93) 84%, #fff), var(--tile, #8e8e93)); color: #fff; box-shadow: inset 0 .5px 0 rgb(255 255 255 / 35%); /* taste-skill-ignore */
}
.symbol-tile .icon { inline-size: 17px; block-size: 17px; stroke-width: 2; }

/* Help */
.help-topic { border-block-end: 1px solid var(--color-separator); }
.help-topic > summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  min-block-size: var(--control-height); padding-block: var(--space-2); font-size: var(--text-subhead); font-weight: var(--weight-medium);
}
.help-topic > summary::after { content: "+"; color: var(--color-muted); font-size: var(--text-title3); font-weight: var(--weight-regular); line-height: 1; transition: transform var(--motion-base) var(--spring-bouncy); }
.help-topic[open] > summary::after { transform: rotate(45deg); }
.help-topic > p { padding-block-end: var(--space-4); color: var(--color-muted); font-size: var(--text-subhead); animation: rise var(--motion-base) var(--ease-out); }

/* Loading and empty states */
[aria-busy="true"] > .field-hint:first-of-type, [aria-busy="true"] > #device-sessions-status, [aria-busy="true"] > .account-state { animation: breathe 1.6s ease-in-out infinite; }
/* A list that is loading keeps the shape of what is coming: three quiet lines under the words. Forms that are saving do not. */
[aria-busy="true"] > :is(.account-state, #recent-status, #usage-status, #device-sessions-status)::after {
  content: ""; display: block; inline-size: min(100%, 26rem); block-size: 10px; margin-block: var(--space-3) 34px; border-radius: var(--radius-full);
  background: var(--color-fill-strong); box-shadow: 0 17px 0 var(--color-fill-strong), 0 34px 0 var(--color-fill-strong);
}
/* The one sign of waiting: the brand nuqta in the assistant's light; its halves part along the pen slit and meet again. */
.wait-star, .finishing-spinner {
  display: block; border-radius: 50%; background: var(--iridescence); /* taste-skill-ignore */
  -webkit-mask: var(--nuqta-wait); mask: var(--nuqta-wait); /* taste-skill-ignore */
  animation: nuqta-wait 1.6s var(--ease-in-out) infinite;
}
.account-state { color: var(--color-muted); font-size: var(--text-subhead); }

.pagination { display: flex; align-items: center; justify-content: center; gap: var(--space-3); color: var(--color-muted); font-size: var(--text-footnote); }

/* Reasoning stays one compact popover, with automatic sections below its scale. */
.effort-panel .effort-heading { display: grid; justify-items: center; gap: 2px; padding: var(--space-2) var(--space-3); text-align: center; }
.effort-panel .effort-value { color: var(--color-accent); font-size: var(--text-subhead); font-weight: var(--weight-strong); }
.effort-panel .effort-model { max-inline-size: 100%; overflow-wrap: anywhere; color: var(--color-muted); font-size: var(--text-footnote); }
.effort-range-track { position: relative; display: flex; align-items: center; min-block-size: 44px; margin-inline: var(--space-2); }
.effort-panel input.effort-range {
  appearance: none; -webkit-appearance: none; inline-size: 100%; min-block-size: 28px; block-size: 28px; margin: 0; padding: 0; border: 0; border-radius: var(--radius-full); box-shadow: none;
  background-color: var(--color-fill-strong); background-image: linear-gradient(var(--color-accent-fill), var(--color-accent-fill)); background-repeat: no-repeat; /* taste-skill-ignore: a flat accent fill for the travelled part */
  cursor: pointer; direction: ltr;
}
.effort-range::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; inline-size: 32px; block-size: 32px; border-radius: 50%; border: 1px solid var(--color-separator); background: var(--color-on-accent); }
.effort-range::-moz-range-thumb { inline-size: 32px; block-size: 32px; border-radius: 50%; border: 1px solid var(--color-separator); background: var(--color-on-accent); }
.effort-range:disabled { cursor: default; opacity: .6; }
.effort-panel input.effort-range:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; box-shadow: none; }
.composer-toolbar .effort-control { flex: 0 1 auto; min-inline-size: 0; }
.composer-toolbar:has(.effort-control:not([hidden])) { min-inline-size: 0; }
.effort-control > details { inline-size: 100%; min-inline-size: 0; }
.effort-control .effort-trigger { inline-size: 100%; max-inline-size: 100%; }
.effort-control #effort-trigger-label { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; }
/* A phone has no room for the sentence, so the chip keeps the value; the trigger's aria-label still says all of it. */
@media (max-width: 480px) {
  .effort-control #effort-trigger-label[data-compact] { font-size: 0; }
  .effort-control #effort-trigger-label[data-compact]::after { content: attr(data-compact); font-size: var(--text-footnote); }
}
.effort-ticks { position: absolute; inset-inline: 16px; display: flex; justify-content: space-between; pointer-events: none; }
.effort-ticks > span { inline-size: 4px; block-size: 4px; border-radius: 50%; background: var(--color-on-accent); opacity: .45; }
.effort-panel .effort-direction { margin: 0; padding-inline: var(--space-3); text-align: center; font-size: var(--text-caption); }
.effort-panel .effort-hint { margin-block: var(--space-1) var(--space-2); }
.effort-panel .auto-section-option:first-of-type { border-block-start: 1px solid var(--color-separator); }

table { inline-size: 100%; border-collapse: collapse; font-size: var(--text-subhead); }
th { color: var(--color-muted); font-weight: var(--weight-regular); text-align: start; }
th, td { padding: var(--space-2) var(--space-3); border-block-end: 1px solid var(--color-separator); text-align: start; }

/* Touch reaches 44px everywhere; a mouse keeps the compact sizes. Last, so it wins over each control's own size. */
@media (pointer: coarse) {
  .button.icon-button, .segment, .account-menu-items > button { min-block-size: 44px; }
  .button.icon-button { inline-size: 44px; }
}
